project QadFinancials > class BMfgDomain > method AdditionalUpdates

Description

This empty method allows to do additional updates on class temp-tables after records were received (and validated) from outside, using method SetPublicTables.
You can start instances of other business classes to do those updates.


Parameters


oiReturnStatusoutputinteger


Internal usage


unused


program code (program/bmfgdomain.p)

assign oiReturnStatus = -98.
    /* Find the SYSTEM Domain */
    <Q-5 run DomainsByDomainType (all) (Read) (NoCache)
          (input ?, (DomainID)
           input {&DOMAINSDOMAINTYPE-SYSTEM}, (DomainType)
           output dataset tqDomainsByDomainType) in BDomain >
                      
           
    /* Now copy all the tables from the SYSTEM Domain to the new Domain */
    for first tqDomainsByDomainType where 
              tqDomainsByDomainType.tcDomainType = {&DOMAINSDOMAINTYPE-SYSTEM},
        each tdom_mstr where 
             tdom_mstr.dom_domain <> "":U  and 
             tdom_mstr.dom_domain <> tqDomainsByDomainType.tcDomainCode  and
             tdom_mstr.tc_Status   = 'N':U:

        if viBVATID = 0 or viBVATID = ? then do:
            <I-21 {bFcStartAndOpenInstance
            &ADD-TO-TRANSACTION = "YES"
            &CLASS              = "BVAT"}>
        end.
        else do:
            <I-23 {bFcOpenInstance
            &CLASS           = "BVAT"}>
        end.

        <M-19 run ApiCreateNonTaxable
           (input  tqDomainsByDomainType.tcDomainCode (icSourceDomainCode), 
            input  tdom_mstr.dom_domain (icTargetDomainCode), 
            output viFcReturnSuper (oiReturnStatus)) in BVAT>

        <I-24 {bFcCloseInstance
            &CLASS           = "BVAT"}>
             
        if viFcReturnSuper <> 0 then assign oiReturnStatus = viFcReturnSuper.
        if viFcReturnSuper < 0  then do:
            <M-26 run StopExternalInstances
               (output viFcReturnSuper (oiReturnStatus)) in BMfgDomain>
            return.
        end.
        
        /* Remove the tCopy records for this domain to prevent duplicate creation
         * of gl_ctrl records in the next section.
         */
        for first tCopyDomains where tCopyDomains.DomainCode = tdom_mstr.dom_domain:
            for first tCopyDomainProperty 
                where tCopyDomainProperty.Domain_ID = tCopyDomains.Domain_ID:
                delete tCopyDomainProperty.
            end.
            delete tCopyDomains.
        end.
        
    end.
    
    /* ================================================================= */
    /* Replicate the domain currency and domain language to MFG/PRO                          */
    /* ================================================================= */
    if viBMfgSystemAccCtrlDomainID = 0 or
       viBMfgSystemAccCtrlDomainID = ?
    then do:
        <I-11 {bFcStartAndOpenInstance
            &ADD-TO-TRANSACTION = "true"
            &CLASS              = "BMfgSystemAccountControl"}>
    end.
    else do:
        <I-13 {bFcOpenInstance
            &CLASS           = "BMfgSystemAccountControl"}>
    end.
    <M-17 run MaintainData
       (input  tCopyDomainProperty (tCopyDomainPropertyRefC), 
        input  tCopyDomains (tCopyDomainRef), 
        output viLocalReturnStatus (oiReturnStatus)) in BMfgSystemAccountControl>
    <I-14 {bFcCloseInstance
            &CLASS           = "BMfgSystemAccountControl"}>
                        
    if viLocalReturnStatus <> 0 then assign oiReturnStatus = viLocalReturnStatus.
    if viLocalReturnStatus < 0 
    then do :
        <M-25 run StopExternalInstances
           (output viFcReturnSuper (oiReturnStatus)) in BMfgDomain>
        Return.
    end. /* if viLocalReturnStatus < 0  */
    
    
    /* ======================== */
    /* Set ReturnStatus = OK    */
    /* ======================== */
    if oiReturnStatus = -98
    then assign oiReturnStatus = 0.
    
<ANCESTOR-CODE>