project QadFinancials > class BDInvoice > method ValidateComponentAllVatAmount
Description
ValidateComponentAllVatAmount
Parameters
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program5/bdinvoice.p)
/* total base and total vat must correspond with total invoice amount (warning) give also a warning when no vat record found */
if t_sDInvoice.DInvoiceIsTaxable and
(t_sDInvoice.DInvoiceType = {&INVOICETYPE-CREDITNOTE} or
t_sDInvoice.DInvoiceType = {&INVOICETYPE-CREDITNOTECORRECTION}) and
(t_sDInvoice.DInvoiceOriginalCreditTC <> ((t_sDInvoice.DInvoiceVatBaseDebitTC + t_sDInvoice.DInvoiceVatDebitTC) - (t_sDInvoice.DInvoiceVatBaseCreditTC + t_sDInvoice.DInvoiceVatCreditTC)) )
then do:
assign vcMessage = trim(substitute(#T-3'The sum of the base and tax amounts (&1) does not equal the invoice amount (&2).':150(1188)T-3#, string((t_sDInvoice.DInvoiceVatBaseDebitTC + t_sDInvoice.DInvoiceVatDebitTC) - (t_sDInvoice.DInvoiceVatBaseCreditTC + t_sDInvoice.DInvoiceVatCreditTC)), string(t_sDInvoice.DInvoiceOriginalCreditTC))) + chr(10) +
trim(substitute(#T-4'GL Calendar Year = &1; GL Period = &2; Daybook = &3; Voucher = &4.':255(969)T-4#,string(t_sDInvoice.DInvoicePostingYear),string(t_sDInvoice.DInvoicePostingPeriod), t_sDInvoice.tcJournalCode, string(t_sDInvoice.DInvoiceVoucher))).
if oiReturnStatus = 0 then assign oiReturnStatus = +1 /* WARNING */.
<M-7 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input 'tDInvoice.DInvoiceOriginalCreditTC':U (icFieldName),
input t_sDInvoice.DInvoiceOriginalCreditTC (icFieldValue),
input 'W':U (icType),
input 3 (iiSeverity),
input t_sDInvoice.tc_Rowid (icRowid),
input 'QadFin-8884':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BDInvoice>
end.
if t_sDInvoice.DInvoiceIsTaxable and
(t_sDInvoice.DInvoiceType = {&INVOICETYPE-INVOICE} or
t_sDInvoice.DInvoiceType = {&INVOICETYPE-FINANCECHARGE} or
t_sDInvoice.DInvoiceType = {&INVOICETYPE-INVOICECORRECTION}) and
(t_sDInvoice.DInvoiceOriginalDebitTC <> ((t_sDInvoice.DInvoiceVatBaseCreditTC + t_sDInvoice.DInvoiceVatCreditTC) - (t_sDInvoice.DInvoiceVatBaseDebitTC + t_sDInvoice.DInvoiceVatDebitTC)) )
then do:
assign vcMessage = trim(substitute(#T-5'The sum of the base and tax amounts (&1) does not equal the invoice amount (&2).':150(1188)T-5#, string((t_sDInvoice.DInvoiceVatBaseCreditTC + t_sDInvoice.DInvoiceVatCreditTC) - (t_sDInvoice.DInvoiceVatBaseDebitTC + t_sDInvoice.DInvoiceVatDebitTC)), string(t_sDInvoice.DInvoiceOriginalDebitTC))) + chr(10) +
trim(substitute(#T-6'GL Calendar Year = &1; GL Period = &2; Daybook = &3; Voucher = &4.':255(969)T-6#,string(t_sDInvoice.DInvoicePostingYear),string(t_sDInvoice.DInvoicePostingPeriod), t_sDInvoice.tcJournalCode, string(t_sDInvoice.DInvoiceVoucher))).
if oiReturnStatus = 0 then assign oiReturnStatus = +1 /* WARNING */.
<M-8 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input 'tDInvoice.DInvoiceOriginalDebitTC':U (icFieldName),
input t_sDInvoice.DInvoiceOriginalDebitTC (icFieldValue),
input 'W':U (icType),
input 3 (iiSeverity),
input t_sDInvoice.tc_Rowid (icRowid),
input 'QadFin-8885':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BDInvoice>
end.
if t_sDInvoice.DInvoiceIsTaxable and
t_sDInvoice.DInvoiceIsTaxExcluded and
(t_sDInvoice.DInvoiceType = {&INVOICETYPE-CREDITNOTE} or
t_sDInvoice.DInvoiceType = {&INVOICETYPE-CREDITNOTECORRECTION} or
t_sDInvoice.DInvoiceType = {&INVOICETYPE-INVOICE} or
t_sDInvoice.DInvoiceType = {&INVOICETYPE-FINANCECHARGE} or
t_sDInvoice.DInvoiceType = {&INVOICETYPE-INVOICECORRECTION})
then do:
vdTotalTax = 0.
for each t_sDInvoiceVat where
t_sDInvoiceVat.tc_ParentRowid = t_sDInvoice.tc_Rowid and
t_sDInvoiceVat.tc_Status <> "D":U
no-lock:
assign vdTotalTax = vdTotalTax + t_sDInvoiceVat.DInvoiceVatVatBaseCreditTC - t_sDInvoiceVat.DInvoiceVatVatBaseDebitTC.
end. /* for each t_sDInvoiceVat where */
if t_sDInvoice.DInvoiceType = {&INVOICETYPE-CREDITNOTE} or
t_sDInvoice.DInvoiceType = {&INVOICETYPE-CREDITNOTECORRECTION}
then assign vdTotalTax = vdTotalTax * -1.
if t_sDInvoice.tdDInvoiceOriginalTC <> vdTotalTax
then do:
assign vcMessage = trim(substitute(#T-37'The total 'TC Base Amount' (&1) does not equal the 'TC Invoice Amount' (&2).':255(189987302)T-37#, string(vdTotalTax), string(t_sDInvoice.tdDInvoiceOriginalTC))) + chr(10) +
trim(substitute(#T-92'GL Calendar Year = &1; GL Period = &2; Daybook = &3; Voucher = &4.':255(969)T-92#,string(t_sDInvoice.DInvoicePostingYear),string(t_sDInvoice.DInvoicePostingPeriod), t_sDInvoice.tcJournalCode, string(t_sDInvoice.DInvoiceVoucher))).
if oiReturnStatus = 0 then assign oiReturnStatus = +1 /* WARNING */.
<M-26 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input 't_sDInvoice.tdDInvoiceOriginalTC':U (icFieldName),
input t_sDInvoice.tdDInvoiceOriginalTC (icFieldValue),
input 'W':U (icType),
input 3 (iiSeverity),
input t_sDInvoice.tc_Rowid (icRowid),
input 'qadfin-918316':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BDInvoice>
end. /* if t_sDInvoice.tdDInvoiceOriginalTC <> vdTotalTax */
end. /*if t_sDInvoice.DInvoiceIsTaxable and */