project QadFinancials > class BBudget > method ValidateComponentBudgetWBS
Description
This method will check the content of a single BudgetWbs record.
Parameters
iiBudgetCompanyID | input | integer | BudgetCompanyID; Company_ID of one of the BudgetCompany records. As this is used to check the FDS information and as all companies should refer to to the same FDS structures (as fas as they are used inthe budget), it doesn't matter which one is used. |
icBudgetWBSTcRowid | input | character | BudgetWBSTcRowid |
icBudgetWBStcStatus | input | character | BudgetWBS tc status |
icBudgetWBSCode | input | character | BudgetWBSCode |
icBudgetWBSFDSType | input | character | BudgetWBSFDSType |
iiBudgetWBSFDSSeq | input | integer | BudgetWBSFDSSeq |
icBudgetWBSFDSCode | input | character | BudgetWBSFDS |
icBudgetWBSFDSList | input | character | BudgetWBSFDSList |
icBudgetWBSFDSFromCode | input | character | BudgetWBSFDSFormCode |
icBudgetWBSFDSToCode | input | character | BudgetWBSFDSToCode |
icBudgetWBSFDSDefault | input | character | BudgetWBSFDSDefault |
iiBudgetGroupID | input | integer | BudgetWBSBudgetGroupID. |
icBudgetGroupCode | input | character | BudgetWBSBudgetGroupCode |
iiSafStructureID | input | integer | SafStructureID |
icSafStructureCode | input | character | SafStructureCode |
iiSafConceptID | input | integer | SafConceptId |
icSafConceptCode | input | character | SAF Concept Code |
icBudgetProjectCode | input | character | BudgetProjectCode |
icBudgetCostCentreCode | input | character | BudgetCostCentreCode |
ilIsReportStructure | input | logical | |
iiAltCOAGroupID | input | integer | |
icAltCOAGroupCode | input | character | |
icFRWChartCode | input | character | |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program5/bbudget.p)
/* ====================================================== */
/* Replace unknown values // validate consistancy ID-Code */
/* ====================================================== */
if icBudgetWBSTcRowid = ? then assign icBudgetWBSTcRowid = "":U.
if icBudgetWBStcStatus = ? then assign icBudgetWBStcStatus = "":U.
if icBudgetWBSCode = ? then assign icBudgetWBSCode = "":U.
if icBudgetWBSFDSType = ? then assign icBudgetWBSFDSType = "":U.
if iiBudgetWBSFDSSeq = ? then assign iiBudgetWBSFDSSeq = 0.
if icBudgetWBSFDSList = ? then assign icBudgetWBSFDSList = "":U.
if icBudgetWBSFDSFromCode = ? then assign icBudgetWBSFDSFromCode = "":U.
if icBudgetWBSFDSToCode = ? then assign icBudgetWBSFDSToCode = "":U.
if icBudgetWBSFDSDefault = ? then assign icBudgetWBSFDSDefault = "":U.
if iiBudgetGroupID = ? then assign iiBudgetGroupID = 0.
if icBudgetGroupCode = ? then assign icBudgetGroupCode = "":U.
if iiAltCOAGroupID = ? then assign iiAltCOAGroupID = 0.
if icAltCOAGroupCode = ? then assign icAltCOAGroupCode = "":U.
if iiSafStructureID = ? then assign iiSafStructureID = 0.
if icSafStructureCode = ? then assign icSafStructureCode = "":U.
if iiSafConceptID = ? then assign iiSafConceptID = 0.
if icSafConceptCode = ? then assign icSafStructureCode = "":U.
if ilIsReportStructure = ? then assign ilIsReportStructure = no.
if iiBudgetGroupID = 0 and icBudgetGroupCode <> "":U
then do :
assign oiReturnStatus = -1
vcMessage = trim(substitute(#T-46'The budget WBS structure for WBS node &1 cannot be validated. The budget group code &2 was specified, but not the corresponding ID.':255(595)T-46#,icBudgetWBSCode,icBudgetGroupCode)).
<M-1 run SetMessage (input vcMessage (icMessage),
input '':U (icArguments),
input 'tBudgetWBS.tcBudgetGroupCode':U (icFieldName),
input icBudgetGroupCode (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input icBudgetWBSTcRowid (icRowid),
input 'QADFIN-520':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BBudget>
Return.
end. /* if iiBudgetGroupID = 0 and icBudgetGroupCode <> "":U */
if iiAltCOAGroupID = 0 and icAltCOAGroupCode <> "":U
then do :
assign oiReturnStatus = -1
vcMessage = trim(substitute(#T-58'Unable to validate the budget WBS structure for WBS node &1: the alternate coa group code (&2) was specified, but not the corresponding ID.':255(999890853)T-58#,icBudgetWBSCode,icAltCOAGroupCode)).
<M-57 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input 'tBudgetWBS.tcAltCOAGroupCode':U (icFieldName),
input icAltCOAGroupCode (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input icBudgetWBSTcRowid (icRowid),
input 'QadFin-9370':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BBudget>
return.
end. /* if iiAltCOAGroupID = 0 and icAltCOAGroupCode <> "":U */
if iiSafStructureID = 0 and icSafStructureCode <> "":U
then do :
assign oiReturnStatus = -1
vcMessage = trim(substitute(#T-47' The budget WBS structure for WBS node &1 cannot be validated. The SAF structure code &2 was specified, but not the corresponding ID.':255(596)T-47#,icBudgetWBSCode,icSafStructureCode)).
<M-2 run SetMessage (input vcMessage (icMessage),
input '':U (icArguments),
input 'tBudgetWBS.tcSafStructureCode':U (icFieldName),
input icSafStructureCode (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input icBudgetWBSTcRowid (icRowid),
input 'QADFIN-523':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BBudget>
Return.
end. /* iiSafStructureID = 0 and icSafStructureCode <> "":U */
if iiSafConceptID = 0 and icSafConceptCode <> "":U
then do :
assign oiReturnStatus = -1
vcMessage = trim(substitute(#T-48' The budget WBS structure for WBS node &1 cannot be validated. The SAF structure code &2 was specified, but not the corresponding ID.':255(596)T-48#,icBudgetWBSCode,icSafStructureCode)).
<M-3 run SetMessage (input vcMessage (icMessage),
input '':U (icArguments),
input 'tBudgetWBS.tcSafConceptCode':U (icFieldName),
input icSafConceptCode (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input icBudgetWBSTcRowid (icRowid),
input 'QADFIN-524':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BBudget>
Return.
end. /* iiSafConceptID = 0 and icSafConceptCode <> "":U */
/* ================== */
/* Check the FDS-type */
/* ================== */
assign vlFDSTypeIsValid = false.
assign vcBUDGETFDSTYPES ={&BUDGETFDSTYPES}.
do viCounter = num-entries(vcBUDGETFDSTYPES,chr(2)) to 1 by -2 :
if icBudgetWBSFDSType = entry(viCounter,vcBUDGETFDSTYPES,chr(2))
then assign vlFDSTypeIsValid = true.
end. /* do viCounter*/
if vlFDSTypeIsValid = false
then do :
assign oiReturnStatus = -1
vcMessage = trim(substitute(#T-49'The COA type &2 for WBS node &1 is invalid.':255(597)T-49#,icBudgetWBSCode,icBudgetWBSFDSType)).
<M-4 run SetMessage (input vcMessage (icMessage),
input '':U (icArguments),
input 'tBudgetWBS.BudgetFDSType':U (icFieldName),
input icBudgetWBSFDSType (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input icBudgetWBSTcRowid (icRowid),
input 'QADFIN-525':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BBudget>
Return.
end. /* if vlFDSTypeIsValid = false*/
/* ============================================================================ */
/* Find the current Wbs-record (use buffer to avoid conflicts with callers) */
/* Get the first BudgetCompany record; the information is used to check the FDS */
/* ============================================================================ */
find bCurrBudgetWbs where
bCurrBudgetWbs.tc_Rowid = icBudgetWBSTcRowid
NO-lock no-error.
if not available bCurrBudgetWbs
then do :
assign oiReturnStatus = -1
vcMessage = trim(substitute(#T-50'Cannot find the WBS node &1 based on its row ID &2.':255(598)T-50#,icBudgetWBSCode,icBudgetWBSTcRowid)).
<M-5 run SetMessage (input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input icBudgetWBSTcRowid (icRowid),
input 'QADFIN-526':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BBudget>
Return.
end. /* if not available bCurrBudgetWbs */
/* ============================================ */
/* Make sure exactly 1 of the 4 options is used */
/* ============================================ */
if icBudgetWBSFDSCode <> "":U then assign viFilledInFDSTopics = viFilledInFDSTopics + 1.
if icBudgetWBSFDSList <> "":U then assign viFilledInFDSTopics = viFilledInFDSTopics + 1.
if icBudgetWBSFDSFromCode <> "":U or
icBudgetWBSFDSToCode <> "":U
then assign viFilledInFDSTopics = viFilledInFDSTopics + 1.
if icBudgetGroupCode <> "":U or
iiBudgetGroupID <> 0
then assign viFilledInFDSTopics = viFilledInFDSTopics + 1.
if icAltCOAGroupCode <> "":U or
iiAltCOAGroupID <> 0
then assign viFilledInFDSTopics = viFilledInFDSTopics + 1.
if viFilledInFDSTopics > 1
then do :
assign oiReturnStatus = -1
vcMessage = trim(substitute(#T-51'WBS node &1. You can only specify only one of the following: Budget Group, List, Range (From/To) , Wildcard or Alternate COA Group.':255(733770729)T-51#,icBudgetWBSCode)).
<M-6 run SetMessage (input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input icBudgetWBSTcRowid (icRowid),
input 'QADFIN-527':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BBudget>
Return.
end. /* if viFilledInFDSTopics > 1 */
if viFilledInFDSTopics <> 1 and
icBudgetWBSFDSType <> {&BUDGETFDSTYPE-TOTAL}
then do :
assign oiReturnStatus = -1
vcMessage = trim(substitute(#T-52'WBS node &1. You must specify one of the following options: Budget Group, List, Range (from/to) or Wildcard.':255(600)T-52#,icBudgetWBSCode)).
<M-7 run SetMessage (input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input icBudgetWBSTcRowid (icRowid),
input 'QADFIN-528':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BBudget>
Return.
end. /* if viFilledInFDSTopics <> 1 and */
/* ============================================================================ */
/* If the FDS-From code is filled then the FDS-To code should be filled as well */
/* ============================================================================ */
if (icBudgetWBSFDSFromCode <> "":U and icBudgetWBSFDSToCode = "":U) or
(icBudgetWBSFDSFromCode = "":U and icBudgetWBSFDSToCode <> "":U)
then do :
assign oiReturnStatus = -1
vcMessage = trim(substitute(#T-53'WBS node &1. You must enter both values for From/To ranges.':255(601)T-53#,icBudgetWBSCode)).
<M-8 run SetMessage (input vcMessage (icMessage),
input '':U (icArguments),
input 'tBudgetWBS.BudgetWBSFDSFromCode':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input icBudgetWBSTcRowid (icRowid),
input 'QADFIN-529':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BBudget>
Return.
end. /* if */
/* ============================ */
/* Check the BudgetGroup Value */
/* ============================ */
if icBudgetGroupCode <> "":U
then do :
<Q-9 assign vlFcQueryRecordsAvailable = BudgetGroupPrim (NoCache)
(input ?, (BudgetGroupID)
input icBudgetGroupCode, (BudgetGroupCode)) in BBudgetGroup >
if vlFcQueryRecordsAvailable = false
then do :
assign oiReturnStatus = -1
vcMessage = trim(substitute(#T-54'WBS node &1. Budget group &2 is invalid.':255(602)T-54#,icBudgetWBSCode,icBudgetGroupCode)).
<M-10 run SetMessage (input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input icBudgetWBSTcRowid (icRowid),
input 'QADFIN-521':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BBudget>
Return.
end. /* if vlFcQueryRecordsAvailable = false */
end. /* if icBudgetGroupCode <> "":U */
/* ============================ */
/* Check the AltCOAGroup Value */
/* ============================ */
if icAltCOAGroupCode <> "":U
then do :
<Q-62 assign vlFcQueryRecordsAvailable = AltCOAGroupPrim (NoCache)
(input ?, (AltCOAGroupId)
input icAltCOAGroupCode, (AltCOAGroupCode)) in BAltCOAGroup >
if vlFcQueryRecordsAvailable = false
then do :
assign oiReturnStatus = -1
vcMessage = trim(substitute(#T-61'WBS node &1 - Invalid alternate coa group (&2).':255(999890855)T-61#,icBudgetWBSCode,icAltCOAGroupCode)).
<M-60 run SetMessage (input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input icBudgetWBSTcRowid (icRowid),
input 'QadFin-9371':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BBudget>
Return.
end. /* if vlFcQueryRecordsAvailable = false */
end. /* if icAltCOAGroupCode <> "":U */
/* ================================ */
/* Check the FDS-Code value */
/* ================================ */
if icBudgetWBSFDSCode <> "":U and
icBudgetWBSFDSCode <> "#":U and
index(icBudgetWBSFDSCode ,"*":U) = 0
then do :
assign oiReturnStatus = -1
vcMessage = trim(substitute(#T-55'WBS node &1. The COA wild card field should contain &2 or should be defined as empty &3.':255(603)T-55#,icBudgetWBSCode,"*":U,"#":U)).
<M-11 run SetMessage (input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input icBudgetWBSTcRowid (icRowid),
input 'QADFIN-522':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BBudget>
Return.
end. /* if icBudgetWBSFDSCode <> "":U and */
/* if you are in copy mode, next validations can be skipped */
if icBudgetWBStcStatus = "N":U and not(icBudgetWBSTcRowid begins "-":U)
then return.
/* ======================================== */
/* Check the FDS-List value (submethod) */
/* ======================================== */
if icBudgetWBSFDSList <> "":U
then do :
<M-43 run ValidateComponentBudgetWBSList
(input iiBudgetCompanyID (iiBudgetCompanyID),
input icBudgetWBSTcRowid (icBudgetWBSTcRowid),
input icBudgetWBSCode (icBudgetWBSCode),
input icBudgetWBSFDSType (icBudgetWBSFDSType),
input icBudgetWBSFDSList (icBudgetWBSFDSList),
input icSafConceptCode (icSafConceptCode),
input icFRWChartCode (icFRWChartCode),
output viFcReturnSuper (oiReturnStatus)) in BBudget>
if viFcReturnSuper <> 0 and viFcReturnSuper < oiReturnStatus
then assign oiReturnStatus = viFcReturnSuper.
end. /* if icBudgetWBSFDSList <> "":U */
/* ======================================== */
/* Check the FDS-From/To values (submethod) */
/* ======================================== */
if icBudgetWBSFDSFromCode <> "":U
then do :
<M-44 run ValidateComponentBudgetWBSRange (input iiBudgetCompanyID (iiBudgetCompanyID),
input icBudgetWBSTcRowid (icBudgetWBSTcRowid),
input icBudgetWBSCode (icBudgetWBSCode),
input icBudgetWBSFDSType (icBudgetWBSFDSType),
input icBudgetWBSFDSFromCode (icBudgetWBSFDSFromCode),
input icBudgetWBSFDSToCode (icBudgetWBSFDSToCode),
input icSafConceptCode (icSafConceptCode),
output viFcReturnSuper (oiReturnStatus)) in BBudget>
if viFcReturnSuper <> 0 and viFcReturnSuper < oiReturnStatus
then assign oiReturnStatus = viFcReturnSuper.
end. /* if icBudgetWBSFDSFormCode <> "":U */
/* ======================================== */
/* Check the FDS-Default (submethod) */
/* ======================================== */
if icBudgetWBSFDSDefault <> "":U
then do :
<M-45 run ValidateComponentBudgetWBSDef (input iiBudgetCompanyID (iiBudgetCompanyID),
input icBudgetWBSTcRowid (icBudgetWBSTcRowid),
input icBudgetWBSFDSCode (icBudgetWBSCode),
input icBudgetWBSFDSType (icBudgetWBSFDSType),
input icBudgetWBSFDSCode (icBudgetWBSFDSCode),
input icBudgetWBSFDSList (icBudgetWBSFDSList),
input icBudgetWBSFDSFromCode (icBudgetWBSFDSFromCode),
input icBudgetWBSFDSToCode (icBudgetWBSFDSToCode),
input icBudgetWBSFDSDefault (icBudgetWBSFDSDefault),
input icSafConceptCode (icSafConceptCode),
input icBudgetGroupCode (icBudgetGroupCode),
input icBudgetProjectCode (icBudgetProjectCode),
input icBudgetCostCentreCode (icBudgetCostCentreCode),
output viFcReturnSuper (oiReturnStatus)) in BBudget>
if viFcReturnSuper <> 0 and viFcReturnSuper < oiReturnStatus
then assign oiReturnStatus = viFcReturnSuper.
end. /* if icBudgetWBSFDSDefault <> "":U and */
/* Check for Structurereports */
if ilIsReportStructure
Then do:
<M-56 run ValidateComponentBudgetWBSIsReportStruct
(input icBudgetWBSTcRowid (icBudgetWBSTcRowid),
input icBudgetWBStcStatus (icBudgetWBStcStatus),
input icBudgetWBSCode (icBudgetWBSCode),
input icBudgetWBSFDSType (icBudgetWBSFDSType),
input iiBudgetWBSFDSSeq (iiBudgetWBSFDSSeq),
input icBudgetWBSFDSCode (icBudgetWBSFDSCode),
input icBudgetWBSFDSList (icBudgetWBSFDSList),
input icBudgetWBSFDSFromCode (icBudgetWBSFDSFromCode),
input icBudgetWBSFDSToCode (icBudgetWBSFDSToCode),
input icBudgetWBSFDSDefault (icBudgetWBSFDSDefault),
input iiBudgetGroupID (iiBudgetGroupID),
input icBudgetGroupCode (icBudgetGroupCode),
input iiBudgetCompanyID (iiBudgetCompanyID),
output viFcReturnSuper (oiReturnStatus)) in BBudget>
if viFcReturnSuper <> 0 and viFcReturnSuper < oiReturnStatus
then assign oiReturnStatus = viFcReturnSuper.
end.