project QadFinancials > class BERSProcessor > method ERSProcessCInvoicePO

Description

Create PO lines of supplier invoice


Parameters


icERSProcessorRefRowIdinputcharacter
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BERSProcessor.ERSProcessLegalDocuments
method BERSProcessor.ERSProcessPORec


program code (program5/bersprocessor.p)

/* =================================================================================================== */
/* Method      : ERSProcessCInvoicePO                                                                  */
/* Desc        : Create record for creation of CInvoicePO records                                      */
/* --------------------------------------------------------------------------------------------------- */
/* Params:  (I)  ERSProcessorRefRowId Row id of record in temporary table with list of receipts        */
/* =================================================================================================== */

assign oiReturnStatus = -98.

find bERSProcessorRef where
     bERSProcessorRef.tcFcRowid = icERSProcessorRefRowId
     no-error.

/* =================================================================================================== */
/* Validate input parameters                                                                           */
/* =================================================================================================== */
if icERSProcessorRefRowId = ?    or
   icERSProcessorRefRowId = '':U or
   not available bERSProcessorRef
then do:
    assign vcMessage = #T-5'The specified input parameters are invalid.':255(70371)t-5#
           vcContext = 'icERSProcessorRefRowId=&1|available bERSProcessorRef=&2':U
           vcContext = replace(vcContext, '|':U, chr(2))
           vcContext = substitute(vcContext, icERSProcessorRefRowId, available bERSProcessorRef).
    <M-1 run SetMessage
       (input  vcMessage (icMessage), 
        input  '':U (icArguments), 
        input  '':U (icFieldName), 
        input  '':U (icFieldValue), 
        input  'S':U (icType), 
        input  3 (iiSeverity), 
        input  '':U (icRowid), 
        input  'QadFin-8530':U (icFcMsgNumber), 
        input  '':U (icFcExplanation), 
        input  '':U (icFcIdentification), 
        input  vcContext (icFcContext), 
        output viFcReturnSuper (oiReturnStatus)) in BERSProcessor>
    assign oiReturnStatus = -1.
    return.
end.

/* =================================================================================================== */
/* Create record for Receiver matching creation                                                        */
/* =================================================================================================== */
if not can-find(first tCInvoicePORefERS where
                      tCInvoicePORefERS.tc_ParentRowid     = tCInvoiceRefERS.tc_RowId       and       
                      tCInvoicePORefERS.CInvoicePOPoDomain = bERSProcessorRef.tcDomainCode  and
                      tCInvoicePORefERS.CInvoicePOPoNbr    = bERSProcessorRef.tcPurchaseOrderNbr)
then do:
    create tCInvoicePORefERS.
    assign tCInvoicePORefERS.tc_ParentRowid     = tCInvoiceRefERS.tc_RowId
           tCInvoicePORefERS.CInvoicePOPoDomain = bERSProcessorRef.tcDomainCode
           tCInvoicePORefERS.CInvoicePOPoNbr    = bERSProcessorRef.tcPurchaseOrderNbr.
    if vcGroupBy = {&ERSPROCESSORINVGROUP-LEGALDOC}
    then do:
        assign
           tCInvoicePORefERS.tc_Rowid           = bERSProcessorRef.tcLegalDocNbr                + 
                                                  bERSProcessorRef.tcSupplier                   +
                                                  string(bERSProcessorRef.ttEffectiveIssueDate) + 
                                                  bERSProcessorRef.tcPurchaseOrderNbr           + 
                                                  bERSProcessorRef.tcReceiverNbr.
    end. /* if vcGroupBy = {&ERSPROCESSORINVGROUP-LEGALDOC} */
end.     /* if not can-find(first tCInvoicePORefERS.....    */

/* =================================================================================================== */
/* Return                                                                                              */
/* =================================================================================================== */
if oiReturnStatus = -98 then assign oiReturnStatus = 0.