project QadFinancials > class BWithholdingTax > method CreateAndOrUpdateWHTSubRoundTC
Description
CreateAndOrUpdateWHTSubRoundTC: sub-method of CreateAndOrUpdateWHTSub that will create and/or update the WHT records based on input temp-table that differs from the class-table
Parameters
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program7/bwithholdingtax.p)
/* ============================================================================================================== */
/* This method is a submethod of CreateAndOrUpdateWHTSub that is a submethod of CreateAndOrUpdateWHT */
/* - see that method for all details */
/* ============================================================================================================== */
/* By now, we have loaded all instance-datas and created the new instances and filled there logical key */
/* Now we will assign the other fields for the WHT-records that represent a Fee */
/* ============================================================================================================== */
/* ==================================== */
/* Exception Handling - Initialisation */
/* ==================================== */
assign oiReturnStatus = -98
viLocalReturnStatus = 0.
/* =========== */
/* Start block */
/* =========== */
FEEBLOCK: DO :
/* ================================================================ */
/* Check that everything that that should be available is available */
/* ================================================================ */
assign vcMessage = "":U.
if not available tInvoiceWHTPayment
then assign vcMessage = trim(substitute(#T-16'Internal error: A record of table &2 should be available but this is not the case. Method:=&1.':255(566293675)T-16#,"BWithholdingTax:CreateAndOrUpdateWHTSub":U,"tInvoiceWHTPayment":U)).
if vcMessage = "":U and
not available tqCInvoiceWHTForWHTCreation
then assign vcMessage = trim(substitute(#T-57'Internal error: A record of table &2 should be available but this is not the case. Method:=&1.':255(566293675)T-57#,"BWithholdingTax:CreateAndOrUpdateWHTSub":U,"tqCInvoiceWHTForWHTCreation":U)).
if vcMessage = "":U and
not available tWHT
then assign vcMessage = trim(substitute(#T-62'Internal error: A record of table &2 should be available but this is not the case. Method:=&1.':255(566293675)T-62#,"BWithholdingTax:CreateAndOrUpdateWHTSub":U,"tWHT":U)).
if vcMessage <> "":U
then do :
assign viLocalReturnStatus = -3.
<M-10 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'qadfin-209750':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BWithholdingTax>
leave FEEBLOCK.
end. /* if vcMessage <> "":U*/
/* ===================================================================== */
/* Assign all LC and CC field of the WHT record based upon the TC fields */
/* ===================================================================== */
assign /* For these fields: use the Accounting-rate at posting date of the invoices */
tWHT.WHTAmtCreditTC = <M-94 RoundAmount
(input tWHT.WHTAmtCreditTC (idUnroundedAmount),
input ? (iiCurrencyID),
input tWHT.tcCurrencyCode (icCurrencyCode)) in BWithholdingTax>
tWHT.WHTAmtDebitTC = <M-14 RoundAmount
(input tWHT.WHTAmtDebitTC (idUnroundedAmount),
input ? (iiCurrencyID),
input tWHT.tcCurrencyCode (icCurrencyCode)) in BWithholdingTax>
tWHT.WHTChargeAmtCreditTC = <M-87 RoundAmount
(input tWHT.WHTChargeAmtCreditTC (idUnroundedAmount),
input ? (iiCurrencyID),
input tWHT.tcCurrencyCode (icCurrencyCode)) in BWithholdingTax>
tWHT.WHTChargeAmtDebitTC = <M-25 RoundAmount
(input tWHT.WHTChargeAmtDebitTC (idUnroundedAmount),
input ? (iiCurrencyID),
input tWHT.tcCurrencyCode (icCurrencyCode)) in BWithholdingTax>
tWHT.WHTPaidAmtCreditTC = <M-78 RoundAmount
(input tWHT.WHTPaidAmtCreditTC (idUnroundedAmount),
input ? (iiCurrencyID),
input tWHT.tcCurrencyCode (icCurrencyCode)) in BWithholdingTax>
tWHT.WHTPaidAmtDebitTC = <M-11 RoundAmount
(input tWHT.WHTPaidAmtDebitTC (idUnroundedAmount),
input ? (iiCurrencyID),
input tWHT.tcCurrencyCode (icCurrencyCode)) in BWithholdingTax>
tWHT.WHTRetainedAmtCreditTC = <M-12 RoundAmount
(input tWHT.WHTRetainedAmtCreditTC (idUnroundedAmount),
input ? (iiCurrencyID),
input tWHT.tcCurrencyCode (icCurrencyCode)) in BWithholdingTax>
tWHT.WHTRetainedAmtDebitTC = <M-3 RoundAmount
(input tWHT.WHTRetainedAmtDebitTC (idUnroundedAmount),
input ? (iiCurrencyID),
input tWHT.tcCurrencyCode (icCurrencyCode)) in BWithholdingTax>
tWHT.WHTTaxableFeesCreditTC = <M-63 RoundAmount
(input tWHT.WHTTaxableFeesCreditTC (idUnroundedAmount),
input ? (iiCurrencyID),
input tWHT.tcCurrencyCode (icCurrencyCode)) in BWithholdingTax>
tWHT.WHTTaxableFeesDebitTC = <M-15 RoundAmount
(input tWHT.WHTTaxableFeesDebitTC (idUnroundedAmount),
input ? (iiCurrencyID),
input tWHT.tcCurrencyCode (icCurrencyCode)) in BWithholdingTax>
tWHT.WHTTotAmtCreditTC = <M-34 RoundAmount
(input tWHT.WHTTotAmtCreditTC (idUnroundedAmount),
input ? (iiCurrencyID),
input tWHT.tcCurrencyCode (icCurrencyCode)) in BWithholdingTax>
tWHT.WHTTotAmtDebitTC = <M-37 RoundAmount
(input tWHT.WHTTotAmtDebitTC (idUnroundedAmount),
input ? (iiCurrencyID),
input tWHT.tcCurrencyCode (icCurrencyCode)) in BWithholdingTax>
tWHT.WHTVATAmtCreditTC = <M-81 RoundAmount
(input tWHT.WHTVATAmtCreditTC (idUnroundedAmount),
input ? (iiCurrencyID),
input tWHT.tcCurrencyCode (icCurrencyCode)) in BWithholdingTax>
tWHT.WHTVATAmtDebitTC = <M-47 RoundAmount
(input tWHT.WHTVATAmtDebitTC (idUnroundedAmount),
input ? (iiCurrencyID),
input tWHT.tcCurrencyCode (icCurrencyCode)) in BWithholdingTax>
no-error. /* Needed as we are doing complex calculations in the previous large assign statement */
/* Check for Progress-errors and raise error when needed */
if error-status:error
then do :
assign viLocalReturnStatus = -3
vcMessage = trim(substitute(#T-48'Internal error occured while assigning the details of the Withholding Taxes.':255(206547406)T-48#),"1":U).
if error-status:num-messages > 0
then assign vcMessage = vcMessage + chr(10) +
trim(substitute(#T-38'Detailed info: &1 (&2)':252(49824)T-38#,error-status:Get-Message(1),string(error-status:Get-Number(1)))).
<M-64 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'qadfin-907070':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BWithholdingTax>
leave FEEBLOCK.
end. /* if error-status:error */
END. /* FEEBLOCK */
/* ================== */
/* Exception Handling */
/* ================== */
assign oiReturnStatus = viLocalReturnStatus.