project QadFinancials > class BPosting > method AddTaxPostingGetExchRates
Description
get the exchange rates
Parameters
| iiCompanyID | input | integer | |
| iiCurrencyId | input | integer | Currency ID |
| icExchangeRateType | input | character | Exchange Rate Type |
| itTaxPointDate | input | date | Tax Point Date |
| bdExchangeRateLC | input-output | decimal | Exchange Rate from TC to LC |
| bdExchangeRateScaleLC | input-output | decimal | Scale factor for exchange rate from TC to LC |
| bdExchangeRateCC | input-output | decimal | Exchange Rate for CC |
| bdExchangeRateScaleCC | input-output | decimal | Scale factor for cc exchange rate |
| oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program6/bposting.p)
assign oiReturnStatus = -98
viLocalReturnStatus = 0.
RATEBLOCK:
DO:
if iiCurrencyId = 0 or
iiCurrencyId = ?
then assign iiCurrencyId = viCompanyLCId.
if iiCurrencyId = viCompanyLCId
then assign bdExchangeRateLC = 1
bdExchangeRateScaleLC = 1.
else if bdExchangeRateLC = 0 or
bdExchangeRateLC = ?
then do:
<M-55 run GetExchangeRate
(input iiCompanyID (iiCompanyID),
input iiCurrencyId (iiFromCurrencyID),
input ? (icFromCurrencyCode),
input viCompanyLCId (iiToCurrencyID),
input ? (icToCurrencyCode),
input ? (iiExchangeRateTypeID),
input icExchangeRateType (icExchangeRateTypeCode),
input itTaxPointDate (itValidityDate),
output bdExchangeRateLC (odExchangeRate),
output bdExchangeRateScaleLC (odExchangeScaleFactor),
output viFcReturnSuper (oiReturnStatus)) in BPosting>
if viFcReturnSuper <> 0
then assign viLocalReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then leave RATEBLOCK.
end. /* else if bdExchangeRateLC = 0 or */
if viCompanyCCId = 0 or
viCompanyCCId = ? or
viCompanyCCId = iiCurrencyId
then assign bdExchangeRateCC = 1
bdExchangeRateScaleCC = 1.
else if bdExchangeRateCC = 0 or
bdExchangeRateCC = ?
then do:
if vlDomainIsStatutory = false
then assign bdExchangeRateCC = bdExchangeRateLC
bdExchangeRateScaleCC = bdExchangeRateScaleLC.
else do:
<M-28 run GetExchangeRate
(input iiCompanyID (iiCompanyID),
input iiCurrencyId (iiFromCurrencyID),
input ? (icFromCurrencyCode),
input viCompanyCCId (iiToCurrencyID),
input ? (icToCurrencyCode),
input ? (iiExchangeRateTypeID),
input {&EXCHANGERATETYPE-STATUTORY} (icExchangeRateTypeCode),
input itTaxPointDate (itValidityDate),
output bdExchangeRateCC (odExchangeRate),
output bdExchangeRateScaleCC (odExchangeScaleFactor),
output viFcReturnSuper (oiReturnStatus)) in BPosting>
if viFcReturnSuper <> 0
then assign viLocalReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then leave RATEBLOCK.
end. /* else do: (if vlDomainIsStatutory = false) */
end. /* else do: */
end. /* RATEBLOCK: */
assign oiReturnStatus = viLocalReturnStatus.