icFAAssetBookCalculationType | input | character | |
iiFAAssetBookLifeCycle | input | integer | |
iiFAAssetBookPeriodsDepreciated | input | integer | |
itFAAssetBookStartDate | input | date | |
itFAAssetBookNextPostingDate | input | date | |
iiDepreciationYear | input | integer | |
iiDepreciationPeriod | input | integer | |
idFAAssetBookCapitalAmountLC | input | decimal | |
idFAAssetBookDeprecAmountLC | input | decimal | |
idFAAssetBookSalvageAmountLC | input | decimal | |
idFAAssetBookDisposalAmountLC | input | decimal | |
idFAAssetBookDisposalDepAmountLC | input | decimal | |
tNewDepreciation | output | temp-table | |
oiReturnStatus | output | integer | Return status of the method. |
empty temp-table tNewDepreciation. case icFAAssetBookCalculationType: when {&BOOKCALCULATIONTYPE-FULLYEAR} then do: do viCounter = ((year(itFAAssetBookNextPostingDate) * 12) + month(itFAAssetBookNextPostingDate)) to ((iiDepreciationYear * 12) + iiDepreciationPeriod): if viCounter = ((year(itFAAssetBookNextPostingDate) * 12) + month(itFAAssetBookNextPostingDate)) then do: do viCounterStart = 1 to month(itFAAssetBookStartDate): create tNewDepreciation. assign tNewDepreciation.tdNewDeprAmountLC = (((idFAAssetBookCapitalAmountLC - idFAAssetBookSalvageAmountLC - idFAAssetBookDisposalAmountLC + idFAAssetBookDisposalDepAmountLC) * ((iiFAAssetBookLifeCycle - viCounterStart + 1) / (<M-8 GetTotalSumDigits (input iiFAAssetBookLifeCycle (iiFAAssetBookLifeCycle)) in BFixedAssetDepreciation>)))) vdNewDeprStartAmountLC = vdNewDeprStartAmountLC + tNewDepreciation.tdNewDeprAmountLC. end. empty temp-table tNewDepreciation. end. 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 viCounter = ((year(itFAAssetBookStartDate) * 12) + month(itFAAssetBookStartDate)) then vdNewDeprStartAmountLC else (((idFAAssetBookCapitalAmountLC - idFAAssetBookSalvageAmountLC - idFAAssetBookDisposalAmountLC + idFAAssetBookDisposalDepAmountLC) * ((iiFAAssetBookLifeCycle - iiFAAssetBookPeriodsDepreciated) / (<M-2 GetTotalSumDigits (input iiFAAssetBookLifeCycle (iiFAAssetBookLifeCycle)) in BFixedAssetDepreciation>)))). assign iiFAAssetBookPeriodsDepreciated = iiFAAssetBookPeriodsDepreciated + (if iiFAAssetBookPeriodsDepreciated = 0 and tNewDepreciation.tiNewDeprYear = year(itFAAssetBookStartDate) and tNewDepreciation.tiNewDeprMonth = month(itFAAssetBookStartDate) then tNewDepreciation.tiNewDeprMonth else 1). end. end. when {&BOOKCALCULATIONTYPE-TEMPORIS} /* NextPostingDate to Set = the last date of the month of the starting date if the asset is not yet depreciated */ then do viCounter = ((year(itFAAssetBookNextPostingDate) * 12) + month(itFAAssetBookNextPostingDate)) to ((iiDepreciationYear * 12) + iiDepreciationPeriod): 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 = ((idFAAssetBookCapitalAmountLC - idFAAssetBookSalvageAmountLC - idFAAssetBookDisposalAmountLC + idFAAssetBookDisposalDepAmountLC) * ((iiFAAssetBookLifeCycle - iiFAAssetBookPeriodsDepreciated) / (<M-4 GetTotalSumDigits (input iiFAAssetBookLifeCycle (iiFAAssetBookLifeCycle)) in BFixedAssetDepreciation>))). if tNewDepreciation.tdNewDeprAmountLC <= 0 then return. assign iiFAAssetBookPeriodsDepreciated = iiFAAssetBookPeriodsDepreciated + 1. end. when {&BOOKCALCULATIONTYPE-FULLYEARTEMPORIS} /* NextPostingDate to Set = the last date of the month of the starting date if the asset is not yet depreciated */ then do viCounter = ((year(itFAAssetBookNextPostingDate) * 12) + month(itFAAssetBookNextPostingDate)) to ((iiDepreciationYear * 12) + iiDepreciationPeriod): if viCounter = ((year(itFAAssetBookNextPostingDate) * 12) + month(itFAAssetBookNextPostingDate)) and year(itFAAssetBookNextPostingDate) = year(itFAAssetBookStartDate) then do: do viCounterStart = 1 to 12: create tNewDepreciation. assign tNewDepreciation.tdNewDeprAmountLC = ((idFAAssetBookCapitalAmountLC - idFAAssetBookSalvageAmountLC - idFAAssetBookDisposalAmountLC + idFAAssetBookDisposalDepAmountLC) * ((iiFAAssetBookLifeCycle - viCounterStart + 1) / (<M-7 GetTotalSumDigits (input iiFAAssetBookLifeCycle (iiFAAssetBookLifeCycle)) in BFixedAssetDepreciation>))) vdNewDeprStartAmountLC = vdNewDeprStartAmountLC + tNewDepreciation.tdNewDeprAmountLC. end. assign vdNewDeprStartAmountLC = vdNewDeprStartAmountLC / (12 - month(itFAAssetBookStartDate) + 1). empty temp-table tNewDepreciation. end. 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 tNewDepreciation.tiNewDeprYear = year(itFAAssetBookStartDate) then vdNewDeprStartAmountLC else ((idFAAssetBookCapitalAmountLC - idFAAssetBookSalvageAmountLC - idFAAssetBookDisposalAmountLC + idFAAssetBookDisposalDepAmountLC) * ((iiFAAssetBookLifeCycle - iiFAAssetBookPeriodsDepreciated) / (<M-6 GetTotalSumDigits (input iiFAAssetBookLifeCycle (iiFAAssetBookLifeCycle)) in BFixedAssetDepreciation>))). if tNewDepreciation.tdNewDeprAmountLC <= 0 then return. assign iiFAAssetBookPeriodsDepreciated = iiFAAssetBookPeriodsDepreciated + (if iiFAAssetBookPeriodsDepreciated = 0 and tNewDepreciation.tiNewDeprYear = year(itFAAssetBookStartDate) and tNewDepreciation.tiNewDeprMonth = month(itFAAssetBookStartDate) then tNewDepreciation.tiNewDeprMonth else 1). end. end.