project QadFinancials > class BBudget > method CalculateBudgetCompany

Description

This submethod of Method Calculate is to fill some calculated field in the BudgetCompany based on the COmpany_ID.


Parameters


oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BBudget.Calculate


program code (program1/bbudget.p)

/* ========================================================= */
    /* Fill CompanyCode in BudgetCompany based on the Company_ID */
    /* This cannot be done using RKBF because then the current   */
    /* company is added as parameter value for the query.        */
    /* ========================================================= */
    for each tBudgetCompany where 
             tBudgetCompany.tc_Status <> "D":U :
        /* Read all companies */
        if not can-find (first tqCompanyPrim)
        then do :
            <Q-1 run CompanyPrim (all) (Read) (NoCache)
          (input ?, (LookupCompanyId)
           input ?, (CompanyCode)
           output dataset tqCompanyPrim) in BCompany >
        end. /* if not can-find (first ) */
        /* Set the company-code */
        find tqCompanyPrim where 
             tqCompanyPrim.tiCompany_ID = tBudgetCompany.Company_ID
             no-lock no-error.
        if available tqCompanyPrim 
        then assign tBudgetCompany.tcCompanyCode = tqCompanyPrim.tcCompanyCode.
    end. /* for each tBudgetCompany where */