project QadFinancials > class BDInvoice > method GetVatExchangeRate
Parameters
| icOwnVatCurrencyCode | input | character | |
| iiOwnVatCurrencyId | input | integer | |
| icDInvoiceCurrencyCode | input | character | |
| iiDInvoiceCurrencyId | input | integer | |
| idDInvoiceExchangeRate | input | decimal | |
| idDInvoiceRateScale | input | decimal | |
| itTaxPointDate | input | date | |
| odVatExchangeRate | output | decimal | |
| odVatRateScale | output | decimal | |
| oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program1/bdinvoice.p)
if iiOwnVatCurrencyId = ? then assign iiOwnVatCurrencyId = 0.
if iiDInvoiceCurrencyId = ? then assign iiDInvoiceCurrencyId = 0.
if icOwnVatCurrencyCode = ? then assign icOwnVatCurrencyCode = "":U.
if icDInvoiceCurrencyCode = ? then assign icDInvoiceCurrencyCode = "":U.
/* CEE Vat Currency =============================================================================== */
/* Set the exchange rate between transactional currency and Vat currency */
/* ================================================================================================ */
if (iiOwnVatCurrencyId <> ? or icOwnVatCurrencyCode <> "") and
(iiDInvoiceCurrencyId <> ? or icDInvoiceCurrencyCode <> "")
then do:
/* if Vat currency are the same as local currency, the same exchange rate as on invoice has to be used */
if iiOwnVatCurrencyID = viCompanyLCId or
icOwnVatCurrencyCode = vcCompanyLC
then assign odVatExchangeRate = idDInvoiceExchangeRate
odVatRateScale = idDInvoiceRateScale.
/* If Vat currency are the same as transactional currency, exchange rate must be 1 */
else if iiOwnVatCurrencyId = iiDInvoiceCurrencyId or
icOwnVatCurrencyCode = icDInvoiceCurrencyCode
then assign odVatExchangeRate = 1
odVatRateScale = 1.
/* Find correct exchange rate from Transactional currency to Vat currency */
else do:
<M-97 run GetExchangeRate
(input viCompanyId (iiCompanyID),
input iiDInvoiceCurrencyId (iiFromCurrencyID),
input icDInvoiceCurrencyCode (icFromCurrencyCode),
input iiOwnVatCurrencyId (iiToCurrencyID),
input icOwnVatCurrencyCode (icToCurrencyCode),
input ? (iiExchangeRateTypeID),
input {&EXCHANGERATETYPE-VAT} (icExchangeRateTypeCode),
input itTaxPointDate (itValidityDate),
output odVatExchangeRate (odExchangeRate),
output odVatRateScale (odExchangeScaleFactor),
output viFcReturnSuper (oiReturnStatus)) in BDInvoice>
if viFcReturnSuper < 0 or
(viFcReturnSuper > 0 and oiReturnStatus = 0)
then do:
assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus < 0
then return.
end.
end.
end.