project QadFinancials > class BCInvoice > method ValidateComponentPostOriginals
Description
This method is a submethod of ValidateComponentPost.
This method validates that the original amounts can not be or must be negative
Parameters
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program5/bcinvoice.p)
if (t_sCInvoice.tc_Status = "N":U or
t_sCInvoice.tc_Status = "C":U) and
not t_sCInvoice.CInvoiceIsInitialStatus and
(t_sCInvoice.CInvoiceType = {&INVOICETYPE-INVOICE} or
t_sCInvoice.CInvoiceType = {&INVOICETYPE-FINANCECHARGE}) and
t_sCInvoice.CInvoiceOriginalCreditTC = 0
then do:
<M-18 run SetMessage
(input trim(#T-19'Warning: You are saving a zero value invoice.':255(68255)t-19#) (icMessage),
input '':U (icArguments),
input 'tCInvoice.CInvoiceOriginalCreditTC':U (icFieldName),
input t_sCInvoice.CInvoiceOriginalCreditTC (icFieldValue),
input 'W':U (icType),
input 3 (iiSeverity),
input t_sCInvoice.tc_Rowid (icRowid),
input 'QadFin-7587':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BCInvoice>
assign oiReturnStatus = +1.
end.
if (t_sCInvoice.tc_Status = "N":U or
t_sCInvoice.tc_Status = "C":U) and
not t_sCInvoice.CInvoiceIsInitialStatus and
t_sCInvoice.CInvoiceType = {&INVOICETYPE-CREDITNOTE} and
t_sCInvoice.CInvoiceOriginalDebitTC = 0
then do:
<M-20 run SetMessage
(input trim(#T-21'Warning: You are saving a zero value invoice.':255(68255)t-21#) (icMessage),
input '':U (icArguments),
input 'tCInvoice.CInvoiceOriginalDebitTC':U (icFieldName),
input t_sCInvoice.CInvoiceOriginalDebitTC (icFieldValue),
input 'W':U (icType),
input 3 (iiSeverity),
input t_sCInvoice.tc_Rowid (icRowid),
input 'QadFin-7588':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BCInvoice>
assign oiReturnStatus = +1.
end.
/* For invoices, the TC credit original 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.CInvoiceOriginalCreditTC <> t_iCInvoice.CInvoiceOriginalCreditTC)) and
t_sCInvoice.CInvoiceType = {&INVOICETYPE-INVOICE} and
t_sCInvoice.CInvoiceOriginalCreditTC < 0
then do:
<M-1 run SetMessage
(input trim(#T-9'The TC invoice amount cannot be negative.':255(65446)T-9#) (icMessage),
input '':U (icArguments),
input 'tCInvoice.CInvoiceOriginalCreditTC':U (icFieldName),
input t_sCInvoice.CInvoiceOriginalCreditTC (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sCInvoice.tc_Rowid (icRowid),
input 'QadFin-7059':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 original 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.CInvoiceOriginalCreditLC <> t_iCInvoice.CInvoiceOriginalCreditLC)) and
t_sCInvoice.CInvoiceType = {&INVOICETYPE-INVOICE} and
t_sCInvoice.CInvoiceOriginalCreditLC < 0
then do:
<M-2 run SetMessage
(input trim(#T-10'The invoice amount in the base currency cannot be negative.':255(65447)t-10#) (icMessage),
input '':U (icArguments),
input 'tCInvoice.CInvoiceOriginalCreditLC':U (icFieldName),
input t_sCInvoice.CInvoiceOriginalCreditLC (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sCInvoice.tc_Rowid (icRowid),
input 'QadFin-7060':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 original 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.CInvoiceOriginalDebitTC <> t_iCInvoice.CInvoiceOriginalDebitTC)) and
t_sCInvoice.CInvoiceType = {&INVOICETYPE-CREDITNOTE} and
t_sCInvoice.CInvoiceOriginalDebitTC < 0
then do:
<M-3 run SetMessage
(input trim(#T-13'The TC invoice amount cannot be negative.':255(65446)T-13#) (icMessage),
input '':U (icArguments),
input 'tCInvoice.CInvoiceOriginalDebitTC':U (icFieldName),
input t_sCInvoice.CInvoiceOriginalDebitTC (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sCInvoice.tc_Rowid (icRowid),
input 'QadFin-7061':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 Original 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.CInvoiceOriginalDebitLC <> t_iCInvoice.CInvoiceOriginalDebitLC)) and
t_sCInvoice.CInvoiceType = {&INVOICETYPE-CREDITNOTE} and
t_sCInvoice.CInvoiceOriginalDebitLC < 0
then do:
<M-4 run SetMessage
(input trim(#T-12'The invoice amount in the base currency cannot be negative.':255(65447)t-12#) (icMessage),
input '':U (icArguments),
input 'tCInvoice.CInvoiceOriginalDebitLC':U (icFieldName),
input t_sCInvoice.CInvoiceOriginalDebitLC (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sCInvoice.tc_Rowid (icRowid),
input 'QadFin-7062':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 original must 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.CInvoiceOriginalCreditTC <> t_iCInvoice.CInvoiceOriginalCreditTC)) and
t_sCInvoice.CInvoiceType = {&INVOICETYPE-INVOICECORRECTION} and
t_sCInvoice.CInvoiceOriginalCreditTC > 0
then do:
<M-5 run SetMessage
(input trim(#T-17'The TC invoice amount must be negative.':255(65448)T-17#) (icMessage),
input '':U (icArguments),
input 'tCInvoice.CInvoiceOriginalCreditTC':U (icFieldName),
input t_sCInvoice.CInvoiceOriginalCreditTC (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sCInvoice.tc_Rowid (icRowid),
input 'QadFin-7063':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 original must 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.CInvoiceOriginalCreditLC <> t_iCInvoice.CInvoiceOriginalCreditLC)) and
t_sCInvoice.CInvoiceType = {&INVOICETYPE-INVOICECORRECTION} and
t_sCInvoice.CInvoiceOriginalCreditLC > 0
then do:
<M-6 run SetMessage
(input trim(#T-14'The invoice amount in the base currency must be negative.':255(65449)t-14#) (icMessage),
input '':U (icArguments),
input 'tCInvoice.CInvoiceOriginalCreditLC':U (icFieldName),
input t_sCInvoice.CInvoiceOriginalCreditLC (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sCInvoice.tc_Rowid (icRowid),
input 'QadFin-7064':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 original 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.CInvoiceOriginalDebitTC <> t_iCInvoice.CInvoiceOriginalDebitTC)) and
t_sCInvoice.CInvoiceType = {&INVOICETYPE-CREDITNOTECORRECTION} and
t_sCInvoice.CInvoiceOriginalDebitTC > 0
then do:
<M-7 run SetMessage
(input trim(#T-15'The TC invoice amount must be negative.':255(65448)T-15#) (icMessage),
input '':U (icArguments),
input 'tCInvoice.CInvoiceOriginalDebitTC':U (icFieldName),
input t_sCInvoice.CInvoiceOriginalDebitTC (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sCInvoice.tc_Rowid (icRowid),
input 'QadFin-7065':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 original 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.CInvoiceOriginalDebitLC <> t_iCInvoice.CInvoiceOriginalDebitLC)) and
t_sCInvoice.CInvoiceType = {&INVOICETYPE-CREDITNOTECORRECTION} and
t_sCInvoice.CInvoiceOriginalDebitLC > 0
then do:
<M-8 run SetMessage
(input trim(#T-16'The invoice amount in the base currency must be negative.':255(65449)t-16#) (icMessage),
input '':U (icArguments),
input 'tCInvoice.CInvoiceOriginalDebitLC':U (icFieldName),
input t_sCInvoice.CInvoiceOriginalDebitLC (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sCInvoice.tc_Rowid (icRowid),
input 'QadFin-7066':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BCInvoice>
assign oiReturnStatus = -1.
end.