project QadFinancials > class BDInvoice > method ValidateDInvoiceExchangeRate
validation procedure
Description
This method validates the Exchange Rate of the debtor invoice.
Parameters
idDinvoiceExchangeRate | input | decimal | Exchange Rate of the debtor invoice |
icRowid | input | character | Contents of field tc_Rowid, if the target field is a field of a component temp-table. |
iiCurrencyID | input | integer | Currency ID |
icDInvoiceReference | input | character | Reference of the Debtor Invoice |
icCurrencyCode | input | character | Currency Code |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program5/bdinvoice.p)
if iiCurrencyID = ? then assign iiCurrencyID = 0.
if icCurrencyCode = ? then assign icCurrencyCode = "".
if idDinvoiceExchangeRate <> 1 and
((iiCurrencyID = viCompanyLCId and
iiCurrencyID <> 0) or
(icCurrencyCode <> "":U and
icCurrencyCode = vcCompanyLC))
then do :
assign vcMessage = trim(substitute(#T-5'The exchange rate should be 1 for invoices (&1) in the base currency.':255(1060)t-5#,trim(icDInvoiceReference))).
oiReturnStatus = -1.
<M-1 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input 'DInvoice.DinvoiceExchangeRate':U (icFieldName),
input string(idDinvoiceExchangeRate) (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input icRowid (icRowid),
input 'QADFIN-1146':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BDInvoice>
end. /* if idDinvoiceExchangeRate = 0 and */
if idDinvoiceExchangeRate = 0 and
((iiCurrencyID <> viCompanyLCId and
iiCurrencyID <> 0 ) or
(icCurrencyCode <> vcCompanyLC and
icCurrencyCode <> "":U))
then do:
assign vcMessage = trim(#T-3'The exchange rate cannot be zero.':250(13844)T-3#)
oiReturnStatus = -1.
<M-4 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input 'DInvoice.DInvoiceExchangeRate':U (icFieldName),
input string(idDinvoiceExchangeRate) (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input icRowid (icRowid),
input 'QADFIN-3076':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BDInvoice>
end.