project BLF > class BNumber > method ReleaseNumber

Description

Release a previously claimed number when a transaction will not be committed.


Parameters


iiCompanyIdinputintegerEntity ID
iiNumbrYearinputintegerNumbrYear
icNumbrTypeinputcharacterNumbrType
iiNumbrinputintegerNumbr
iiInstanceIdinputinteger
icClassNameinputcharacter
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BAPMatching.StopExternalInstances
method BAPMatching.ExitInstance
method BAPMatching.GetJournalSequenceNumber
method BBankEntry.ExitInstance
method BBankEntry.PostSave
method BBill.CreateBills
method BBill.ExitInstance
method BBill.PostSave
method BCCollection.ExitInstance
method BCDocument.DefaultValuesCDocumentNumber
method BCDocument.ExitInstance
method BCInvoice.CopyIntoNew
method BCInvoice.DefaultValuesCAJournal
method BCInvoice.DefaultValuesDaybookSetCodeSite
method BCInvoice.DefaultValuesInvoiceType
method BCInvoice.DefaultValuesJournal
method BCInvoice.DefaultValuesLinkedInvoice
method BCInvoice.DefaultValuesReason
method BCInvoice.ExitInstance
method BCInvoice.PreSave
method BCInvoice.ReplaceCInvoice
method BDCollection.ExitInstance
method BDDocument.DefaultValuesDDocumentNumber
method BDDocument.ExitInstance
method BDInvoice.DefaultValuesDAJournal
method BDInvoice.DefaultValuesDAVoucher
method BDInvoice.DefaultValuesInvoiceType
method BDInvoice.DefaultValuesJournal
method BDInvoice.DefaultValuesLinkedInvoice
method BDInvoice.DefaultValuesVoucher
method BDInvoice.ExitInstance
method BDInvoice.PreSave
method BExpenseNote.ExitInstance
method BExpenseNote.GetExpenseNoteNumber
method BFixedAssetAsset.DefaultValuesAssetCode
method BFixedAssetAsset.ExitInstance
method BPosting.ClearData
method BPosting.CreatePostingsFromImport
method BPosting.ExitInstance
method BPosting.GetPostingNumber
method BPosting.RemovePostingFromInstance
method BPosting.ValidateComponentPre
method BJournalEntry.CreateReverseEntries
method BJournalEntry.DefaultValuesYearJournal
method BJournalEntry.UpdateYearJournal
method BOpenItemAdjustment.ExitInstance
method BRevaluation.ExitInstance
method BRevaluation.GetRevalHeaderNumber


program code (program1/bnumber.p)

/* is there a number to release ? */
if iiNumbr = 0
or iiNumbr = ?
then return.

assign vcWhere = "for each Numbr where Numbr.Company_ID = ":U + string(iiCompanyId)
               + " and Numbr.NumbrYear = ":U + string(iiNumbrYear)
               + " and Numbr.NumbrType = '":U + icNumbrType
               + "' and Numbr.Numbr = ":U + string(iiNumbr).

<M-1 run StartPersistence
   (output vhFcComponent (ohPersistence), 
    output viFcReturnSuper (oiReturnStatus)) in BNumber>
if viFcReturnSuper <> 0
then return.

<M-8 run DeleteNumber
   (input  iiInstanceId (iiInstanceId), 
    input  icClassName (icClassName), 
    input  string(iiCompanyId) + ',' + string(iiNumbrYear) + ',' + icNumbrType + ',' + string(iiNumbr) (icNumberData)) in persistence>

/* Save date and time in UTC */
session:timezone = 0.

<M-3 run WriteDirect
   (input  'Numbr':U (icTableName), 
    input  vcWhere (icPrepare), 
    input  'NumbrStatus,LastModifiedDate,LastModifiedTime,LastModifiedUser':U (icFieldList), 
    input  'c,t,i,c':U (icFieldListDataTypes), 
    input  {&NUMBERSTATUS-RELEASED} + chr(2) + string(today) + chr(2) + string(time) + chr(2) + vcUserLogin (icAbsolute), 
    input  '' (icIncremental), 
    input  {&TARGETPROCEDURE} (ihClass), 
    input  vcUserLogin (icUserLogin), 
    output viFcReturnSuper (oiReturnStatus)) in persistence>

session:timezone = viTimeOffset.

/* remove any errors from WriteDirect */
for each tFcMessages where
         tFcMessages.tcFcType     = "D" and
         tFcMessages.tcFcBusMethod = "PersistenceLayer":
    delete tFcMessages.
end.