Description
Validations before the ancestor code (The field AltCOAStructDetSeq in table tAltCOAStructDet saves the sequence of the record. This method will initial the sequence for all the detail lines.)
Parameters
| oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program5/baltcoastruct.p)
/* assign the sequence, level and leaf fields */
for each t_sAltCOAStruct where t_sAltCOAStruct.tc_Status <> "D":U:
assign vdSequence = 0.
for each t_sAltCOAStructDet where
t_sAltCOAStructDet.tc_Status <> "D":U and
t_sAltCOAStructDet.tc_ParentRowid = t_sAltCOAStruct.tc_Rowid :
/* assign AltCOAGroup ID */
if t_sAltCOAStructDet.tcAltCOAGroupCode <> ? and
t_sAltCOAStructDet.tcAltCOAGroupCode <> "":U and
(t_sAltCOAStructDet.AltCOAGroup_ID = 0 or
t_sAltCOAStructDet.AltCOAGroup_ID = ?)
then do:
<Q-2 run AltCOAGroupPrim (all) (Read) (NoCache)
(input ?, (AltCOAGroupId)
input t_sAltCOAStructDet.tcAltCOAGroupCode, (AltCOAGroupCode)
output dataset tqAltCOAGroupPrim) in BAltCOAGroup >
find first tqAltCOAGroupPrim no-error.
if available tqAltCOAGroupPrim
then assign t_sAltCOAStructDet.AltCOAGroup_ID = tqAltCOAGroupPrim.tiAltCOAGroup_ID.
end.
/*
/* get values for the sequence and level fields */
if (t_sAltCOAStructDet.ParentAltCOAStructDet_ID = 0 or
t_sAltCOAStructDet.ParentAltCOAStructDet_ID = ?)
/* assign the values for the first level record */
then do:
assign vdSequence = vdSequence + 1
t_sAltCOAStructDet.AltCOAStructDetSeq = string(vdSequence, "999")
t_sAltCOAStructDet.AltCOAStructDetLevel = 1
vdChildrenCounter = 0.
/* call the recursion method for handling all children records */
<M-3 run ValidateComponentPreSeq
(input t_sAltCOAStructDet.AltCOAStructDet_ID (iiParentAltCOAStructDetId),
input string(vdSequence, '999') (icParentSequence),
input t_sAltCOAStructDet.AltCOAStructDetLevel (iiParentLevel),
output vdChildrenCounter (odChildrenCounter),
output viFcReturnSuper (oiReturnStatus)) in BAltCOAStruct>
if vdChildrenCounter = 0
then assign t_sAltCOAStructDet.AltCOAStructDetIsLeaf = true.
end. /* end of if (t_sAltCOAStructDet.ParentAltCOAStructDet_ID = 0 */
*/
end. /* end of for each t_sAltCOAStructDet */
end. /* end of for each t_sAltCOAStruct */