project QadFinancials > class BAPMatching > method GetGLPLVarRateDiscrepancy
Description
AdditionalUpdatesAllLinesPLVarRateDiscrepancy; submethod of AdditionalUpdatesAllLinesPLVarRate that is located in the same segment. This method takes about find thie correct accounting information to create a posting-line for the Rate-Variance (difference in price) for NON-Logistic-charges and Discrepancy.
Parameters
icAPMatchingLnGLCode | input | character | |
icAPMatchingLnDivCode | input | character | |
icAPMatchingLnCCCode | input | character | |
ilAPMatchingLnIsVarGLPosting | input | logical | |
idAPMatchingLnMatchQty | input | decimal | |
idAPMatchingLnMatchUnitPrice | input | decimal | |
icAPMatchingLnPvodCCCode | input | character | |
icAPMatchingLnPvodCostMtdCur | input | character | |
icAPMatchingLnPvodCostMtdGL | input | character | |
icAPMatchingLnPvodDivCode | input | character | |
icAPMatchingLnPvodGLCode | input | character | |
ilAPMatchingLnPvodIsLgCharge | input | logical | |
icAPMatchingLnPvodItem | input | character | |
icAPMatchingLnPvodItemType | input | character | |
icAPMatchingLnPvodLgCharge | input | character | |
icAPMatchingLnPvodPrjCode | input | character | |
idAPMatchingLnPvodReceiptQty | input | decimal | |
icAPMatchingLnPvodSite | input | character | |
idAPMatchingLnPvodUnitPrice | input | decimal | |
idAPMatchingLnVarRateTC | input | decimal | |
icPvoDomain | input | character | |
iiPvoId | input | integer | |
iiPvodLineID | input | integer | |
icPvodOpAllocCode | input | character | inputer parameter: pending voucher operational allocation code. |
icOpAllocCode | input | character | input parameter: operational allocation code. |
icpod_loc | input | character | |
iipod_op | input | integer | |
icpod_wo_Lot | input | character | |
icprh_site | input | character | |
icprh_type | input | character | |
icprh_vend | input | character | |
icpt_prod_line | input | character | |
icpt_site | input | character | |
icpvo_order_type | input | character | |
icpvo_shipfrom | input | character | |
icpvo_shipto | input | character | |
icpvod_channel | input | character | |
icpvod_shipto | input | character | |
icvd_type | input | character | |
ocGLCode | output | character | |
ocDivisionCode | output | character | |
ocCostCentreCode | output | character | CostCentreCode |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program6/bapmatching.p)
/* ==================================================================================== */
/* Find out the correct Discrepancy GL, Division and CostCentre that are used for */
/* posting line created for the rate variance */
/* */
/* Case 1: Get account from the product-line(global-domain, prod-line, site and loc */
/* (only for positive receipts) */
/* Case 2: Get accounts from the product-line-det (global-domain, prod-line and site) */
/* Case 3: Get accounts from the product-line (global-domain, prod-line) */
/* Case 4: Really fallback mechanism - get value from domain account control setting */
/* ==================================================================================== */
FINDACCOUNTBLOCK: DO :
assign vcGLCode = "":U
vcDivisionCode = "":U
vcCostCentreCode = "":U.
/* === Case: 1 === */
/* Find Product Line Discrepency Account Details in the pld_det - Inventory Account */
if idAPMatchingLnPvodReceiptQty >= 0
then do:
<Q-7 run ProductLineDetForMatchingAcc (all) (Read) (NoCache)
(input icPvoDomain, (DomainCode)
input icpt_prod_line, (ProductLineCode)
input icpt_site, (Site)
input icpod_loc, (Location)
output dataset tqProductLineDetForMatchingAcc) in BMfgProductLine>
find first tqProductLineDetForMatchingAcc where
tqProductLineDetForMatchingAcc.tcpld_domain = icPvoDomain and
tqProductLineDetForMatchingAcc.tcpld_prodline = icpt_prod_line and
tqProductLineDetForMatchingAcc.tcpld_site = icpt_site and
tqProductLineDetForMatchingAcc.tcpld_loc = icpod_loc
no-error.
if available tqProductLineDetForMatchingAcc and
tqProductLineDetForMatchingAcc.tcpld_dscracct <> "":U
then do:
assign vcGLCode = tqProductLineDetForMatchingAcc.tcpld_dscracct
vcDivisionCode = tqProductLineDetForMatchingAcc.tcpld_dscr_sub
vcCostCentreCode = tqProductLineDetForMatchingAcc.tcpld_dscr_cc.
leave FINDACCOUNTBLOCK.
end.
end. /* if idAPMatchingLnPvodReceiptQty >= 0 */
/* === Case: 2 === */
/* Get accounts from the product-line-details (global-domain, prod-line and site=ship-to) */
<Q-53 run ProductLineDetForMatchingAcc (all) (Read) (Cache)
(input icPvoDomain, (DomainCode)
input icpt_prod_line, (ProductLineCode)
input icpvo_shipto, (Site)
input '':U, (Location)
output dataset tqProductLineDetForMatchingAcc) in BMfgProductLine >
find first tqProductLineDetForMatchingAcc where
tqProductLineDetForMatchingAcc.tcpld_domain = icPvoDomain and
tqProductLineDetForMatchingAcc.tcpld_prodline = icpt_prod_line and
tqProductLineDetForMatchingAcc.tcpld_site = icpvo_shipto and
tqProductLineDetForMatchingAcc.tcpld_loc = "":U
no-lock no-error.
if available tqProductLineDetForMatchingAcc and
tqProductLineDetForMatchingAcc.tcpld_dscracct <> "":U
then do:
assign vcGLCode = tqProductLineDetForMatchingAcc.tcpld_dscracct
vcDivisionCode = tqProductLineDetForMatchingAcc.tcpld_dscr_sub
vcCostCentreCode = tqProductLineDetForMatchingAcc.tcpld_dscr_cc.
leave FINDACCOUNTBLOCK.
end.
/* === Case: 3 === */
/* Get accounts from the product-line (global-domain, prod-line) */
<Q-50 run ProductLineForMatchingAcc (all) (Read) (Cache)
(input icPvoDomain, (DomainCode)
input icpt_prod_line, (ProductLineCode)
output dataset tqProductLineForMatchingAcc) in BMfgProductLine >
find first tqProductLineForMatchingAcc where
tqProductLineForMatchingAcc.tcpl_domain = icPvoDomain and
tqProductLineForMatchingAcc.tcpl_prod_line = icpt_prod_line
no-lock no-error.
if available tqProductLineForMatchingAcc and
tqProductLineForMatchingAcc.tcpl_dscr_acct <> "":U
then do:
assign vcGLCode = tqProductLineForMatchingAcc.tcpl_dscr_acct
vcDivisionCode = tqProductLineForMatchingAcc.tcpl_dscr_sub
vcCostCentreCode = tqProductLineForMatchingAcc.tcpl_dscr_cc.
leave FINDACCOUNTBLOCK.
end.
/* === Case: 4 ==== */
/* Fall-back mechanism - look at system control account setting */
<Q-74 run SystemAccountControlForAll (all) (Read) (Cache)
(input icPvoDomain, (DomainCode)
output dataset tqSystemAccountControlForAll) in BMfgSystemAccountControl>
find first tqSystemAccountControlForAll where
tqSystemAccountControlForAll.tcgl_domain = icPvoDomain
no-error.
if available tqSystemAccountControlForAll and
tqSystemAccountControlForAll.tcgl_dscr_acct <> "":U
then do:
assign vcGLCode = tqSystemAccountControlForAll.tcgl_dscr_acct
vcDivisionCode = tqSystemAccountControlForAll.tcgl_dscr_sub
vcCostCentreCode = tqSystemAccountControlForAll.tcgl_dscr_cc.
leave FINDACCOUNTBLOCK.
end.
END. /* FINDACCOUNTBLOCK */
/* ========================================= */
/* Check wether we have a G/L account by now */
/* ========================================= */
if (vcGLCode = "":U or
vcGLCode = ?) and
(icOpAllocCode = "":U or
icOpAllocCode = ?)
then do:
assign oiReturnStatus = -3
vcMsgAPMatching = trim(substitute(#T-52'The system cannot find the required accounting information in the pending invoice details to create the posting line on the rate variances for discrepancy (Domain:&1, Pinv: &2, Pinv det: &3).':255(55541)t-52#,icPvoDomain, iiPvoID, iiPvodLineID)).
<M-51 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-5532':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
return.
end. /* if vcGLCode = "":U or */
/* ======================== */
/* Assign output parameters */
/* ======================== */
assign ocGLCode = vcGLCode
ocDivisionCode = vcDivisionCode
ocCostCentreCode = vcCostCentreCode.