project QadFinancials > class BAPMatching > method AdditionalUpdatesAllTaxGetLogChargePPV

Description

AdditionalUpdatesAllTaxGetLogChargePPV: submethod of AdditionalUpdatesAllTaxNew that assigns the PPV-account (and division and CC) in the calc-fields of APMatchingLn


Parameters


oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BAPMatching.AdditionalUpdatesAllTaxGetPPV
method BAPMatching.AdditionalUpdatesAllTaxGetInvAcc


program code (program6/bapmatching.p)

/* ====================================================================================== */
/* AdditionalUpdatesAllTaxGetLogChargePPV: submethod of AdditionalUpdatesAllTaxNew that   */
/* assigns the PPV-account (and division and CC) in the calc-fields of APMatchingLn       */
/* ====================================================================================== */

/* ================================================================================================================================================ */
/* Case 1: Get info from AccDeftMstr (acdf_acct): Domain + Module(LA) + Type (LA_IN_PO_VAR_ACCT) + Log Charges + ProductLine + Site + SupplierType  */
/* Case 2: Get info from AccDeftMstr (acdf_acct): Domain + Module(LA) + Type (LA_IN_PO_VAR_ACCT) + Log Charges + ProductLine + Site                 */
/* Case 3: Get info from AccDeftMstr (acdf_acct): Domain + Module(LA) + Type (LA_IN_PO_VAR_ACCT) + Log Charges + ProductLine                        */
/* Case 4: Get info from AccDeftMstr (acdf_acct): Domain + Module(LA) + Type (LA_IN_PO_VAR_ACCT) + Log Charges                                      */
/* Case 5: Get info from AccDeftMstr (acdf_acct): Domain + Module(LA) + Type (LA_IN_PO_VAR_ACCT) + Log Charges + Special Product Line               */
/* Case 6: Get info from AccDeftMstr (acdf_acct): Domain + Module(LA) + Type (LA_IN_PO_VAR_ACCT)                                                    */
/* ================================================================================================================================================ */

/* ================== */
/* Exception handling */
/* Start Block        */
/* ================== */
assign oiReturnStatus      = -98
       viLocalReturnStatus = 0.
PPVHANDLINGBLOCK : 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-16'Internal error: information that should have been available is not available.':254(999890202)T-16#)) + chr(10) + 
                                      trim(substitute(#T-17'Available matching header: &1.':234(49819)T-17#,available (tAPMatching)))  + chr(10) + 
                                      trim(substitute(#T-14'Available matching details: &1.':234(49820)T-14#,available (tAPMatchingLn))) + chr(10) + 
                                      trim(substitute(#T-20'Available accounting query: &1.':255(68803)T-20#,available (tqPendingVoucherForMatchingAcc))).
        <M-12 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-7833':U (icFcMsgNumber), 
                     input  '':U (icFcExplanation), 
                     input  '':U (icFcIdentification), 
                     input  '':U (icFcContext), 
                     output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
        Leave PPVHANDLINGBLOCK.
    end. /* if not avail */

    /* Case 1: Get info from AccDeftMstr (acdf_acct): Domain + Module(LA) + Type (LA_IN_PO_VAR_ACCT) + Log Charges + ProductLine + Site + SupplierType */
    <Q-18 run AccountDefaultMasterByPrimKey (all) (Read) (Cache)
       (input tqPendingVoucherForMatchingAcc.tcpvo_domain, (DomainCode)
        input 'LA':U, (Module)
        input 'LA_IN_PO_VAR_ACCT':U, (Type)
        input tAPMatchingLn.APMatchingLnPvodLgCharge, (Key1)
        input tqPendingVoucherForMatchingAcc.tcpt_prod_line, (Key2)
        input tqPendingVoucherForMatchingAcc.tcprh_site, (Key3)
        input tqPendingVoucherForMatchingAcc.tcvd_type, (Key4)
        input '':U, (Key5)
        input '':U, (Key6)
        output dataset tqAccountDefaultMasterByPrimKey) in BMfgAccountDefaultMaster>
    find first tqAccountDefaultMasterByPrimKey where 
               tqAccountDefaultMasterByPrimKey.tcacdf_domain = tqPendingVoucherForMatchingAcc.tcpvo_domain   and
               tqAccountDefaultMasterByPrimKey.tcacdf_module = "LA":U                                        and
               tqAccountDefaultMasterByPrimKey.tcacdf_type   = "LA_IN_PO_VAR_ACCT":U                         and
               tqAccountDefaultMasterByPrimKey.tcacdf_key1   = tAPMatchingLn.APMatchingLnPvodLgCharge        and 
               tqAccountDefaultMasterByPrimKey.tcacdf_key2   = tqPendingVoucherForMatchingAcc.tcpt_prod_line and 
               tqAccountDefaultMasterByPrimKey.tcacdf_key3   = tqPendingVoucherForMatchingAcc.tcprh_site     and 
               tqAccountDefaultMasterByPrimKey.tcacdf_key4   = tqPendingVoucherForMatchingAcc.tcvd_type      and 
               tqAccountDefaultMasterByPrimKey.tcacdf_key5   = "":U                                          and
               tqAccountDefaultMasterByPrimKey.tcacdf_key6   = "":U
               no-lock no-error.
    if not available tqAccountDefaultMasterByPrimKey or
       tqAccountDefaultMasterByPrimKey.tcacdf_acct = "":U
    then do:
        /* Case 2: Get info from AccDeftMstr (acdf_acct): Domain + Module(LA) + Type (LA_IN_PO_VAR_ACCT) + Log Charges + ProductLine + Site  */
        <Q-88 run AccountDefaultMasterByPrimKey (all) (Read) (Cache)
           (input tqPendingVoucherForMatchingAcc.tcpvo_domain, (DomainCode)
            input 'LA':U, (Module)
            input 'LA_IN_PO_VAR_ACCT':U, (Type)
            input tAPMatchingLn.APMatchingLnPvodLgCharge, (Key1)
            input tqPendingVoucherForMatchingAcc.tcpt_prod_line, (Key2)
            input tqPendingVoucherForMatchingAcc.tcprh_site, (Key3)
            input '':U, (Key4)
            input '':U, (Key5)
            input '':U, (Key6)
            output dataset tqAccountDefaultMasterByPrimKey) in BMfgAccountDefaultMaster>
        find first tqAccountDefaultMasterByPrimKey where 
                   tqAccountDefaultMasterByPrimKey.tcacdf_domain = tqPendingVoucherForMatchingAcc.tcpvo_domain   and
                   tqAccountDefaultMasterByPrimKey.tcacdf_module = "LA":U                                        and
                   tqAccountDefaultMasterByPrimKey.tcacdf_type   = "LA_IN_PO_VAR_ACCT":U                         and
                   tqAccountDefaultMasterByPrimKey.tcacdf_key1   = tAPMatchingLn.APMatchingLnPvodLgCharge        and 
                   tqAccountDefaultMasterByPrimKey.tcacdf_key2   = tqPendingVoucherForMatchingAcc.tcpt_prod_line and 
                   tqAccountDefaultMasterByPrimKey.tcacdf_key3   = tqPendingVoucherForMatchingAcc.tcprh_site     and 
                   tqAccountDefaultMasterByPrimKey.tcacdf_key4   = "":U                                          and 
                   tqAccountDefaultMasterByPrimKey.tcacdf_key5   = "":U                                          and
                   tqAccountDefaultMasterByPrimKey.tcacdf_key6   = "":U
                   no-lock no-error.
    end.

    if not available tqAccountDefaultMasterByPrimKey or
       tqAccountDefaultMasterByPrimKey.tcacdf_acct = "":U
    then do:
        /* Case 3: Get info from AccDeftMstr (acdf_acct): Domain + Module(LA) + Type (LA_IN_PO_VAR_ACCT) + Log Charges + ProductLine */
        <Q-5 run AccountDefaultMasterByPrimKey (all) (Read) (Cache)
           (input tqPendingVoucherForMatchingAcc.tcpvo_domain, (DomainCode)
            input 'LA':U, (Module)
            input 'LA_IN_PO_VAR_ACCT':U, (Type)
            input tAPMatchingLn.APMatchingLnPvodLgCharge, (Key1)
            input tqPendingVoucherForMatchingAcc.tcpt_prod_line, (Key2)
            input '':U, (Key3)
            input '':U, (Key4)
            input '':U, (Key5)
            input '':U, (Key6)
            output dataset tqAccountDefaultMasterByPrimKey) in BMfgAccountDefaultMaster>
        find first tqAccountDefaultMasterByPrimKey where 
                   tqAccountDefaultMasterByPrimKey.tcacdf_domain = tqPendingVoucherForMatchingAcc.tcpvo_domain   and
                   tqAccountDefaultMasterByPrimKey.tcacdf_module = "LA":U                                        and
                   tqAccountDefaultMasterByPrimKey.tcacdf_type   = "LA_IN_PO_VAR_ACCT":U                         and
                   tqAccountDefaultMasterByPrimKey.tcacdf_key1   = tAPMatchingLn.APMatchingLnPvodLgCharge        and 
                   tqAccountDefaultMasterByPrimKey.tcacdf_key2   = tqPendingVoucherForMatchingAcc.tcpt_prod_line and 
                   tqAccountDefaultMasterByPrimKey.tcacdf_key3   = "":U                                          and
                   tqAccountDefaultMasterByPrimKey.tcacdf_key4   = "":U                                          and
                   tqAccountDefaultMasterByPrimKey.tcacdf_key5   = "":U                                          and
                   tqAccountDefaultMasterByPrimKey.tcacdf_key6   = "":U
                   no-lock no-error.
    end.
               
    if not available tqAccountDefaultMasterByPrimKey or
       tqAccountDefaultMasterByPrimKey.tcacdf_acct = "":U
    then do:
        /* Case 4: Get info from AccDeftMstr (acdf_acct): Domain + Module(LA) + Type (LA_IN_PO_VAR_ACCT) + Log Charges */
        <Q-39 run AccountDefaultMasterByPrimKey (all) (Read) (Cache)
           (input tqPendingVoucherForMatchingAcc.tcpvo_domain, (DomainCode)
            input 'LA':U, (Module)
            input 'LA_IN_PO_VAR_ACCT':U, (Type)
            input tAPMatchingLn.APMatchingLnPvodLgCharge, (Key1)
            input '':U, (Key2)
            input '':U, (Key3)
            input '':U, (Key4)
            input '':U, (Key5)
            input '':U, (Key6)
            output dataset tqAccountDefaultMasterByPrimKey) in BMfgAccountDefaultMaster>
        find first tqAccountDefaultMasterByPrimKey where 
                   tqAccountDefaultMasterByPrimKey.tcacdf_domain = tqPendingVoucherForMatchingAcc.tcpvo_domain   and
                   tqAccountDefaultMasterByPrimKey.tcacdf_module = "LA":U                                        and
                   tqAccountDefaultMasterByPrimKey.tcacdf_type   = "LA_IN_PO_VAR_ACCT":U                         and
                   tqAccountDefaultMasterByPrimKey.tcacdf_key1   = tAPMatchingLn.APMatchingLnPvodLgCharge        and 
                   tqAccountDefaultMasterByPrimKey.tcacdf_key2   = "":U                                          and
                   tqAccountDefaultMasterByPrimKey.tcacdf_key3   = "":U                                          and
                   tqAccountDefaultMasterByPrimKey.tcacdf_key4   = "":U                                          and
                   tqAccountDefaultMasterByPrimKey.tcacdf_key5   = "":U                                          and
                   tqAccountDefaultMasterByPrimKey.tcacdf_key6   = "":U
                   no-lock no-error.
    end.

    if not available tqAccountDefaultMasterByPrimKey or
       tqAccountDefaultMasterByPrimKey.tcacdf_acct = "":U
    then do:
        /* Case 5: Get info from AccDeftMstr (acdf_acct): Domain + Module(LA) + Type (LA_IN_PO_VAR_ACCT) + Log Charges + Special ProductLine */
        <Q-44 run AccountDefaultMasterByPrimKey (all) (Read) (Cache)
           (input tqPendingVoucherForMatchingAcc.tcpvo_domain, (DomainCode)
            input 'LA':U, (Module)
            input 'LA_IN_PO_VAR_ACCT':U, (Type)
            input tAPMatchingLn.APMatchingLnPvodLgCharge, (Key1)
            input '********':U, (Key2)
            input '':U, (Key3)
            input '':U, (Key4)
            input '':U, (Key5)
            input '':U, (Key6)
            output dataset tqAccountDefaultMasterByPrimKey) in BMfgAccountDefaultMaster>
        find first tqAccountDefaultMasterByPrimKey where 
                   tqAccountDefaultMasterByPrimKey.tcacdf_domain = tqPendingVoucherForMatchingAcc.tcpvo_domain   and
                   tqAccountDefaultMasterByPrimKey.tcacdf_module = "LA":U                                        and
                   tqAccountDefaultMasterByPrimKey.tcacdf_type   = "LA_IN_PO_VAR_ACCT":U                         and
                   tqAccountDefaultMasterByPrimKey.tcacdf_key1   = tAPMatchingLn.APMatchingLnPvodLgCharge        and 
                   tqAccountDefaultMasterByPrimKey.tcacdf_key2   = "********":U                                  and 
                   tqAccountDefaultMasterByPrimKey.tcacdf_key3   = "":U                                          and
                   tqAccountDefaultMasterByPrimKey.tcacdf_key4   = "":U                                          and
                   tqAccountDefaultMasterByPrimKey.tcacdf_key5   = "":U                                          and
                   tqAccountDefaultMasterByPrimKey.tcacdf_key6   = "":U
                   no-lock no-error.
    end.

    if not available tqAccountDefaultMasterByPrimKey or
       tqAccountDefaultMasterByPrimKey.tcacdf_acct = "":U
    then do:
        /* Case 6: Get info from AccDeftMstr (acdf_acct): Domain + Module(LA) + Type (LA_IN_PO_VAR_ACCT) */
        <Q-62 run AccountDefaultMasterByPrimKey (all) (Read) (Cache)
           (input tqPendingVoucherForMatchingAcc.tcpvo_domain, (DomainCode)
            input 'LA':U, (Module)
            input 'LA_IN_PO_VAR_ACCT':U, (Type)
            input '':U, (Key1)
            input '':U, (Key2)
            input '':U, (Key3)
            input '':U, (Key4)
            input '':U, (Key5)
            input '':U, (Key6)
            output dataset tqAccountDefaultMasterByPrimKey) in BMfgAccountDefaultMaster>
        find first tqAccountDefaultMasterByPrimKey where 
                   tqAccountDefaultMasterByPrimKey.tcacdf_domain = tqPendingVoucherForMatchingAcc.tcpvo_domain   and
                   tqAccountDefaultMasterByPrimKey.tcacdf_module = "LA":U                                        and
                   tqAccountDefaultMasterByPrimKey.tcacdf_type   = "LA_IN_PO_VAR_ACCT":U                         and
                   tqAccountDefaultMasterByPrimKey.tcacdf_key1   = "":U                                          and
                   tqAccountDefaultMasterByPrimKey.tcacdf_key2   = "":U                                          and
                   tqAccountDefaultMasterByPrimKey.tcacdf_key3   = "":U                                          and
                   tqAccountDefaultMasterByPrimKey.tcacdf_key4   = "":U                                          and
                   tqAccountDefaultMasterByPrimKey.tcacdf_key5   = "":U                                          and
                   tqAccountDefaultMasterByPrimKey.tcacdf_key6   = "":U
                   no-lock no-error.
    end.
   
    if not available tqAccountDefaultMasterByPrimKey or
       tqAccountDefaultMasterByPrimKey.tcacdf_acct = "":U
    then do:
        assign vcMsgAPMatching      = trim(substitute(#T-64'Unable to find PO Price Variance Account of Logistics Charges for domain &1':255(121774819)T-64#,tqPendingVoucherForMatchingAcc.tcpvo_domain)) + 
                                      trim(substitute(#T-13'Technical details: &1.':222(55526)T-13#,"PPV-Logistic/11":U))
               viLocalReturnStatus  = -1.
        <M-84 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-745114':U (icFcMsgNumber), 
            input  '':U (icFcExplanation), 
            input  '':U (icFcIdentification), 
            input  '':U (icFcContext), 
            output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
        Leave PPVHANDLINGBLOCK.
    end.

    assign tAPMatchingLn.tcAPMatchingLnPVVGLCode  = tqAccountDefaultMasterByPrimKey.tcacdf_acct
           tAPMatchingLn.tcAPMatchingLnPVVDivCode = tqAccountDefaultMasterByPrimKey.tcacdf_sub
           tAPMatchingLn.tcAPMatchingLnPVVCCCode  = tqAccountDefaultMasterByPrimKey.tcacdf_cc.

end. /* PPVHANDLINGBLOCK */

/* ================== */
/* Exception handling */
/* ================== */
assign oiReturnStatus = viLocalReturnStatus.