49 $basis = FinancialConstants::BASIS_DAYS_PER_YEAR_NASD
57 $basis = ($basis === null)
58 ? FinancialConstants::BASIS_DAYS_PER_YEAR_NASD
70 return $e->getMessage();
74 if (is_string($yearFrac)) {
78 $amortiseCoeff = self::getAmortizationCoefficient($rate);
80 $rate *= $amortiseCoeff;
81 $fNRate = round($yearFrac * $rate * $cost, 0);
83 $fRest = $cost - $salvage;
85 for (
$n = 0;
$n < $period; ++
$n) {
86 $fNRate = round($rate * $cost, 0);
90 switch ($period -
$n) {
93 return round($cost * 0.5, 0);
136 $basis = FinancialConstants::BASIS_DAYS_PER_YEAR_NASD
144 $basis = ($basis === null)
145 ? FinancialConstants::BASIS_DAYS_PER_YEAR_NASD
157 return $e->getMessage();
160 $fOneRate = $cost * $rate;
161 $fCostDelta = $cost - $salvage;
165 if (is_string($yearFrac)) {
170 ($basis == FinancialConstants::BASIS_DAYS_PER_YEAR_ACTUAL) &&
173 $yearFrac *= 365 / 366;
176 $f0Rate = $yearFrac * $rate * $cost;
177 $nNumOfFullPeriods = (int) (($cost - $salvage - $f0Rate) / $fOneRate);
181 } elseif ($period <= $nNumOfFullPeriods) {
183 } elseif ($period == ($nNumOfFullPeriods + 1)) {
184 return $fCostDelta - $fOneRate * $nNumOfFullPeriods - $f0Rate;
198 $fUsePer = 1.0 / $rate;
200 if ($fUsePer < 3.0) {
202 } elseif ($fUsePer < 4.0) {
204 } elseif ($fUsePer <= 6.0) {
static AMORLINC( $cost, $purchased, $firstPeriod, $salvage, $period, $rate, $basis=FinancialConstants::BASIS_DAYS_PER_YEAR_NASD)
AMORLINC.
static validateDate($date)
static year($dateValue)
YEAR.
static fraction($startDate, $endDate, $method=0)
YEARFRAC.
static isLeapYear($year)
Identify if a year is a leap year or not.
static AMORDEGRC( $cost, $purchased, $firstPeriod, $salvage, $period, $rate, $basis=FinancialConstants::BASIS_DAYS_PER_YEAR_NASD)
AMORDEGRC.
static validateFloat($value)
static validateInt($value)
static getAmortizationCoefficient(float $rate)
static flattenSingleValue($value='')
Convert an array to a single scalar value by extracting the first element.
static validateBasis($basis)