project QadFinancials > class BBankEntry > method GetDefaultCCProjDivForControlGL
Parameters
iiControlGLProfileId | input | integer | |
iiDivisionProfileId | input | integer | |
ocGLCode | output | character | |
ocCostCentreCode | output | character | |
ocProjectCode | output | character | |
ocDivisionCode | output | character | |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program3/bbankentry.p)
if iiControlGLProfileId = ? or iiControlGLProfileId = 0
then return.
assign viDivisionProfileId = 0.
<Q-1 run ProfileLinkByGL (all) (Read) (NoCache)
(input iiControlGLProfileId, (GlProfileId)
input viCompanyId, (CompanyId)
output dataset tqProfileLinkByGL) in BProfile >
find first tqProfileLinkByGL where
tqProfileLinkByGL.tiProfile_ID = iiControlGLProfileId
no-error.
if available tqProfileLinkByGL and tqProfileLinkByGL.tiGL_ID <> ? and tqProfileLinkByGL.tiGL_ID <> 0
then do:
assign ocGLCode = tqProfileLinkByGL.tcGLCode.
/* Retrieve default Cost Center and Project */
<Q-2 run GLByGLAnalysis (all) (Read) (NoCache)
(input viCompanyId, (CompanyId)
input ?, (GLCode)
input tqProfileLinkByGL.tiGL_ID, (GLID)
output dataset tqGLByGLAnalysis) in BGL >
find first tqGLByGLAnalysis where
tqGLByGLAnalysis.tiGL_ID = tqProfileLinkByGL.tiGL_ID
no-error.
if available tqGLByGLAnalysis
then do:
if tqGLByGLAnalysis.tlGLIsCostCentreAccount
then assign ocCostCentreCode = tqGLByGLAnalysis.tcCostCentreCode.
if tqGLByGLAnalysis.tlGLIsProjectAccount
then assign ocProjectCode = tqGLByGLAnalysis.tcProjectCode.
end.
if tqProfileLinkByGL.tlGLIsDivisionAccount
then do:
/* Retrieve default division */
if iiDivisionProfileId <> 0 and iiDivisionProfileId <> ?
then assign viDivisionProfileId = iiDivisionProfileId.
else do:
<Q-3 run GLById (all) (Read) (NoCache)
(input ?, (CompanyId)
input tqProfileLinkByGL.tiGL_ID, (GLId)
output dataset tqGLById) in BGL >
find first tqGLById where
tqGLById.tiGL_ID = tqProfileLinkByGL.tiGL_ID
no-error.
if available tqGLById and tqGLById.tiDivisionProfile_ID <> 0 and tqGLById.tiDivisionProfile_ID <> ?
then viDivisionProfileId = tqGLById.tiDivisionProfile_ID.
end.
if viDivisionProfileId <> 0 and viDivisionProfileId <> ?
then do:
<Q-4 run GetDivisionFromProfile (all) (Read) (NoCache)
(input viCompanyId, (CompanyId)
input viDivisionProfileId, (DivisionProfileId)
output dataset tqDivisionFromProfile) in BProfile >
find first tqDivisionFromProfile where
tqDivisionFromProfile.tiProfile_ID = viDivisionProfileId
no-error.
if available tqDivisionFromProfile
then assign ocDivisionCode = tqDivisionFromProfile.tcDivisionCode.
end.
end.
end. /* if available tqProfileLinkByGL */