project QadFinancials > class BAPMatching > method CheckCICirecAmountAgainstMatched
Description
This method checks the Cirec Amount for SI Posting and APMatching
Parameters
iiAPMatchingID | input | integer | |
iiCInvoiceID | input | integer | |
iiReasonID | input | integer | |
icReasonCode | input | character | |
iiCIPostingYear | input | integer | |
icCIJournalCode | input | character | |
iiCIVoucher | input | integer | |
idAPMatchingTotalAmountTC | input | decimal | |
idAPMatchingTotalAmountLC | input | decimal | |
idAPMatchingAIRecTaxTC | input | decimal | APMatchingAIRecTaxTC: recoverable taxes accrued at invoices |
odCirecCInvoiceAmountTC | output | decimal | |
odCirecCInvoiceAmountLC | output | decimal | |
odAPMatchingARRecTaxTC | output | decimal | |
odAPMatchingARNRecTaxTC | output | decimal | |
odAPMatchingAIRecTaxTC | output | decimal | |
odAPMatchingAINRecTaxTC | output | decimal | |
odInvoiceDiscountPercentage | output | decimal | |
ilBCInvoiceIsAlreadyOpen | input | logical | |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program4/bapmatching.p)
/* ==================================================================== */
/* Get all Cirec- postinglines of the CI - validations: */
/* - the amount on these lines should equal the amount in APMatching */
/* ==================================================================== */
/* ========================== */
/* Set default return-status */
/* ========================== */
assign oiReturnStatus = -98.
viLocalReturnStatus = 0.
CHECKPROCESSBLOCK: DO:
/* ========================================================== */
/* Call method that will return the information about the CI */
/* ========================================================== */
<M-10 run DefaultValuesInvoiceAmount
(input iiCInvoiceID (iiCInvoiceID),
input iiAPMatchingID (iiAPMatchingID),
input ? (iiOldReasonID),
input-output iiReasonID (biNewReasonID),
input-output icReasonCode (bcNewReasonCode),
output vcCirecCurrency (ocCurrency),
output odCirecCInvoiceAmountTC (odAmountToMatchTC),
output odCirecCInvoiceAmountLC (odAmountToMatchLC),
output odAPMatchingARRecTaxTC (odTaxAcrueReceiptRecovTC),
output odAPMatchingARNRecTaxTC (odTaxAcrueReceiptNonRecovTC),
output odAPMatchingAIRecTaxTC (odTaxAcrueInvoiceRecovTC),
output odAPMatchingAINRecTaxTC (odTaxAcrueInvoiceNonRecovTC),
output odInvoiceDiscountPercentage (odInvoiceDiscountPercentage),
input ilBCInvoiceIsAlreadyOpen (ilBCInvoiceIsAlreadyOpen),
output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
if viFcReturnSuper <> 0
then assign viLocalReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then Leave CHECKPROCESSBLOCK.
/* ====================================================================== */
/* Check the Cirec-amoutn of the invoice against the total matched amount */
/* ====================================================================== */
if idAPMatchingTotalAmountTC <> odCirecCInvoiceAmountTC or
idAPMatchingTotalAmountLC <> odCirecCInvoiceAmountLC
then do :
assign viLocalReturnStatus = -1.
if idAPMatchingAIRecTaxTC <> odAPMatchingAIRecTaxTC
then assign vcMsgAPMatching = trim(substitute(#T-16'The Matching Total Amount (&1) does not equal the Invoice Total Amount (&2) for invoice &3/&4/&5.':255(227636475)T-16#, idAPMatchingTotalAmountTC + odAPMatchingAIRecTaxTC, idAPMatchingTotalAmountTC + idAPMatchingAIRecTaxTC, string(iiCIPostingYear), string(icCIJournalCode), string(iiCIVoucher))) + chr(10) +
trim(substitute(#T-17'You can either use the Update-Invoice-Amount button to update the invoice, or update the taxes or other values on the matching-lines.':255(733757747)T-17#)) + chr(10) +
trim(substitute(#T-18'Recoverable invoice-taxes TC as mentioned in the matching: &1.':255(413950957)T-18#, odAPMatchingAIRecTaxTC)) + chr(10) +
trim(substitute(#T-19'Recoverable invoice-taxes TC as mentioned in the invoice: &1.':255(591273901)T-19#, idAPMatchingAIRecTaxTC)).
else assign vcMsgAPMatching = trim(substitute(#T-11'The sum of the SIREC posting lines of the invoice (&1/&2/&3) does not equal the matched amount on the matching':255(999890395)T-11#, string(iiCIPostingYear), string(icCIJournalCode), string(iiCIVoucher))) + chr(10) +
trim(substitute(#T-12'Sum of the SIREC posting lines of the invoice in TC: &1':255(999890396)T-12#,string(odCirecCInvoiceAmountTC))) + chr(10) +
trim(substitute(#T-13'Allocated amount TC on the matching header: &1':255(999890397)T-13#,string(idAPMatchingTotalAmountTC))) + chr(10) +
trim(substitute(#T-14'Sum of the SIREC posting lines of the invoice in BC: &1':255(999890398)T-14#,string(odCirecCInvoiceAmountLC))) + chr(10) +
trim(substitute(#T-15'Allocated BC amount on the matching header: &1':255(999890399)T-15#,string(idAPMatchingTotalAmountLC))).
<M-9 run SetMessage
(input vcMsgAPMatching (icMessage),
input ? (icArguments),
input '' (icFieldName),
input '' (icFieldValue),
input 'E' (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QadFin-9078':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
end. /*if idAPMatchingTotalAmountTC <> vdCirecCInvoiceAmountTC or */
END. /* CHECKPROCESSBLOCK */
assign oiReturnStatus = viLocalReturnStatus.