project QadFinancials > class BAPMatching > method AddAPMatchingCost

Description

This method will receive the extra cost posting lines that need to be added in the additional updates.


Parameters


tAPMatchingCostFromBCIAPMinputtemp-tablePass the additional posting lines for the matching. The Parent-rowid in here is the rowid of the parent tAPMatching table.
tAPMatchingCostSafFromBCIAPMinputtemp-tableTemp-table to pass the safs for the extra postinglines for the ap matching integration.
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BCInvoiceAPMatching.CreateAPMatchingRun


program code (program8/bapmatching.p)

/* ============================================ */
/* Copy the input temp-table to tAPMatchingCost */
/* ============================================ */
for each tAPMatchingCostFromBCIAPM on error undo, throw:
    /* Validate if GL was of Type STANDARD */
    if tAPMatchingCostFromBCIAPM.tcGLCode <> '' and
       tAPMatchingCostFromBCIAPM.tcGLCode <> ?
    then do:
        <Q-91 run GLByCode (all) (Read) (Cache)
           (input viCompanyId, (CompanyId)
            input tAPMatchingCostFromBCIAPM.tcGLCode, (GLCode)
            output dataset tqGLByCode) in BGL>
        find first tqGLByCode where
                   tqGLByCode.tcGLCode = tAPMatchingCostFromBCIAPM.tcGLCode
                   no-lock no-error.
        if available tqGLByCode and
           tqGLByCode.tcGLTypeCode <> {&GLTYPECODE-STAN} and
           tqGLByCode.tcGLTypeCode <> {&GLTYPECODE-OPEN} and
           tqGLByCode.tcGLTypeCode <> {&GLTYPECODE-VAT}
        then do:
            assign vcMessage      = substitute(#T-25'Additional posting lines passed in the integration can only use following account types: &1, &2, &3':255(528549583)T-25#, 
                                    trim({&GLTYPECODE-STAN-TR}), trim({&GLTYPECODE-OPEN-TR}), trim({&GLTYPECODE-VAT-TR}))
                   oiReturnStatus = -1.
            <M-58 run SetMessage
               (input  vcMessage (icMessage), 
                input  '' (icArguments), 
                input  'tAPMatchingCostFromBCIAPM.tcGLCode' (icFieldName), 
                input  tAPMatchingCostFromBCIAPM.tcGLCode (icFieldValue), 
                input  'E' (icType), 
                input  3 (iiSeverity), 
                input  tAPMatchingCostFromBCIAPM.tc_Rowid (icRowid), 
                input  'qadfin-40649':U (icFcMsgNumber), 
                input  '' (icFcExplanation), 
                input  '' (icFcIdentification), 
                input  '' (icFcContext), 
                output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
            return.                               
        end. /* if available tqGLByCode and */
        
        /* If vat-account, then copy vat-amounts to normal debit/credit amounts. */
        if available tqGLByCode and
           tqGLByCode.tcGLTypeCode = {&GLTYPECODE-VAT}
        then assign tAPMatchingCostFromBCIAPM.tdDebitTC  = tAPMatchingCostFromBCIAPM.tdVatDebitTC
                    tAPMatchingCostFromBCIAPM.tdDebitLC  = tAPMatchingCostFromBCIAPM.tdVatDebitLC
                    tAPMatchingCostFromBCIAPM.tdDebitCC  = tAPMatchingCostFromBCIAPM.tdVatDebitCC
                    tAPMatchingCostFromBCIAPM.tdCreditTC = tAPMatchingCostFromBCIAPM.tdVatCreditTC
                    tAPMatchingCostFromBCIAPM.tdCreditLC = tAPMatchingCostFromBCIAPM.tdVatCreditLC
                    tAPMatchingCostFromBCIAPM.tdCreditCC = tAPMatchingCostFromBCIAPM.tdVatCreditCC.
    end. /* if tAPMatchingCostFromBCIAPM.tcGLCode <> '' and */
    
    create tAPMatchingCost.
    buffer-copy tAPMatchingCostFromBCIAPM to tAPMatchingCost
    assign tAPMatchingCost.tc_Status = 'N'.
    
    for each tAPMatchingCostSafFromBCIAPM where
             tAPMatchingCostSafFromBCIAPM.tc_ParentRowid = tAPMatchingCostFromBCIAPM.tc_Rowid
             on error undo, throw:
        create tAPMatchingCostSaf.
        buffer-copy tAPMatchingCostSafFromBCIAPM to tAPMatchingCostSaf.        
    end. /* for each tAPMatchingCostSafFromBCIAPM where */
end. /* for each tAPMatchingCostFromBCIAPM: */