project QadFinancials > class BCInvoiceAPMatching > method CreateAPMatching

Description

Create receiver matching records


Parameters


oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BCInvoiceAPMatching.CreateCInvoiceAPMatchingAllInOneTran
method BCInvoiceAPMatching.CreateCInvoiceAPMatchingOneInOneTran


program code (program6/bcinvoiceapmatching.p)

/* =================================================================================================== */
/* Method      : CreateAPMatching                                                                      */
/* Desc        : Create receiver matching                                                              */
/*               Method has to be in the same segment as CreateCInvoiceAPMatching                      */
/* --------------------------------------------------------------------------------------------------- */
/* Params:       tCInvoiceRef         There has to be active record in this table                      */
/* =================================================================================================== */

assign oiReturnStatus = -98
       viLocalReturn  = 0.

APMATCHING_BLOCK:
do on error undo, return:

    /* =============================================================================================== */
    /* Create Receiver matching lines                                                                  */
    /* =============================================================================================== */
    empty temp-table tAPMatchingLnBCIAPM.
    empty temp-table tAPMatchingCostBCIAPM.
    empty temp-table tAPMatchingCostSafBCIAPM.
    
    for each tAPMatchingLnRef where
            tAPMatchingLnRef.tc_ParentRowid = tCInvoiceRef.tc_Rowid:
        create tAPMatchingLnBCIAPM.
        assign tAPMatchingLnBCIAPM.tiPvoID                      = tAPMatchingLnRef.tiPvoId
               tAPMatchingLnBCIAPM.tiPvodLineID                 = tAPMatchingLnRef.tiPvodLineId
               tAPMatchingLnBCIAPM.tdAPMAtchingLnMatchQty       = tAPMatchingLnRef.tdMatchQty
               tAPMatchingLnBCIAPM.tdAPMAtchingLnMatchUnitPrice = tAPMatchingLnRef.tdMatchUnitPrice
               tAPMatchingLnBCIAPM.tlAPMAtchingLnIsVarGLPosting = tAPMatchingLnRef.tlIsVarGLPosting
               tAPMatchingLnBCIAPM.tlIsPvodFinished             = tAPMatchingLnRef.tlIsPvodFinished
               tAPMatchingLnBCIAPM.tlIsLgCharge                 = tAPMatchingLnRef.tlIsLgCharge.
    end. /* for each tAPMatchingLnRef where */
    
    for each tAPMatchingCostRef where
             tAPMatchingCostRef.tc_ParentRowid = tCInvoiceRef.tc_Rowid:
        create tAPMatchingCostBCIAPM.
        buffer-copy tAPMatchingCostRef to tAPMatchingCostBCIAPM.     
        
        for each tAPMatchingCostSafRef where
                 tAPMatchingCostSafRef.tc_ParentRowid = tAPMatchingCostRef.tc_Rowid:
            create tAPMatchingCostSafBCIAPM.
            buffer-copy tAPMatchingCostSafRef to tAPMatchingCostSafBCIAPM.                      
        end. /* for each tAPMatchingCostSafRef where */
    end. /* for each tAPMatchingCostRef where */
    
end. /* APMATCHING_BLOCK: */

/* =================================================================================================== */
/* Error handling                                                                                      */
/* =================================================================================================== */
assign oiReturnStatus = viLocalReturn.