project QadFinancials > class BBudget > method BudgetWBSAutoLink
Description
This method is used to autolink BudgetWBS and FDS.
Parameters
icBudgetTcRowid | input | character | BudgetTcRowid |
icBudgetWBSTcRowid | input | character | BudgetWBSTcRowid |
tNewBudgetWBS | input | temp-table | Input temp-table that should contain all WBS-nodes that are childs of the node identiefied by BudgetWBSTcRowid. |
tNewMBudgetWBS | output | temp-table | Output temp-table that should contain all WBS-nodes that are childs of the node identiefied by BudgetWBSTcRowid |
icBudgetFRWChartCode | input | character | |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
unused
program code (program9/bbudget.p)
/* it's possible to autolink with restricted option or with full option */
empty temp-table tNewMBudgetWBS.
/* ------------------------------------------------- */
/* validate all the inputparameters */
/* ------------------------------------------------- */
/* check if there are records in the temptable that will be used */
find first tNewBudgetWBS
no-lock no-error.
if not available tNewBudgetWBS
then do:
assign oiReturnStatus = -3.
<M-1 run SetMessage
(input trim(#T-7'Not all of the parameters have the correct value.':255(703)t-7#) (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QADFIN-2245':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BBudget>
end.
/* all records with FDS type SAF must have a safstructure */
for each tNewBudgetWBS:
if tNewBudgetWBS.BudgetFDSType = {&BUDGETFDSTYPE-SAF} and
(tNewBudgetWBS.SafStructure_ID = ? or
tNewBudgetWBS.SafStructure_ID = 0)
then do:
assign oiReturnStatus = -3.
<M-2 run SetMessage
(input trim(#T-8'No SAF structure is available for the COA type SAF.':255(704)T-8#) (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QADFIN-2246':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BBudget>
leave.
end.
end.
if oiReturnStatus = -1
then return.
/* -------------------------------------------------- */
/* start of the mainprogram */
/* -------------------------------------------------- */
/* restricted option is choosen */
if icBudgetWBSTcRowid <> "":U and icBudgetWBSTcRowid <> ?
then do:
find tNewBudgetWBS where
tNewBudgetWBS.tc_Rowid = icBudgetWBSTcRowid
no-lock no-error.
if available tNewBudgetWBS
then do:
<M-3 run BudgetWBSAutoLinkAssignFDS
(input-output vcBudgetWBSCodes (bcBudgetWBSCodes),
input icBudgetFRWChartCode (icBudgetFRWChartCode),
output viFcReturnSuper (oiReturnStatus)) in BBudget>
if viFcReturnSuper < 0 or (viFcReturnSuper > 0 and oiReturnStatus = 0)
then assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus < 0
then return.
<M-5 run BudgetWBSAutoLinkCycle
(input tNewBudgetWBS.BudgetWBS_ID (iiParentBudgetWBSID),
input-output vcBudgetWBSCodes (bcBudgetWBSCodes),
input icBudgetFRWChartCode (icBudgetFRWChartCode),
output viFcReturnSuper (oiReturnStatus)) in BBudget>
if viFcReturnSuper < 0 or (viFcReturnSuper > 0 and oiReturnStatus = 0)
then assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus < 0
then return.
end.
end. /* icBudgetWBSTcRowid <> "":U */
/* FULL option is choosen */
else do:
<M-4 run BudgetWBSAutoLinkCycle
(input 0 (iiParentBudgetWBSID),
input-output vcBudgetWBSCodes (bcBudgetWBSCodes),
input icBudgetFRWChartCode (icBudgetFRWChartCode),
output viFcReturnSuper (oiReturnStatus)) in BBudget>
if viFcReturnSuper < 0 or (viFcReturnSuper > 0 and oiReturnStatus = 0)
then assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus < 0
then return.
end.
if oiReturnStatus = 1
then do:
<M-6 run SetMessage
(input trim(#T-9'The WBS codes ($1) are already linked to a COA.':255(705)T-9#) (icMessage),
input vcBudgetWBSCodes (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'W':U (icType),
input 3 (iiSeverity),
input ? (icRowid),
input 'QADFIN-2268':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BBudget>
end.