project QadFinancials > class BDInvoice > method ValidateComponentAllPostBalances
Description
This method is a submethod of ValidateComponentAllPost.
This method validates the balance fields of the debtor invoice.
Parameters
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program5/bdinvoice.p)
/* For invoices, the TC debit balance cannot be negative */
if (t_sDInvoice.tc_Status = "N":U or
t_sDInvoice.tc_Status = "C":U and
(t_sDInvoice.DInvoiceType <> t_iDInvoice.DInvoiceType or
t_sDInvoice.DInvoiceBalanceDebitTC <> t_iDInvoice.DInvoiceBalanceDebitTC)) and
(t_sDInvoice.DInvoiceType = {&INVOICETYPE-INVOICE} or
t_sDInvoice.DInvoiceType = {&INVOICETYPE-FINANCECHARGE}) and
t_sDInvoice.DInvoiceBalanceDebitTC < 0
then do:
assign vcMessage = substitute(#T-53'The TC Balance amount of Invoice(&1) cannot be negative':255(119855252)T-53# ,
string(t_sDInvoice.DInvoiceVoucher) + "/" + t_sDInvoice.tcJournalCode).
<M-63 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input 'tDInvoice.DInvoiceBalanceDebitTC':U (icFieldName),
input t_sDInvoice.DInvoiceBalanceDebitTC (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sDInvoice.tc_Rowid (icRowid),
input 'qadfin-782674':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BDInvoice>
assign oiReturnStatus = -1.
end.
/* For invoices, the LC Debit balance cannot be negative */
if (t_sDInvoice.tc_Status = "N":U or
t_sDInvoice.tc_Status = "C":U and
(t_sDInvoice.DInvoiceType <> t_iDInvoice.DInvoiceType or
t_sDInvoice.DInvoiceBalanceDebitLC <> t_iDInvoice.DInvoiceBalanceDebitLC)) and
(t_sDInvoice.DInvoiceType = {&INVOICETYPE-INVOICE} or
t_sDInvoice.DInvoiceType = {&INVOICETYPE-FINANCECHARGE}) and
t_sDInvoice.DInvoiceBalanceDebitLC < 0
then do:
assign vcMessage = substitute(#T-45'Balance Amount of Invoice(&1) in Base Currency cannot be negative':255(37501631)T-45# ,
string(t_sDInvoice.DInvoiceVoucher) + "/" + t_sDInvoice.tcJournalCode).
<M-10 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input 'tDInvoice.DInvoiceBalanceDebitLC':U (icFieldName),
input t_sDInvoice.DInvoiceBalanceDebitLC (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sDInvoice.tc_Rowid (icRowid),
input 'QadFin-8015':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BDInvoice>
assign oiReturnStatus = -1.
end.
/* For credit notes, the TC credit balance cannot be negative */
if (t_sDInvoice.tc_Status = "N":U or
t_sDInvoice.tc_Status = "C":U and
(t_sDInvoice.DInvoiceType <> t_iDInvoice.DInvoiceType or
t_sDInvoice.DInvoiceBalanceCreditTC <> t_iDInvoice.DInvoiceBalanceCreditTC)) and
t_sDInvoice.DInvoiceType = {&INVOICETYPE-CREDITNOTE} and
t_sDInvoice.DInvoiceBalanceCreditTC < 0
then do:
<M-13 run SetMessage
(input #T-14'The TC Balance amount cannot be negative.':255(69269)T-14# (icMessage),
input '':U (icArguments),
input 'tDInvoice.DInvoiceBalanceCreditTC':U (icFieldName),
input t_sDInvoice.DInvoiceBalanceCreditTC (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sDInvoice.tc_Rowid (icRowid),
input 'QadFin-8016':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BDInvoice>
assign oiReturnStatus = -1.
end.
/* For credit notes, the LC debit balance cannot be negative */
if (t_sDInvoice.tc_Status = "N":U or
t_sDInvoice.tc_Status = "C":U and
(t_sDInvoice.DInvoiceType <> t_iDInvoice.DInvoiceType or
t_sDInvoice.DInvoiceBalanceCreditLC <> t_iDInvoice.DInvoiceBalanceCreditLC)) and
t_sDInvoice.DInvoiceType = {&INVOICETYPE-CREDITNOTE} and
t_sDInvoice.DInvoiceBalanceCreditLC < 0
then do:
<M-15 run SetMessage
(input #T-16'Balance Amount in Base Currency cannot be negative':255(69270)T-16# (icMessage),
input '':U (icArguments),
input 'tDInvoice.DInvoiceBalanceCreditLC':U (icFieldName),
input t_sDInvoice.DInvoiceBalanceCreditLC (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sDInvoice.tc_Rowid (icRowid),
input 'QadFin-8017':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BDInvoice>
assign oiReturnStatus = -1.
end.
/* For invoice corrections, the TC debit balance cannot be positive */
if (t_sDInvoice.tc_Status = "N":U or
t_sDInvoice.tc_Status = "C":U and
(t_sDInvoice.DInvoiceType <> t_iDInvoice.DInvoiceType or
t_sDInvoice.DInvoiceBalanceDebitTC <> t_iDInvoice.DInvoiceBalanceDebitTC)) and
t_sDInvoice.DInvoiceType = {&INVOICETYPE-INVOICECORRECTION} and
t_sDInvoice.DInvoiceBalanceDebitTC > 0
then do:
<M-17 run SetMessage
(input #T-19'The TC Balance Amount cannot be positive.':255(69271)T-19# (icMessage),
input '':U (icArguments),
input 'tDInvoice.DInvoiceBalanceDebitTC':U (icFieldName),
input t_sDInvoice.DInvoiceBalanceDebitTC (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sDInvoice.tc_Rowid (icRowid),
input 'QadFin-8018':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BDInvoice>
assign oiReturnStatus = -1.
end.
/* For invoice corrections, the LC debit balance cannot be positive */
if (t_sDInvoice.tc_Status = "N":U or
t_sDInvoice.tc_Status = "C":U and
(t_sDInvoice.DInvoiceType <> t_iDInvoice.DInvoiceType or
t_sDInvoice.DInvoiceBalanceDebitLC <> t_iDInvoice.DInvoiceBalanceDebitLC)) and
t_sDInvoice.DInvoiceType = {&INVOICETYPE-INVOICECORRECTION} and
t_sDInvoice.DInvoiceBalanceDebitLC > 0
then do:
<M-20 run SetMessage
(input #T-21'Balance Amount in Base Currency cannot be negative':255(69270)T-21# (icMessage),
input '':U (icArguments),
input 'tDInvoice.DInvoiceBalanceDebitLC':U (icFieldName),
input t_sDInvoice.DInvoiceBalanceDebitLC (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sDInvoice.tc_Rowid (icRowid),
input 'QadFin-8019':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BDInvoice>
assign oiReturnStatus = -1.
end.
/* For credit note corrections, the TC credit balance cannot be positive */
if (t_sDInvoice.tc_Status = "N":U or
t_sDInvoice.tc_Status = "C":U and
(t_sDInvoice.DInvoiceType <> t_iDInvoice.DInvoiceType or
t_sDInvoice.DInvoiceBalanceCreditTC <> t_iDInvoice.DInvoiceBalanceCreditTC)) and
t_sDInvoice.DInvoiceType = {&INVOICETYPE-CREDITNOTECORRECTION} and
t_sDInvoice.DInvoiceBalanceCreditTC > 0
then do:
<M-22 run SetMessage
(input #T-23'The TC Balance Amount cannot be positive.':255(69271)T-23# (icMessage),
input '':U (icArguments),
input 'tDInvoice.DInvoiceBalanceCreditTC':U (icFieldName),
input t_sDInvoice.DInvoiceBalanceCreditTC (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sDInvoice.tc_Rowid (icRowid),
input 'QadFin-8020':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BDInvoice>
assign oiReturnStatus = -1.
end.
/* For credit note corrections, the LC debit balance cannot be positive */
if (t_sDInvoice.tc_Status = "N":U or
t_sDInvoice.tc_Status = "C":U and
(t_sDInvoice.DInvoiceType <> t_iDInvoice.DInvoiceType or
t_sDInvoice.DInvoiceBalanceCreditLC <> t_iDInvoice.DInvoiceBalanceCreditLC)) and
t_sDInvoice.DInvoiceType = {&INVOICETYPE-CREDITNOTECORRECTION} and
t_sDInvoice.DInvoiceBalanceCreditLC > 0
then do:
<M-24 run SetMessage
(input #T-26'Balance Amount in Base Currency cannot be positive':255(69272)T-26# (icMessage),
input '':U (icArguments),
input 'tDInvoice.DInvoiceBalanceCreditLC':U (icFieldName),
input t_sDInvoice.DInvoiceBalanceCreditLC (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sDInvoice.tc_Rowid (icRowid),
input 'QadFin-8021':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BDInvoice>
assign oiReturnStatus = -1.
end.