project QadFinancials > class BAPMatching > method ValidateComponentPostAPM4LogCharge
validation procedure
Description
ValidateComponentPostAPM4LogCharge: Submethod of ValidateComponentPostAPM that performs some validations for the logis-charges
Parameters
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program4/bapmatching.p)
/* =========================================================================================== */
/* Some validations that are specific for LogCharge-related pending-vouchers that are matched */
/* Validations: */
/* 1. Make sure that the MatchedAmountTC that was entered during the matching on the pvo-level */
/* (on the pop-form) equals the sum of the MatchedAmountTC on all APMatchingLn-records */
/* (pvod-level) that refer to that pvo-mstr */
/* 2. Make sure that the Selected-property on all APMatchingLn-records pvod-level that refer */
/* to a single pvo-mstr is equal to the Selected-property that was entered during the */
/* matching on the pvo-mstr-level (on the pop-form) */
/* 3. Make sure that the Finished-property on all APMatchingLn-records pvod-level that refer */
/* to a single pvo-mstr is equal to the Finished-property that was entered during the */
/* matching on the pvo-mstr-level (on the pop-form) */
/* Notes: */
/* - All APMatchingLn-record that belong to the same Pvo have the same InternalReference */
/* - The values that were entered on pvo-level in the pop-form are stored in following */
/* calculated fields in the APMatchingLn-records: */
/* tlLogChargeHeaderIsSelected */
/* tlLogChargeHeaderIsFinished */
/* tdLogChargeHeaderMatchedAmtTC */
/* =========================================================================================== */
/* ================== */
/* Exception Hanlding */
/* Start Block */
/* ================== */
assign oiReturnStatus = -98
viLocalReturnStatus = 0.
LOGCHARGEVALIDATIONBLOCK : DO :
/* ============================= */
/* Check for record-availability */
/* ============================= */
if not available t_sAPMatching
then do :
assign viLocalReturnStatus = -3
vcMessageText = trim(substitute(#T-27'Internal error: no AP matching record is available.':255(56009)T-27#)).
<M-22 run SetMessage
(input vcMessageText (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'S':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QadFin-8526':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
Leave LOGCHARGEVALIDATIONBLOCK.
end. /* if not available t_sAPMatching */
/* ============================================================================================ */
/* Skip all these tests if we are in modify-mode and the loaded matching was in inital status */
/* as in this case the info on what was on the pop-form for the log-charges is not longer */
/* available on the matching-line and there is thus nothing to check against anymore */
/* ============================================================================================ */
if (t_sAPMatching.tc_Status = "C":U or
t_sAPMatching.tc_Status = "":U) and
can-find (t_iAPMatching where
t_iAPMatching.tc_Rowid = t_sAPMatching.tc_Rowid and
t_iAPMatching.APMatchingStatus = {&APMATCHINGSTATUS-INITIAL})
then do :
assign oiReturnStatus = 0.
Return.
end. /* if (t_sAPMatching.tc_Status = "C":U or */
/* ======================================== */
/* Go through all LogCharge matching lines */
/* ======================================== */
for each t_sAPMatchingLn where
t_sAPMatchingLn.tc_ParentRowid = t_sAPMatching.tc_Rowid and
t_sAPMatchingLn.APMatchingLnPvodIsLgCharge = true and
t_sAPMatchingLn.tc_Status <> 'D':U
break by t_sAPMatchingLn.APMatchingLnPvodLgCharge
by t_sAPMatchingLn.PvoDomain
by t_sAPMatchingLn.PvoID:
/* ===================================================================================== */
/* If it is the first APMatchingLn record of a certain PVO: */
/* Hold these 3 values that need to be validated so they can be used for the validations */
/* Reset the sum of the MatchedAmountTC's for the underlaying APMathcing records */
/* ===================================================================================== */
if first-of(t_sAPMatchingLn.PvoID)
then assign vlLogChargeHeaderIsSelected = t_sAPMatchingLn.tlLogChargeHeaderIsSelected
vlLogChargeHeaderIsFinished = t_sAPMatchingLn.tlLogChargeHeaderIsFinished
vdLogChargeHeaderMatchedAmtTC = t_sAPMatchingLn.tdLogChargeHeaderMatchedAmountTC
vdSumMatchedAmountTC = 0.
/* ===================================== */
/* Increase / Raise vdSumMatchedAmountTC */
/* ===================================== */
assign vdSumMatchedAmountTC = vdSumMatchedAmountTC + t_sAPMatchingLn.APMatchingLnMatchAmtTC.
/* ============================================================================================================================== */
/* IsSelected: For all APMatchingLn record of a certain PVO: check if the 2 toggles are equeal to the value entered on the pop-up */
/* ============================================================================================================================== */
if t_sAPMatchingLn.tlIsSelected <> vlLogChargeHeaderIsSelected
then do :
if t_sAPMatchingLn.tlIsSelected = true
then assign vcMessageText = trim(substitute(#T-37'The matching-line for logistic-charge &1 is marked as Selected allthough the Selected-flag was turned off for the corresponding logistic-charge header on the pop-form':255(70969)T-37#,t_sAPMatchingLn.APMatchingLnPvodLgCharge)).
else assign vcMessageText = trim(substitute(#T-38'The matching-line for logistic-charge &1 is marked as Un-selected allthough the Selected-flag was turned on for the corresponding logistic-charge header on the pop-form':255(70968)T-38#,t_sAPMatchingLn.APMatchingLnPvodLgCharge)).
assign viLocalReturnStatus = -3
vcMessageText = vcMessageText + chr(10) +
trim(substitute(#T-39'Order: &1':255(70970)T-39#,t_sAPMatchingLn.APMatchingLnPvodOrder)) + chr(10) +
trim(substitute(#T-40'Internal Reference: &1':255(70971)T-40#,t_sAPMatchingLn.APMatchingLnPvodIntRef)).
<M-36 run SetMessage
(input vcMessageText (icMessage),
input '':U (icArguments),
input 'tAPMatchingLn.tlIsSelected':U (icFieldName),
input string(t_sAPMatchingLn.tlIsSelected) (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sAPMatchingLn.tc_Rowid (icRowid),
input 'QadFin-8529':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
Leave LOGCHARGEVALIDATIONBLOCK.
end. /* if t_sAPMatchingLn.tlIsSelected <> vlLogChargeHeaderIsSelected */
/* ============================================================================================================================== */
/* IsFinished: For all APMatchingLn record of a certain PVO: check if the 2 toggles are equeal to the value entered on the pop-up */
/* ============================================================================================================================== */
if t_sAPMatchingLn.APMatchingLnIsPvodFinished <> vlLogChargeHeaderIsFinished
then do :
if t_sAPMatchingLn.APMatchingLnIsPvodFinished = true
then assign vcMessageText = trim(substitute(#T-42'The matching-line for logistic-charge &1 is marked as Finished allthough the Finish-flag was turned off for the corresponding logistic-charge header on the pop-form':255(70972)T-42#,t_sAPMatchingLn.APMatchingLnPvodLgCharge)).
else assign vcMessageText = trim(substitute(#T-43'The matching-line for logistic-charge &1 is not marked as Finished allthough the Finish-flag was turned on for the corresponding logistic-charge header on the pop-form':255(70973)T-43#,t_sAPMatchingLn.APMatchingLnPvodLgCharge)).
assign viLocalReturnStatus = -3
vcMessageText = vcMessageText + chr(10) +
trim(substitute(#T-44'Order: &1':255(70970)T-44#,t_sAPMatchingLn.APMatchingLnPvodOrder)) + chr(10) +
trim(substitute(#T-45'Internal Reference: &1':255(70971)T-45#,t_sAPMatchingLn.APMatchingLnPvodIntRef)).
<M-46 run SetMessage
(input vcMessageText (icMessage),
input '':U (icArguments),
input 'tAPMatchingLn.APMatchingLnIsPvodFinished':U (icFieldName),
input string(t_sAPMatchingLn.APMatchingLnIsPvodFinished) (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sAPMatchingLn.tc_Rowid (icRowid),
input 'QadFin-8532':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
Leave LOGCHARGEVALIDATIONBLOCK.
end. /* if t_sAPMatchingLn.APMatchingLnIsPvodFinished <> vlLogChargeHeaderIsFinished */
/* ====================================================================== */
/* If it is the last APMatchingLn record of a certain PVO: */
/* The sum of the matched-amount of all APMatchingLn-records of a certain */
/* PVO should equal the corresponding value entered on the pop-up form */
/* ====================================================================== */
if last-of(t_sAPMatchingLn.PvoID) and
vdSumMatchedAmountTC <> vdLogChargeHeaderMatchedAmtTC
then do :
assign viLocalReturnStatus = -3
vcMessageText = trim(substitute(#T-48'The sum of the TC-Matched-Amounts (&2) of all matching-lines for logistic-charge &1 differs from the TC-Matched-Amount (&3) that was entered on the corresponding logistic-charge header on the pop-form':255(70974)T-48#,t_sAPMatchingLn.APMatchingLnPvodLgCharge,vdSumMatchedAmountTC,vdLogChargeHeaderMatchedAmtTC)) + chr(10) +
trim(substitute(#T-52'Order: &1':255(70970)T-52#,t_sAPMatchingLn.APMatchingLnPvodOrder)) + chr(10) +
trim(substitute(#T-53'Internal Reference: &1':255(70971)T-53#,t_sAPMatchingLn.APMatchingLnPvodIntRef)).
<M-47 run SetMessage
(input vcMessageText (icMessage),
input '':U (icArguments),
input 'tAPMatchingLn.APMatchingLnMatchAmtTC':U (icFieldName),
input string(t_sAPMatchingLn.APMatchingLnMatchAmtTC) (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sAPMatchingLn.tc_Rowid (icRowid),
input 'QadFin-8533':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
Leave LOGCHARGEVALIDATIONBLOCK.
end. /* if last-of(t_sAPMatchingLn.APMatchingLnPvodIntRef) and */
end. /* for each t_sAPMatchingLn where */
END. /* LOGCHARGEVALIDATIONBLOCK */
/* ================== */
/* Exception Hanlding */
/* ================== */
assign oiReturnStatus = viLocalReturnStatus.