project QadFinancials > class BMassLayerTransfer > method PeriodicCostingModuleIsActive

Description

PeriodicCostingModuleIsActive: this function will retuirn if a the periodic-costing module is active or not for the domain specified in the input


Parameters


icDomainCodeinputcharacterOptional parameter holding the domain wherefor this check is needed.
If this parameter is empty, then we will check if the current domain is enabled for Periodic-costing or not.
olPeriodicCostingModuleIsActiveoutputlogicalIndicates if the periodic-costing module has been enabled for the domain mentioned in the input or not
ocPeriodicCostingFinalJournaloutputcharacterPeriodicCostingFinalJournal: final journal as specified in the PC control-file
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BMassLayerTransfer.ApiExecuteLayerTransferV01
method BMassLayerTransfer.ApiGetJournalEntriesValidate


program code (program6/bmasslayertransfer.p)

/* =============================== */
    /* Exception handling - main block */
    /* Default output                  */ 
    /* =============================== */
    assign oiReturnStatus                   = -98
           olPeriodicCostingModuleIsActive  = ?
           ocPeriodicCostingFinalJournal    = ?
           viLocalReturnStatus              = 0.
    MAINPCBLOCK: DO :
        
        /* ====================================================================== */
        /* In case the domain is not specified in the input; take the current one */
        /* ====================================================================== */
        if icDomainCode = "":U or 
           icDomainCode = ?
        then assign icDomainCode = vcDomainCode.
        
        /* ==================================================================================== */
        /* First check the MfgPro version:                                                      */
        /* If the MfgPro version is eB3.SP5 or lower then Periodidc-costing is not active as    */
        /* it is even not implemented in these older versions.                                  */
        /* If the MfgPro version if higher than eB3.SP5 then we need to check the control-file  */
        /* (pcsc_ctrl) to find out if periodic-costing has been activated for the domain or not */
        /* We can't just check the control-file straight away without taking the MfgPro-version */
        /* into account as accessing table pcsc_ctrl via the associated BMfgxxxx-class when the */
        /* table is not in the db would result in progress-errors                               */
        /* ==================================================================================== */
        <M-54 run StartCacher
           (output vhFcComponent (ohCacher), 
            output viExternalReturnStatus (oiReturnStatus)) in BMassLayerTransfer>
        if viExternalReturnStatus <> 0 then assign viLocalReturnStatus = viExternalReturnStatus.
        if viExternalReturnStatus < 0 
        then do :
            assign olPeriodicCostingModuleIsActive = false.
            Leave MAINPCBLOCK.
        end. /* if viExternalReturnStatus < 0  */
    
        <M-86 run GetIntegerValueFromSession
           (input  viSessionID (iiSessionId), 
            input  'MfgProMajorVersion' (icDataItemName), 
            output viMfgProMajorVersion (oiValue), 
            output viExternalReturnStatus (oiReturnStatus)) in Cacher>
        if viExternalReturnStatus <> 0 then assign viLocalReturnStatus = viExternalReturnStatus.
        if viExternalReturnStatus < 0 
        then do :
            assign olPeriodicCostingModuleIsActive = false.
            Leave MAINPCBLOCK.
        end. /* if viExternalReturnStatus < 0  */
    
        <M-60 run GetIntegerValueFromSession
           (input  viSessionID (iiSessionId), 
            input  'MfgProMinorVersion' (icDataItemName), 
            output viMfgProMinorVersion (oiValue), 
            output viExternalReturnStatus (oiReturnStatus)) in Cacher>
        if viExternalReturnStatus <> 0 then assign viLocalReturnStatus = viExternalReturnStatus.
        if viExternalReturnStatus < 0 
        then do :
            assign olPeriodicCostingModuleIsActive = false.
            Leave MAINPCBLOCK.
        end. /* if viExternalReturnStatus < 0  */
        
        if viMfgProMajorVersion > 3 /* Meaning eB3 */ or 
           (viMfgProMajorVersion  = 3 /* Meaning eB3 */and 
            viMfgProMinorVersion >= 6 /* Meaning SP6 */)
        then do :
            <Q-5 run PeriodicCostingControlByDomain (all) (Read) (NoCache)
               (input icDomainCode, (DomainCode)
                output dataset tqPeriodicCostingControlByDomain) in BMfgPeriodicCostingCtrl >
            Find first tqPeriodicCostingControlByDomain where 
                       tqPeriodicCostingControlByDomain.tcpcsc_domain = icDomainCode
                       no-lock no-error.
            if available tqPeriodicCostingControlByDomain
            then do :
                assign ocPeriodicCostingFinalJournal = tqPeriodicCostingControlByDomain.tcpcsc_final_daybook.
                if tqPeriodicCostingControlByDomain.tlpcsc_enable = true
                then assign olPeriodicCostingModuleIsActive = true.
            end. /* if available tqPeriodicCostingControlByDomain */
            else assign olPeriodicCostingModuleIsActive = false
                        ocPeriodicCostingFinalJournal    = "":U.
        end. /* if viMfgProMajorVersion > 3 /* Meaning eB3 */ or  */
        else assign olPeriodicCostingModuleIsActive = false
                    ocPeriodicCostingFinalJournal    = "":U.
        
    /* =============================== */
    /* Exception handling - main block */
    /* =============================== */
    END. /* MAINPCBLOCK */
    assign oiReturnStatus = viLocalReturnStatus.