project QadFinancials > class BDInvoice > method DefaultValuesDAVoucher
Description
Default voucher for DA Posting
Parameters
icNewDAJournalCode | input | character | DA Journal Code for which a number must be found |
icOldDAJournalCode | input | character | DA Journal Code that must be released |
iiNewPeriodYear | input | integer | Year of accounting period for which a number must be found |
iiOldPeriodYear | input | integer | Year of accounting period for which the old number must be released |
iiOldDAVoucher | input | integer | Voucher number that must be released |
oiNewDAVoucher | output | integer | New number |
icRowId | input | character | Row ID |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program3/bdinvoice.p)
if (icNewDAJournalCode = "":U or icNewDAJournalCode = ? or
iiNewPeriodYear = 0 or iiNewPeriodYear = ?) and
iiOldDAVoucher = 0
then return.
if icNewDAJournalCode = icOldDAJournalCode and
iiNewPeriodYear = iiOldPeriodYear and
iiOldDAVoucher <> 0
then do:
assign oiNewDAVoucher = iiOldDAVoucher.
return.
end.
find first tDInvoice where
tDInvoice.tc_Rowid = icRowId
no-error.
if not available tDInvoice
then do:
<M-3 run SetMessage
(input #T-4'The specified customer invoice is not defined in the system.':255(69263)t-4# (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'D':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QadFin-8009':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BDInvoice>
assign oiReturnStatus = -3.
return.
end.
/* ================================================================= */
/* Reserve a number for this sheet. */
/* This number will be released again by housekeeping if the */
/* transaction was not committed by then. */
/* ================================================================= */
assign vhFcComponent = ?.
<M-1 run GetNumber
(input viCompanyId (iiCompanyId),
input iiNewPeriodYear (iiNumbrYear),
input icNewDAJournalCode (icNumbrType),
output oiNewDAVoucher (oiNumber),
input viFcCurrentInstanceId (iiInstanceId),
input vcFcComponentName (icClassName),
output viFcReturnSuper (oiReturnStatus)) in BNumber>
if viFcReturnSuper < 0 or (viFcReturnSuper > 0 and oiReturnStatus = 0)
then assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus < 0
then return.
assign tDInvoice.DInvoicePostingYear = iiNewPeriodYear
tDInvoice.tcJournalCode = icNewDAJournalCode
tDInvoice.DInvoiceVoucher = oiNewDAVoucher.
/* ================================================================= */
/* Release previously reserved number. */
/* ================================================================= */
if iiOldDAVoucher <> 0
then do:
assign vhFcComponent = ?.
<M-2 run ReleaseNumber
(input viCompanyId (iiCompanyId),
input iiOldPeriodYear (iiNumbrYear),
input icOldDAJournalCode (icNumbrType),
input iiOldDAVoucher (iiNumbr),
input viFcCurrentInstanceId (iiInstanceId),
input vcFcComponentName (icClassName),
output viFcReturnSuper (oiReturnStatus)) in BNumber>
if viFcReturnSuper < 0 or (viFcReturnSuper > 0 and oiReturnStatus = 0)
then assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus < 0
then return.
end.