project QadFinancials > class BAPMatching > method AdditionalUpdatesAllTax
Description
AdditionalUpdatesAllTax
Parameters
| icAPMatchingPostingRowID | input | character | |
| icPostingText | input | character | |
| oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program6/bapmatching.p)
/* ======================================================================================================== */
/* This method contains the creation of the posting-lines based upon the taxes entered on the matching-line */
/* ======================================================================================================== */
/* ================== */
/* Exception handling */
/* Start Block */
/* ================== */
assign oiReturnStatus = -98
viLocalReturnStatus = 0.
TAXHANDLINGBLOCK : DO :
/* ======================================================================== */
/* First check whether everything is available what is supposed to be avail */
/* ======================================================================== */
if not available tAPMatching or
not available tAPMatchingLn
then do :
assign viLocalReturnStatus = -3
vcMsgAPMatching = trim(substitute(#T-30'Internal error: information is missing.':255(49818)t-30#)) + chr(10) +
trim(substitute(#T-31'Available matching header: &1.':234(49819)T-31#,available (tAPMatching))) + chr(10) +
trim(substitute(#T-28'Available matching details: &1.':234(49820)T-28#,available (tAPMatchingLn))).
<M-26 run SetMessage (input vcMsgAPMatching (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QadFin-7867':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
Leave TAXHANDLINGBLOCK.
end. /* if not avail */
/* ==================================================================================================== */
/* Go through all taxes of the APMatchingLn in case a rate- or usage-variance occured or in case */
/* there was an ExchangeRate-variance or in case a change was made to the tax-properties on the line */
/* ==================================================================================================== */
assign vlTaxDetailsAreChanged = false.
if tAPMatchingLn.APMatchingLnTaxClass <> tAPMatchingLn.APMatchingLnPvodTaxClass or
tAPMatchingLn.APMatchingLnTaxUsage <> tAPMatchingLn.APMatchingLnPvodTaxUsage or
tAPMatchingLn.APMatchingLnTaxEnv <> tAPMatchingLn.APMatchingLnPvodTaxEnv or
tAPMatchingLn.APMatchingLnIsTaxable <> tAPMatchingLn.APMatchingLnPvodIsTaxable or
tAPMatchingLn.APMatchingLnVarRateTC <> 0 or
tAPMatchingLn.APMatchingLnVarUsageTC <> 0 or
tAPMatchingLn.APMatchingLnVarExchRateLC <> 0 or
tAPMatchingLn.APMatchingLnVarExchRateCC <> 0 or
tAPMatchingLn.tdAPMatchingLnAINRecTaxTC <> 0
then assign vlTaxDetailsAreChanged = true.
else do :
for each tAPMatchingLnTax where
tAPMatchingLnTax.tc_ParentRowid = tAPMatchingLn.tc_rowid and
tAPMatchingLnTax.tc_status <> "D":U :
if not can-find (t_iAPMatchingLnTax where
t_iAPMatchingLnTax.tc_ParentRowid = trim(tAPMatchingLn.PvoDomain) + "-":U + trim(string(tAPMatchingLn.PvoID)) + "-":U + trim(string(tAPMatchingLn.PvodLineID)) and
t_iAPMatchingLnTax.tcVatCode = tAPMatchingLnTax.tcVatCode and
t_iAPMatchingLnTax.APMatchingLnTaxTaxPct = tAPMatchingLnTax.APMatchingLnTaxTaxPct and
t_iAPMatchingLnTax.APMatchingLnTaxRecovTaxPct = tAPMatchingLnTax.APMatchingLnTaxRecovTaxPct and
t_iAPMatchingLnTax.APMatchingLnTaxIsAccrRcp = tAPMatchingLnTax.APMatchingLnTaxIsAccrRcp and
t_iAPMatchingLnTax.APMatchingLnTaxIsDiscAtInv = tAPMatchingLnTax.APMatchingLnTaxIsDiscAtInv and
t_iAPMatchingLnTax.APMatchingLnTaxIsAbsRet = tAPMatchingLnTax.APMatchingLnTaxIsAbsRet and
t_iAPMatchingLnTax.APMatchingLnTaxIsUpdAllow = tAPMatchingLnTax.APMatchingLnTaxIsUpdAllow and
t_iAPMatchingLnTax.APMatchingLnTaxIsRevCharge = tAPMatchingLnTax.APMatchingLnTaxIsRevCharge and
t_iAPMatchingLnTax.APMatchingLnTaxIsSuspDel = tAPMatchingLnTax.APMatchingLnTaxIsSuspDel and
t_iAPMatchingLnTax.APMatchingLnTaxTaxTC = tAPMatchingLnTax.APMatchingLnTaxTaxTC *
tAPMatchingLn.APMatchingLnPvodReceiptQty /
(if tAPMatchingLn.APMatchingLnMatchQty = 0 then 1 else tAPMatchingLn.APMatchingLnMatchQty))
then do :
assign vlTaxDetailsAreChanged = true.
Leave.
end. /* if not can-find (t_iAPMatchingLnTax where */
end. /* for each tAPMatchingLnTax where */
if vlTaxDetailsAreChanged = false
then do :
for each t_iAPMatchingLnTax where
t_iAPMatchingLnTax.tc_ParentRowid = trim(tAPMatchingLn.PvoDomain) + "-":U + trim(string(tAPMatchingLn.PvoID)) + "-":U + trim(string(tAPMatchingLn.PvodLineID)) :
if not can-find (tAPMatchingLnTax where
tAPMatchingLnTax.tc_status <> "D":U and
tAPMatchingLnTax.tc_ParentRowid = tAPMatchingLn.tc_rowid and
tAPMatchingLnTax.tcVatCode = t_iAPMatchingLnTax.tcVatCode and
tAPMatchingLnTax.APMatchingLnTaxTaxPct = t_iAPMatchingLnTax.APMatchingLnTaxTaxPct and
tAPMatchingLnTax.APMatchingLnTaxRecovTaxPct = t_iAPMatchingLnTax.APMatchingLnTaxRecovTaxPct and
tAPMatchingLnTax.APMatchingLnTaxIsAccrRcp = t_iAPMatchingLnTax.APMatchingLnTaxIsAccrRcp and
tAPMatchingLnTax.APMatchingLnTaxIsDiscAtInv = t_iAPMatchingLnTax.APMatchingLnTaxIsDiscAtInv and
tAPMatchingLnTax.APMatchingLnTaxIsAbsRet = t_iAPMatchingLnTax.APMatchingLnTaxIsAbsRet and
tAPMatchingLnTax.APMatchingLnTaxIsUpdAllow = t_iAPMatchingLnTax.APMatchingLnTaxIsUpdAllow and
tAPMatchingLnTax.APMatchingLnTaxIsRevCharge = t_iAPMatchingLnTax.APMatchingLnTaxIsRevCharge and
tAPMatchingLnTax.APMatchingLnTaxIsSuspDel = t_iAPMatchingLnTax.APMatchingLnTaxIsSuspDel and
tAPMatchingLnTax.APMatchingLnTaxTaxTC = t_iAPMatchingLnTax.APMatchingLnTaxTaxTC *
tAPMatchingLn.APMatchingLnMatchQty /
tAPMatchingLn.APMatchingLnPvodReceiptQty)
then do :
assign vlTaxDetailsAreChanged = true.
Leave.
end. /* if not can-find (tAPMatchingLnTax where */
end. /* for each tAPMatchingLnTax where */
end. /* if vlTaxDetailsAreChanged = false */
end. /* Not if if tAPMatchingLn.APMatchingLnTaxClass */
if vlTaxDetailsAreChanged = true
then do :
/* ============================================================ */
/* Go through all APMatchingLnTax records and call a sub-method */
/* because this method cannot contain all program-code */
/* ============================================================ */
for each tAPMatchingLnTax where
tAPMatchingLnTax.tc_ParentRowid = tAPMatchingLn.tc_rowid and
tAPMatchingLnTax.tc_status <> "D":U :
/* Store total non recoverable tax - because of rounding problems */
assign vdTaxARNRecTC = tAPMatchingLnTax.APMatchingLnTaxARNRecTaxTC
vdTaxAINRecTC = tAPMatchingLnTax.APMatchingLnTaxAINRecTaxTC.
<M-35 run AdditionalUpdatesAllTaxNewOne
(input icAPMatchingPostingRowID (icAPMatchingPostingRowidID),
input icPostingText (icPostingText),
input-output vdTaxARNRecTC (bdTaxARNRecTC),
input-output vdTaxAINRecTC (bdTaxAINRecTC),
output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
if viFcReturnSuper <> 0 then assign viLocalReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0 then Leave TAXHANDLINGBLOCK.
<M-34 run AdditionalUpdatesAllTaxNewTwo
(input icAPMatchingPostingRowID (icAPMatchingPostingRowidID),
input icPostingText (icPostingText),
input-output vdTaxARNRecTC (bdTaxARNRecTC),
input-output vdTaxAINRecTC (bdTaxAINRecTC),
output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
if viFcReturnSuper <> 0 then assign viLocalReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0 then Leave TAXHANDLINGBLOCK.
end. /* for each tAPMatchingLnTax where */
/* =================================================================================== */
/* Go through all t_iAPMatchingLnTax records (they hold the taxes of the receipt) that */
/* are acrued at receipt and call a sub-method because this method cannot contain all */
/* program-code. t_iAPMatchingLnTax.tc_ParentRowid is just a reference to the pvod */
/* =================================================================================== */
for each t_iAPMatchingLnTax where
t_iAPMatchingLnTax.tc_ParentRowid = trim(tAPMatchingLn.PvoDomain) + "-":U + trim(string(tAPMatchingLn.PvoID)) + "-":U + trim(string(tAPMatchingLn.PvodLineID)) :
<M-33 run AdditionalUpdatesAllTaxOldOne
(input icAPMatchingPostingRowID (icAPMatchingPostingRowidID),
input icPostingText (icPostingText),
output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
if viFcReturnSuper <> 0 then assign viLocalReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0 then Leave TAXHANDLINGBLOCK.
<M-37 run AdditionalUpdatesAllTaxOldTwo
(input icAPMatchingPostingRowID (icAPMatchingPostingRowidID),
input icPostingText (icPostingText),
output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
if viFcReturnSuper <> 0 then assign viLocalReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0 then Leave TAXHANDLINGBLOCK.
end. /* for each t_iAPMatchingLnTax where */
end. /* if vlTaxDetailsAreChanged = true */
END. /* TAXHANDLINGBLOCK */
/* ================== */
/* Exception handling */
/* ================== */
assign oiReturnStatus = viLocalReturnStatus.