project QadFinancials > class BBankEntry > method AdditionalUpdatesInvInstanceValidate

Description

AdditionalUpdatesInvInstanceValidate: method that takes care of the validation of instances


Parameters


ilBCInvoiceOpenedinputlogicalIs BCInvoice already openend ?
ilBDInvoiceOpenedinputlogicalIs BDInvoice already openend ?
ilBCDocumentOpenedinputlogicalIs BCDocument already openend ?
ilBDDocumentOpenedinputlogicalIs BDDocument already openend ?
ilBWithHoldingTaxOpenedinputlogicalIs BWithHoldingTax component opened?
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BBankEntry.AdditionalUpdatesInv


program code (program4/bbankentry.p)

    /* ======================================================= */
    /* Set default return-status                               */
    /* ======================================================= */
    assign oiReturnStatus = -98.
    
    /* ======================================================== */
    /* Performing ValidateBCAndAddUpd on BCI                    */
    /* Turn off 'CInvoiceRoleIsMandatory' in Session before     */
    /* performing these actions on BCI                          */
    /* ======================================================== */
    if ilBCInvoiceOpened = true and vlBCInvoiceIsStartedFromBE = true 
    then do:
        /* Set CInvoiceRoleIsMandatory = false */
        <I-1 {bFcOpenInstance
            &CLASS           = "Session"}>
        <M-2 run SetLogicalValue (input  'CInvoiceRoleIsMandatory':U (icName), 
                          input  false (ilValue), 
                          output viFcReturnSuper (oiReturnStatus)) in Session>
        <I-3 {bFcCloseInstance
            &CLASS           = "Session"}>
        /* Real validations + AddUpd */
        <M-4 run ValidateBCAndAdditionalUpdates (output viExternalReturnStatus (oiReturnStatus)) in BCInvoice>
        if viExternalReturnStatus < 0
        then do:
            assign vcMessage = trim(substitute(#T-16'Error &1 has occurred when validating the supplier invoices for the bank statement.':150(15023)T-16#, string(viExternalReturnStatus))).
            <M-5 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-4271':U (icFcMsgNumber), 
                         input  '' (icFcExplanation), 
                         input  '' (icFcIdentification), 
                         input  '' (icFcContext), 
                         output viFcReturnSuper (oiReturnStatus)) in BBankEntry>
        end. /* if viExternalReturnStatus < 0 */
        /* Set CInvoiceRoleIsMandatory = true */
        <I-7 {bFcOpenInstance
            &CLASS           = "Session"}>
        <M-8 run SetLogicalValue (input  'CInvoiceRoleIsMandatory':U (icName), 
                      input  true (ilValue), 
                      output viFcReturnSuper (oiReturnStatus)) in Session>
        <I-9 {bFcCloseInstance
            &CLASS           = "Session"}>
        /* Return in case of errors */
        if viExternalReturnStatus <> 0 
        then assign oiReturnStatus = viExternalReturnStatus.
        if viExternalReturnStatus < 0 
        then Return.
    end. /* if vlCInvoice and vlBCInvoiceIsStartedFromBE = true */
    
    /* ======================================================== */
    /* Performing ValidateBCAndAddUpd on BDI                    */
    /* ======================================================== */
    if ilBDInvoiceOpened = true and vlBDInvoiceIsStartedFromBE = true
    then do:
        <M-10 run ValidateBCAndAdditionalUpdates (output viExternalReturnStatus (oiReturnStatus)) in BDInvoice>
        if viExternalReturnStatus < 0
        then do:
            assign vcMessage = trim(substitute(#T-17'Error &1 has occurred when validating the customer invoices for the bank statement.':150(15024)T-17#, string(viExternalReturnStatus))).
            <M-11 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-4272':U (icFcMsgNumber), 
                  input  '' (icFcExplanation), 
                  input  '' (icFcIdentification), 
                  input  '' (icFcContext), 
                  output viFcReturnSuper (oiReturnStatus)) in BBankEntry>
        end. /* if viExternalReturnStatus < 0 */
        /* Return in case of errors */
        if viExternalReturnStatus <> 0 
        then assign oiReturnStatus = viExternalReturnStatus.
        if viExternalReturnStatus < 0 
        then Return.
    end. /* if vlDInvoice and vlBDInvoiceIsStartedFromBE = true */
    
    /* ======================================================== */
    /* Performing ValidateBCAndAddUpd on BCDocument             */
    /* ======================================================== */
    if ilBCDocumentOpened = true and vlBCDocumentIsStartedFromBE = true
    then do:
        <M-18 run ValidateBCAndAdditionalUpdates (output vcDummy (ocCreatedPrePaymentForPaySel), 
                                          output viExternalReturnStatus (oiReturnStatus)) in BCDocument>
        if viExternalReturnStatus < 0
        then do:
            assign vcMessage      = trim(substitute(#T-21'Error &1 has occurred when validating the supplier payments.':150(284)T-21#, string(viExternalReturnStatus))).
            <M-19 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-4318':U (icFcMsgNumber),
                     input  '' (icFcExplanation),
                     input  '' (icFcIdentification),
                     input  '' (icFcContext),
                     output viFcReturnSuper (oiReturnStatus)) in BBankEntry>
        end. /* if viExternalReturnStatus < 0 */
        /* Return in case of errors */
        if viExternalReturnStatus <> 0 
        then assign oiReturnStatus = viExternalReturnStatus.
        if viExternalReturnStatus < 0 
        then Return.
        
        <M-91 run GetWHTCrossCyPosting
           (output tBEWHTCrossCyPosting (tWHTCrossCyPosting), 
            output viExternalReturnStatus (oiReturnStatus)) in BCDocument>
        if viExternalReturnStatus < 0
        then do:
            assign vcMessage      = trim(substitute(#T-34'Error &1 has occurred when retrieving the cross cy wht of the supplier payments.':150(631762712)T-34#, string(viExternalReturnStatus))).
            <M-61 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-113087':U (icFcMsgNumber), 
                input  '' (icFcExplanation), 
                input  '' (icFcIdentification), 
                input  '' (icFcContext), 
                output viFcReturnSuper (oiReturnStatus)) in BBankEntry>
        end. /* if viExternalReturnStatus < 0 */
        /* Return in case of errors */
        if viExternalReturnStatus <> 0 
        then assign oiReturnStatus = viExternalReturnStatus.
        if viExternalReturnStatus < 0 
        then Return.
        
        /* update the cross company posting lines that were created in AdditionalUpdatesPostingXRefWHT */
        /* with the correct cross company information                                                  */
        <I-88 {bFcOpenInstance
             &CLASS           = "BJournalEntry"}>
             
        for each tBEWHTCrossCyPosting where
                 tBEWHTCrossCyPosting.tiOriginatorCompanyId = viCompanyId :  
            <M-70 run UpdateCrossCompanyInfo
               (input  tBEWHTCrossCyPosting.tiOriginatorCompanyId (iiPostingCompanyID), 
                input  tBEWHTCrossCyPosting.tiOriginatorPostingID (iiPostingID), 
                input  tBEWHTCrossCyPosting.tiOriginatorPostingLineID (iiPostingLineID), 
                input  tBEWHTCrossCyPosting.tiCrossCompanyCompanyId (iiCrossCompanyID), 
                input  tBEWHTCrossCyPosting.tiCrossCompanyPostingID (iiCrossCompanyPostingID), 
                input  tBEWHTCrossCyPosting.tiCrossCompanyPostingLineID (iiCrossCompanyPostingLineID), 
                output viExternalReturnStatus (oiReturnStatus)) in BJournalEntry>   
            if viExternalReturnStatus < 0
            then do:
                assign vcMessage      = trim(substitute(#T-14'Error &1 has occurred when updating the cross cy info on the posting.':150(536063754)T-14#, string(viExternalReturnStatus))).
                <M-69 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-822037':U (icFcMsgNumber), 
                    input  '' (icFcExplanation), 
                    input  '' (icFcIdentification), 
                    input  '' (icFcContext), 
                    output viFcReturnSuper (oiReturnStatus)) in BBankEntry>
            end. /* if viExternalReturnStatus < 0 */
            /* Return in case of errors */
            if viExternalReturnStatus <> 0 
            then assign oiReturnStatus = viExternalReturnStatus.
            if viExternalReturnStatus < 0 
            then leave.
        end.
        
        /* ========================================================================================================= */
        /* Normally we would here close BJournalEntry but we will not do it for performance                          */
        /* reasons as this way the Commit of the transaction does not have to re-open the instance to commit it.     */
        /* And in all other scenario's the instance of the class ill be closed by the de-activiate procedure of the  */
        /* appserver that is executed after each call to the appserver                                               */
        /* ========================================================================================================= */

         
    end. /* if ilBCDocumentOpened = true and vlBCDocumentIsStartedFromBE = true */
    
    /* ======================================================== */
    /* Performing ValidateBCAndAddUpd on BDDocument             */
    /* ======================================================== */
    if ilBDDocumentOpened = true and vlBDDocumentIsStartedFromBE = true
    then do:
        <M-22 run ValidateBCAndAdditionalUpdates (output viExternalReturnStatus (oiReturnStatus)) in BDDocument>
        if viExternalReturnStatus < 0
        then do:
            assign vcMessage      = trim(substitute(#T-25'Error &1 has occurred when validating the customer payments.':150(285)T-25#, string(viExternalReturnStatus))).
            <M-23 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-4319':U (icFcMsgNumber),
                     input  '' (icFcExplanation),
                     input  '' (icFcIdentification),
                     input  '' (icFcContext),
                     output viFcReturnSuper (oiReturnStatus)) in BBankEntry>
        end. /* if viExternalReturnStatus < 0 */
        /* Return in case of errors */
        if viExternalReturnStatus <> 0 
        then assign oiReturnStatus = viExternalReturnStatus.
        if viExternalReturnStatus < 0 
        then Return.
    end. /* if ilBDDocumentOpened = true and vlBDDocumentIsStartedFromBE = true */

    /* ======================================================= */    
    /* Performing ValidateBCAndAddUpd on BWithHoldingTax       */
    /* ======================================================= */
    if ilBWithHoldingTaxOpened = true and vlBWHTBEWasStartedHere = true
    then do:
        <M-813 run ValidateBCAndAdditionalUpdates  (output viExternalReturnStatus (oiReturnStatus)) in BWithholdingTax>    
        /* Return in case of errors */
        if viExternalReturnStatus <> 0 
        then assign oiReturnStatus = viExternalReturnStatus.
        if viExternalReturnStatus < 0 
        then Return.    
    end. /* if ilBWithHoldingTaxOpened = true and vlBWHTBEWasStartedHere = true */
                                                                 
    /* ======================================================= */
    /* Set return-status = OK                                  */
    /* ======================================================= */
    if oiReturnStatus = -98
    then assign oiReturnStatus = 0.