project QadFinancials > class BDInvoice > method DefaultValuesExchangeRateOriginal
Description
default the exchange rate and the invoice amount LC
Parameters
iiCurrencyId | input | integer | |
icCurrencyCode | input | character | Currency Code |
idDInvoiceOriginalLC | input | decimal | Invoice Amount in LC |
idDInvoiceOriginalTC | input | decimal | Invoice Amount in TC |
itDInvoicePostingDate | input | date | Posting Date |
odDInvoiceExchangeRate | output | decimal | exchange rate |
odDInvoiceExchangeRateScale | output | decimal | |
odDInvoiceOriginalLC | output | decimal | Invoice Amount in LC |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
unused
program code (program3/bdinvoice.p)
if iiCurrencyId = ? then assign iiCurrencyId = 0.
if iiCurrencyId = viCompanyLCId or
icCurrencyCode = vcCompanyLC
then assign odDInvoiceExchangeRate = 1
odDInvoiceExchangeRateScale = 1
odDInvoiceOriginalLC = if idDInvoiceOriginalLC <> 0
then idDInvoiceOriginalLC
else idDInvoiceOriginalTC.
else do :
<M-73 run GetExchangeRate
(input viCompanyId (iiCompanyID),
input iiCurrencyId (iiFromCurrencyID),
input if iicurrencyId = 0 then iccurrencyCode else '':U (icFromCurrencyCode),
input viCompanyLCId (iiToCurrencyID),
input ? (icToCurrencyCode),
input ? (iiExchangeRateTypeID),
input {&EXCHANGERATETYPE-ACCOUNTING} (icExchangeRateTypeCode),
input itDInvoicePostingDate (itValidityDate),
output odDInvoiceExchangeRate (odExchangeRate),
output odDInvoiceExchangeRateScale (odExchangeScaleFactor),
output viFcReturnSuper (oiReturnStatus)) in BDInvoice>
if viFcReturnSuper < 0 or (viFcReturnSuper > 0 and oiReturnStatus = 0)
then assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus < 0 then return.
assign odDInvoiceExchangeRate = if idDInvoiceOriginalLC <> 0
then (idDInvoiceOriginalLC / idDInvoiceOriginalTC)
else odDInvoiceExchangeRate
odDInvoiceExchangeRateScale = if idDInvoiceOriginalLC <> 0
then 1
else odDInvoiceExchangeRateScale
odDInvoiceOriginalLC = if idDInvoiceOriginalLC <> 0
then idDInvoiceOriginalLC
else <M-2 RoundAmount
(input idDInvoiceOriginalTC * odDInvoiceExchangeRate * odDInvoiceExchangeRateScale (idUnroundedAmount),
input viCompanyLCId (iiCurrencyID),
input vcCompanyLC (icCurrencyCode)) in business>.
end. /* end else iiCurrencyId = viCompanyLCId or ... */