Description
Load a Vat template into current posting
Parameters
| iiCompanyID | input | integer | |
| icParentRowid | input | character | |
| idAmountTC | input | decimal | |
| idTotalDebit | input | decimal | |
| itPostingDate | input | date | |
| oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program1/bjournalentry.p)
for each tPostingVat where tPostingVat.tc_ParentRowid = icParentRowid:
assign tPostingVat.PostingVatBaseCreditTC = <M-58 RoundAmount
(input tPostingVat.PostingVatBaseCreditTC * idAmountTC / idTotalDebit (idUnroundedAmount),
input 0 (iiCurrencyID),
input tPostingVat.tcCurrencyCode (icCurrencyCode)) in business>
tPostingVat.PostingVatBaseDebitTC = <M-3 RoundAmount
(input tPostingVat.PostingVatBaseDebitTC * idAmountTC / idTotalDebit (idUnroundedAmount),
input 0 (iiCurrencyID),
input tPostingVat.tcCurrencyCode (icCurrencyCode)) in business>
tPostingVat.PostingVatTaxCreditTC = <M-17 RoundAmount
(input tPostingVat.PostingVatTaxCreditTC * idAmountTC / idTotalDebit (idUnroundedAmount),
input 0 (iiCurrencyID),
input tPostingVat.tcCurrencyCode (icCurrencyCode)) in business>
tPostingVat.PostingVatTaxDebitTC = <M-83 RoundAmount
(input tPostingVat.PostingVatTaxDebitTC * idAmountTC / idTotalDebit (idUnroundedAmount),
input 0 (iiCurrencyID),
input tPostingVat.tcCurrencyCode (icCurrencyCode)) in business>.
/* Calculate value in local currency */
if tPostingVat.tcCurrencyCode = vcCompanyLC
then assign tPostingVat.PostingVatBaseCreditLC = tPostingVat.PostingVatBaseCreditTC
tPostingVat.PostingVatBaseDebitLC = tPostingVat.PostingVatBaseDebitTC
tPostingVat.PostingVatTaxCreditLC = tPostingVat.PostingVatTaxCreditTC
tPostingVat.PostingVatTaxDebitLC = tPostingVat.PostingVatTaxDebitTC.
else do:
assign tPostingVat.PostingVatBaseCreditLC = <M-6 RoundAmount
(input tPostingVat.PostingVatBaseCreditTC * tPostingVat.PostingVatExchangeRate * tPostingVat.PostingVatRateScale (idUnroundedAmount),
input viCompanyLCId (iiCurrencyID),
input vcCompanyLC (icCurrencyCode)) in business>
tPostingVat.PostingVatBaseDebitLC = <M-63 RoundAmount
(input tPostingVat.PostingVatBaseDebitTC * tPostingVat.PostingVatExchangeRate * tPostingVat.PostingVatRateScale (idUnroundedAmount),
input viCompanyLCId (iiCurrencyID),
input vcCompanyLC (icCurrencyCode)) in business>
tPostingVat.PostingVatTaxCreditLC = <M-35 RoundAmount
(input tPostingVat.PostingVatTaxCreditTC * tPostingVat.PostingVatExchangeRate * tPostingVat.PostingVatRateScale (idUnroundedAmount),
input viCompanyLCId (iiCurrencyID),
input vcCompanyLC (icCurrencyCode)) in business>
tPostingVat.PostingVatTaxDebitLC = <M-87 RoundAmount
(input tPostingVat.PostingVatTaxDebitTC * tPostingVat.PostingVatExchangeRate * tPostingVat.PostingVatRateScale (idUnroundedAmount),
input viCompanyLCId (iiCurrencyID),
input vcCompanyLC (icCurrencyCode)) in business>.
end. /* else do: */
/* Calculate value in consolidation currency */
if vcCompanyCC = "":U
then assign tPostingVat.PostingVatBaseCreditCC = 0
tPostingVat.PostingVatBaseDebitCC = 0
tPostingVat.PostingVatTaxCreditCC = 0
tPostingVat.PostingVatTaxDebitCC = 0.
else if vcCompanyCC = tPostingVat.tcCurrencyCode
then assign tPostingVat.PostingVatBaseCreditCC = tPostingVat.PostingVatBaseCreditTC
tPostingVat.PostingVatBaseDebitCC = tPostingVat.PostingVatBaseDebitTC
tPostingVat.PostingVatTaxCreditCC = tPostingVat.PostingVatTaxCreditTC
tPostingVat.PostingVatTaxDebitCC = tPostingVat.PostingVatTaxDebitTC.
else if vlDomainIsStatutory = false
then assign tPostingVat.PostingVatBaseCreditCC = tPostingVat.PostingVatBaseCreditLC
tPostingVat.PostingVatBaseDebitCC = tPostingVat.PostingVatBaseDebitLC
tPostingVat.PostingVatTaxCreditCC = tPostingVat.PostingVatTaxCreditLC
tPostingVat.PostingVatTaxDebitCC = tPostingVat.PostingVatTaxDebitLC.
else do:
<M-47 run GetExchangeRate
(input iiCompanyID (iiCompanyID),
input tPostingVat.Currency_ID (iiFromCurrencyID),
input ? (icFromCurrencyCode),
input viCompanyCCId (iiToCurrencyID),
input ? (icToCurrencyCode),
input ? (iiExchangeRateTypeID),
input {&EXCHANGERATETYPE-STATUTORY} (icExchangeRateTypeCode),
input itPostingDate (itValidityDate),
output vdRateCC (odExchangeRate),
output vdRateScale (odExchangeScaleFactor),
output viFcReturnSuper (oiReturnStatus)) in BJournalEntry>
if viFcReturnSuper < 0 or
(viFcReturnSuper > 0 and
oiReturnStatus = 0)
then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.
assign tPostingVat.PostingVatBaseCreditCC = <M-7 RoundAmount
(input tPostingVat.PostingVatBaseCreditTC * vdRateCC * vdRateScale (idUnroundedAmount),
input viCompanyCCId (iiCurrencyID),
input vcCompanyCC (icCurrencyCode)) in business>
tPostingVat.PostingVatBaseDebitCC = <M-23 RoundAmount
(input tPostingVat.PostingVatBaseDebitTC * vdRateCC * vdRateScale (idUnroundedAmount),
input viCompanyCCId (iiCurrencyID),
input vcCompanyCC (icCurrencyCode)) in business>
tPostingVat.PostingVatTaxCreditCC = <M-11 RoundAmount
(input tPostingVat.PostingVatTaxCreditTC * vdRateCC * vdRateScale (idUnroundedAmount),
input viCompanyCCId (iiCurrencyID),
input vcCompanyCC (icCurrencyCode)) in business>
tPostingVat.PostingVatTaxDebitCC = <M-90 RoundAmount
(input tPostingVat.PostingVatTaxDebitTC * vdRateCC * vdRateScale (idUnroundedAmount),
input viCompanyCCId (iiCurrencyID),
input vcCompanyCC (icCurrencyCode)) in business>.
end. /* else do: */
end. /* for each tPostingVat */