Description
ValidateComponentPreValidate: submethod of ValidateComponent
Parameters
| oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program4/bapmatching.p)
/* ==================================================================================== */
/* Method that will do some auto-assignments for a bunch of redundant fields */
/* ==================================================================================== */
/* ========================= */
/* Set default return-status */
/* ========================= */
assign oiReturnStatus = -98.
/* ============================================================================================= */
/* Start a block: all error/warning-situations in the block are catched by viBlockReturnStatus */
/* Thi is done to be able to start/stop the queries correctly and to have a default return-stat */
/* Queries are started conditionaly during this method and conditionaly stopped at the end */
/* ============================================================================================= */
assign vlBCostingOpenedForCostMethod = false.
AUTOASSIGNBLOCK: DO:
/* ==================================================================================== */
/* Go through all not deleted t_sAPMatching-records */
/* We also include the unchanged as they may have changed or new lines */
/* ==================================================================================== */
for each t_sAPMatching where
t_sAPMatching.tc_Status <> "D":U :
/* ================================================================================================================ *
* Taxes Absorbed/Retained *
* Becuase of different way Operational and Financial stores indication about Absorbed/Retained some small *
* manipulation sometimes needs to be done *
* ================================================================================================================ */
<M-98 run ValidateComponentPreTaxAbsRet (output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
if viFcReturnSuper <> 0 then assign viBlockReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0 then Leave AUTOASSIGNBLOCK.
/* ================================================================================== */
/* Call submethod that will handle the data in tAPMatchingCost and tAPMatchingCostSaf */
/* This needs to be done before ValidateComponentPreAPM is called as that method uses */
/* the data we update here in the records of tAPMatchingCost and tAPMatchingCostSaf */
/* ================================================================================== */
<M-92 run ValidateComponentPreAPMCost (output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
if viFcReturnSuper <> 0 then assign viBlockReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0 then Leave AUTOASSIGNBLOCK.
/* ================================================================================================================ */
/* Fill in the Read-only RKBF of CInvoice_ID in case they are all unknown and the updatbale RKBF are filled */
/* This is done here as from this point onwards we expect these fields to be filled but we can hardly expect all */
/* callers (like external parties) to provide us all detail information on an invoice. They should thus simply */
/* provide unknown values for these detail-fields and provide correct information for the key-fields of the invoice */
/* ================================================================================================================ */
if t_sAPMatching.tc_Status = "C":U or
t_sAPMatching.tc_Status = "N":U
then do :
<M-29 run ValidateComponentPreAPM (output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
if viFcReturnSuper <> 0
then assign viBlockReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then Leave AUTOASSIGNBLOCK.
end. /* if t_sAPMatching.tc_Status = "C":U or */
/* ============================================================ */
/* Go through all non-deleted APMatchingLines of the APMatching */
/* ============================================================ */
for each t_sAPMatchingLn where
t_sAPMatchingLn.tc_ParentRowid = t_sAPMatching.tc_Rowid and
t_sAPMatchingLn.tc_Status <> "D":U :
/* ================================================================================================================ */
/* Fill in the Read-only RKBF of PVOD in case they are all unknown and the PVOD-ID fields are filled */
/* This is done here as from this point onwards we expect these fields to be filled but we can hardly expect all */
/* callers (like external parties) to provide us all detail information on a PVOD. They should thus simply */
/* provide unknown values for these detail-fields and provide correct information for the key-fields of the PVOD */
/* There are 2 calls as a single submethod could not hold all program-code required */
/* ================================================================================================================ */
if t_sAPMatchingLn.tc_Status = "C":U or
t_sAPMatchingLn.tc_Status = "N":U
then do :
<M-30 run ValidateComponentPreAPMLn1
(input-output vlBCostingOpenedForCostMethod (blBCostingOpenedForCostMethod),
output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
if viFcReturnSuper <> 0
then assign viBlockReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then Leave AUTOASSIGNBLOCK.
<M-35 run ValidateComponentPreAPMLn2 (output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
if viFcReturnSuper <> 0
then assign viBlockReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then Leave AUTOASSIGNBLOCK.
end. /* if t_sAPMatchingLn.tc_Status = "C":U or */
/* ========================================================== */
/* Complete definition of APMatchingLnTax: fill APMatching_ID */
/* Assign the Sum-Tax fields on the Line-level */
/* ========================================================== */
<M-40 run ValidateComponentPreAPMLnTax
(output t_sAPMatchingLn.tdAPMatchingLnARRecTaxTC (odSumARRecTaxTC),
output t_sAPMatchingLn.tdAPMatchingLnARNRecTaxTC (odSumARNRecTaxTC),
output t_sAPMatchingLn.tdAPMatchingLnAIRecTaxTC (odSumAIRecTaxTC),
output t_sAPMatchingLn.tdAPMatchingLnAINRecTaxTC (odSumAINRecTaxTC),
output t_sAPMatchingLn.tdAPMatchingLnOrigARRetainTaxTC (odSumOrigARRetainTaxTC),
output t_sAPMatchingLn.tdAPMatchingLnOrigARRecTaxTC (odSumOrigARRecTaxTC),
output t_sAPMatchingLn.tdAPMatchingLnOrigARNRecTaxTC (odSumOrigARNRecTaxTC),
output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
if viFcReturnSuper <> 0 then assign viBlockReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0 then Leave AUTOASSIGNBLOCK.
end. /* for each t_sAPMatchingLn where */
end. /* for each t_sAPMatching where */
END. /* AUTOASSIGNBLOCK */
/* ===================================================== */
/* Stop classes that were started in this method */
/* ===================================================== */
if vlBCostingOpenedForCostMethod = true
then do:
<I-34 {bFcCloseInstance
&CLASS = "BMfgCosting"}>
assign vlBCostingOpenedForCostMethod = false.
end. /* if vlBCostingOpenedForCostMethod = true */
/* ============================================= */
/* Check for errors in the block */
/* ============================================= */
if viBlockReturnStatus <> 0
then assign oiReturnStatus = viBlockReturnStatus.
if viBlockReturnStatus < 0
then Return.
/* ============================================= */
/* Set Return status = OK */
/* ============================================= */
if oiReturnStatus = -98
then assign oiReturnStatus = 0.