Description
Assign the Statutory Currency Amounts based on the amounts in TC and the exchange Rate between TC and the newly entered SC.
Split into detail method, because main method would get to big.
Parameters
ocErrorMessage | output | character | |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program1/tsetstatutorycurrency.p)
assign oiReturnStatus = -98
viLocalReturnStatus = 0.
STATCURRDETBLOCK:
do:
/* WHT */
for each WHT of company exclusive-lock ,
each CInvoice of WHT
no-lock Transaction:
/* For these fields: use the Statutory-rate at posting date of the invoices */
<M-89 run GetExchangeRate
(input WHT.Currency_ID (iiFromCurrencyID),
input viNewSCID (iiToCurrencyID),
input viSCExchangeRateTypeID (iiExchangeRateTypeID),
input CInvoice.CInvoicePostingDate (itDate),
input viExchangeRateSharedSetID (iiSharedSetID),
output vdRate (odExchangeRate),
output vdScale (odExchangeRateScale),
output ocErrorMessage (ocErrorMessage),
output viFcReturnSuper (oiReturnStatus)) in TSetStatutoryCurrency>
if viFcReturnSuper <> 0
then assign viLocalReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then leave STATCURRDETBLOCK.
assign WHT.WHTChargeAmtDebitCC = <M-10 RoundSCAmount (input WHT.WHTChargeAmtDebitTC * vdRate * vdScale (idUnroundedAmount)) in TSetStatutoryCurrency>
WHT.WHTChargeAmtCreditCC = <M-53 RoundSCAmount (input WHT.WHTChargeAmtCreditTC * vdRate * vdScale (idUnroundedAmount)) in TSetStatutoryCurrency>
WHT.WHTTaxableFeesDebitCC = <M-62 RoundSCAmount (input WHT.WHTTaxableFeesDebitTC * vdRate * vdScale (idUnroundedAmount)) in TSetStatutoryCurrency>
WHT.WHTTaxableFeesCreditCC = <M-13 RoundSCAmount (input WHT.WHTTaxableFeesCreditTC * vdRate * vdScale (idUnroundedAmount)) in TSetStatutoryCurrency>
WHT.WHTVATAmtDebitCC = <M-38 RoundSCAmount (input WHT.WHTVATAmtDebitTC * vdRate * vdScale (idUnroundedAmount)) in TSetStatutoryCurrency>
WHT.WHTVATAmtCreditCC = <M-20 RoundSCAmount (input WHT.WHTVATAmtCreditTC * vdRate * vdScale (idUnroundedAmount)) in TSetStatutoryCurrency>
WHT.WHTTotAmtDebitCC = <M-63 RoundSCAmount (input WHT.WHTTotAmtDebitTC * vdRate * vdScale (idUnroundedAmount)) in TSetStatutoryCurrency>
WHT.WHTTotAmtCreditCC = <M-22 RoundSCAmount (input WHT.WHTTotAmtCreditTC * vdRate * vdScale (idUnroundedAmount)) in TSetStatutoryCurrency>.
/* For following fields: use the Statutory-rate at posting date of the payment */
<M-69 run GetExchangeRate
(input WHT.Currency_ID (iiFromCurrencyID),
input viNewSCID (iiToCurrencyID),
input viSCExchangeRateTypeID (iiExchangeRateTypeID),
input WHT.WHTPaymentDate (itDate),
input viExchangeRateSharedSetID (iiSharedSetID),
output vdRate (odExchangeRate),
output vdScale (odExchangeRateScale),
output ocErrorMessage (ocErrorMessage),
output viFcReturnSuper (oiReturnStatus)) in TSetStatutoryCurrency>
if viFcReturnSuper <> 0
then assign viLocalReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then leave STATCURRDETBLOCK.
assign WHT.WHTPaidAmtDebitCC = <M-61 RoundSCAmount (input WHT.WHTPaidAmtDebitTC * vdRate * vdScale (idUnroundedAmount)) in TSetStatutoryCurrency>
WHT.WHTPaidAmtCreditCC = <M-78 RoundSCAmount (input WHT.WHTPaidAmtCreditTC * vdRate * vdScale (idUnroundedAmount)) in TSetStatutoryCurrency>.
/* For following fields: use the VAT/WHT-rate of the posting date of the payment */
<M-7 run GetExchangeRate
(input WHT.Currency_ID (iiFromCurrencyID),
input viNewSCID (iiToCurrencyID),
input viTXExchangeRateTypeID (iiExchangeRateTypeID),
input WHT.WHTPaymentDate (itDate),
input viExchangeRateSharedSetID (iiSharedSetID),
output vdRate (odExchangeRate),
output vdScale (odExchangeRateScale),
output ocErrorMessage (ocErrorMessage),
output viFcReturnSuper (oiReturnStatus)) in TSetStatutoryCurrency>
if viFcReturnSuper <> 0
then assign viLocalReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then leave STATCURRDETBLOCK.
assign WHT.WHTAmtDebitCC = <M-33 RoundSCAmount (input WHT.WHTAmtDebitTC * vdRate * vdScale (idUnroundedAmount)) in TSetStatutoryCurrency>
WHT.WHTAmtCreditCC = <M-72 RoundSCAmount (input WHT.WHTAmtCreditTC * vdRate * vdScale (idUnroundedAmount)) in TSetStatutoryCurrency>
WHT.WHTRetainedAmtDebitCC = <M-14 RoundSCAmount (input WHT.WHTRetainedAmtDebitTC * vdRate * vdScale (idUnroundedAmount)) in TSetStatutoryCurrency>
WHT.WHTRetainedAmtCreditCC = <M-49 RoundSCAmount (input WHT.WHTRetainedAmtCreditTC * vdRate * vdScale (idUnroundedAmount)) in TSetStatutoryCurrency> .
end. /* for each WHT of company Transaction : */
end. /* STATCURRDETBLOCK */
assign oiReturnStatus = viLocalReturnStatus.