project QadFinancials > class BCInvoice > method DefaultValuesCostCentre

Description

Return default value for RoleName based on the Cost Centre


Parameters


icCostCentreCodeinputcharacterCost Center Code
ocRoleNameoutputcharacterRole Name
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


unused


program code (program3/bcinvoice.p)

if icCostCentreCode = ?
then assign icCostCentreCode = "":U.

if icCostCentreCode = "":U
then return.

<Q-2 run CostCentreByCodeID (all) (Read) (NoCache)
   (input viCompanyId, (CompanyId)
    input icCostCentreCode, (CostCentreCode)
    input 0, (CostCentreID)
    output dataset tqCostCentreByCodeID) in BCostCentre >

find tqCostCentreByCodeID where
     tqCostCentreByCodeID.tcCostCentreCode = icCostCentreCode
     no-error.

if not available tqCostCentreByCodeID
then return.

<Q-4 run RolePrim (all) (Read) (NoCache)
   (input ?, (RoleID)
    input 'CIA-':U + trim(tqCostCentreByCodeID.tcUsrName), (RoleName)
    output dataset tqRolePrim) in BRole >

find tqRolePrim where
     tqRolePrim.tcRoleName = 'CIA-':U + trim(tqCostCentreByCodeID.tcUsrName)
     no-error.

assign ocRoleName = if available tqRolePrim
                    then tqRolePrim.tcRoleName
                    else "":U.