project QadFinancials > class BCInvoice > method ValidateComponentPostBalances
Description
This method is a submethod of ValidateComponentPost.
This method validates the balance fields of the creditor invoice.
Parameters
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program5/bcinvoice.p)
/* For invoices, the TC credit balance cannot be negative */
if (t_sCInvoice.tc_Status = "N":U or
t_sCInvoice.tc_Status = "C":U and
(t_sCInvoice.CInvoiceType <> t_iCInvoice.CInvoiceType or
t_sCInvoice.CInvoiceBalanceCreditTC <> t_iCInvoice.CInvoiceBalanceCreditTC)) and
t_sCInvoice.CInvoiceType = {&INVOICETYPE-INVOICE} and
t_sCInvoice.CInvoiceBalanceCreditTC < 0
then do:
<M-1 run SetMessage
(input trim(#T-5'The TC balance amount cannot be negative.':150(1125)T-5#) (icMessage),
input '':U (icArguments),
input 'tCInvoice.CInvoiceBalanceCreditTC':U (icFieldName),
input t_sCInvoice.CInvoiceBalanceCreditTC (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sCInvoice.tc_Rowid (icRowid),
input 'QadFin-7035':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BCInvoice>
assign oiReturnStatus = -1.
end.
/* For invoices, the LC credit balance cannot be negative */
if (t_sCInvoice.tc_Status = "N":U or
t_sCInvoice.tc_Status = "C":U and
(t_sCInvoice.CInvoiceType <> t_iCInvoice.CInvoiceType or
t_sCInvoice.CInvoiceBalanceCreditLC <> t_iCInvoice.CInvoiceBalanceCreditLC)) and
t_sCInvoice.CInvoiceType = {&INVOICETYPE-INVOICE} and
t_sCInvoice.CInvoiceBalanceCreditLC < 0
then do:
<M-2 run SetMessage
(input trim(#T-8'The balance amount in the base currency cannot be negative.':150(1126)t-8#) (icMessage),
input '':U (icArguments),
input 'tCInvoice.CInvoiceBalanceCreditLC':U (icFieldName),
input t_sCInvoice.CInvoiceBalanceCreditLC (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sCInvoice.tc_Rowid (icRowid),
input 'QadFin-7036':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BCInvoice>
assign oiReturnStatus = -1.
end.
/* For credit notes, the TC debit balance cannot be negative */
if (t_sCInvoice.tc_Status = "N":U or
t_sCInvoice.tc_Status = "C":U and
(t_sCInvoice.CInvoiceType <> t_iCInvoice.CInvoiceType or
t_sCInvoice.CInvoiceBalanceDebitTC <> t_iCInvoice.CInvoiceBalanceDebitTC)) and
t_sCInvoice.CInvoiceType = {&INVOICETYPE-CREDITNOTE} and
t_sCInvoice.CInvoiceBalanceDebitTC < 0
then do:
<M-3 run SetMessage
(input trim(#T-12'The TC balance amount cannot be negative.':150(1125)T-12#) (icMessage),
input '':U (icArguments),
input 'tCInvoice.CInvoiceBalanceDebitTC':U (icFieldName),
input t_sCInvoice.CInvoiceBalanceDebitTC (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sCInvoice.tc_Rowid (icRowid),
input 'QadFin-7037':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BCInvoice>
assign oiReturnStatus = -1.
end.
/* For credit notes, the LC debit balance cannot be negative */
if (t_sCInvoice.tc_Status = "N":U or
t_sCInvoice.tc_Status = "C":U and
(t_sCInvoice.CInvoiceType <> t_iCInvoice.CInvoiceType or
t_sCInvoice.CInvoiceBalanceDebitLC <> t_iCInvoice.CInvoiceBalanceDebitLC)) and
t_sCInvoice.CInvoiceType = {&INVOICETYPE-CREDITNOTE} and
t_sCInvoice.CInvoiceBalanceDebitLC < 0
then do:
<M-4 run SetMessage
(input trim(#T-13'The balance amount in the base currency cannot be negative.':150(1126)t-13#) (icMessage),
input '':U (icArguments),
input 'tCInvoice.CInvoiceBalanceDebitLC':U (icFieldName),
input t_sCInvoice.CInvoiceBalanceDebitLC (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sCInvoice.tc_Rowid (icRowid),
input 'QadFin-7038':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BCInvoice>
assign oiReturnStatus = -1.
end.
/* For invoice corrections, the TC credit balance cannot be positive */
if (t_sCInvoice.tc_Status = "N":U or
t_sCInvoice.tc_Status = "C":U and
(t_sCInvoice.CInvoiceType <> t_iCInvoice.CInvoiceType or
t_sCInvoice.CInvoiceBalanceCreditTC <> t_iCInvoice.CInvoiceBalanceCreditTC)) and
t_sCInvoice.CInvoiceType = {&INVOICETYPE-INVOICECORRECTION} and
t_sCInvoice.CInvoiceBalanceCreditTC > 0
then do:
<M-9 run SetMessage
(input trim(#T-11'The TC balance amount cannot be positive.':255(65421)T-11#) (icMessage),
input '':U (icArguments),
input 'tCInvoice.CInvoiceBalanceCreditTC':U (icFieldName),
input t_sCInvoice.CInvoiceBalanceCreditTC (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sCInvoice.tc_Rowid (icRowid),
input 'QadFin-7039':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BCInvoice>
assign oiReturnStatus = -1.
end.
/* For invoice corrections, the LC credit balance cannot be positive */
if (t_sCInvoice.tc_Status = "N":U or
t_sCInvoice.tc_Status = "C":U and
(t_sCInvoice.CInvoiceType <> t_iCInvoice.CInvoiceType or
t_sCInvoice.CInvoiceBalanceCreditLC <> t_iCInvoice.CInvoiceBalanceCreditLC)) and
t_sCInvoice.CInvoiceType = {&INVOICETYPE-INVOICECORRECTION} and
t_sCInvoice.CInvoiceBalanceCreditLC > 0
then do:
<M-14 run SetMessage
(input trim(#T-16'The balance amount in the base currency cannot be positive.':255(65424)t-16#) (icMessage),
input '':U (icArguments),
input 'tCInvoice.CInvoiceBalanceCreditLC':U (icFieldName),
input t_sCInvoice.CInvoiceBalanceCreditLC (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sCInvoice.tc_Rowid (icRowid),
input 'QadFin-7040':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BCInvoice>
assign oiReturnStatus = -1.
end.
/* For credit note corrections, the TC debit balance cannot be positive */
if (t_sCInvoice.tc_Status = "N":U or
t_sCInvoice.tc_Status = "C":U and
(t_sCInvoice.CInvoiceType <> t_iCInvoice.CInvoiceType or
t_sCInvoice.CInvoiceBalanceDebitTC <> t_iCInvoice.CInvoiceBalanceDebitTC)) and
t_sCInvoice.CInvoiceType = {&INVOICETYPE-CREDITNOTECORRECTION} and
t_sCInvoice.CInvoiceBalanceDebitTC > 0
then do:
<M-17 run SetMessage
(input trim(#T-21'The TC balance amount cannot be positive.':255(65421)T-21#) (icMessage),
input '':U (icArguments),
input 'tCInvoice.CInvoiceBalanceDebitTC':U (icFieldName),
input t_sCInvoice.CInvoiceBalanceDebitTC (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sCInvoice.tc_Rowid (icRowid),
input 'QadFin-7041':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BCInvoice>
assign oiReturnStatus = -1.
end.
/* For credit note corrections, the LC debit balance cannot be positive */
if (t_sCInvoice.tc_Status = "N":U or
t_sCInvoice.tc_Status = "C":U and
(t_sCInvoice.CInvoiceType <> t_iCInvoice.CInvoiceType or
t_sCInvoice.CInvoiceBalanceDebitLC <> t_iCInvoice.CInvoiceBalanceDebitLC)) and
t_sCInvoice.CInvoiceType = {&INVOICETYPE-CREDITNOTECORRECTION} and
t_sCInvoice.CInvoiceBalanceDebitLC > 0
then do:
<M-18 run SetMessage
(input trim(#T-22'The balance amount in the base currency cannot be positive.':255(65424)t-22#) (icMessage),
input '':U (icArguments),
input 'tCInvoice.CInvoiceBalanceDebitLC':U (icFieldName),
input t_sCInvoice.CInvoiceBalanceDebitLC (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sCInvoice.tc_Rowid (icRowid),
input 'QadFin-7042':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BCInvoice>
assign oiReturnStatus = -1.
end.