Parameters
Internal usage
QadFinancials
program code (program3/bfrwanalysiscode.p)
/* Get FRWChartCode */
find first tAnCodeforUpdate where
tAnCodeforUpdate.tcFRWCodeChartCode <> "":U and
tAnCodeforUpdate.tcFRWCodeChartCode <> ? no-error.
if available tAnCodeforUpdate then
assign vcFRWAnCodeChartCode = tAnCodeforUpdate.tcFRWCodeChartCode.
else return.
/* Assign FRWChart_ID */
<Q-18 run FRWChartPrim (all) (Read) (NoCache)
(input ?, (FRWChart_ID)
input vcFRWAnCodeChartCode, (FRWChartCode)
output dataset tqFRWChartPrim) in BFRWChart>
find first tqFRWChartPrim no-error.
if available tqFRWChartPrim
then do:
assign viFRWChart_ID = tqFRWChartPrim.tiFRWChart_ID.
end.
/* Validation */
<M-97 run ValidateAnCodeForUpdate
(input vcFRWAnCodeChartCode (icFRWChartCode),
output viFcReturnSuper (oiReturnStatus)) in BFRWAnalysisCode>
if viFcReturnSuper <> 0 then
assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus < 0 then
return.
empty temp-table tAnCodeExcelMapping.
for each tAnCodeforUpdate:
/* Assign Current Analysis Code */
if tAnCodeforUpdate.tcQAnCode <> "" then assign vcCurrenttcQAnCode = tAnCodeforUpdate.tcQAnCode.
else assign tAnCodeforUpdate.tcQAnCode = vcCurrenttcQAnCode.
vcFreeform = "for each FRWAnCode where FRWAnCode.FRWAnCodeFRWChartCode = '":U + vcFRWAnCodeChartCode + "'":U
+ " and FRWAnCode.FRWAnCodeCode = '":U + tAnCodeforUpdate.tcQAnCode + "'":U.
<M-32 run DataLoad
(input '' (icRowids),
input '' (icPkeys),
input '' (icObjectIds),
input vcFreeForm (icFreeform),
input yes (ilKeepPrevious),
output viFcReturnSuper (oiReturnStatus)) in BFRWAnalysisCode>
assign viDataLoadResult = viFcReturnSuper.
/* At this point starts the update of the Report Analysis Code. That should only happen when there is detail information */
if tAnCodeforUpdate.tcQAnAnalyseType <> "":U then
do:
/* Data Load successful. Delete also the dimensions that are not used anymore */
if viDataLoadResult >=0 then
do:
find first tFRWAnCode where
tFRWAnCode.FRWAnCodeFRWChartCode = vcFRWAnCodeChartCode and
tFRWAnCode.FRWAnCodeCode = tAnCodeforUpdate.tcQAnCode no-error.
if available tFRWAnCode then
do:
if tFRWAnCode.tc_Status = "":U then
do:
/* Delete FRWAnCodeElem data. */
for each tFRWAnCodeElem where tFRWAnCodeElem.FRWAnCode_ID = tFRWAnCode.FRWAnCode_ID:
assign tFRWAnCodeElem.tc_Status = "D":U.
end.
assign tFRWAnCode.tc_Status = "C":U.
end. /* If tFRWAnCode.tc_Status = "":U */
assign tFRWAnCode.FRWAnCodeDescription = tAnCodeforUpdate.tcQAnDesc.
create tAnCodeExcelMapping.
assign tAnCodeExcelMapping.tiQCode_ID = tFRWAnCode.FRWAnCode_ID
tAnCodeExcelMapping.tiRowNbr = tAnCodeforUpdate.tiRowNbr
tAnCodeExcelMapping.tcDataType = "tFRWAnCode":U.
end. /* If available tFRWAnCode */
end. /* If viDataLoadResult >=0 */
/* Data Load fail */
else do:
find first tFRWAnCode where
tFRWAnCode.FRWAnCodeCode = tAnCodeforUpdate.tcQAnCode and
tFRWAnCode.tc_Status = "N":U no-error.
if not available tFRWAnCode then
do:
<M-30 run AddDetailLine
(input 'FRWAnCode' (icTable),
input '' (icParentRowid),
output viFcReturnSuper (oiReturnStatus)) in BFRWAnalysisCode>
if viFcReturnSuper < 0 or (viFcReturnSuper > 0 and oiReturnStatus = 0) then
assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus < 0 then
return.
end.
assign
tFRWAnCode.FRWAnCodeCode = tAnCodeforUpdate.tcQAnCode
tFRWAnCode.FRWAnCodeFRWChartCode = vcFRWAnCodeChartCode
tFRWAnCode.FRWChart_ID = viFRWChart_ID
tFRWAnCode.FRWAnCodeDescription = tAnCodeforUpdate.tcQAnDesc.
create tAnCodeExcelMapping.
assign tAnCodeExcelMapping.tiQCode_ID = tFRWAnCode.FRWAnCode_ID
tAnCodeExcelMapping.tiRowNbr = tAnCodeforUpdate.tiRowNbr
tAnCodeExcelMapping.tcDataType = "tFRWAnCode":U.
end. /* Else */
/* Convert COA Type */
assign
vcCOAType = tAnCodeforUpdate.tcQAnCOAType.
if vcCOAType = "Entity" then assign vcCOAType = "Company".
if vcCOAType = "Sub-Account" then assign vcCOAType = "Division".
if vcCOAType = "Cost Center" then assign vcCOAType = "CostCentre".
if vcCOAType = "Daybook" then assign vcCOAType = "Journal".
assign
tFRWAnCode.FRWAnCodeAnalyseText = tAnCodeforUpdate.tcQAnAnalyseText
tFRWAnCode.FRWAnCodeXBRElement = tAnCodeforUpdate.tcQAnXBRL
tFRWAnCode.FRWAnCodeTaxoName = tAnCodeforUpdate.tcQAnTaxoName
tFRWAnCode.FRWAnCodeELR = tAnCodeforUpdate.tcQAnELR
tFRWAnCode.FRWAnCodeAnalyseType = tAnCodeforUpdate.tcQAnAnalyseType.
/* Handle data refer to Analysis Type */
if tFRWAnCode.FRWAnCodeAnalyseType = "A" then
do:
/* if tAnCodeforUpdate.tcQAnBegins = "<blank>" then assign tAnCodeforUpdate.tcQAnBegins = "".
if tAnCodeforUpdate.tcQFrom = "<blank>" then assign tAnCodeforUpdate.tcQFrom = "".
if tAnCodeforUpdate.tcQTo = "<blank>" then assign tAnCodeforUpdate.tcQTo = "".*/
if vcCOAType <> "" and
(tAnCodeforUpdate.tcQAnBegins <> "" or
tAnCodeforUpdate.tcQFrom <> "" or
tAnCodeforUpdate.tcQTo <> "" or
tAnCodeforUpdate.tiQListLength <> 0) then
do:
find first tFRWAnCodeElem where
tFRWAnCodeElem.FRWAnCode_ID = tFRWAnCode.FRWAnCode_ID and
tFRWAnCodeElem.FRWAnCodeElemCOAType = vcCOAType and
(tFRWAnCodeElem.tc_Status = "":U or
tFRWAnCodeElem.tc_Status = "N":U) no-error.
if not available tFRWAnCodeElem then
do:
<M-12 run AddDetailLine
(input 'FRWAnCodeElem' (icTable),
input tFRWAnCode.tc_Rowid (icParentRowid),
output viFcReturnSuper (oiReturnStatus)) in BFRWAnalysisCode>
assign
tFRWAnCodeElem.FRWAnCode_ID = tFRWAnCode.FRWAnCode_ID
tFRWAnCodeElem.FRWAnCodeElemCOAType = vcCOAType.
end.
else do:
if tFRWAnCodeElem.tc_Status = "":U then assign tFRWAnCodeElem.tc_Status = "C":U.
end.
assign
tFRWAnCodeElem.FRWAnCodeElemMask = tAnCodeforUpdate.tcQAnBegins
tFRWAnCodeElem.FRWAnCodeElemMaskRange1 = tAnCodeforUpdate.tcQFrom
tFRWAnCodeElem.FRWAnCodeElemMaskRange2 = tAnCodeforUpdate.tcQTo
tFRWAnCodeElem.FRWAnCodeElemIsDetRowExpl = tAnCodeforUpdate.tlQAnExplode.
create tAnCodeExcelMapping.
assign tAnCodeExcelMapping.tiQCode_ID = tFRWAnCodeElem.FRWAnCodeElem_ID
tAnCodeExcelMapping.tiRowNbr = tAnCodeforUpdate.tiRowNbr
tAnCodeExcelMapping.tcDataType = "tFRWAnCodeElem":U.
if tAnCodeforUpdate.tiQListLength <> 0 then
do:
do with viIndex = 1 to tAnCodeforUpdate.tiQListLength:
<M-89 run AddDetailLine
(input 'FRWAnCodeElemDet' (icTable),
input tFRWAnCodeElem.tc_Rowid (icParentRowid),
output viFcReturnSuper (oiReturnStatus)) in BFRWAnalysisCode>
assign
tFRWAnCodeElemDet.FRWAnCodeElem_ID = tFRWAnCodeElem.FRWAnCodeElem_ID
tFRWAnCodeElemDet.FRWAnCodeElemDetCode = ENTRY(viIndex, tAnCodeforUpdate.tcQList).
/* Get COA id */
<M-15 run GetCOAElementDescription
(input vcCOAType (icCOAElementType),
input 0 (iiCOAElement_ID),
input tFRWAnCodeElemDet.FRWAnCodeElemDetCode (icCOAElementCode),
output vcFRWAnCodeElementDetDesc (ocCOAElementDescription),
output viFRWAnCodeElementDet_ID (oiOutCOAElement_ID),
output viFcReturnSuper (oiReturnStatus)) in BFRWAnalysisCode>
assign oiReturnStatus = if (oiReturnStatus > 0 and
viFcReturnSuper = 0) or
oiReturnStatus < 0
then oiReturnStatus
else viFcReturnSuper.
if oiReturnStatus < 0
then return.
if tFRWAnCodeElemDet.FRWAnCodeElemDetCode = "<blank>" then
assign tFRWAnCodeElemDet.FRWAnCodeElemDetCode = "":U.
assign tFRWAnCodeElemDet.FRWAnCodeElemDetValue = viFRWAnCodeElementDet_ID.
create tAnCodeExcelMapping.
assign tAnCodeExcelMapping.tiQCode_ID = tFRWAnCodeElemDet.FRWAnCodeElemDet_ID
tAnCodeExcelMapping.tiRowNbr = tAnCodeforUpdate.tiRowNbr
tAnCodeExcelMapping.tcDataType = "tFRWAnCodeElemDet":U.
end. /* Do with viIndex = 1 to tAnCodeforUpdate.tiQListLength */
end. /* If tAnCodeforUpdate.tiQListLength <> 0 */
end. /* If vcCOAType <> "" */
end. /* If tFRWAnCode.FRWAnCodeAnalyseType = "A" */
if tFRWAnCode.FRWAnCodeAnalyseType = "C" then
do:
assign
tFRWAnCode.FRWAnCodeCalcElement = tAnCodeforUpdate.tcQAnCalcElement.
end.
if tFRWAnCode.FRWAnCodeAnalyseType = "S" then
do:
assign
tFRWAnCode.FRWAnCodeCalcElement = "".
end.
end. /* If tAnCodeforUpdate.tctcQAnCodeAnalysisType <> "" */
else
do:
if available tFRWAnCode then
do:
assign
tFRWAnCode.FRWAnCodeAnalyseText = tAnCodeforUpdate.tcQAnAnalyseText
tFRWAnCode.FRWAnCodeXBRElement = tAnCodeforUpdate.tcQAnXBRL
tFRWAnCode.FRWAnCodeTaxoName = tAnCodeforUpdate.tcQAnTaxoName
tFRWAnCode.FRWAnCodeELR = tAnCodeforUpdate.tcQAnELR
tFRWAnCode.tc_Status = "C":U
tFRWAnCode.FRWAnCodeDescription = tAnCodeforUpdate.tcQAnDesc.
create tAnCodeExcelMapping.
assign tAnCodeExcelMapping.tiQCode_ID = tFRWAnCode.FRWAnCode_ID
tAnCodeExcelMapping.tiRowNbr = tAnCodeforUpdate.tiRowNbr
tAnCodeExcelMapping.tcDataType = "tFRWAnCode":U.
end. /* If available tFRWAnCode */
end. /* Else */
end. /* For each tAnCodeforUpdate */
empty temp-table tFRWAnCodeNew.
for each tFRWAnCode where
tFRWAnCode.tc_Status = "N":U:
create tFRWAnCodeNew.
assign tFRWAnCodeNew.tiFRWAn_ID = tFRWAnCode.FRWAnCode_ID
tFRWAnCodeNew.tcAnalysisCode = tFRWAnCode.FRWAnCodeCode
tFRWAnCodeNew.tiFRWAnChart_ID = tFRWAnCode.FRWChart_ID
tFRWAnCodeNew.tcFRWAnCodeAnalysisType = tFRWAnCode.FRWAnCodeAnalyseType.
end.
/* Validations */
<M-96 run ValidateBC (output viFcReturnSuper (oiReturnStatus)) in BFRWAnalysisCode>
assign oiReturnStatus = if (oiReturnStatus > 0 and
viFcReturnSuper = 0) or
oiReturnStatus < 0
then oiReturnStatus
else viFcReturnSuper.
if oiReturnStatus < 0
then return.
/* AddtionalUpdates */
<M-83 run AdditionalUpdates (output viFcReturnSuper (oiReturnStatus)) in BFRWAnalysisCode>
assign oiReturnStatus = if (oiReturnStatus > 0 and
viFcReturnSuper = 0) or
oiReturnStatus < 0
then oiReturnStatus
else viFcReturnSuper.
if oiReturnStatus < 0
then return.
/* DataSave */
<M-91 run DataSave (output viFcReturnSuper (oiReturnStatus)) in BFRWAnalysisCode>
assign oiReturnStatus = if (oiReturnStatus > 0 and
viFcReturnSuper = 0) or
oiReturnStatus < 0
then oiReturnStatus
else viFcReturnSuper.
if oiReturnStatus < 0
then return.