project QadFinancials > class BFixedAssetReport > method TransactionsByAssetCode

report procedure


Parameters


icLanguageCodeinputcharacter
tFilterinputtemp-table
dcrTransactionsByAssetCodeoutputdataset
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


unused


program code (program7/bfixedassetreport.p)

empty temp-table tqTransactionsByAssetCode.

<M-1 run GetReportLabels (input  'TransactionsByAssetCode':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-2 run SetDataItemsBasedOnFilterTT (output viFcReturnSuper (oiReturnStatus)) in BFixedAssetReport>

assign vcErrorMsg = "":U.

if vcBookCodeFilter = ?
then do:
    assign vcErrorMsg = #T-17'You must specify a value for the book filter.':50(14284)t-17#.
    <M-3 run SetMessage (input  vcErrorMsg (icMessage), 
                     input  '':U (icArguments), 
                     input  '':U (icFieldName), 
                     input  '':U (icFieldValue), 
                     input  '':U (icType), 
                     input  3 (iiSeverity), 
                     input  '':U (icRowid), 
                     input  'QADFIN-3322':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-19'You enter a value for the From-To Break-Off Period filter.':100(14286)t-19#.
    <M-5 run SetMessage (input  vcErrorMsg (icMessage), 
                     input  '':U (icArguments), 
                     input  '':U (icFieldName), 
                     input  '':U (icFieldValue), 
                     input  '':U (icType), 
                     input  3 (iiSeverity), 
                     input  '':U (icRowid), 
                     input  'QADFIN-3324':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-20'You must enter a value for the From - To Break-Off Year filter.':100(14346)t-20#.
    <M-6 run SetMessage (input  vcErrorMsg (icMessage), 
                     input  '':U (icArguments), 
                     input  '':U (icFieldName), 
                     input  '':U (icFieldValue), 
                     input  '':U (icType), 
                     input  3 (iiSeverity), 
                     input  '':U (icRowid), 
                     input  'QADFIN-3325':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.

assign viFromPeriodYearPeriod = viFromBreakOffYearFilter * 100 + viFromBreakOffPeriodFilter
       viToPeriodYearPeriod   = viToBreakOffYearFilter * 100 + viToBreakOffPeriodFilter.        
                               
<Q-7 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 viToPeriodYearPeriod, (ToBreakOffPeriod)
           input vcCandoFACatalogueValue2Filter, (CandoFACatalogueValue2)
           input vcCandoFACatalogueValue3Filter, (CandoFACatalogueValue3)
           input vcCandoFACatalogueValue4Filter, (CandoFACatalogueValue4)
           input vcCandoFACatalogueValue5Filter, (CandoFACatalogueValue5)
           input vcCandoFACatalogueValue6Filter, (CandoFACatalogueValue6)
           output dataset tqCapitalizedFixedAsset) in BFixedAssetReport >                               

<Q-8 run DepriciationTrans (Start) in BFixedAssetReport >
<Q-9 run DisposalTrans (Start) in BFixedAssetReport >
<Q-10 run RevaluationTrans (Start) in BFixedAssetReport >

for each tqCapitalizedFixedAsset break by tqCapitalizedFixedAsset.tiFAAsset_ID:

    /* Filter out irrelevant fixed assets */
    if tqCapitalizedFixedAsset.tiPeriodYearPeriod >= viFromPeriodYearPeriod
    then do:
        create tqTransactionsByAssetCode.
        buffer-copy tqCapitalizedFixedAsset to tqTransactionsByAssetCode.
        assign tqTransactionsByAssetCode.tdAmountLC = tqCapitalizedFixedAsset.tdFACapitalAmountLC
               tqTransactionsByAssetCode.tdAmountCC = tqCapitalizedFixedAsset.tdPostingLineDebitCC
               tqTransactionsByAssetCode.tcTransactionType = #T-21'Capitalization':30(14430)T-21#
               tqTransactionsByAssetCode.tcDescription = tqCapitalizedFixedAsset.tcFACapitalDescription
               tqTransactionsByAssetCode.tcPostingText = tqCapitalizedFixedAsset.tcFACapitalDescription.
    end.
    
    if last-of(tqCapitalizedFixedAsset.tiFAAsset_ID)
    then do:
        <Q-11 run DepriciationTrans (all) (Read) (NoCache)
          (input viCompanyId, (CompanyId)
           input viFromPeriodYearPeriod, (FromBreakOffPeriod)
           input viToPeriodYearPeriod, (ToBreakOffPeriod)
           input tqCapitalizedFixedAsset.tiFAAsset_ID, (FAAssetID)
           input vcBookCodeFilter, (BookCode)
           output dataset tqDepriciationTrans) in BFixedAssetReport >
        for each tqDepriciationTrans:
            create tqTransactionsByAssetCode.
            buffer-copy tqCapitalizedFixedAsset to tqTransactionsByAssetCode.
            buffer-copy tqDepriciationTrans to tqTransactionsByAssetCode.
            assign tqTransactionsByAssetCode.tdAmountLC = - tqDepriciationTrans.tdFADepreciationAmountLC
                   tqTransactionsByAssetCode.tdAmountCC = - tqDepriciationTrans.tdFADepreciationAmountCC
                   tqTransactionsByAssetCode.tcTransactionType = #T-22'Depreciation':30(14431)T-22#
                   tqTransactionsByAssetCode.tcDescription = tqDepriciationTrans.tcFADepreciationDescription
                   tqTransactionsByAssetCode.tcPostingText = tqDepriciationTrans.tcFADepreciationDescription.                                                                                      
        end.
    
        <Q-12 run DisposalTrans (all) (Read) (NoCache)
          (input viCompanyId, (CompanyId)
           input tqCapitalizedFixedAsset.tiFAAsset_ID, (FAAssetID)
           input vcBookCodeFilter, (BookType)
           input viFromPeriodYearPeriod, (PeriodFrom)
           input viToPeriodYearPeriod, (PeriodTo)
           output dataset tqDisposalTrans) in BFixedAssetReport >
        /*todo - add period filter it si not possible now no link to period*/
        for each tqDisposalTrans:        
            create tqTransactionsByAssetCode.
            buffer-copy tqCapitalizedFixedAsset to tqTransactionsByAssetCode.            
            buffer-copy tqDisposalTrans to tqTransactionsByAssetCode.
            assign tqTransactionsByAssetCode.tdAmountLC = - tqDisposalTrans.tdFADisposalAmountLC
                   tqTransactionsByAssetCode.tdAmountCC = - tqDisposalTrans.tdFADisposalAmountCC
                   tqTransactionsByAssetCode.tcTransactionType = #T-23'Disposal':30(14432)T-23#.
        end.
    
        <Q-13 run RevaluationTrans (all) (Read) (NoCache)
          (input viCompanyId, (CompanyId)
           input viFromPeriodYearPeriod, (FromBreakOffPeriod)
           input viToPeriodYearPeriod, (ToBreakOffPeriod)
           input tqCapitalizedFixedAsset.tiFAAsset_ID, (FAAssetID)
           input vcBookCodeFilter, (BookCode)
           output dataset tqRevaluationTrans) in BFixedAssetReport >
        for each tqRevaluationTrans:      
            create tqTransactionsByAssetCode.
            buffer-copy tqCapitalizedFixedAsset to tqTransactionsByAssetCode.
            buffer-copy tqRevaluationTrans to tqTransactionsByAssetCode.
            assign tqTransactionsByAssetCode.tdAmountLC = tqRevaluationTrans.tdFARevalAmountLC
                   tqTransactionsByAssetCode.tdAmountCC = tqRevaluationTrans.tdFARevalAmountCC
                   tqTransactionsByAssetCode.tcTransactionType = #T-24'Revaluation':30(14433)T-24#.
        end.                                                  
    end.          
end.

<Q-14 run DepriciationTrans (Stop) in BFixedAssetReport >
<Q-15 run DisposalTrans (Stop) in BFixedAssetReport >
<Q-16 run RevaluationTrans (Stop) in BFixedAssetReport >