project QadFinancials > class BBudget > method BudgetCheckInfoResolveReadWBS
Description
This method is just a submethod of the instanceless method BudgetCheckInfoResolve that will create tBudgetCheckInfoWBSTemp-records
Parameters
iiSafDepth | input | integer | SafDepth |
olBudgetWBSByAllNotFound | output | logical | |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program8/bbudget.p)
/* ========================= */
/* Set default Return Status */
/* ========================= */
assign oiReturnStatus = -98.
/* ======================================================================================== */
/* Prerequisites; */
/* - tBudgetCheckInfoWBSTemp is empty */
/* - This method should be in the same segment as the caller */
/* - Following records should be available: */
/* tBudgetByBudgetIDCodeStatus, tBudgetCheckInfo, tqBudgetPeriodByBudgetIDDate, */
/* tqBudgetVersionByBudgetIDStat, tqBudgetFDSByBudgetIDType and tqBudgetCompanyByBudgetID */
/* ======================================================================================== */
empty temp-table tBudgetCheckInfoWBSTemp.
/* =============================================================================================== */
/* Actions; */
/* 001: State the saf-information and state the Code-value (always needed) */
/* 101: Read all the WBS-records of the FDS-type and create tBudgetCheckInfoWBSTemp-records for */
/* the tq-records */
/* 102: Read the WBS-records of the FDS-type for the parents in tBudgetCheckInfoWBS and create */
/* tBudgetCheckInfoWBSTemp-records for the tq-records */
/* 103: Read the WBS-records of the FDS-type based for parents in tBudgetCheckInfoWBS and create */
/* tBudgetCheckInfoWBSTemp-records of the tBudgetCheckInfoWBS-records but set the WBS-ID of */
/* these newly created records equal the WBS-ID of the tq-records */
/* 201: Remove the tBudgetCheckInfoWBSTemp-records that have a FDS-code (list, matching, ...) or */
/* budgetgroup that does not fit the info in tBudgetCheckInfo */
/* This can be split into several mechanisms: */
/* 201-1: Equal Match (FDSCode - no *, no #) */
/* 201-2: Matches (FDSCode with *) */
/* 201-3: All - except the defined ones of the same parent (FDSCode with #) */
/* 201-4: FromTo (FDSFromCode+FDSToCode) */
/* 201-5: List (FDSList) */
/* 201-6: BudgetGroup (BudgetGroupID) */
/* =============================================================================================== */
/* =============================================================================================== */
/* Different situations; */
/* A: FDSLevel = 1 and Type <> Total (Action 001+101+201) */
/* B: FDSLevel <> 1 and Type <> Total (Action 001+102+201) */
/* C: FDSLevel = 1 and Type = Total (Action 001+101) */
/* C: FDSLevel <> 1 and Type = Total (Action 001+103) */
/* =============================================================================================== */
/* ========================================================================== */
/* 001. State the Saf-information based on the FDS-type we are checking */
/* ========================================================================== */
if tqBudgetFDSByBudgetIDType.tcBudgetFDSType = {&BUDGETFDSTYPE-SAF}
then do :
assign viSafStructureID = tBudgetCheckInfo.tiSafStructureID.
case iiSafDepth:
when 1 then assign viSafConceptID = tBudgetCheckInfo.tiSafConcept1ID
vcCode = tBudgetCheckInfo.tcSaf1Code.
when 2 then assign viSafConceptID = tBudgetCheckInfo.tiSafConcept2ID
vcCode = tBudgetCheckInfo.tcSaf2Code.
when 3 then assign viSafConceptID = tBudgetCheckInfo.tiSafConcept3ID
vcCode = tBudgetCheckInfo.tcSaf3Code.
when 4 then assign viSafConceptID = tBudgetCheckInfo.tiSafConcept4ID
vcCode = tBudgetCheckInfo.tcSaf4Code.
when 5 then assign viSafConceptID = tBudgetCheckInfo.tiSafConcept5ID
vcCode = tBudgetCheckInfo.tcSaf5Code.
end case.
end. /* if tqBudgetFDSByBudgetIDType.tcBudgetFDSType = {&BUDGETFDSTYPE-SAF} */
else do :
assign viSafConceptID = 0
viSafStructureID = 0.
case tqBudgetFDSByBudgetIDType.tcBudgetFDSType :
when {&BUDGETFDSTYPE-GL}
then assign vcCode = tBudgetCheckInfo.tcGLCode.
when {&BUDGETFDSTYPE-DIVISION}
then assign vcCode = tBudgetCheckInfo.tcDivisionCode.
when {&BUDGETFDSTYPE-PROJECT}
then assign vcCode = tBudgetCheckInfo.tcProjectCode.
when {&BUDGETFDSTYPE-COSTCENTRE}
then assign vcCode = tBudgetCheckInfo.tcCostCentreCode.
end case.
end. /* if tqBudgetFDSByBudgetIDType.tcBudgetFDSType = {&BUDGETFDSTYPE-SAF} */
/* ============= */
/* Read the data */
/* ============= */
if tqBudgetFDSByBudgetIDType.tiBudgetFDSSeq = 1
then do :
/* ======================================================== */
/* 101: Read all the WBS-records of the FDS-type and create */
/* tBudgetCheckInfoWBSTemp-records for the tq-records */
/* ======================================================== */
for each tBudgetWBSByAll where
tBudgetWBSByAll.tiBudgetFDSSeq = tqBudgetFDSByBudgetIDType.tiBudgetFDSSeq and
tBudgetWBSByAll.tiSafStructure_ID = viSafStructureID and
tBudgetWBSByAll.tiSafConcept_ID = viSafConceptID :
create tBudgetCheckInfoWBSTemp.
assign tBudgetCheckInfoWBSTemp.tiBudgetCheckInfoID = tBudgetCheckInfo.tiBudgetCheckInfoID
tBudgetCheckInfoWBSTemp.tcCallerReference = tBudgetCheckInfo.tcCallerReference
tBudgetCheckInfoWBSTemp.tcCurrencyCode = tBudgetByBudgetIDCodeStatus.tcCurrencyCode
tBudgetCheckInfoWBSTemp.tcBudgetCode = tBudgetByBudgetIDCodeStatus.tcBudgetCode
tBudgetCheckInfoWBSTemp.tiBudgetID = tBudgetByBudgetIDCodeStatus.tiBudget_ID
tBudgetCheckInfoWBSTemp.tcProjectCode = tBudgetByBudgetIDCodeStatus.tcProjectCode
tBudgetCheckInfoWBSTemp.tcCostCentreCode = tBudgetByBudgetIDCodeStatus.tcCostCentreCode
tBudgetCheckInfoWBSTemp.tlBudgetIsSendError = tBudgetByBudgetIDCodeStatus.tlBudgetIsSendError
tBudgetCheckInfoWBSTemp.tlBudgetIsSendWarning = tBudgetByBudgetIDCodeStatus.tlBudgetIsSendWarning
tBudgetCheckInfoWBSTemp.tiBudgetPeriodID = tqBudgetPeriodByBudgetIDDate.tiBudgetPeriod_ID
tBudgetCheckInfoWBSTemp.tiBudgetPeriodSeq = tqBudgetPeriodByBudgetIDDate.tiBudgetPeriodSeq
tBudgetCheckInfoWBSTemp.tcBudgetVersionCode = tqBudgetVersionByBudgetIDStat.tcBudgetVersionCode
tBudgetCheckInfoWBSTemp.tiBudgetVersionID = tqBudgetVersionByBudgetIDStat.tiBudgetVersion_ID
tBudgetCheckInfoWBSTemp.tiReportPeriodID = tqBudgetVersionByBudgetIDStat.tiReportPeriod_ID
tBudgetCheckInfoWBSTemp.tlReportPeriodIsReported = tqBudgetVersionByBudgetIDStat.tlReportPeriodIsReported
tBudgetCheckInfoWBSTemp.tcBudgetCheckReportPeriod = tBudgetByBudgetIDCodeStatus.tcBudgetCheckReportPeriod
tBudgetCheckInfoWBSTemp.tiReportPeriodYear = tqBudgetVersionByBudgetIDStat.tiReportPeriodYear
tBudgetCheckInfoWBSTemp.tiReportPeriodPeriod = tqBudgetVersionByBudgetIDStat.tiReportPeriodPeriod
tBudgetCheckInfoWBSTemp.tcBudgetWBSCode = tBudgetWBSByAll.tcBudgetWBSCode
tBudgetCheckInfoWBSTemp.tiBudgetWBSID = tBudgetWBSByAll.tiBudgetWBS_ID
tBudgetCheckInfoWBSTemp.tcBudgetWBSOverrunPeriod = tBudgetWBSByAll.tcBudgetWBSOverrunPeriod
tBudgetCheckInfoWBSTemp.tcBudgetWBSOverrunYTD = tBudgetWBSByAll.tcBudgetWBSOverrunYTD
tBudgetCheckInfoWBSTemp.tcBudgetWBSOverrunTotal = tBudgetWBSByAll.tcBudgetWBSOverrunTotal
tBudgetCheckInfoWBSTemp.tcBudgetWBSTcRowid = entry(1,tBudgetWBSByAll.tc_rowid)
tBudgetCheckInfoWBSTemp.tcBudgetWBSCostRevenue = tBudgetWBSByAll.tcBudgetWBSCostRevenue
tBudgetCheckInfoWBSTemp.tcFDSCode = tBudgetWBSByAll.tcBudgetWBSFDSCode
tBudgetCheckInfoWBSTemp.tcFDSFromCode = tBudgetWBSByAll.tcBudgetWBSFDSFromCode
tBudgetCheckInfoWBSTemp.tcFDSToCode = tBudgetWBSByAll.tcBudgetWBSFDSToCode
tBudgetCheckInfoWBSTemp.tcFDSList = tBudgetWBSByAll.tcBudgetWBSFDSList
tBudgetCheckInfoWBSTemp.tcFDSType = tBudgetWBSByAll.tcBudgetFDSType
tBudgetCheckInfoWBSTemp.tiBudgetGroupID = tBudgetWBSByAll.tiBudgetGroup_ID
tBudgetCheckInfoWBSTemp.tiParentBudgetWBSID = tBudgetWBSByAll.tiParentBudgetWBS_ID
tBudgetCheckInfoWBSTemp.tiUnitID = tBudgetWBSByAll.tiUnit_ID
tBudgetCheckInfoWBSTemp.tiCurrencyID = tBudgetByBudgetIDCodeStatus.tiCurrency_ID
tBudgetCheckInfoWBSTemp.tlBudgetIsUsedForAllocation = tBudgetByBudgetIDCodeStatus.tlBudgetIsUsedForAllocation
tBudgetCheckInfoWBSTemp.tlBudgetFDSIsAllocationTotal = tqBudgetFDSByBudgetIDType.tlBudgetFDSIsAllocationTotal
tBudgetCheckInfoWBSTemp.tiSafConceptID = tBudgetWBSByAll.tiSafConcept_ID
tBudgetCheckInfoWBSTemp.tiUsrId = tBudgetByBudgetIDCodeStatus.tiUsr_ID.
end. /* tBudgetWBSByAll */
end. /* if tqBudgetFDSByBudgetIDType.tiBudgetFDSSeq = 1 */
else do :
if tqBudgetFDSByBudgetIDType.tcBudgetFDSType <> {&BUDGETFDSTYPE-TOTAL}
then do :
/* ================================================================================= */
/* 102: Read the WBS-records of the FDS-type for the parents in tBudgetCheckInfoWBS */
/* and create tBudgetCheckInfoWBSTemp-records for the tq-records */
/* ================================================================================= */
for each tBudgetCheckInfoWBSOneBudget :
for each tBudgetWBSByAll where
tBudgetWBSByAll.tiBudgetFDSSeq = tqBudgetFDSByBudgetIDType.tiBudgetFDSSeq and
tBudgetWBSByAll.tiParentBudgetWBS_ID = tBudgetCheckInfoWBSOneBudget.tiBudgetWBSID and
tBudgetWBSByAll.tiSafStructure_ID = viSafStructureID and
tBudgetWBSByAll.tiSafConcept_ID = viSafConceptID :
assign olBudgetWBSByAllNotfound = false.
create tBudgetCheckInfoWBSTemp.
assign tBudgetCheckInfoWBSTemp.tiBudgetCheckInfoID = tBudgetCheckInfo.tiBudgetCheckInfoID
tBudgetCheckInfoWBSTemp.tcCallerReference = tBudgetCheckInfo.tcCallerReference
tBudgetCheckInfoWBSTemp.tcCurrencyCode = tBudgetByBudgetIDCodeStatus.tcCurrencyCode
tBudgetCheckInfoWBSTemp.tcBudgetCode = tBudgetByBudgetIDCodeStatus.tcBudgetCode
tBudgetCheckInfoWBSTemp.tiBudgetID = tBudgetByBudgetIDCodeStatus.tiBudget_ID
tBudgetCheckInfoWBSTemp.tcProjectCode = tBudgetByBudgetIDCodeStatus.tcProjectCode
tBudgetCheckInfoWBSTemp.tcCostCentreCode = tBudgetByBudgetIDCodeStatus.tcCostCentreCode
tBudgetCheckInfoWBSTemp.tlBudgetIsSendError = tBudgetByBudgetIDCodeStatus.tlBudgetIsSendError
tBudgetCheckInfoWBSTemp.tlBudgetIsSendWarning = tBudgetByBudgetIDCodeStatus.tlBudgetIsSendWarning
tBudgetCheckInfoWBSTemp.tiBudgetPeriodID = tqBudgetPeriodByBudgetIDDate.tiBudgetPeriod_ID
tBudgetCheckInfoWBSTemp.tiBudgetPeriodSeq = tqBudgetPeriodByBudgetIDDate.tiBudgetPeriodSeq
tBudgetCheckInfoWBSTemp.tcBudgetVersionCode = tqBudgetVersionByBudgetIDStat.tcBudgetVersionCode
tBudgetCheckInfoWBSTemp.tiBudgetVersionID = tqBudgetVersionByBudgetIDStat.tiBudgetVersion_ID
tBudgetCheckInfoWBSTemp.tiReportPeriodID = tqBudgetVersionByBudgetIDStat.tiReportPeriod_ID
tBudgetCheckInfoWBSTemp.tlReportPeriodIsReported = tqBudgetVersionByBudgetIDStat.tlReportPeriodIsReported
tBudgetCheckInfoWBSTemp.tcBudgetCheckReportPeriod = tBudgetByBudgetIDCodeStatus.tcBudgetCheckReportPeriod
tBudgetCheckInfoWBSTemp.tiReportPeriodYear = tqBudgetVersionByBudgetIDStat.tiReportPeriodYear
tBudgetCheckInfoWBSTemp.tiReportPeriodPeriod = tqBudgetVersionByBudgetIDStat.tiReportPeriodPeriod
tBudgetCheckInfoWBSTemp.tcBudgetWBSCode = tBudgetWBSByAll.tcBudgetWBSCode
tBudgetCheckInfoWBSTemp.tiBudgetWBSID = tBudgetWBSByAll.tiBudgetWBS_ID
tBudgetCheckInfoWBSTemp.tcBudgetWBSOverrunPeriod = tBudgetWBSByAll.tcBudgetWBSOverrunPeriod
tBudgetCheckInfoWBSTemp.tcBudgetWBSOverrunYTD = tBudgetWBSByAll.tcBudgetWBSOverrunYTD
tBudgetCheckInfoWBSTemp.tcBudgetWBSOverrunTotal = tBudgetWBSByAll.tcBudgetWBSOverrunTotal
tBudgetCheckInfoWBSTemp.tcBudgetWBSTcRowid = entry(1,tBudgetWBSByAll.tc_rowid)
tBudgetCheckInfoWBSTemp.tcBudgetWBSCostRevenue = tBudgetWBSByAll.tcBudgetWBSCostRevenue
tBudgetCheckInfoWBSTemp.tcFDSCode = tBudgetWBSByAll.tcBudgetWBSFDSCode
tBudgetCheckInfoWBSTemp.tcFDSFromCode = tBudgetWBSByAll.tcBudgetWBSFDSFromCode
tBudgetCheckInfoWBSTemp.tcFDSToCode = tBudgetWBSByAll.tcBudgetWBSFDSToCode
tBudgetCheckInfoWBSTemp.tcFDSList = tBudgetWBSByAll.tcBudgetWBSFDSList
tBudgetCheckInfoWBSTemp.tcFDSType = tBudgetWBSByAll.tcBudgetFDSType
tBudgetCheckInfoWBSTemp.tiBudgetGroupID = tBudgetWBSByAll.tiBudgetGroup_ID
tBudgetCheckInfoWBSTemp.tiParentBudgetWBSID = tBudgetWBSByAll.tiParentBudgetWBS_ID
tBudgetCheckInfoWBSTemp.tiUnitID = tBudgetWBSByAll.tiUnit_ID
tBudgetCheckInfoWBSTemp.tiCurrencyID = tBudgetByBudgetIDCodeStatus.tiCurrency_ID
tBudgetCheckInfoWBSTemp.tlBudgetIsUsedForAllocation = tBudgetByBudgetIDCodeStatus.tlBudgetIsUsedForAllocation
tBudgetCheckInfoWBSTemp.tlBudgetFDSIsAllocationTotal = tqBudgetFDSByBudgetIDType.tlBudgetFDSIsAllocationTotal
tBudgetCheckInfoWBSTemp.tiSafConceptID = tBudgetWBSByAll.tiSafConcept_ID
tBudgetCheckInfoWBSTemp.tiUsrId = tBudgetByBudgetIDCodeStatus.tiUsr_ID.
end. /* for each tBudgetWBSByAll */
end. /* for each tBudgetCheckInfoWBSOneBudget */
end. /* if tqBudgetFDSByBudgetIDType.tcBudgetFDSType <> {&BUDGETFDSTYPE-TOTAL} */
else do :
/* ================================================================================== */
/* 103: Read the WBS-records of the FDS-type based for parents in tBudgetCheckInfoWBS */
/* and create tBudgetCheckInfoWBSTemp-records of the tBudgetCheckInfoWBS-records but */
/* set the WBS-ID of these newly created records equal the WBS-ID of the tq-records */
/* ================================================================================= */
for each tBudgetCheckInfoWBSOneBudget :
for each tBudgetWBSByAll where
tBudgetWBSByAll.tiBudgetFDSSeq = tqBudgetFDSByBudgetIDType.tiBudgetFDSSeq and
tBudgetWBSByAll.tiParentBudgetWBS_ID = tBudgetCheckInfoWBSOneBudget.tiBudgetWBSID :
assign olBudgetWBSByAllNotfound = false.
create tBudgetCheckInfoWBSTemp.
buffer-copy tBudgetCheckInfoWBSOneBudget
to tBudgetCheckInfoWBSTemp
assign tBudgetCheckInfoWBSTemp.tiBudgetWBSID = tBudgetWBSByAll.tiBudgetWBS_ID.
end. /* for each tBudgetWBSByAll */
end. /* for each tBudgetCheckInfoWBSOneBudget */
end. /* if tqBudgetFDSByBudgetIDType.tcBudgetFDSType = {&BUDGETFDSTYPE-TOTAL} */
end. /* if tqBudgetFDSByBudgetIDType.tiBudgetFDSSeq <> 1 */
/* ============================================================================= */
/* 201: Remove the tBudgetCheckInfoWBSTemp-records that have a FDS-code (list, */
/* matching, ...) or budgetgroup that does not fit the info in tBudgetCheckInfo */
/* ============================================================================= */
if can-find (first tBudgetCheckInfoWBSTemp) and
tqBudgetFDSByBudgetIDType.tcBudgetFDSType <> {&BUDGETFDSTYPE-TOTAL}
then do :
<M-7 run BudgetCheckInfoResolveReadWBSSub (input vcCode (icCode),
input viSafStructureID (iiSafStructureID),
input viSafConceptID (iiSafConceptID),
output viFcReturnSuper (oiReturnStatus)) in BBudget>
if viFcReturnSuper <> 0
then do :
assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus < 0 then return.
end. /* if viFcReturnSuper <> 0 */
end. /* if can-find (first tBudgetCheckInfoWBSTemp) and */
/* =========================== */
/* Reset default Return Status */
/* =========================== */
if oiReturnStatus = -98
then assign oiReturnStatus = 0.