project QadFinancials > class BAPMatching > method AddAPMatchingLnValidate

Description

AddAPMatchingLnValidate: Submethod of AddAPMatchingLn holding the validations


Parameters


bcAPMatchingTcRowidinput-outputcharacterTc-rowid of the tAPMatching-record for which you want to create detail lines
bcDomainCodeinput-outputcharacterDomain: this should be the domain that the user logged in on.
if not filled, then the current domain is used
blCallGTMinput-outputlogicalCallGTM: set to true in case you want the taxes to be recalculated, set to false if you just want to use the taxes of the pending-voucher
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BAPMatching.AddAPMatchingLn


program code (program8/bapmatching.p)

/* ================================ */
    /* Exception handling - Start Block */
    /* ================================ */
    assign oiReturnStatus      = -98
           viLocalReturnStatus = 0.
    VALIDATIONADDBLOCK: Do :
        
        /* =============================================================== */
        /* Validate input / Provide defaults / Find the tAPMatching        */
        /* Note that the instanceless temp-table that is used in this code */
        /* can be accessed as this is input for the parent of this method  */
        /* =============================================================== */
        if not can-find (tAPMatching where 
                         tAPMatching.tc_Rowid = bcAPMatchingTcRowid)
        then do :
            assign viLocalReturnStatus = -3
                   vcMsgAPMatching     = trim(substitute(#T-43'The system cannot create a matching line because the header cannot be found based on its TC row ID (&1).':255(70301)t-43#,bcAPMatchingTcRowid)).
            <M-32 run SetMessage
               (input  vcMsgAPMatching (icMessage), 
                input  '':U (icArguments), 
                input  '':U (icFieldName), 
                input  '':U (icFieldValue), 
                input  'E':U (icType), 
                input  3 (iiSeverity), 
                input  '':U (icRowid), 
                input  'QadFin-8338':U (icFcMsgNumber), 
                input  '':U (icFcExplanation), 
                input  '':U (icFcIdentification), 
                input  '':U (icFcContext), 
                output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
            Leave VALIDATIONADDBLOCK.
        end. /* if not can-find (tAPMatching where */
        if bcDomainCode = "":U or 
           bcDomainCode = ? 
        then assign bcDomainCode = vcDomainCode.
        else if bcDomainCode <> vcDomainCode
             then do :
                assign viLocalReturnStatus = -3
                       vcMsgAPMatching     = trim(substitute(#T-46'The system cannot create a matching line because the domain (&1) used in the matching is not the current domain (&2).':255(70314)t-46#,bcDomainCode,vcDomainCode)).
                <M-38 run SetMessage
                   (input  vcMsgAPMatching (icMessage), 
                    input  '':U (icArguments), 
                    input  '':U (icFieldName), 
                    input  '':U (icFieldValue), 
                    input  'E':U (icType), 
                    input  3 (iiSeverity), 
                    input  '':U (icRowid), 
                    input  'QadFin-8344':U (icFcMsgNumber), 
                    input  '':U (icFcExplanation), 
                    input  '':U (icFcIdentification), 
                    input  '':U (icFcContext), 
                    output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
                Leave VALIDATIONADDBLOCK.
             end. /* if bcDomainCode <> vcDomainCode */
        if blCallGTM = ?
        then do :
            assign viLocalReturnStatus = -3
                   vcMsgAPMatching     = trim(substitute(#T-48'The system cannot create a matching line because there is no indication as to whether GTM must be called or not.':255(70308)t-48#)).
            <M-47 run SetMessage
               (input  vcMsgAPMatching (icMessage), 
                input  '':U (icArguments), 
                input  '':U (icFieldName), 
                input  '':U (icFieldValue), 
                input  'E':U (icType), 
                input  3 (iiSeverity), 
                input  '':U (icRowid), 
                input  'QadFin-8345':U (icFcMsgNumber), 
                input  '':U (icFcExplanation), 
                input  '':U (icFcIdentification), 
                input  '':U (icFcContext), 
                output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
            Leave VALIDATIONADDBLOCK.
        end. /* if blCallGTM = ? or  */
        if not can-find (first tAPMatchingLnBasedUponPvod)
        then do :
            assign viLocalReturnStatus = -3
                   vcMsgAPMatching     = trim(substitute(#T-50'The system cannot create a matching line because the input does not contain data about the matching lines.':255(70336)t-50#)).
            <M-49 run SetMessage
               (input  vcMsgAPMatching (icMessage), 
                input  '':U (icArguments), 
                input  '':U (icFieldName), 
                input  '':U (icFieldValue), 
                input  'E':U (icType), 
                input  3 (iiSeverity), 
                input  '':U (icRowid), 
                input  'QadFin-8364':U (icFcMsgNumber), 
                input  '':U (icFcExplanation), 
                input  '':U (icFcIdentification), 
                input  '':U (icFcContext), 
                output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
            Leave VALIDATIONADDBLOCK.
        end. /* if can-find (first tAPMatchingLnBasedUponPvod) */
        if can-find (first tAPMatchingLnBasedUponPvod where 
                           tAPMatchingLnBasedUponPvod.tiPvoID = 0 or 
                           tAPMatchingLnBasedUponPvod.tiPvoID = ?)
        then do :
            assign viLocalReturnStatus = -3
                   vcMsgAPMatching     = trim(substitute(#T-39'The system cannot create a matching line because the pending invoice ID was not specified.':255(70313)t-39#)).
            <M-31 run SetMessage
               (input  vcMsgAPMatching (icMessage), 
                input  '':U (icArguments), 
                input  '':U (icFieldName), 
                input  '':U (icFieldValue), 
                input  'E':U (icType), 
                input  3 (iiSeverity), 
                input  '':U (icRowid), 
                input  'QadFin-8337':U (icFcMsgNumber), 
                input  '':U (icFcExplanation), 
                input  '':U (icFcIdentification), 
                input  '':U (icFcContext), 
                output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
            Leave VALIDATIONADDBLOCK.
        end. /* if can-find (first tAPMatchingLnBasedUponPvod where  */
        if can-find (first tAPMatchingLnBasedUponPvod where 
                           tAPMatchingLnBasedUponPvod.tiPvodLineID = 0 or 
                           tAPMatchingLnBasedUponPvod.tiPvodLineID = ?)
        then do :
            assign viLocalReturnStatus = -3
                   vcMsgAPMatching     = trim(substitute(#T-45'The system cannot create a matching line because the ID of the pending invoice detail was not specified.':255(70304)t-45#)).
            <M-37 run SetMessage
               (input  vcMsgAPMatching (icMessage), 
                input  '':U (icArguments), 
                input  '':U (icFieldName), 
                input  '':U (icFieldValue), 
                input  'E':U (icType), 
                input  3 (iiSeverity), 
                input  '':U (icRowid), 
                input  'QadFin-8343':U (icFcMsgNumber), 
                input  '':U (icFcExplanation), 
                input  '':U (icFcIdentification), 
                input  '':U (icFcContext), 
                output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
            Leave VALIDATIONADDBLOCK.
        end. /* if if can-find (first tAPMatchingLnBasedUponPvod where or  */
        if can-find (first tAPMatchingLnBasedUponPvod where 
                           (tAPMatchingLnBasedUponPvod.tdAPMAtchingLnMatchQty = 0 or 
                            tAPMatchingLnBasedUponPvod.tdAPMAtchingLnMatchQty = ?) and
                           tAPMatchingLnBasedUponPvod.tlIsLgCharge           <> true)
        then do :
            assign viLocalReturnStatus = -3
                   vcMsgAPMatching     = trim(substitute(#T-44'The system cannot create a matching line because the matched quantity was not specified.':255(70305)t-44#)).
            <M-35 run SetMessage
               (input  vcMsgAPMatching (icMessage), 
                input  '':U (icArguments), 
                input  '':U (icFieldName), 
                input  '':U (icFieldValue), 
                input  'E':U (icType), 
                input  3 (iiSeverity), 
                input  '':U (icRowid), 
                input  'QadFin-8341':U (icFcMsgNumber), 
                input  '':U (icFcExplanation), 
                input  '':U (icFcIdentification), 
                input  '':U (icFcContext), 
                output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
            Leave VALIDATIONADDBLOCK.
        end. /* if can-find (first tAPMatchingLnBasedUponPvod where  */
        if can-find (first tAPMatchingLnBasedUponPvod where 
                           tAPMatchingLnBasedUponPvod.tdAPMAtchingLnMatchUnitPrice = ?)
        then do :
            assign viLocalReturnStatus = -3
                   vcMsgAPMatching     = trim(substitute(#T-41'Unable to create a matching-line as the matched-unit-price was not specified (even not as zero).':255(71137)T-41#)).
            <M-33 run SetMessage
               (input  vcMsgAPMatching (icMessage), 
                input  '':U (icArguments), 
                input  '':U (icFieldName), 
                input  '':U (icFieldValue), 
                input  'E':U (icType), 
                input  3 (iiSeverity), 
                input  '':U (icRowid), 
                input  'QadFin-8339':U (icFcMsgNumber), 
                input  '':U (icFcExplanation), 
                input  '':U (icFcIdentification), 
                input  '':U (icFcContext), 
                output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
            Leave VALIDATIONADDBLOCK.
        end. /* if can-find (first tAPMatchingLnBasedUponPvod where  */
        if can-find (first tAPMatchingLnBasedUponPvod where 
                           tAPMatchingLnBasedUponPvod.tlAPMAtchingLnIsVarGLPosting = ?)
        then do :
            assign viLocalReturnStatus = -3
                   vcMsgAPMatching     = trim(substitute(#T-40'The system cannot create a matching line because there is no indication about the variance posting.':255(70307)t-40#)).
            <M-36 run SetMessage
               (input  vcMsgAPMatching (icMessage), 
                input  '':U (icArguments), 
                input  '':U (icFieldName), 
                input  '':U (icFieldValue), 
                input  'E':U (icType), 
                input  3 (iiSeverity), 
                input  '':U (icRowid), 
                input  'QadFin-8342':U (icFcMsgNumber), 
                input  '':U (icFcExplanation), 
                input  '':U (icFcIdentification), 
                input  '':U (icFcContext), 
                output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
            Leave VALIDATIONADDBLOCK.
        end. /* if can-find (first tAPMatchingLnBasedUponPvod where  */
        
    END. /* VALIDATIONADDBLOCK */
   
    /* ======================== */
    /* Exception handling       */
    /* ======================== */
    assign oiReturnStatus = viLocalReturnStatus.