public static function PHPExcel_Calculation_Financial::SLN in Loft Data Grids 7.2
Same name and namespace in other branches
- 6.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/Financial.php \PHPExcel_Calculation_Financial::SLN()
* SLN * * Returns the straight-line depreciation of an asset for one period * *
Parameters
cost Initial cost of the asset: * @param salvage Value at the end of the depreciation * @param life Number of periods over which the asset is depreciated * @return float
File
- vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Calculation/ Financial.php, line 1928
Class
- PHPExcel_Calculation_Financial
- PHPExcel_Calculation_Financial
Code
public static function SLN($cost, $salvage, $life) {
$cost = PHPExcel_Calculation_Functions::flattenSingleValue($cost);
$salvage = PHPExcel_Calculation_Functions::flattenSingleValue($salvage);
$life = PHPExcel_Calculation_Functions::flattenSingleValue($life);
// Calculate
if (is_numeric($cost) && is_numeric($salvage) && is_numeric($life)) {
if ($life < 0) {
return PHPExcel_Calculation_Functions::NaN();
}
return ($cost - $salvage) / $life;
}
return PHPExcel_Calculation_Functions::VALUE();
}