Parameters
| icfromreportyear | input | character | |
| ictoreportyear | input | character | |
| icfromreportperiod | input | character | |
| ictoreportperiod | input | character | |
| icCubeName | input | character | |
| iiAmountInView | input | integer | |
| icTaregetChart | input | character | |
| icAnCodeCode | input | character | |
| iiNodeID | input | integer | |
| tNewNode | output | temp-table | |
| tErrorTable | output | temp-table | |
| bcTempParams | input-output | character | |
| oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program1/tfrwtreeview.p)
empty temp-table tErrorTable.
empty temp-table tAnalelemcubedim.
empty temp-table tcube.
empty temp-table tancode.
empty temp-table tCols.
empty temp-table tancode.
empty temp-table tPerrange.
define buffer bcube for frwcube.
define buffer bcubecy for frwcubecy.
define buffer bcubeperiod for frwcubeperiod.
assign vifromreportyear = INTEGER(icfromreportyear)
vitoreportyear = INTEGER(ictoreportyear)
vifromreportperiod = INTEGER(icfromreportperiod)
vitoreportperiod = INTEGER(ictoreportperiod)
viAmountInView = iiAmountInView
oiReturnStatus = -98.
/* Get frwcube by cubeName */
assign vccubenames = icCubeName.
find frwcube where frwcube.frwcubecode = vccubenames no-lock no-error.
if not available frwcube then do:
/*This cube does not exist. */
create tErrorTable.
assign tErrorTable.tcErrorMessage = trim(#T-15'This cube does not exist.':255(757983350)T-15#)
oiReturnStatus = -1.
return.
end.
/* ================================================================= */
/* Create temp table tCols,tPerrange */
/* ================================================================= */
<M-92 run CreateTempTableBeforeAddNode (output viFcReturnSuper (oiReturnStatus)) in TFRWTreeView>
create tcube.
assign tcube.tccubename = vccubenames.
create tancode.
assign tancode.tcancode = icancodecode
tAnCode.tiLeafNodeID = iiNodeID.
/* Retrive Cube Dim */
<M-22 run GetFRWTreeLevel2NodeRetriveCubeDim
(input icTaregetChart (icTargetChart),
output viFcReturnSuper (oiReturnStatus)) in TFRWTreeView>
if viFcReturnSuper <> 0 then do:
assign oiReturnStatus = viFcReturnSuper.
return.
end.
/* Complete the tAnalElemcubedim */
for each tancode:
for each tPerrange:
for each tanalelemcubedim where tanalelemcubedim.tccubename = iccubename and
tanalelemcubedim.tcancode = tancode.tcancode use-index analelemcubedimanindex,
each frwcubedim where frwcubedim.frwcubedim_id = tanalelemcubedim.ticubedimid no-lock,
each frwcubemeas where frwcubemeas.frwcubedim_id = frwcubedim.frwcubedim_id and
frwcubemeasreportyear = tPerrange.tiyear and
frwcubemeasreportperiod >= tPerrange.tifromperiod and
frwcubemeasreportperiod <= tPerrange.titoperiod no-lock:
for each tColPer where tColPer.tiPerSeq = tPerrange.tiPerrangeSeq,
each tCols where tCols.tiSeq = tColPer.tiColSeq:
/* now we are sure about that this FRWCubeMeas needs to be added to some columns */
assign vdAmountx = 0.
if tCols.tcMeas = "ACT" then
assign vdAmountx = FRWCubeMeasactivityDRPC - FRWCubeMeasactivityCRPC.
if tCols.tcMeas = "ACTDR" then
assign vdAmountx = FRWCubeMeasactivityDRPC.
if tCols.tcMeas = "ACTCR" then
assign vdAmountx = FRWCubeMeasactivityCRPC.
if tCols.tcMeas = "ACTQTY" then
assign vdAmountx = FRWCubeMeasAcitivtyQTY.
if tCols.tcMeas = "ABC" then
assign vdAmountx = FRWCubeMeasactivityDRLC - FRWCubeMeasactivityCRLC.
if tCols.tcMeas = "ABCDR" then
assign vdAmountx = FRWCubeMeasactivityDRLC.
if tCols.tcMeas = "ABCCR" then
assign vdAmountx = FRWCubeMeasactivityCRLC.
if tCols.tcMeas begins "OP" and
FRWCubeMeasReportyear = tCols.tiFromYear and
FRWCubeMeasReportPeriod = tCols.tiFromPeriod then do:
if tCols.tcMeas = "OPEN" then
assign vdAmountx = FRWCubeMeasOpenBalPC.
if tCols.tcMeas = "OPENDR" then
assign vdAmountx = FRWCubeMeasOpenBalDRPC.
if tCols.tcMeas = "OPENCR" then
assign vdAmountx = FRWCubeMeasOpenBalCRPC.
if tCols.tcMeas = "OPENQTY" then
assign vdAmountx = FRWCubeMeasOpenBalQTY.
if tCols.tcMeas = "OPBC" then
assign vdAmountx = FRWCubeMeasOpenBalLC.
if tCols.tcMeas = "OPBCDR" then
assign vdAmountx = FRWCubeMeasOpenBalDRLC.
if tCols.tcMeas = "OPBCCR" then
assign vdAmountx = FRWCubeMeasOpenBalCRLC.
end. /* if tCols.tcMeas begins "OPEN" */
if tCols.tcMeas begins "CLO" and
FRWCubeMeasReportyear = tCols.tiToYear and
FRWCubeMeasReportPeriod = tCols.tiToPeriod then do:
if tCols.tcMeas = "CLOSE" then
assign vdAmountx = FRWCubeMeasCloseBalPC.
if tCols.tcMeas = "CLOSEDR" then
assign vdAmountx = FRWCubeMeasCloseBalDRPC.
if tCols.tcMeas = "CLOSECR" then
assign vdAmountx = FRWCubeMeasCloseBalCRPC.
if tCols.tcMeas = "CLOSEQTY" then
assign vdAmountx = FRWCubeMeasClosingBalQTY.
if tCols.tcMeas = "CLOBC" then
assign vdAmountx = FRWCubeMeasCloseBalLC.
if tCols.tcMeas = "CLOBCDR" then
assign vdAmountx = FRWCubeMeasCloseBalDRLC.
if tCols.tcMeas = "CLOBCCR" then
assign vdAmountx = FRWCubeMeasCloseBalCRLC.
end. /* if tCols.tcMeas begins "CLOSE" */
if vdAmountx <> 0 then
do:
assign tAnalelemcubedim.tlIsHasMeasure = yes.
end.
if tCols.tiSeq = 1 then assign tAnalelemcubedim.tdOpeningBalance = tAnalelemcubedim.tdOpeningBalance + vdAmountx.
if tCols.tiSeq = 2 then assign tAnalelemcubedim.tdActivityDR = tAnalelemcubedim.tdActivityDR + vdAmountx.
if tCols.tiSeq = 3 then assign tAnalelemcubedim.tdActivityCR = tAnalelemcubedim.tdActivityCR + vdAmountx.
if tCols.tiSeq = 4 then assign tAnalelemcubedim.tdClosingBalance = tAnalelemcubedim.tdClosingBalance + vdAmountx.
end. /* for each tCols */
end. /* for each tqAnalElemCubedim, FRWCubeDim, FRWCubeMeas */
end. /* for each tPerrange */
end. /* for each tancode*/
/* remove the cube dimension without the measure data. */
for each tAnalelemcubedim where tAnalelemcubedim.tlIsHasMeasure = no:
delete tAnalelemcubedim.
end.
/* Create output table */
empty temp-table tNewNode.
assign viGeoNumber = 1
viDummyNodeId = -1.
for each tAnalelemcubedim no-lock:
create tNewNode.
assign tNewNode.tiNodeID = viDummyNodeId
tNewNode.tcEntityName = tAnalelemcubedim.tcCompanyCode
tNewNode.tcCurrencyCodeTC = tAnalelemcubedim.tcCurrencyCode
tNewNode.tcLayer = tAnalelemcubedim.tcLayerCode
tNewNode.tcDaybook = tAnalelemcubedim.tcJournalCode
tNewNode.tcGL = tAnalelemcubedim.tcGLCode
tNewNode.tcSubAccount = tAnalelemcubedim.tcDivisionCode
tNewNode.tcCostCenter = tAnalelemcubedim.tcCostCentreCode
tNewNode.tcProjectCode = tAnalelemcubedim.tcProjectCode
tNewNode.tcIntercocode = tAnalelemcubedim.tcICInterco
tNewNode.tcSAF1 = tAnalelemcubedim.tcSafCode01
tNewNode.tcSAF2 = tAnalelemcubedim.tcSafCode02
tNewNode.tcSAF3 = tAnalelemcubedim.tcSafCode03
tNewNode.tcSAF4 = tAnalelemcubedim.tcSafCode04
tNewNode.tcSAF5 = tAnalelemcubedim.tcSafCode05
tNewNode.tcSAF6 = tAnalelemcubedim.tcSafCode06
tNewNode.tcSAF7 = tAnalelemcubedim.tcSafCode07
tNewNode.tcSAF8 = tAnalelemcubedim.tcSafCode08
tNewNode.tcSAF9 = tAnalelemcubedim.tcSafCode09
tNewNode.tcSAF10 = tAnalelemcubedim.tcSafCode10
tNewNode.tdOpeningBalance = tAnalelemcubedim.tdOpeningBalance
tNewNode.tdActivityDR = tAnalelemcubedim.tdActivityDR
tNewNode.tdActivityCR = tAnalelemcubedim.tdActivityCR
tNewNode.tdNetActivity = tAnalelemcubedim.tdActivityDR - tAnalelemcubedim.tdActivityCR
tNewNode.tdClosingBalance = tAnalelemcubedim.tdClosingBalance
tNewNode.tiGeoNumber = viGeoNumber
tNewNode.tcNodeDescription = tAnalelemcubedim.tcDescription
tNewNode.tiLeafType = 2
viGeoNumber = viGeoNumber + 1
viDummyNodeId = viDummyNodeId - 1.
end.
if viFcReturnSuper < 0 or viFcReturnSuper <> 0 then
assign oiReturnStatus = viFcReturnSuper.
else
assign oiReturnStatus = 0.