report procedure
Parameters
Internal usage
unused
program code (program7/bfixedassetreport.p)
empty temp-table tqMovementsByAssetCode.
<M-58 run GetReportLabels (input 'MovementsByAssetCode':U (icReportName),
input icLanguageCode (icLanguageCode),
input tFilter (tFilter),
output tqHeader (tqHeader),
output tqFilter (tqFilter),
output tqText (tqText),
output oiReturnStatus (oiReturnStatus)) in BFixedAssetReport>
if oiReturnStatus <> 0
then return.
<M-59 run SetDataItemsBasedOnFilterTT (output viFcReturnSuper (oiReturnStatus)) in BFixedAssetReport>
assign vcErrorMsg = "":U.
if vcBookCodeFilter = ?
then do:
assign vcErrorMsg = #T-74'You must specify a value for the book filter.':50(14284)t-74#.
<M-60 run SetMessage (input vcErrorMsg (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QADFIN-3259':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BFixedAssetReport>
end.
if vcCurrencyLCCCFilter = ?
then do:
assign vcErrorMsg = #T-75'You must specify a value for the currency filter.':50(14285)t-75#.
<M-61 run SetMessage (input vcErrorMsg (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QADFIN-3260':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BFixedAssetReport>
end.
if (viFromBreakOffPeriodFilter = ? or viToBreakOffPeriodFilter = ?)
then do:
assign vcErrorMsg = #T-76'You enter a value for the From-To Break-Off Period filter.':100(14286)t-76#.
<M-62 run SetMessage (input vcErrorMsg (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QADFIN-3261':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BFixedAssetReport>
end.
if (viFromBreakOffYearFilter = ? or viToBreakOffYearFilter = ?)
then do:
assign vcErrorMsg = #T-78'You must enter a value for the From - To Break-Off Year filter.':100(14346)t-78#.
<M-77 run SetMessage (input vcErrorMsg (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QADFIN-3275':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BFixedAssetReport>
end.
if vcErrorMsg <> "":U
then do:
assign oiReturnStatus = -1.
return.
end.
<Q-64 run CapitalizedFixedAsset (all) (Read) (NoCache)
(input viCompanyId, (CompanyId)
input vcCandoAssetCodeFilter, (CandoFAAssetCode)
input vcFromAssetCodeFilter, (FromFAAssetCode)
input vcToAssetCodeFilter, (ToFAAssetCode)
input vcBookCodeFilter, (BookCode)
input vcCandoAssetTypeFilter, (CandoFAAssetType)
input vcFromAssetTypeFilter, (FromFAAssetType)
input vcToAssetTypeFilter, (ToFAAssetType)
input vcCandoGLCodeFilter, (CandoGLCode)
input vcFromGLCodeFilter, (FromGLCode)
input vcToGLCodeFilter, (ToGLCode)
input ?, (FromBreakOffPeriod)
input ?, (ToBreakOffPeriod)
input vcCandoFACatalogueValue2Filter, (CandoFACatalogueValue2)
input vcCandoFACatalogueValue3Filter, (CandoFACatalogueValue3)
input vcCandoFACatalogueValue4Filter, (CandoFACatalogueValue4)
input vcCandoFACatalogueValue5Filter, (CandoFACatalogueValue5)
input vcCandoFACatalogueValue6Filter, (CandoFACatalogueValue6)
output dataset tqCapitalizedFixedAsset) in BFixedAssetReport >
<Q-65 run DepriciationTrans (Start) in BFixedAssetReport >
<Q-66 run DisposalTrans (Start) in BFixedAssetReport >
<Q-67 run RevaluationTrans (Start) in BFixedAssetReport >
/* Create period code in shape YYYYPP */
assign viFromBreakOffPeriodFilter = viFromBreakOffYearFilter * 100 + viFromBreakOffPeriodFilter
viToBreakOffPeriodFilter = viToBreakOffYearFilter * 100 + viToBreakOffPeriodFilter.
/* Now we'll go through each record, grouped by Fixedasset_id and we'll aggregate values by asses and by given period */
for each tqCapitalizedFixedAsset break by tqCapitalizedFixedAsset.tiFAAsset_ID:
if first-of(tqCapitalizedFixedAsset.tiFAAsset_ID)
then do:
create tqMovementsByAssetCode.
buffer-copy tqCapitalizedFixedAsset to tqMovementsByAssetCode.
assign tqMovementsByAssetCode.tdCapitalizationLCCC =
if vcCurrencyLCCCFilter = "LC":U
then tqCapitalizedFixedAsset.tdFACapitalAmountLC
else tqCapitalizedFixedAsset.tdPostingLineDebitCC
tqMovementsByAssetCode.tdFAAssetBookSalvageAmountLCCC =
if vcCurrencyLCCCFilter = "LC":U
then tqCapitalizedFixedAsset.tdFAAssetBookSalvageAmountLC
else tqCapitalizedFixedAsset.tdFAAssetBookSalvageAmountCC.
end.
else do:
assign tqMovementsByAssetCode.tdCapitalizationLCCC =
tqMovementsByAssetCode.tdCapitalizationLCCC +
if vcCurrencyLCCCFilter = "LC":U
then tqCapitalizedFixedAsset.tdFACapitalAmountLC
else tqCapitalizedFixedAsset.tdPostingLineDebitCC.
end.
/* Now sum up all remaining values and split them into periods (before) <within> (after) */
if last-of(tqCapitalizedFixedAsset.tiFAAsset_ID)
then do:
assign tqMovementsByAssetCode.tdDeprecAfterLCCC = 0
tqMovementsByAssetCode.tdDeprecBeforeLCCC = 0
tqMovementsByAssetCode.tdDeprecWithinLCCC = 0
tqMovementsByAssetCode.tdDisposeAfterLCCC = 0
tqMovementsByAssetCode.tdDisposeBeforeLCCC = 0
tqMovementsByAssetCode.tdDisposeWithinLCCC = 0
tqMovementsByAssetCode.tdRevalAfterLCCC = 0
tqMovementsByAssetCode.tdRevalBeforeLCCC = 0
tqMovementsByAssetCode.tdRevalWithinLCCC = 0.
<Q-68 run DepriciationTrans (all) (Read) (NoCache)
(input viCompanyId, (CompanyId)
input ?, (FromBreakOffPeriod)
input ?, (ToBreakOffPeriod)
input tqCapitalizedFixedAsset.tiFAAsset_ID, (FAAssetID)
input vcBookCodeFilter, (BookCode)
output dataset tqDepriciationTrans) in BFixedAssetReport >
for each tqDepriciationTrans:
if tqDepriciationTrans.tiPeriodYearPeriod < viFromBreakOffPeriodFilter
then assign tqMovementsByAssetCode.tdDeprecBeforeLCCC =
tqMovementsByAssetCode.tdDeprecBeforeLCCC +
if vcCurrencyLCCCFilter = "LC":U
then tqDepriciationTrans.tdFADepreciationAmountLC
else tqDepriciationTrans.tdFADepreciationAmountCC.
else if tqDepriciationTrans.tiPeriodYearPeriod > viToBreakOffPeriodFilter
then assign tqMovementsByAssetCode.tdDeprecAfterLCCC =
tqMovementsByAssetCode.tdDeprecAfterLCCC +
if vcCurrencyLCCCFilter = "LC":U
then tqDepriciationTrans.tdFADepreciationAmountLC
else tqDepriciationTrans.tdFADepreciationAmountCC.
else assign tqMovementsByAssetCode.tdDeprecWithinLCCC =
tqMovementsByAssetCode.tdDeprecWithinLCCC +
if vcCurrencyLCCCFilter = "LC":U
then tqDepriciationTrans.tdFADepreciationAmountLC
else tqDepriciationTrans.tdFADepreciationAmountCC.
end.
<Q-69 run DisposalTrans (all) (Read) (NoCache)
(input viCompanyId, (CompanyId)
input tqCapitalizedFixedAsset.tiFAAsset_ID, (FAAssetID)
input vcBookCodeFilter, (BookType)
input ?, (PeriodFrom)
input ?, (PeriodTo)
output dataset tqDisposalTrans) in BFixedAssetReport >
for each tqDisposalTrans:
if tqDisposalTrans.tiPeriodYearPeriod < viFromBreakOffPeriodFilter
then assign tqMovementsByAssetCode.tdDisposeBeforeLCCC =
tqMovementsByAssetCode.tdDisposeBeforeLCCC +
if vcCurrencyLCCCFilter = "LC":U
then tqDisposalTrans.tdFADisposalAmountLC
else tqDisposalTrans.tdFADisposalAmountCC.
else if tqDisposalTrans.tiPeriodYearPeriod > viToBreakOffPeriodFilter
then assign tqMovementsByAssetCode.tdDisposeAfterLCCC =
tqMovementsByAssetCode.tdDisposeAfterLCCC +
if vcCurrencyLCCCFilter = "LC":U
then tqDisposalTrans.tdFADisposalAmountLC
else tqDisposalTrans.tdFADisposalAmountCC.
else assign tqMovementsByAssetCode.tdDisposeWithinLCCC =
tqMovementsByAssetCode.tdDisposeWithinLCCC +
if vcCurrencyLCCCFilter = "LC":U
then tqDisposalTrans.tdFADisposalAmountLC
else tqDisposalTrans.tdFADisposalAmountCC.
end.
<Q-70 run RevaluationTrans (all) (Read) (NoCache)
(input viCompanyId, (CompanyId)
input ?, (FromBreakOffPeriod)
input ?, (ToBreakOffPeriod)
input tqCapitalizedFixedAsset.tiFAAsset_ID, (FAAssetID)
input vcBookCodeFilter, (BookCode)
output dataset tqRevaluationTrans) in BFixedAssetReport >
for each tqRevaluationTrans:
if tqRevaluationTrans.tiPeriodYearPeriod < viFromBreakOffPeriodFilter
then assign tqMovementsByAssetCode.tdRevalBeforeLCCC =
tqMovementsByAssetCode.tdRevalBeforeLCCC +
if vcCurrencyLCCCFilter = "LC":U
then tqRevaluationTrans.tdFARevalAmountLC
else tqRevaluationTrans.tdFARevalAmountCC.
else if tqRevaluationTrans.tiPeriodYearPeriod > viToBreakOffPeriodFilter
then assign tqMovementsByAssetCode.tdRevalAfterLCCC =
tqMovementsByAssetCode.tdRevalAfterLCCC +
if vcCurrencyLCCCFilter = "LC":U
then tqRevaluationTrans.tdFARevalAmountLC
else tqRevaluationTrans.tdFARevalAmountCC.
else assign tqMovementsByAssetCode.tdRevalWithinLCCC =
tqMovementsByAssetCode.tdRevalWithinLCCC +
if vcCurrencyLCCCFilter = "LC":U
then tqRevaluationTrans.tdFARevalAmountLC
else tqRevaluationTrans.tdFARevalAmountCC.
end.
end.
end.
<Q-71 run DepriciationTrans (Stop) in BFixedAssetReport >
<Q-72 run DisposalTrans (Stop) in BFixedAssetReport >
<Q-73 run RevaluationTrans (Stop) in BFixedAssetReport >