project QadFinancials > class BCInvoice > method DefaultValuesProject

Description

Return default value for RoleName based on the Project


Parameters


icProjectCodeinputcharacterProject Code
ilGetRoleinputlogical
ilGetDivisioninputlogical
ocRoleNameoutputcharacterRole Name
ocDivisionCodeoutputcharacter
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


unused


program code (program3/bcinvoice.p)

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

if icProjectCode = "":U
then return.

<Q-8 run ProjectForInvoiceDefault (all) (Read) (NoCache)
   (input viCompanyId, (CompanyId)
    input icProjectCode, (ProjectCode)
    output dataset tqProjectForInvoiceDefault) in BProject >

find first tqProjectForInvoiceDefault where
           tqProjectForInvoiceDefault.tcProjectCode = icProjectCode
           no-error.

if not available tqProjectForInvoiceDefault
then return.

if ilGetRole
then do:
    <Q-3 run RolePrim (all) (Read) (NoCache)
       (input ?, (RoleID)
        input 'CIA-':U + trim(tqProjectForInvoiceDefault.tcUsrName), (RoleName)
        output dataset tqRolePrim) in BRole >

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

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

if ilGetDivision                                         and
   tqProjectForInvoiceDefault.tiDivisionProfile_ID <> ? and
   tqProjectForInvoiceDefault.tiDivisionProfile_ID <> 0
then do:
    <Q-6 run GetDivisionFromProfile (all) (Read) (NoCache)
       (input viCompanyId, (CompanyId)
        input tqProjectForInvoiceDefault.tiDivisionProfile_ID, (DivisionProfileId)
        output dataset tqDivisionFromProfile) in BProfile >

    find first tqDivisionFromProfile
               no-error.

    assign ocDivisionCode = if available tqDivisionFromProfile
                            then tqDivisionFromProfile.tcDivisionCode
                            else "":U.
end.
else assign ocDivisionCode = "":U.