Description
Assign the Statutory Currency amounts based on the amounts in TC and the exchange rate between TC and the newly entered SC.
Parameters
icDomainCode | input | character | |
ocErrorMessage | output | character | |
oiPostingLineCounter | output | integer | |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program1/tsetstatutorycurrency.p)
assign oiReturnStatus = -98
viLocalReturnStatus = 0.
define variable dotx2_mstr as com.qad.eefin.tsetstatutorycurrency.taxmaster.
STATCURRBLOCK:
do:
/* Get DomainProperty */
find Domains where
Domains.DomainCode = icDomainCode
no-lock no-error.
if not available Domains
then do:
assign viLocalReturnStatus = -300
ocErrorMessage = substitute("Unable to get the Domain with code &1", icDomainCode).
leave STATCURRBLOCK.
end. /* if not available Domains */
find DomainProperty where
DomainProperty.Domain_ID = Domains.Domain_ID
no-lock no-error.
if not available DomainProperty
then do:
assign viLocalReturnStatus = -301
ocErrorMessage = substitute("Unable to get the DomainProperty for code &1", icDomainCode).
leave STATCURRBLOCK.
end. /* if not available DomainProperty */
/* Find the non-taxable vat-code of the domain as Tax-posting-lines on WHT-accounts will use this as the VatCode */
dotx2_mstr = new com.qad.eefin.tsetstatutorycurrency.taxmaster (Domains.DomainCode,
'NON-TAX':U).
assign vcNonTaxableVatCode = dotx2_mstr:tx2_tax_code no-error.
if valid-object(dotx2_mstr)
then delete object dotx2_mstr no-error. /* Needed to free up memory */
/* ======================================================================== */
/* Update Suplier invoices */
/* ======================================================================== */
<M-35 run SetStatutoryCurrencyBasedOnTCCInvoice
(output vcTempErrorMessage (ocErrorMessage),
output viFcReturnSuper (oiReturnStatus)) in TSetStatutoryCurrency>
assign ocErrorMessage = ocErrorMessage + vcTempErrorMessage.
if viFcReturnSuper <> 0 then assign viLocalReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0 then leave STATCURRBLOCK.
/* === Logging === */
output to value(vcLogFile) append.
put unformatted
STRING(TIME,"HH:MM:SS")
" TRANS"
" Recalculation of the SC-amounts on all Supplier invoices of domain " Domains.DomainCode " have now been completed." skip .
output close.
/* ======================================================================== */
/* Update Customer invoices */
/* ======================================================================== */
<M-4 run SetStatutoryCurrencyBasedOnTCDInvoice
(output vcTempErrorMessage (ocErrorMessage),
output viFcReturnSuper (oiReturnStatus)) in TSetStatutoryCurrency>
assign ocErrorMessage = ocErrorMessage + vcTempErrorMessage.
if viFcReturnSuper <> 0 then assign viLocalReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0 then leave STATCURRBLOCK.
/* === Logging === */
output to value(vcLogFile) append.
put unformatted
STRING(TIME,"HH:MM:SS")
" TRANS"
" Recalculation of the SC-amounts on all Customer invoices of domain " Domains.DomainCode " have now been completed." skip .
output close.
/* ======================================================================== */
/* Update Suplier payments */
/* ======================================================================== */
<M-83 run SetStatutoryCurrencyBasedOnTCCDocument
(output vcTempErrorMessage (ocErrorMessage),
output viFcReturnSuper (oiReturnStatus)) in TSetStatutoryCurrency>
assign ocErrorMessage = ocErrorMessage + vcTempErrorMessage.
if viFcReturnSuper <> 0 then assign viLocalReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0 then leave STATCURRBLOCK.
/* === Logging === */
output to value(vcLogFile) append.
put unformatted
STRING(TIME,"HH:MM:SS")
" TRANS"
" Recalculation of the SC-amounts on all Supplier payments of domain " Domains.DomainCode " have now been completed." skip .
output close.
/* ======================================================================== */
/* Update Customer payments */
/* ======================================================================== */
<M-71 run SetStatutoryCurrencyBasedOnTCDDocument
(output vcTempErrorMessage (ocErrorMessage),
output viFcReturnSuper (oiReturnStatus)) in TSetStatutoryCurrency>
assign ocErrorMessage = ocErrorMessage + vcTempErrorMessage.
if viFcReturnSuper <> 0 then assign viLocalReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0 then leave STATCURRBLOCK.
/* === Logging === */
output to value(vcLogFile) append.
put unformatted
STRING(TIME,"HH:MM:SS")
" TRANS"
" Recalculation of the SC-amounts on all Customer payments of domain " Domains.DomainCode " have now been completed." skip .
output close.
/* ======================================================================== */
/* Update Customer payment selection */
/* ======================================================================== */
<M-87 run SetStatutoryCurrencyBasedOnTCDPaySel
(output vcTempErrorMessage (ocErrorMessage),
output viFcReturnSuper (oiReturnStatus)) in TSetStatutoryCurrency>
assign ocErrorMessage = ocErrorMessage + vcTempErrorMessage.
if viFcReturnSuper <> 0 then assign viLocalReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0 then leave STATCURRBLOCK.
/* === Logging === */
output to value(vcLogFile) append.
put unformatted
STRING(TIME,"HH:MM:SS")
" TRANS"
" Recalculation of the SC-amounts on all Customer payment selection of domain " Domains.DomainCode " have now been completed." skip .
output close.
/* ======================================================================== */
/* Update Open item adjustment */
/* ======================================================================== */
<M-39 run SetStatutoryCurrencyBasedOnTCOIAdjust
(output vcTempErrorMessage (ocErrorMessage),
output viFcReturnSuper (oiReturnStatus)) in TSetStatutoryCurrency>
assign ocErrorMessage = ocErrorMessage + vcTempErrorMessage.
if viFcReturnSuper <> 0 then assign viLocalReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0 then leave STATCURRBLOCK.
/* === Logging === */
output to value(vcLogFile) append.
put unformatted
STRING(TIME,"HH:MM:SS")
" TRANS"
" Recalculation of the SC-amounts on all Open item adjustments of domain " Domains.DomainCode " have now been completed." skip .
output close.
/* ======================================================================== */
/* Update Postings */
/* ======================================================================== */
<M-62 run SetStatutoryCurrencyBasedOnTCPosting
(output vcTempErrorMessage (ocErrorMessage),
output oiPostingLineCounter (oiPostingLineCounter),
output viFcReturnSuper (oiReturnStatus)) in TSetStatutoryCurrency>
assign ocErrorMessage = ocErrorMessage + vcTempErrorMessage.
if viFcReturnSuper <> 0 then assign viLocalReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0 then leave STATCURRBLOCK.
/* === Logging === */
output to value(vcLogFile) append.
put unformatted
STRING(TIME,"HH:MM:SS")
" TRANS"
" Recalculation of the SC-amounts on all Postings of domain " Domains.DomainCode " have now been completed." skip .
output close.
for each Company of Domains no-lock:
/* Continue in submethods because of 32K limit */
<M-9 run SetStatutoryCurrencyBasedOnTCDet1
(output ocErrorMessage (ocErrorMessage),
output viFcReturnSuper (oiReturnStatus)) in TSetStatutoryCurrency>
if viFcReturnSuper <> 0
then assign viLocalReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then leave STATCURRBLOCK.
/* === Logging === */
output to value(vcLogFile) append.
put unformatted
STRING(TIME,"HH:MM:SS")
" TRANS"
" The first-part of the SC-amounts on all non-receiver-matching transactions of entity " Company.CompanyCode " have now been recalculated." skip .
output close.
/* Wht recalculation */
<M-72 run SetStatutoryCurrencyBasedOnTCWht
(output ocErrorMessage (ocErrorMessage),
output viFcReturnSuper (oiReturnStatus)) in TSetStatutoryCurrency>
if viFcReturnSuper <> 0
then assign viLocalReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then leave STATCURRBLOCK.
/* === Logging === */
output to value(vcLogFile) append.
put unformatted
STRING(TIME,"HH:MM:SS")
" TRANS"
" The Wht part of the SC-amounts of entity " Company.CompanyCode " have now been recalculated." skip .
output close.
/* Tackle now the APMatching data */
<M-52 run SetStatutoryCurrencyBasedOnTCAPM
(output ocErrorMessage (ocErrorMessage),
output viFcReturnSuper (oiReturnStatus)) in TSetStatutoryCurrency>
if viFcReturnSuper <> 0
then assign viLocalReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then leave STATCURRBLOCK.
/* === Logging === */
output to value(vcLogFile) append.
put unformatted
STRING(TIME,"HH:MM:SS")
" TRANS"
" The SC-amounts on the receiver-matching transactions of entity " Company.CompanyCode " have now been recalculated." skip .
output close.
end. /* for each company where */
end. /* STATCURRBLOCK */
assign oiReturnStatus = viLocalReturnStatus.