project QadFinancials > class BMFGLegalDocument > method GetLegalDocumentIDByPendingVoucher

Description

This method retrieves identificaion of the Legal document, that was used for Fiscal receiving of the pending voucher


Parameters


icPvoDomaininputcharacter
iiPvoIdinputinteger
iiPvodIdinputinteger
ocLgdDomainoutputcharacterLegal document domain
ocLgdSupplieroutputcharacterShip-from, normally this is Supplier (for material)
ocLgdNbroutputcharacter
otLgdEffDateoutputdateLegal document effective issue date
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BAPMatching.ValidateComponentPreAPMCInvoiceLegalDocument


program code (program5/bmfglegaldocument.p)

/* ====================================================================================== *
 * Method       : GetLegalDocumentIDByPendingVoucher                                      *
 * Description  : This method retrieves identificaion of the Legal document, that was     *
 *                used for Fiscal receiving of the pending voucher                        *
 * -------------------------------------------------------------------------------------- *
 * Parameters   : PvoDomain        Pending voucher domain (mandatory)                     *
 *                PvoId            Pending voucher ID (mandatory)                         *
 *                PvodId           Pending voucher detaild ID (mandatory)                 *
 *              O LgdDomain        Legal document domain                                  *
 *              O LgdNbr           Legal document number                                  *
 *              O LgdSupplier      Legal document supplier                                *
 *              O LgdEffDate       Legal document effective issue date                    *
 * ====================================================================================== */

define variable doGetLgdPendVouch as com.qad.eefin.bmfglegaldocument.GetLegalDocumentByPendVouch.

MAIN_BLOCK:
do on error undo, throw:
    
    /* Normalize parameters */
    if icPvoDomain = "":U then assign icPvoDomain = ?.
    if iiPvoId     = 0    then assign iiPvoId     = ?.
    if iiPvodId    = 0    then assign iiPvodId    = ?.
     
    /* Default output parameters */
    assign ocLgdDomain   = ?
           ocLgdNbr      = ?
           ocLgdSupplier = ?
           otLgdEffDate  = ?.

    /* Pre-validation block */
    if icPvoDomain = ? or
       iiPvoId     = ? or
       iiPvodId    = ?
    then do:
        assign vcMessage = #T-34'Not all mandatory input parameters are populated or they have wrong value.':255(999890330)T-34#
               vcContext = "icPvoDomain=&1|iiPvoId=&2|iiPvodId=&3":U
               vcContext = substitute(vcContext, icPvoDomain, iiPvoId, iiPvodId)
               vcContext = replace(vcContext, "|":U, chr(2)).
        <M-54 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-577830':U (icFcMsgNumber), 
            input  '':U (icFcExplanation), 
            input  '':U (icFcIdentification), 
            input  vcContext (icFcContext), 
            output viFcReturnSuper (oiReturnStatus)) in BMFGLegalDocument>
        assign oiReturnStatus = -1.
        return.
    end. /* Pre-validation block */

    /* ================================================================================== *
     * Get pending voucher details                                                        *
     * ================================================================================== */
    publish "Logging.BusinessCode":U ("START-SUB,doGetLgdPendVouch ":U, subst("In: icPvoDomain=&1 iiPvoId=&2 iiPvodId=&3":U, icPvoDomain, iiPvoId, iiPvodId)).
    
    assign doGetLgdPendVouch = new com.qad.eefin.bmfglegaldocument.GetLegalDocumentByPendVouch(
                                       icPvoDomain,
                                       iiPvoId,
                                       iiPvodId).
                                       
    publish "Logging.BusinessCode":U ("END-SUB,doGetLgdPendVouch ":U).
                                       
    if not doGetLgdPendVouch:available
    then do:
        assign vcMessage = #T-88'Cannot retrieve legal document based on the pending voucher.':255(168663964)T-88#
               vcContext = "icPvoDomain=&1|iiPvoId=&2|iiPvodId=&3":U
               vcContext = substitute(vcContext,  icPvoDomain, iiPvoId, iiPvodId)
               vcContext = replace(vcContext, "|":U, chr(2)).
        <M-40 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-708477':U (icFcMsgNumber), 
            input  '':U (icFcExplanation), 
            input  '':U (icFcIdentification), 
            input  vcContext (icFcContext), 
            output viFcReturnSuper (oiReturnStatus)) in BMFGLegalDocument>
        assign oiReturnStatus = -1.
        return.
    end.
    
    assign ocLgdDomain   = doGetLgdPendVouch:lgd_domain
           ocLgdNbr      = doGetLgdPendVouch:lgd_nbr
           ocLgdSupplier = doGetLgdPendVouch:lgd_shipfrom
           otLgdEffDate  = doGetLgdPendVouch:lgd_effdate.
    
    /* Finally block */
    finally:
        if valid-object(doGetLgdPendVouch) then delete object doGetLgdPendVouch no-error.
    end.

end. /* MAIN_BLOCK */