project QadFinancials > class BERSProcessor > method ValidateLogisticCharge

Description

This method validates the pending voucher receipts to determine if the pending voucher is ready to be matched to a supplier invoice.


Parameters


icDomaininputcharacterDomain code for the current working domain.
iiPvoIdinputintegerUnique ID for the pending voucher record.
iiPvodLineIdinputintegerUnique ID for the pending voucher line record.
idMatchAmountinputdecimalThe matching amount of the pending voucher.
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BERSProcessor.ERSProcessLegalDocuments


program code (program5/bersprocessor.p)

/* =================================================================================================== */
/* Method      : ValidateReceipt                                                                       */
/* Desc        : Validate receipt whether can be processed by ERS Processor                            */
/* --------------------------------------------------------------------------------------------------- */
/* Params:  (I)  Domain               Domain code receipt was done in                                  */
/*          (I)  PvoId                Pending voucher ID                                               */
/*          (I)  PvodLineId           Pending voucher line ID                                          */
/*          (I)  MatchQty             Matching quantity (in purchase order UoM)                        */
/* =================================================================================================== */

assign oiReturnStatus = -98
       viLocalReturn  = 0.

/* =================================================================================================== */
/* Normalize input parameters                                                                          */
/* =================================================================================================== */
if icDomain     = '':U then assign icDomain     = ?.
if iiPvoId      = 0    then assign iiPvoId      = ?.
if iiPvodLineId = 0    then assign iiPvodLineId = ?.

if vcGroupBy = {&ERSPROCESSORINVGROUP-LEGALDOC}
then do:

    /* =================================================================================================== */
    /* Validate input parameters                                                                           */
    /* =================================================================================================== */
    if not available tqLogAcctPendingVoucherForERS
    then do:
        assign vcMessage = #T-63'There is missing expected record in temporary table':255(70754)T-63#.
        <M-36 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-261992':U (icFcMsgNumber), 
            input  '':U (icFcExplanation), 
            input  '':U (icFcIdentification), 
            input  '':U (icFcContext), 
            output viFcReturnSuper (oiReturnStatus)) in BERSProcessor>
        assign oiReturnStatus = -1.
        return.
    end.
end. /* if vcGroupBy = {&ERSPROCESSORINVGROUP-LEGALDOC} */
else do:

    /* =================================================================================================== */
    /* Validate input parameters                                                                           */
    /* =================================================================================================== */
    assign vcMessage = #T-88'There is not implemented requred functionality to process Logistic Charges by ERS without Legal documents.':255(493824580)T-88#.
    <M-77 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-484634':U (icFcMsgNumber), 
        input  '':U (icFcExplanation), 
        input  '':U (icFcIdentification), 
        input  '':U (icFcContext), 
        output viFcReturnSuper (oiReturnStatus)) in BERSProcessor>
    assign oiReturnStatus = -1.
    return.
end. /* NOT if vcGroupBy = {&ERSPROCESSORINVGROUP-LEGALDOC} */

/* =================================================================================================== */
/* Is there already any Receiver matching for pending voucher (in Final or Init status)                */
/* =================================================================================================== */
<Q-13 run APMatchingLnByStatusPvod (all) (Read) (NoCache)
   (input ?, (CompanyId)
    input icDomain, (PvoDomain)
    input iiPvoId, (PvoID)
    input iiPvodLineId, (PvodLineID)
    input ?, (APMatchingStatus)
    input ?, (SkipAPMatchingLnRowid)
    output dataset tqAPMatchingLnByStatusPvod) in BAPMatching >

find first tqAPMatchingLnByStatusPvod where
           tqAPMatchingLnByStatusPvod.tcPvoDomain  = icDomain     and
           tqAPMatchingLnByStatusPvod.tiPvoID      = iiPvoId      and
           tqAPMatchingLnByStatusPvod.tiPvodLineID = iiPvodLineId and
           (tqAPMatchingLnByStatusPvod.tcAPMatchingStatus = {&APMATCHINGSTATUS-INITIAL} or
            tqAPMatchingLnByStatusPvod.tcAPMatchingStatus = {&APMATCHINGSTATUS-FINISHED})
           no-error.
if available tqAPMatchingLnByStatusPvod
then do:
    assign vcMessage = #T-16'This Receiver &1 is already included on other Receiver matching.':255(70691)T-16#
           vcMessage = substitute(vcMessage, tqPendingVoucherForERSDetail.tcprh_receiver).
    <M-15 run SetMessage
       (input  vcMessage (icMessage), 
        input  '':U (icArguments), 
        input  '':U (icFieldName), 
        input  '':U (icFieldValue), 
        input  'E':U (icType), 
        input  3 (iiSeverity), 
        input  '':U (icRowid), 
        input  'QadFin-8494':U (icFcMsgNumber), 
        input  '':U (icFcExplanation), 
        input  '':U (icFcIdentification), 
        input  '':U (icFcContext), 
        output viFcReturnSuper (oiReturnStatus)) in BERSProcessor>
    assign oiReturnStatus = -1.
    return.
end.

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