project QadFinancials > class BFixedAssetDepreciation > method DepreciationTypeUser1

Description

Execute Depreciations for the Type 'User Defined' (USER1) or 'Activity Related' (ACT1)


Parameters


icFAAssetBookDepreciationTypeinputcharacter
iiFAAssetBookIdinputinteger
iiFAAssetBookPeriodsDepreciatedinputinteger
itFAAssetBookStartDateinputdate
itFAAssetBookNextPostingDateinputdate
iiDepreciationYearinputinteger
iiDepreciationPeriodinputinteger
idFAAssetBookCapitalAmountLCinputdecimal
idFAAssetBookDeprecAmountLCinputdecimal
idFAAssetBookSalvageAmountLCinputdecimal
idFAAssetBookDisposalAmountLCinputdecimal
idFAAssetBookDisposalDepAmountLCinputdecimal
tNewDepreciationoutputtemp-table
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BFixedAssetDepreciation.DepreciationTypes


program code (program1/bfixedassetdepreciation.p)

empty temp-table tNewDepreciation.

do viCounter = ((year(itFAAssetBookNextPostingDate) * 12) + month(itFAAssetBookNextPostingDate)) to ((iiDepreciationYear * 12) + iiDepreciationPeriod):
    
    <Q-1 run FAAssetBookDeprecByAssetBook (all) (Read) (NoCache)
          (input iiFAAssetBookId, (FAAssetBookId)
           input integer(truncate(viCounter / 12,0)) - (if viCounter mod 12 = 0 then 1 else 0), (FADepreciationYear)
           input if viCounter mod 12 = 0 then 12 else viCounter mod 12, (FADepreciationMonth)
           output dataset tqFAAssetBookDeprecByAssetBook) in BFixedAssetAsset >
    find first tqFAAssetBookDeprecByAssetBook no-error.
    if available tqFAAssetBookDeprecByAssetBook
    then do:
        create tNewDepreciation.
        assign tNewDepreciation.tiNewDeprYear     = integer(truncate(viCounter / 12,0)) - (if viCounter mod 12 = 0 then 1 else 0)
               tNewDepreciation.tiNewDeprMonth    = if viCounter mod 12 = 0 then 12 else viCounter mod 12
               tNewDepreciation.tdNewDeprAmountLC = if icFAAssetBookDepreciationType = {&DEPRECIATIONTYPE-USER1}
                                                    then tqFAAssetBookDeprecByAssetBook.tdFAAssetBookDeprecAmountLC
                                                    else (tqFAAssetBookDeprecByAssetBook.tdFAAssetBookDeprecQTY * tqFAAssetBookDeprecByAssetBook.tdFAAssetBookDeprecPRICE). 
    end.
end.