project QadFinancials > class BWithholdingTax > method CreateAndOrUpdateWHTSubAssignLCCC
Description
CreateAndOrUpdateWHTSubAssignLCCC: 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-4'Internal error: A record of table &2 should be available but this is not the case. Method:=&1.':255(566293675)T-4#,"BWithholdingTax:CreateAndOrUpdateWHTSub":U,"tInvoiceWHTPayment":U)).
if vcMessage = "":U and
not available tqCInvoiceWHTForWHTCreation
then assign vcMessage = trim(substitute(#T-88'Internal error: A record of table &2 should be available but this is not the case. Method:=&1.':255(566293675)T-88#,"BWithholdingTax:CreateAndOrUpdateWHTSub":U,"tqCInvoiceWHTForWHTCreation":U)).
if vcMessage = "":U and
not available tWHT
then assign vcMessage = trim(substitute(#T-75'Internal error: A record of table &2 should be available but this is not the case. Method:=&1.':255(566293675)T-75#,"BWithholdingTax:CreateAndOrUpdateWHTSub":U,"tWHT":U)).
if vcMessage <> "":U
then do :
assign viLocalReturnStatus = -3.
<M-15 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-560717':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.WHTChargeAmtDebitLC = <M-31 RoundAmount
(input tWHT.WHTChargeAmtDebitTC * tqCInvoiceWHTForWHTCreation.tdCInvoiceExchangeRate * tqCInvoiceWHTForWHTCreation.tdCInvoiceRateScale (idUnroundedAmount),
input viCompanyCCId (iiCurrencyID),
input vcCompanyCC (icCurrencyCode)) in BWithholdingTax>
tWHT.WHTChargeAmtCreditLC = <M-74 RoundAmount
(input tWHT.WHTChargeAmtCreditTC * tqCInvoiceWHTForWHTCreation.tdCInvoiceExchangeRate * tqCInvoiceWHTForWHTCreation.tdCInvoiceRateScale (idUnroundedAmount),
input viCompanyLCId (iiCurrencyID),
input vcCompanyLC (icCurrencyCode)) in BWithholdingTax>
tWHT.WHTChargeAmtDebitCC = <M-536 RoundAmount
(input tWHT.WHTChargeAmtDebitTC * tqCInvoiceWHTForWHTCreation.tdCInvoiceCCRate * tqCInvoiceWHTForWHTCreation.tdCInvoiceCCScale (idUnroundedAmount),
input viCompanyCCId (iiCurrencyID),
input vcCompanyCC (icCurrencyCode)) in BWithholdingTax>
tWHT.WHTChargeAmtCreditCC = <M-71 RoundAmount
(input tWHT.WHTChargeAmtCreditTC * tqCInvoiceWHTForWHTCreation.tdCInvoiceCCRate * tqCInvoiceWHTForWHTCreation.tdCInvoiceCCScale (idUnroundedAmount),
input viCompanyCCId (iiCurrencyID),
input vcCompanyCC (icCurrencyCode)) in BWithholdingTax>
tWHT.WHTTaxableFeesDebitLC = <M-67 RoundAmount
(input tWHT.WHTTaxableFeesDebitTC * tqCInvoiceWHTForWHTCreation.tdCInvoiceExchangeRate * tqCInvoiceWHTForWHTCreation.tdCInvoiceRateScale (idUnroundedAmount),
input viCompanyLCId (iiCurrencyID),
input vcCompanyLC (icCurrencyCode)) in BWithholdingTax>
tWHT.WHTTaxableFeesCreditLC = <M-21 RoundAmount
(input tWHT.WHTTaxableFeesCreditTC * tqCInvoiceWHTForWHTCreation.tdCInvoiceExchangeRate * tqCInvoiceWHTForWHTCreation.tdCInvoiceRateScale (idUnroundedAmount),
input viCompanyLCId (iiCurrencyID),
input vcCompanyLC (icCurrencyCode)) in BWithholdingTax>
tWHT.WHTTaxableFeesDebitCC = <M-73 RoundAmount
(input tWHT.WHTTaxableFeesDebitTC * tqCInvoiceWHTForWHTCreation.tdCInvoiceCCRate * tqCInvoiceWHTForWHTCreation.tdCInvoiceCCScale (idUnroundedAmount),
input viCompanyCCId (iiCurrencyID),
input vcCompanyCC (icCurrencyCode)) in BWithholdingTax>
tWHT.WHTTaxableFeesCreditCC = <M-11 RoundAmount
(input tWHT.WHTTaxableFeesCreditTC * tqCInvoiceWHTForWHTCreation.tdCInvoiceCCRate * tqCInvoiceWHTForWHTCreation.tdCInvoiceCCScale (idUnroundedAmount),
input viCompanyCCId (iiCurrencyID),
input vcCompanyCC (icCurrencyCode)) in BWithholdingTax>
tWHT.WHTVATAmtDebitLC = <M-26 RoundAmount
(input tWHT.WHTVATAmtDebitTC * tqCInvoiceWHTForWHTCreation.tdCInvoiceExchangeRate * tqCInvoiceWHTForWHTCreation.tdCInvoiceRateScale (idUnroundedAmount),
input viCompanyLCId (iiCurrencyID),
input vcCompanyLC (icCurrencyCode)) in BWithholdingTax>
tWHT.WHTVATAmtCreditLC = <M-77 RoundAmount
(input tWHT.WHTVATAmtCreditTC * tqCInvoiceWHTForWHTCreation.tdCInvoiceExchangeRate * tqCInvoiceWHTForWHTCreation.tdCInvoiceRateScale (idUnroundedAmount),
input viCompanyLCId (iiCurrencyID),
input vcCompanyLC (icCurrencyCode)) in BWithholdingTax>
tWHT.WHTVATAmtDebitCC = <M-92 RoundAmount
(input tWHT.WHTVATAmtDebitTC * tqCInvoiceWHTForWHTCreation.tdCInvoiceCCRate * tqCInvoiceWHTForWHTCreation.tdCInvoiceCCScale (idUnroundedAmount),
input viCompanyCCId (iiCurrencyID),
input vcCompanyCC (icCurrencyCode)) in BWithholdingTax>
tWHT.WHTVATAmtCreditCC = <M-69 RoundAmount
(input tWHT.WHTVATAmtCreditTC * tqCInvoiceWHTForWHTCreation.tdCInvoiceCCRate * tqCInvoiceWHTForWHTCreation.tdCInvoiceCCScale (idUnroundedAmount),
input viCompanyCCId (iiCurrencyID),
input vcCompanyCC (icCurrencyCode)) in BWithholdingTax>
tWHT.WHTTotAmtDebitLC = <M-97 RoundAmount
(input tWHT.WHTTotAmtDebitTC * tqCInvoiceWHTForWHTCreation.tdCInvoiceExchangeRate * tqCInvoiceWHTForWHTCreation.tdCInvoiceRateScale (idUnroundedAmount),
input viCompanyLCId (iiCurrencyID),
input vcCompanyLC (icCurrencyCode)) in BWithholdingTax>
tWHT.WHTTotAmtCreditLC = <M-682 RoundAmount
(input tWHT.WHTTotAmtCreditTC * tqCInvoiceWHTForWHTCreation.tdCInvoiceExchangeRate * tqCInvoiceWHTForWHTCreation.tdCInvoiceRateScale (idUnroundedAmount),
input viCompanyLCId (iiCurrencyID),
input vcCompanyLC (icCurrencyCode)) in BWithholdingTax>
tWHT.WHTTotAmtDebitCC = <M-35 RoundAmount
(input tWHT.WHTTotAmtDebitTC * tqCInvoiceWHTForWHTCreation.tdCInvoiceCCRate * tqCInvoiceWHTForWHTCreation.tdCInvoiceCCScale (idUnroundedAmount),
input viCompanyCCId (iiCurrencyID),
input vcCompanyCC (icCurrencyCode)) in BWithholdingTax>
tWHT.WHTTotAmtCreditCC = <M-61 RoundAmount
(input tWHT.WHTTotAmtCreditTC * tqCInvoiceWHTForWHTCreation.tdCInvoiceCCRate * tqCInvoiceWHTForWHTCreation.tdCInvoiceCCScale (idUnroundedAmount),
input viCompanyCCId (iiCurrencyID),
input vcCompanyCC (icCurrencyCode)) in BWithholdingTax>
/* For following fields: use the Accounting-rate at posting date of the payment */
tWHT.WHTPaidAmtDebitLC = <M-47 RoundAmount
(input tWHT.WHTPaidAmtDebitTC * tInvoiceWHTPayment.tdPaymentAccRateTCLC * tInvoiceWHTPayment.tdPaymentAccScaleTCLC (idUnroundedAmount),
input viCompanyLCId (iiCurrencyID),
input vcCompanyLC (icCurrencyCode)) in BWithholdingTax>
tWHT.WHTPaidAmtCreditLC = <M-25 RoundAmount
(input tWHT.WHTPaidAmtCreditTC * tInvoiceWHTPayment.tdPaymentAccRateTCLC * tInvoiceWHTPayment.tdPaymentAccScaleTCLC (idUnroundedAmount),
input viCompanyLCId (iiCurrencyID),
input vcCompanyLC (icCurrencyCode)) in BWithholdingTax>
tWHT.WHTPaidAmtDebitCC = <M-17 RoundAmount
(input tWHT.WHTPaidAmtDebitTC * tInvoiceWHTPayment.tdPaymentAccRateTCCC * tInvoiceWHTPayment.tdPaymentAccScaleTCCC (idUnroundedAmount),
input viCompanyCCId (iiCurrencyID),
input vcCompanyCC (icCurrencyCode)) in BWithholdingTax>
tWHT.WHTPaidAmtCreditCC = <M-48 RoundAmount
(input tWHT.WHTPaidAmtCreditTC * tInvoiceWHTPayment.tdPaymentAccRateTCCC * tInvoiceWHTPayment.tdPaymentAccScaleTCCC (idUnroundedAmount),
input viCompanyCCId (iiCurrencyID),
input vcCompanyCC (icCurrencyCode)) in BWithholdingTax>
/* For following fields: use the WHT-rate of the posting date of the payment */
tWHT.WHTAmtDebitLC = <M-3 RoundAmount
(input tWHT.WHTAmtDebitTC * tInvoiceWHTPayment.tdPaymentWHTRateTCLC * tInvoiceWHTPayment.tdPaymentWHTScaleTCLC (idUnroundedAmount),
input viCompanyLCId (iiCurrencyID),
input vcCompanyLC (icCurrencyCode)) in BWithholdingTax>
tWHT.WHTAmtCreditLC = <M-79 RoundAmount
(input tWHT.WHTAmtCreditTC * tInvoiceWHTPayment.tdPaymentWHTRateTCLC * tInvoiceWHTPayment.tdPaymentWHTScaleTCLC (idUnroundedAmount),
input viCompanyLCId (iiCurrencyID),
input vcCompanyLC (icCurrencyCode)) in BWithholdingTax>
tWHT.WHTAmtDebitCC = <M-20 RoundAmount
(input tWHT.WHTAmtDebitTC * tInvoiceWHTPayment.tdPaymentWHTRateTCCC * tInvoiceWHTPayment.tdPaymentWHTScaleTCCC (idUnroundedAmount),
input viCompanyCCId (iiCurrencyID),
input vcCompanyCC (icCurrencyCode)) in BWithholdingTax>
tWHT.WHTAmtCreditCC = <M-280 RoundAmount
(input tWHT.WHTAmtCreditTC * tInvoiceWHTPayment.tdPaymentWHTRateTCCC * tInvoiceWHTPayment.tdPaymentWHTScaleTCCC (idUnroundedAmount),
input viCompanyCCId (iiCurrencyID),
input vcCompanyCC (icCurrencyCode)) in BWithholdingTax>
tWHT.WHTRetainedAmtDebitLC = <M-30 RoundAmount
(input tWHT.WHTRetainedAmtDebitTC * tInvoiceWHTPayment.tdPaymentWHTRateTCLC * tInvoiceWHTPayment.tdPaymentWHTScaleTCLC (idUnroundedAmount),
input viCompanyLCId (iiCurrencyID),
input vcCompanyLC (icCurrencyCode)) in BWithholdingTax>
tWHT.WHTRetainedAmtCreditLC = <M-18 RoundAmount
(input tWHT.WHTRetainedAmtCreditTC * tInvoiceWHTPayment.tdPaymentWHTRateTCLC * tInvoiceWHTPayment.tdPaymentWHTScaleTCLC (idUnroundedAmount),
input viCompanyLCId (iiCurrencyID),
input vcCompanyLC (icCurrencyCode)) in BWithholdingTax>
tWHT.WHTRetainedAmtDebitCC = <M-68 RoundAmount
(input tWHT.WHTRetainedAmtDebitTC * tInvoiceWHTPayment.tdPaymentWHTRateTCCC * tInvoiceWHTPayment.tdPaymentWHTScaleTCCC (idUnroundedAmount),
input viCompanyCCId (iiCurrencyID),
input vcCompanyCC (icCurrencyCode)) in BWithholdingTax>
tWHT.WHTRetainedAmtCreditCC = <M-56 RoundAmount
(input tWHT.WHTRetainedAmtCreditTC * tInvoiceWHTPayment.tdPaymentWHTRateTCCC * tInvoiceWHTPayment.tdPaymentWHTScaleTCCC (idUnroundedAmount),
input viCompanyCCId (iiCurrencyID),
input vcCompanyCC (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-53'Internal error occured while assigning the details of the Withholding Taxes.':255(206547406)T-53#),"1":U).
if error-status:num-messages > 0
then assign vcMessage = vcMessage + chr(10) +
trim(substitute(#T-94'Detailed info: &1 (&2)':252(49824)T-94#,error-status:Get-Message(1),string(error-status:Get-Number(1)))).
<M-80 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-554107':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.