project QadFinancials > class BCInvoiceAPMatching > method CreateCInvoiceAPMatching

Description

Create Supplier Invoice and APMatchng based on incomming data stored in imput temporary tables.


Parameters


tCInvoiceRefinput-outputtemp-table
tCInvoicePORefinputtemp-table
tAPMatchingLnRefinput-outputtemp-table
tAPMatchingCostRefinput-outputtemp-tableTemp-table to pass additional posting lines.
tAPMatchingCostSafRefinput-outputtemp-tablePass the safs for the Additional posting lines in tAPMatchingCostRef.
ilIsAllInvoicesInOneTransinputlogicalShould be all invoices created in one database transaction?
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BCInvoiceAPMatching.ApiEDICInvoiceAPMatchingImport
method BERSProcessor.ERSProcess


program code (program6/bcinvoiceapmatching.p)

/* =================================================================================================== */
/* Method      : CreateCInvoiceAPMatching                                                              */
/* Desc        : This method create Supplier Invoice and Receiver Matching (optional) based on data    */
/*               stored in incomming termporary table                                                  */
/* --------------------------------------------------------------------------------------------------- */
/* Params:  (I)  tCInvoiceRef         Supplier Invoice definition                                      */
/*          (I)  tCInvoicePORef       List of purchase orders linked to supplier invoice               */
/*          (I)  tAPMatchingLnRef     Matching line details                                            */
/*          (I)  ilIsAllInvoicesInOneTrans  Create all invoices in one database transaction            */
/* =================================================================================================== */

assign oiReturnStatus = -98
       viLocalReturn  = 0.

/* =================================================================================================== */
/* Start processing of the invoices/ap matchings based in incomming data                               */
/* =================================================================================================== */
MAIN_BLOCK:
do on error undo, return:
    /* =================================================================================== */
    /* Create invoices in one transaction - this is needed for ERS processing for instance */
    /* =================================================================================== */
    if ilIsAllInvoicesInOneTrans
    then do:
        <M-58 run CreateCInvoiceAPMatchingAllInOneTran
           (input-output tCInvoiceRef (tCInvoiceRef), 
            input  tCInvoicePORef (tCInvoicePORef), 
            input-output tAPMatchingLnRef (tAPMatchingLnRef), 
            output viFcReturnSuper (oiReturnStatus)) in BCInvoiceAPMatching>
        if viFcReturnSuper < 0 or viFcReturnSuper > 0 and viLocalReturn = 0 then assign viLocalReturn = viFcReturnSuper.
        if viFcReturnSuper < 0 then leave MAIN_BLOCK.
    end.
    /* ============================================================================== */
    /* Create invoices one by one - this is suitable for large volume data processing */
    /* ============================================================================== */
    else do:
        <M-35 run CreateCInvoiceAPMatchingOneInOneTran
           (input-output tCInvoiceRef (tCInvoiceRef), 
            input  tCInvoicePORef (tCInvoicePORef), 
            input-output tAPMatchingLnRef (tAPMatchingLnRef), 
            output viFcReturnSuper (oiReturnStatus)) in BCInvoiceAPMatching>
        if viFcReturnSuper < 0 or viFcReturnSuper > 0 and viLocalReturn = 0 then assign viLocalReturn = viFcReturnSuper.
        if viFcReturnSuper < 0 then leave MAIN_BLOCK.
    end.
end. /* MAIN_BLOCK */

/* =================================================================================================== */
/* Return                                                                                              */
/* =================================================================================================== */
assign oiReturnStatus = viLocalReturn.