project QadFinancials > class BAPMatching > method AdditionalUpdatesAllTaxGetInvAcc
Description
AdditionalUpdatesAllTaxNewGetInvAcc: submethod of AdditionalUpdatesAllTaxNew that assigns the inventory-account (and division and CC)
Parameters
ocInvAccGLCode | output | character | |
ocInvAccDivCode | output | character | |
ocInvAccCCCode | output | character | |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program6/bapmatching.p)
/* ================================================================================ */
/* AdditionalUpdatesAllTaxGetInvAcc: submethod of AdditionalUpdatesAllTaxNew that */
/* retrieves the Inventory-account (and division and CC) */
/* ================================================================================ */
/* ================== */
/* Exception handling */
/* Start Block */
/* ================== */
assign oiReturnStatus = -98.
viLocalReturnStatus = 0.
INVHANDLINGBLOCK : DO :
/* ======================================================================== */
/* First check whether everything is available what is supposed to be avail */
/* ======================================================================== */
if not available tAPMatching or
not available tAPMatchingLn or
not available tqPendingVoucherForMatchingAcc
then do :
assign viLocalReturnStatus = -3
vcMsgAPMatching = trim(substitute(#T-14'Internal error: information that should have been available is not available.':254(999890202)T-14#)) + chr(10) +
trim(substitute(#T-48'Available matching header: &1.':234(49819)T-48#,available (tAPMatching))) + chr(10) +
trim(substitute(#T-88'Available matching details: &1.':234(49820)T-88#,available (tAPMatchingLn))) + chr(10) +
trim(substitute(#T-39'Available accounting query: &1.':255(68803)T-39#,available (tqPendingVoucherForMatchingAcc))).
<M-56 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-260627':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
Leave INVHANDLINGBLOCK.
end. /* if not avail */
/* Check if Logistics charges */
if tAPMatchingLn.APMatchingLnPvodIsLgCharge = true and
tqPendingVoucherForMatchingAcc.tcpvo_order_type = {&PENDINGVOUCHER-ORDERTYPE-PO}
then do:
<M-44 run AdditionalUpdatesAllTaxGetLogChargePPV (output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
if viFcReturnSuper <> 0
then assign viLocalReturnStatus = viFcReturnSuper.
if tAPMatchingLn.tcAPMatchingLnPVVGLCode <> "":U and
tAPMatchingLn.tcAPMatchingLnPVVGLCode <> ?
then assign ocInvAccGLCode = tAPMatchingLn.tcAPMatchingLnPVVGLCode
ocInvAccDivCode = tAPMatchingLn.tcAPMatchingLnPVVDivCode
ocInvAccCCCode = tAPMatchingLn.tcAPMatchingLnPVVCCCode.
else assign ocInvAccGLCode = tAPMatchingLn.tcGLCode
ocInvAccDivCode = tAPMatchingLn.tcDivisionCode
ocInvAccCCCode = tAPMatchingLn.tcCostCentreCode.
Leave INVHANDLINGBLOCK.
end.
/* Check if item is an Inventory-item; this mean Normal and Sub-contract-items */
if tqPendingVoucherForMatchingAcc.tcprh_type = "":U or
tqPendingVoucherForMatchingAcc.tcprh_type = "S":U
then do:
<Q-62 run ProductLineForMatchingAcc (all) (Read) (NoCache)
(input tqPendingVoucherForMatchingAcc.tcpvo_domain, (DomainCode)
input tqPendingVoucherForMatchingAcc.tcpt_prod_line, (ProductLineCode)
output dataset tqProductLineForMatchingAcc) in BMfgProductLine>
find first tqProductLineForMatchingAcc where
tqProductLineForMatchingAcc.tcpl_domain = tqPendingVoucherForMatchingAcc.tcpvo_domain and
tqProductLineForMatchingAcc.tcpl_prod_line = tqPendingVoucherForMatchingAcc.tcpt_prod_line
no-lock no-error.
if available tqProductLineForMatchingAcc and tqProductLineForMatchingAcc.tcpl_apvr_acct <> "":U
then /* === Case 1: Get info from the product-line (pl_inv_acct): Domain + ProductLine */
assign ocInvAccGLCode = tqProductLineForMatchingAcc.tcpl_inv_acct
ocInvAccDivCode = tqProductLineForMatchingAcc.tcpl_inv_sub
ocInvAccCCCode = tqProductLineForMatchingAcc.tcpl_inv_cc.
else do :
/* Get info from the GL-control-file (gl_inv_acct): Domain */
<Q-40 run SystemAccountControlForAll (all) (Read) (NoCache)
(input tqPendingVoucherForMatchingAcc.tcpvo_domain, (DomainCode)
output dataset tqSystemAccountControlForAll) in BMfgSystemAccountControl>
find first tqSystemAccountControlForAll where
tqSystemAccountControlForAll.tcgl_domain = tqPendingVoucherForMatchingAcc.tcpvo_domain
no-lock no-error.
if not available tqSystemAccountControlForAll
then do :
assign vcMsgAPMatching = trim(substitute(#T-35'Unable to find System/Account Control for domain &1 while retrieving the Purchase-price-variances':255(733753805)T-35#,tqPendingVoucherForMatchingAcc.tcpvo_domain))
viLocalReturnStatus = -1.
<M-45 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-883092':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
Leave INVHANDLINGBLOCK.
end. /* if not available tqSystemAccountControlForAll */
/* === Case 2: Get info from the GL-control-file (gl_inv_acct): Domain */
assign ocInvAccGLCode = tqSystemAccountControlForAll.tcgl_inv_acct
ocInvAccDivCode = tqSystemAccountControlForAll.tcgl_inv_sub
ocInvAccCCCode = tqSystemAccountControlForAll.tcgl_inv_cc.
end.
end. /* if tqPendingVoucherForMatchingAcc.tcprh_type = "":U or */
else do:
/* For Non-Inventory Items */
assign ocInvAccGLCode = tAPMatchingLn.tcGLCode
ocInvAccDivCode = tAPMatchingLn.tcDivisionCode
ocInvAccCCCode = tAPMatchingLn.tcCostCentreCode.
end. /* if not tqPendingVoucherForMatchingAcc.tcprh_type = "":U */
END. /* INVHANDLINGBLOCK */
/* ================== */
/* Exception handling */
/* ================== */
assign oiReturnStatus = viLocalReturnStatus.