601,100
562,"NULL"
586,
585,
564,
565,"hdlITYA=aXVZ0>^Uf9^=h95`T[?@`mW@^D@dP1qeGChysxRHEG^t7rOzUyu44xJl@N209kEc1Lwprgy]sfWi2XKu^Ei>BVa\rTR;[AlP@TDNto7c=\gHQNj1xKdMbbhfxP6f\lY=>;q[i@pyQ32[UQ^I;1cP@6vjuNVyhqFvXOhlwCWf\:;au\xNR\bkOj0^47p]Uz]>"
559,0
593,
594,
595,
597,
598,
596,
800,
801,
566,0
567,","
588,"."
589,
568,""""
570,
571,
569,0
592,0
599,1000
560,7
Paction
Puser
Ptask_type
Ptask
Pversion
Pplan
pReturnStatusFile
561,7
2
2
2
2
2
2
2
590,7
Paction,"Submit"
Puser,"Planner"
Ptask_type,"subset"
Ptask,"test"
Pversion,"FY 2004 Budget"
Pplan,"plan_version"
pReturnStatusFile,""
637,7
Paction,Action?
Puser,User?
Ptask_type,What's being Passed ?
Ptask,element/subtask name ?
Pversion,Version name?
Pplan,Plan Name?
pReturnStatusFile,Status File
577,0
578,0
579,0
580,0
581,0
582,0
572,222

#****GENERATED STATEMENTS START****
#****GENERATED STATEMENTS FINISH****



### Pre defining the attributes to update based on the action being taken

vObjectPrefix = attrs('}sm_controls', 'subman_object_prefix', 'value');
vObjectSeparator = attrs('}sm_controls', 'subman_object_separator', 'value');

vSysPropertiesDim = '}sm_client_properties';
vLockedMsg = ' ' | ATTRS(vSysPropertiesDim, 'Task Locked Flag', 'Default Value');
IF (TRIM(vLockedMsg) @= '');
vLockedMsg = ' Locked';
ENDIF;
vLockedLong = LONG(vLockedMsg);

VvtDimension=vObjectPrefix|'sm_versiontasks';
VplantaskName=vObjectSeparator|Pplan;
VversionName = vObjectSeparator|Pversion;
VdimensionName=VvtDimension|VplantaskName|VversionName;

vStatusDim = vObjectPrefix | 'sm_task_status';
vActionDim = vObjectPrefix | 'sm_task_action';
vActionAttrDim = '}ElementAttributes_' | vdimensionName;
vStatus = ATTRS(vDimensionName, pTask, 'Status');
vLocking = ATTRS(vStatusDim, vStatus, 'Locking');

vCompletesWaiting = ATTRS(vStatusDim, vStatus, 'Completes Waiting');
vTriggersDependents = ATTRS(vStatusDim, vStatus, 'Triggers Dependent Tasks');
vReportedReload = 0;

IF (vLocking @= 'Lock');
VwhoAttr='Locked By User';
VwhenAttr='Locked Datetime';
ATTRINSERT(vDimensionName, '', vWhoAttr, 'S');
ATTRINSERT(vDimensionName, '', vWhenAttr, 'S');
ELSEIF (vLocking @= 'UnLock');
VwhoAttr='UnLocked By User';
VwhenAttr='UnLocked Datetime';
ATTRINSERT(vDimensionName, '', vWhoAttr, 'S');
ATTRINSERT(vDimensionName, '', vWhenAttr, 'S');
ENDIF;

IF (vTriggersDependents @= 'Y');
ATTRINSERT(vDimensionName, '', 'Dependent Tasks Triggered By User', 'S');
ATTRINSERT(vDimensionName, '', 'Dependent Tasks Triggered Datetime', 'S');
ENDIF;

IF (vCompletesWaiting @= 'Y');
ATTRINSERT(vDimensionName, '', 'Subtask Wait Completed By User', 'S');
ATTRINSERT(vDimensionName, '', 'Subtask Wait Completed Datetime', 'S');
ENDIF;

#### Action Date
Vdate=TIMST(NOW,'\m/\d/\Y  \h:\i ');
Vlevel= DNLEV(VdimensionName);

IF(Ptask_type@='element');

IF (pAction @= 'SET' & pTask @= 'Set Current Reporting Period');

ENDIF;
IF (pAction @= 'LOAD' & pTask @= 'Load Trial Balance');
EXECUTEPROCESS('fr_report_sample_trial balance');
ELSEIF (pAction @= 'LOAD' & pTask @= 'Load Balance Sheet');
EXECUTEPROCESS('fr_report_sample_balance sheet');
ELSEIF (pAction @= 'LOAD' & pTask @= 'Load Income Statement');
EXECUTEPROCESS('fr_report_sample_income statement');
ENDIF;

IF (vTriggersDependents @= 'Y');

pTaskName = ATTRS(vDimensionName, pTask, 'Task');

vTaskCount = DIMSIZ(vDimensionName);
vTaskIndex = 1;
WHILE (vTaskIndex <= vTaskCount);
vTriggerTask = DIMNM(vDimensionName, vTaskIndex);

IF (vTriggerTask @<> pTask);
IF (ATTRS(vDimensionName, vTriggerTask, 'Predecessor Task') @= pTaskName );
vTriggerStatus = ATTRS(vDimensionName, vTriggerTask, 'Status');
vTriggeredStatus = ATTRS(vStatusDim, vTriggerStatus, 'Waits for Predecessor Task');
IF (vTriggeredStatus @<> '');
ATTRPUTS(vTriggeredStatus, vDimensionName, vTriggerTask, 'Status');
ATTRPUTS(pUser, vDimensionName, vTriggerTask, 'Predecessor Completed By User');
ATTRPUTS(vDate, vDimensionName, vTriggerTask, 'Predecessor Completed Datetime');
IF (vReportedReload = 0 & pReturnStatusFile @<> '');
ASCIIOUTPUT(pReturnStatusFile, 'RELOADTASKLIST=TRUE');
vReportedReload = 1;
ENDIF;
ENDIF;
ENDIF;
ENDIF;

vTaskIndex = vTaskIndex + 1;

END;

ENDIF;

IF (vCompletesWaiting @= 'Y');
IF (ELPARN(vDimensionName, pTask) > 0);
vParentTask = ELPAR(vDimensionName, pTask, 1);
vParentStatus = ATTRS(vDimensionName, vParentTask, 'Status');
vWaitingCompleteStatus = ATTRS(vStatusDim, vParentStatus, 'Waits for Subtasks');
IF (vWaitingCompleteStatus @<> '');

vParentChildren = ELCOMPN(vDimensionName, vParentTask);
vParentChildIndex = 1;
vUpdateParent = -1;
WHILE (vParentChildIndex <= vParentChildren & vUpdateParent = -1);
vParentChild = ELCOMP(vDimensionName, vParentTask, vParentChildIndex);
IF (vParentChild @<> pTask);
IF (ATTRS(vStatusDim, ATTRS(vDimensionName, vParentChild, 'Status'), 'Completes Waiting') @<> 'Y');
vUpdateParent = 0;
ENDIF;
ENDIF;
vParentChildIndex = vParentChildIndex + 1;
END;
IF (vUpdateParent = -1);
ATTRPUTS(vWaitingCompleteStatus, vDimensionName, vParentTask, 'Status');
ATTRPUTS(pUser, vDimensionName, vParentTask, 'Subtask Wait Completed By User');
ATTRPUTS(vDate, vDimensionName, vParentTask, 'Subtask Wait Completed Datetime');
ENDIF;

ENDIF;
ENDIF;
ENDIF;

IF  (ELLEV(vDimensionName, pTask) > 0 & (vLocking @= 'Lock' % vLocking @= 'Unlock'));

vTaskCount = DIMSIZ(vDimensionName);
vTaskIndex = 1;
WHILE (vTaskIndex <= vTaskCount);
bChangeIt = 0;
vLockTask = DIMNM(vDimensionName, vTaskIndex);

IF (vLockTask @<> pTask & ELISANC(vDimensionName, pTask, vLockTask) <> 0);
vLockStatus = ATTRS(vDimensionName, vLockTask, 'Status');

IF ((vLocking @= 'Lock' & ATTRS(vStatusDim, vLockStatus, 'Lockable') @= 'Y') % (vLocking @= 'UnLock'));

vStatusLong = LONG(vLockStatus);
IF (vLocking @= 'Lock');

IF (vStatusLong <= vLockedLong);
bChangeIt = -1;
ELSE;
IF (SUBST(vLockStatus, 1 + (vStatusLong - vLockedLong), vLockedLong) @<> vLockedMsg);
bChangeIt = -1;
ENDIF;
ENDIF;
IF (bChangeIt = -1);
ATTRPUTS(vLockStatus | vLockedMsg, vDimensionName, vLockTask, 'Status');
ENDIF;

ELSE;

IF (vStatusLong > vLockedLong);
IF (SUBST(vLockStatus, 1 + (vStatusLong - vLockedLong), vLockedLong) @= vLockedMsg);
# iterate through parents and grandparents up to the unlocked task to make sure there isn't some other locking status
# if there isn't then unlock this task
vParCheck = 0;
vParSafety = 10;
vParIndex = 1;
vPar = ELPAR(vDimensionName, vLockTask, 1);
WHILE (vParCheck = 0 & vParIndex <= vParSafety & vPar @<> pTask);
IF (ATTRS(vStatusDim, ATTRS(vDimensionName, vPar, 'Status'), 'Locking') @= 'Lock');
vParCheck = 1;
ELSE;
vPar = ELPAR(vDimensionName, vPar, 1);
ENDIF;
vParIndex = vParIndex + 1;
END;

IF (vParCheck = 0);
bChangeIt = -1;
ATTRPUTS(SUBST(vLockStatus, 1, vStatusLong - vLockedLong), vDimensionName, vLockTask, 'Status');
ENDIF;
ENDIF;
ENDIF;

ENDIF;

IF (bChangeIt = -1);
if (vWhoAttr @<> '' );
AttrPutS(Puser,VdimensionName, vLockTask,Vwhoattr);
endif;
if (vWhenAttr @<> '');
AttrPutS(Vdate,VdimensionName, vLockTask,Vwhenattr);
endif;
ENDIF;
ENDIF;
ENDIF;

vTaskIndex = vTaskIndex + 1;
END;

ENDIF;




ELSE;

### SUBSET PASSED #########
VElementIdx=1;
VElementCount=SubsetGetSize(VdimensionName,Ptask);

While(VElementIdx <= VElementCount);


# this code not yet written

VelementIdx=VelementIdx+1;

end;

endif;
573,3

#****GENERATED STATEMENTS START****
#****GENERATED STATEMENTS FINISH****
574,3

#****GENERATED STATEMENTS START****
#****GENERATED STATEMENTS FINISH****
575,5

#****GENERATED STATEMENTS START****
#****GENERATED STATEMENTS FINISH****

EXECUTEPROCESS('}sm_create_versiontaskstatuses_cube');
576,CubeAction=1511	DataAction=1503	CubeLogChanges=0	
638,1
804,0
900,
901,
902,
903,
906,
907,
908,
904,0
905,0
909,0
910,0
911,
912,
913,
914,
915,
916,
