project QadFinancials > class BCInvoice > method DefaultValuesReverseDaybook
Description
Get default values for daybook
Parameters
icCInvoiceRowId | input | character | Row ID of the supplier invoice |
icReverseInvoiceType | input | character | |
iiReverseInvoiceYear | input | integer | |
ocReverseInvoiceJournal | output | character | |
oiReverseInvoiceVoucher | output | integer | |
ocAdjustmentJournal | output | character | |
oiAdjustmentVoucher | output | integer | |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program3/bcinvoice.p)
/* =================================================================================================== */
/* Method : DefaultValuesReverseDaybook */
/* Desc : Get default values for daybooks */
/* --------------------------------------------------------------------------------------------------- */
/* Params: (I) ReverseInvoiceType Type of invoice reversing original one */
/* (O) ReverseInvoiceJournal Journal for reversing of invoice */
/* (O) ReverseInvoiceVoucher Vouchaer number for reversing of inovice */
/* (O) AdjustmentJournal Journal for posting of adjustment */
/* (O) AdjustmentVoucher Voucher number for adjustment posting */
/* =================================================================================================== */
assign oiReturnStatus = -98.
/* =================================================================================================== */
/* Default output values */
/* =================================================================================================== */
assign ocReverseInvoiceJournal = ?
oiReverseInvoiceVoucher = ?
ocAdjustmentJournal = ?
oiAdjustmentVoucher = ?.
/* =================================================================================================== */
/* Normalize input parameters */
/* =================================================================================================== */
if icReverseInvoiceType = '':U then assign icReverseInvoiceType = ?.
/* =================================================================================================== */
/* Get journal for reversing of invoice */
/* =================================================================================================== */
assign vcJournalType = '':U.
case icReverseInvoiceType:
when {&INVOICETYPE-INVOICE} then assign vcJournalType = {&JOURNALTYPE-CREDITORINVOICE}.
when {&INVOICETYPE-INVOICECORRECTION} then assign vcJournalType = {&JOURNALTYPE-CREDITORINVOICECORRECT}.
when {&INVOICETYPE-CREDITNOTE} then assign vcJournalType = {&JOURNALTYPE-CREDITORCREDITNOTE}.
when {&INVOICETYPE-CREDITNOTECORRECTION} then assign vcJournalType = {&JOURNALTYPE-CREDITORCREDITNOTECORRECT}.
end case.
if vcJournalType <> '':U
then do:
<M-2 run GetJournalCode
(input vcJournalType (icJournalType),
output ocReverseInvoiceJournal (ocJournalCode),
output viFcReturnSuper (oiReturnStatus)) in BCInvoice>
if viFcReturnSuper <> 0 then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0 then return.
if ocReverseInvoiceJournal <> '':U and
ocReverseInvoiceJournal <> ?
then do:
<M-3 run DefaultValuesJournal
(input icCInvoiceRowId (icCInvoiceRowId),
input-output ocReverseInvoiceJournal (bcJournalCode),
input iiReverseInvoiceYear (iiCInvoicePostingYear),
input icReverseInvoiceType (icCInvoiceType),
input ? (iiOldCInvoicePostingYear),
input ? (icOldJournalCode),
input ? (iiOldCInvoiceVoucher),
input false (ilCInvoiceIsInitialStatus),
output oiReverseInvoiceVoucher (oiCInvoiceVoucher),
output viFcReturnSuper (oiReturnStatus)) in BCInvoice>
if viFcReturnSuper <> 0 then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0 then return.
end.
end.
/* =================================================================================================== */
/* Get Creditor adjustment journal */
/* =================================================================================================== */
<M-4 run GetCAJournalCode
(output ocAdjustmentJournal (ocCAJournalCode),
output viFcReturnSuper (oiReturnStatus)) in BCInvoice>
if viFcReturnSuper <> 0 then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0 then return.
if ocAdjustmentJournal <> '':U and
ocAdjustmentJournal <> ?
then do:
<M-5 run DefaultValuesCAJournal
(input icCInvoiceRowId (icCInvoiceRowId),
input-output ocAdjustmentJournal (bcCAJournalCode),
input iiReverseInvoiceYear (iiCInvoicePostingYear),
input ? (iiOldCInvoicePostingYear),
input ? (icOldCAJournalCode),
input ? (iiOldCAVoucher),
output oiAdjustmentVoucher (oiCAVoucher),
output viFcReturnSuper (oiReturnStatus)) in BCInvoice>
if viFcReturnSuper <> 0 then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0 then return.
end.
/* =================================================================================================== */
/* Return */
/* =================================================================================================== */
if oiReturnStatus = -98 then assign oiReturnStatus = 0.