project QadFinancials > class BPeriod > method InitialValues

Description

Add code here to initialize the calculated fields of a 'new' record (= a record that must be created in the application database) in a class temp-table.


Parameters


icTableNameinputcharacterName of the database table of which a record is created in the class temp-table.
oiReturnStatusoutputinteger


Internal usage


unused


program code (program/bperiod.p)

<ANCESTOR-CODE>

    /* ===================================================== */
    /* Get PeriodMark with Sequence=1 of the current company */
    /* ===================================================== */
    if viPeriodMarkIDSequence1 = 0 or 
       viPeriodMarkIDSequence1 = ?
    then do :
        <M-2 run SetPeriodMarkIDSequence1 (output viFcReturnSuper (oiReturnStatus)) in BPeriod>
    end. /* if viPeriodMarkIDSequence1 = 0 */
                                                               
    /* ===================================================== */
    /* Set Initial values                                    */
    /* ===================================================== */
    assign tPeriod.company_ID                  = viCompanyId
           tPeriod.PeriodStatus                = {&PERIODSTATUS-OPEN}
           tPeriod.PeriodIsPostingGLAllowed    = true
           tPeriod.PeriodIsPostingPurchAllow   = true
           tPeriod.PeriodIsPostingSalesAllow   = true
           tPeriod.PeriodIsPostingInvAllowed   = true
           tPeriod.PeriodIsPostingOtherAllow   = true
           tPeriod.PeriodTypeCode              = {&PERIODTYPECODE-CORRECTION}
           tPeriod.PeriodIsReportChecked       = false
           tPeriod.PeriodMark_ID               = viPeriodMarkIDSequence1
           tPeriod.tcPeriodMarkCode            = vcPeriodMarkCodeSequence1
           tPeriod.PeriodIsPostingPCAllowed    = false.
    <Q-6 run CompanyByDomain (all) (Read) (NoCache)
              (input tPeriod.Company_ID, (CompanyId)
               input '':U, (DomainId)
               input ?, (Active)
               output dataset tqCompanyByDomain) in BCompany >
    for first tqCompanyByDomain:
        assign tPeriod.tcDomainCode = tqCompanyByDomain.tcDomainCode
               tPeriod.tcEntityCode = tqCompanyByDomain.tcCompanyCode.
    end. /* for first tqCompanyByDomain: */
    
    /* ========================================================================================================= */
    /* Set Period.PeriodIsPostingPC to true in case the current domain is abled for Periodic-Costing             */
    /* ========================================================================================================= */
    if vlPeriodicCostingModIsActive = ? 
    then do :
        <M-18 run PeriodicCostingModuleIsActive
           (input  vcDomainCode (icDomainCode), 
            output vlPeriodicCostingModIsActive (olPeriodicCostingModuleIsActive), 
            output viFcReturnSuper (oiReturnStatus)) in BPeriod>
        if viFcReturnSuper <> 0 
        then assign oiReturnStatus = viFcReturnSuper.
        if viFcReturnSuper < 0 
        then Return. 
    end.  /* if vlPeriodicCostingModIsActive = ?  */
    if vlPeriodicCostingModIsActive = true
    then assign tPeriod.PeriodIsPostingPCAllowed = true.
    else assign tPeriod.PeriodIsPostingPCAllowed = false.