Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

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

(no description)

File Size: 267 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])

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,
return: float|string

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])

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.
return: float|string

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

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

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
return: float|string Result, or a string containing an error

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

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

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
return: float|string Result, or a string containing an error

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