project QadFinancials > class BDInvoice > method ValBalanceNotNegative
validation procedure
Description
Validates the balance fields.
Balance fields cannot be negative.
Parameters
| idTargetField | input | decimal | Value of the business field to validate. |
| icTargetFieldName | input | character | Name of the business field to validate. |
| icRowid | input | character | Contents of field tc_Rowid, if the target field is a field of a component temp-table. |
| icDInvoiceType | input | character | DInvoice Type |
| oiReturnStatus | output | integer | Return status of the method. |
Internal usage
unused
program code (program7/bdinvoice.p)
assign vcMessage = "":U.
if idTargetField < 0
then do:
case icTargetFieldName:
when "DInvoice.DInvoiceBalanceDebitTC":U
then assign vcMessage = if icDinvoiceType = {&INVOICETYPE-INVOICE} or icDinvoiceType = {&INVOICETYPE-FINANCECHARGE}
then trim(#T-2'The TC balance amount cannot be negative.':150(1125)T-2#)
else "":U.
when "DInvoice.DInvoiceBalanceCreditTC":U
then assign vcMessage = if icDinvoiceType = {&INVOICETYPE-CREDITNOTE}
then trim(#T-4'The TC balance amount cannot be negative.':150(1125)T-4#)
else "":U.
when "DInvoice.DInvoiceBalanceDebitlC":U
then assign vcMessage = if icDinvoiceType = {&INVOICETYPE-INVOICE} or icDinvoiceType = {&INVOICETYPE-FINANCECHARGE}
then trim(#T-3'The balance amount in the base currency cannot be negative.':150(1126)t-3#)
else "":U.
when "DInvoice.DInvoiceBalanceCreditlC":U
then assign vcMessage = if icDinvoiceType = {&INVOICETYPE-CREDITNOTE}
then trim(#T-5'The balance amount in the base currency cannot be negative.':150(1126)t-5#)
else "":U.
end case.
end.
if idTargetField > 0
then do:
case icTargetFieldName:
when "DInvoice.DInvoiceBalanceDebitTC":U
then assign vcMessage = if icDinvoiceType = {&INVOICETYPE-INVOICE} or icDinvoiceType = {&INVOICETYPE-FINANCECHARGE}
then trim(#T-6'The balance amount in the transaction currency must be less than or equal to zero.':150(14068)t-6#)
else "":U.
when "DInvoice.DInvoiceBalanceCreditTC":U
then assign vcMessage = if icDinvoiceType = {&INVOICETYPE-CREDITNOTE}
then trim(#T-7'The balance amount in the transaction currency must be less than or equal to zero.':150(14068)t-7#)
else "":U.
when "DInvoice.DInvoiceBalanceDebitlC":U
then assign vcMessage = if icDinvoiceType = {&INVOICETYPE-INVOICE} or icDinvoiceType = {&INVOICETYPE-FINANCECHARGE}
then trim(#T-8'The balance amount in the base currency must be less than or equal to zero.':150(14069)t-8#)
else "":U.
when "DInvoice.DInvoiceBalanceCreditlC":U
then assign vcMessage = if icDinvoiceType = {&INVOICETYPE-CREDITNOTE}
then trim(#T-9'The balance amount in the base currency must be less than or equal to zero.':150(14069)t-9#)
else "":U.
end case.
end.
if vcMessage <> "":U
then do:
assign oiReturnStatus = -1.
<M-1 run SetMessage (input vcMessage (icMessage),
input '':U (icArguments),
input icTargetFieldName (icFieldName),
input string(idTargetField) (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input icRowid (icRowid),
input 'QADFIN-2074':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BDInvoice>
end.