project QadFinancials > class BJournalEntryMultiCy > method ApiProcessIncomingData

Description

Process the incoming data for cross company or journal entry excel integration.


Parameters


oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BJournalEntryMultiCy.ApiCreateCrossCyPostings


program code (program1/bjournalentrymulticy.p)

/* ======================================================================================== */
/* This method processes the incoming dataset and performs the necessary validations        */
/* All tables are validated before returning - even if an error is found.                   */ 
/* ======================================================================================== */
for each tPostingHeaderMultiCy where 
         tPostingHeaderMultiCy.tlPostingHeaderIsPosted = false
         on error undo, throw:
    
    find first tPostingJournalEntryType where 
               tPostingJournalEntryType.tc_Rowid = tPostingHeaderMultiCy.tc_Rowid 
               no-error.

    /* if cross company (record should always be available but if not we assume its cross company as default) */     
    if not available tPostingJournalEntryType or 
       tPostingJournalEntryType.tiJournalEntryType = {&JOURNALENTRY-CROSSCOMPANYEXCELINT}
    then do:
        
        /* ================================================================ */
        /*  Run validations on the incoming data                            */
        /* ================================================================ */
        <M-28 run ApiCreateCrossCyPostingsApplyCCyValidations
           (input  tPostingHeaderMultiCy.tc_Rowid (icRowId), 
            output viFcReturnSuper (oiReturnStatus)) in BJournalEntryMultiCy>
        if viFcReturnSuper <> 0 then do:
            if viFcReturnSuper < 0 or (viFcReturnSuper > 0 and oiReturnStatus = 0)
            then assign oiReturnStatus = viFcReturnSuper.
        end.    
        if oiReturnStatus < 0
        then return.
        
        /* ================================================================ */
        /* A cross company posting line is added to each tPostingMultiCy    */
        /* record.                                                          */
        /*                                                                  */
        /* This method can be overwritten by NI Customization               */
        /* If the customization code sets the variable                      */
        /* vlIsCustomizedBuildPostings is set to true, then this method     */
        /* code will not be run                                             */
        /* ================================================================ */         
        <M-82 run ApiCreateCrossCyPostingsAddCCyPostings
           (input  tPostingHeaderMultiCy.tc_Rowid (icRowId), 
            output viFcReturnSuper (oiReturnStatus)) in BJournalEntryMultiCy>

        if viFcReturnSuper <> 0 
        then do:
            if viFcReturnSuper < 0 or (viFcReturnSuper > 0 and oiReturnStatus = 0)
            then assign oiReturnStatus = viFcReturnSuper.
        end.      
        if oiReturnStatus < 0
        then return.

    end. /* end of if cross company */ 
    else 
    if tPostingJournalEntryType.tiJournalEntryType = {&JOURNALENTRY-NORMALEXCELINT} /* if normal journal entry ie. not cross company */
    then do:
        /* ================================================================ */
        /*  Run validations on the incoming data                            */
        /* ================================================================ */
        <M-74 run ApiCreateJournalEntryPostingsApplyValidations
           (input  tPostingHeaderMultiCy.tc_Rowid (icRowId), 
            output viFcReturnSuper (oiReturnStatus)) in BJournalEntryMultiCy>

        if viFcReturnSuper <> 0 
        then do:
            if viFcReturnSuper < 0 or (viFcReturnSuper > 0 and oiReturnStatus = 0)
            then assign oiReturnStatus = viFcReturnSuper.
        end.    
        if oiReturnStatus < 0
        then return.         

    end. /* end of else journal entry */    
         
end. /* for each tPostingHeaderMultiCy */