public static void Create(
NumberSequenceCode _numSeqCode,
Name _txt,
NumberSequenceRange _highest,
NumberSequenceRange _lowest,
NumberSequenceRange _nextRec,
Name _prefix,
Name _format,
str 1 _manual,
str 1 _cont,
Name _numSeqScopeStr
)
{
NumberSequenceTable numberSeqTable;
NumberSequenceScope numberSeqScope;
NumberSequenceReference numberSeqRef;
RefRecId _numSeqScopeR,_numSeqIdR;
container segments, segmentReset;
str annotatedFormat, format;
;
_nextRec =1;
select firstonly * from numberSeqScope where numberSeqScope.DataArea == _numSeqScopeStr;
_numSeqScopeR = numberSeqScope.RecId;
if(!NumberSequenceTable::findByNaturalKey(_numSeqCode,_numSeqScopeR))
{
ttsBegin;
numberSeqTable.clear();
numberSeqTable.NumberSequence = _numSeqCode;
numberSeqTable.Txt = _txt;
numberSeqTable.Highest = _highest;
numberSeqTable.Lowest = _lowest;
numberSeqTable.NextRec = _nextRec;
if(_manual == 'Y')
{ numberSeqTable.Manual = NoYes::Yes; }
if(_cont == 'Y')
{ numberSeqTable.Continuous = NoYes::Yes; }
segments = segmentReset;
//segments += [[-1, conPeek(rec, 8)]];// 0 company, -1 constant, -2 alphanumeric
if(_prefix)
{ segments += [[-1, _prefix]]; }
segments += [[-2, _format]];
annotatedFormat = NumberSeq::createAnnotatedFormatFromSegments(segments);
format = NumberSeq::createAnnotatedFormatFromSegments(segments, false);
numberSeqTable.AnnotatedFormat = annotatedFormat;
numberSeqTable.Format = format;
numberSeqTable.NumberSequenceScope = _numSeqScopeR;
numberSeqTable.validateWrite();
numberSeqTable.insert();
ttsCommit;
}
}
No comments:
Post a Comment