Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

Differences Between: [Versions 400 and 401] [Versions 400 and 402] [Versions 400 and 403]

(no description)

File Size: 266 lines (10 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

Depreciation:: (10 methods):
  DB()
  DDB()
  SLN()
  SYD()
  validateCost()
  validateSalvage()
  validateLife()
  validatePeriod()
  validateMonth()
  validateFactor()


Class: Depreciation  - X-Ref

DB($cost, $salvage, $life, $period, $month = 12)   X-Ref
DB.

Returns the depreciation of an asset for a specified period using the
fixed-declining balance method.
This form of depreciation is used if you want to get a higher depreciation value
at the beginning of the depreciation (as opposed to linear depreciation). The
depreciation value is reduced with every depreciation period by the depreciation
already deducted from the initial cost.

Excel Function:
DB(cost,salvage,life,period[,month])

return: float|string
param: mixed $cost Initial cost of the asset
param: mixed $salvage Value at the end of the depreciation.
param: mixed $life Number of periods over which the asset is depreciated.
param: mixed $period The period for which you want to calculate the
param: mixed $month Number of months in the first year. If month is omitted,

DDB($cost, $salvage, $life, $period, $factor = 2.0)   X-Ref
DDB.

Returns the depreciation of an asset for a specified period using the
double-declining balance method or some other method you specify.

Excel Function:
DDB(cost,salvage,life,period[,factor])

return: float|string
param: mixed $cost Initial cost of the asset
param: mixed $salvage Value at the end of the depreciation.
param: mixed $life Number of periods over which the asset is depreciated.
param: mixed $period The period for which you want to calculate the
param: mixed $factor The rate at which the balance declines.

SLN($cost, $salvage, $life)   X-Ref
SLN.

Returns the straight-line depreciation of an asset for one period

return: float|string Result, or a string containing an error
param: mixed $cost Initial cost of the asset
param: mixed $salvage Value at the end of the depreciation
param: mixed $life Number of periods over which the asset is depreciated

SYD($cost, $salvage, $life, $period)   X-Ref
SYD.

Returns the sum-of-years' digits depreciation of an asset for a specified period.

return: float|string Result, or a string containing an error
param: mixed $cost Initial cost of the asset
param: mixed $salvage Value at the end of the depreciation
param: mixed $life Number of periods over which the asset is depreciated
param: mixed $period Period

validateCost($cost, bool $negativeValueAllowed = false)   X-Ref
No description

validateSalvage($salvage, bool $negativeValueAllowed = false)   X-Ref
No description

validateLife($life, bool $negativeValueAllowed = false)   X-Ref
No description

validatePeriod($period, bool $negativeValueAllowed = false)   X-Ref
No description

validateMonth($month)   X-Ref
No description

validateFactor($factor)   X-Ref
No description