project QadFinancials > class BAPMatching > method ValidateComponentPreAPMCost

validation procedure

Description

ValidateComponentPreAPMCost: submethod of ValidateComponentPre that handles the data in table tAPMatchingCost


Parameters


oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BAPMatching.ValidateComponentPre


program code (program4/bapmatching.p)

    
    /* ====================================================================== */
    /* Method: ValidateComponentPreAPMCost: submethod of ValidateComponentPre */
    /* that handles the data in table tAPMatchingCost and tAPMatchingCostSaf  */             
    /* ====================================================================== */
    
     
    /* ========================= */
    /* Set default return-status */
    /* ========================= */
    assign oiReturnStatus = -98.
    
    /* ============================= */
    /* Check for record-availability */
    /* ============================= */
    if not available t_sAPMatching
    then do :
        assign oiReturnStatus      = -1
               vcMsgAPMatching     = trim(substitute(#T-63'Internal error: no AP matching record is available.':255(56009)T-63#)).
        <M-29 run SetMessage
           (input  vcMsgAPMatching (icMessage), 
            input  '':U (icArguments), 
            input  '':U (icFieldName), 
            input  '':U (icFieldValue), 
            input  'S':U (icType), 
            input  3 (iiSeverity), 
            input  '':U (icRowid), 
            input  'qadfin-208125':U (icFcMsgNumber), 
            input  '':U (icFcExplanation), 
            input  '':U (icFcIdentification), 
            input  '':U (icFcContext), 
            output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
        Return.
    end. /* if not available t_sAPMatching */
    
    /* ================================================================================================================================== */
    /* Go through all new or changed APMatchingCost records of the matching and ensure the amount fields do not contain unknown values.   */
    /* This mainly happens when the data is received from an XML-based (eg XML-daemon, QXtend) and some tage were not provided in the XML */
    /* ================================================================================================================================== */
    for each t_sAPMatchingCost where 
             t_sAPMatchingCost.tc_ParentRowid = t_sAPMatching.tc_Rowid and
             (t_sAPMatchingCost.tc_Status      = "N":U or 
              t_sAPMatchingCost.tc_Status      = "C":U) :
        if t_sAPMatchingCost.tdDebitTC  = ? then assign t_sAPMatchingCost.tdDebitTC  = 0.
        if t_sAPMatchingCost.tdDebitLC  = ? then assign t_sAPMatchingCost.tdDebitLC  = 0.
        if t_sAPMatchingCost.tdDebitCC  = ? then assign t_sAPMatchingCost.tdDebitCC  = 0.
        if t_sAPMatchingCost.tdCreditTC = ? then assign t_sAPMatchingCost.tdCreditTC = 0.
        if t_sAPMatchingCost.tdCreditLC = ? then assign t_sAPMatchingCost.tdCreditLC = 0.
        if t_sAPMatchingCost.tdCreditCC = ? then assign t_sAPMatchingCost.tdCreditCC = 0.
        if t_sAPMatchingCost.tdBaseDebitTC  = ? then assign t_sAPMatchingCost.tdBaseDebitTC  = 0.
        if t_sAPMatchingCost.tdBaseDebitLC  = ? then assign t_sAPMatchingCost.tdBaseDebitLC  = 0.
        if t_sAPMatchingCost.tdBaseDebitCC  = ? then assign t_sAPMatchingCost.tdBaseDebitCC  = 0.
        if t_sAPMatchingCost.tdBaseCreditTC = ? then assign t_sAPMatchingCost.tdBaseCreditTC = 0.
        if t_sAPMatchingCost.tdBaseCreditLC = ? then assign t_sAPMatchingCost.tdBaseCreditLC = 0.
        if t_sAPMatchingCost.tdBaseCreditCC = ? then assign t_sAPMatchingCost.tdBaseCreditCC = 0.
        if t_sAPMatchingCost.tdVatDebitTC  = ? then assign t_sAPMatchingCost.tdVatDebitTC  = 0.
        if t_sAPMatchingCost.tdVatDebitLC  = ? then assign t_sAPMatchingCost.tdVatDebitLC  = 0.
        if t_sAPMatchingCost.tdVatDebitCC  = ? then assign t_sAPMatchingCost.tdVatDebitCC  = 0.
        if t_sAPMatchingCost.tdVatCreditTC = ? then assign t_sAPMatchingCost.tdVatCreditTC = 0.
        if t_sAPMatchingCost.tdVatCreditLC = ? then assign t_sAPMatchingCost.tdVatCreditLC = 0.
        if t_sAPMatchingCost.tdVatCreditCC = ? then assign t_sAPMatchingCost.tdVatCreditCC = 0.        
    end. /* for each t_sAPMatchingCost where */
    
    /* ====================== */
    /* Set Return status = OK */
    /* ====================== */
    if oiReturnStatus = -98
    then assign oiReturnStatus = 0.