icDraftReference | input | character | Description for the draft instance. This parameter will have a value when creating a draft instance. |
icDraftFormName | input | character | This parameter will have a value when creating a draft instance. |
ilDraftIsShared | input | logical | This parameter will have a value when creating a draft instance. |
oiReturnStatus | output | integer | Return status of the method. |
<ANCESTOR-CODE> /* ================================================================= */ /* If the instance contains uncommitted bankstates, do not wait for */ /* housekeeping to release the reserved number. Release it now. */ /* (do not release numbr when cancelling a draft) */ /* ================================================================= */ if viCurrentDraftInstanceId = 0 then do: for each tBankStateline where tBankStateLine.tc_Status = "N":U and tBankStateLine.tiPostingVoucher <> 0 and tBankStateLine.tiPostingVoucher <> ? on error undo, throw: assign vhFcComponent = ?. if icDraftReference = "":U then do: <M-1 run ReleaseNumber (input tBankStateLine.Company_ID (iiCompanyId), input tBankStateLine.tiPostingPeriodYear (iiNumbrYear), input tBankStateLine.tcPostingJournalCode (icNumbrType), input tBankStateLine.tiPostingVoucher (iiNumbr), input viFcCurrentInstanceId (iiInstanceId), input vcFcComponentName (icClassName), output viFcReturnSuper (oiReturnStatus)) in BNumber> end. else do: <M-2 run StoreNumber (input tBankStateLine.Company_ID (iiCompanyID), input tBankStateLine.tiPostingPeriodYear (iiNumbrYear), input tBankStateLine.tcPostingJournalCode (icNumbrType), input tBankStateLine.tiPostingVoucher (iiNumbr), output viFcReturnSuper (oiReturnStatus)) in BNumber> end. if viFcReturnSuper < 0 or (viFcReturnSuper > 0 and oiReturnStatus = 0) then assign oiReturnStatus = viFcReturnSuper. if oiReturnStatus < 0 then leave. end. /* for each tBankStateline where */ end. /* if viCurrentDraftInstanceId = 0 */ /* ====================================================================================== */ /* Release or store the WHT number */ /* WHT Numbers are retrieved in BCInvoice, BBankEntry, BCDocument and BOpenItemAdjustment */ /* The Numbers are stored in BWithHoldingTax.PostSave */ /* ====================================================================================== */ if viCurrentDraftInstanceId = 0 then do: /* The WHT Numbers that are retrieved are stored in a data item, since the normal temp-table can be cleared when errors occured somewhere */ do viReleaseNumberCount = num-entries(vcReleaseWHTNumberListBE, chr(4)) to 1 by -1 on error undo, throw: assign viReleaseWHTNumber = integer(entry(viReleaseNumberCount, vcReleaseWHTNumberListBE, chr(4))) no-error. if error-status:error then do: assign vcMessage = trim(substitute(#T-53'Error releasing WHT Number.':255(183355101)T-53#)) + chr(10) + trim(substitute(#T-58'WHT Number List: &1':255(517036178)T-58#, trim(vcReleaseWHTNumberListBE))). oiReturnStatus = -3. <M-56 run SetMessage (input vcMessage (icMessage), input '':U (icArguments), input '':U (icFieldName), input '':U (icFieldValue), input 'S':U (icType), input 2 (iiSeverity), input '':U (icRowid), input 'qadfin-754354':U (icFcMsgNumber), input '' (icFcExplanation), input '' (icFcIdentification), input '' (icFcContext), output viFcReturnSuper (oiReturnStatus)) in BBankEntry> return. end. /* if error-status:error */ assign vhFcComponent = ?. if icDraftReference = "":U then do: <M-87 run ReleaseNumber (input viCompanyId (iiCompanyId), input 9999 (iiNumbrYear), input 'WHT':U (icNumbrType), input viReleaseWHTNumber (iiNumbr), input viFcCurrentInstanceId (iiInstanceId), input vcFcComponentName (icClassName), output viFcReturnSuper (oiReturnStatus)) in BNumber> if viFcReturnSuper <> -4 and /* it can be that the number is already committed in BWHT */ (viFcReturnSuper < 0 or (viFcReturnSuper > 0 and oiReturnStatus = 0)) then assign oiReturnStatus = viFcReturnSuper. end. /* if icDraftReference = "":U */ else do: <M-40 run StoreNumber (input viCompanyId (iiCompanyID), input 9999 (iiNumbrYear), input 'WHT':U (icNumbrType), input viReleaseWHTNumber (iiNumbr), output viFcReturnSuper (oiReturnStatus)) in BNumber> if viFcReturnSuper < 0 or (viFcReturnSuper > 0 and oiReturnStatus = 0) then assign oiReturnStatus = viFcReturnSuper. end. /* else do: */ if oiReturnStatus < 0 then leave. end. /* do viReleaseNumberCount = num-entries(vcReleaseWHTNumberListBE, chr(4)) to 1 by -1: */ end. /* if viCurrentDraftInstanceId = 0 */