Vendor/phpspreadsheet/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial.php
public static function DB($cost, $salvage, $life, $period, $month = 12)
    {
        $cost = Functions::flattenSingleValue($cost);
        $salvage = Functions::flattenSingleValue($salvage);
        $life = Functions::flattenSingleValue($life);
        $period = Functions::flattenSingleValue($period);
        $month = Functions::flattenSingleValue($month);

        //    Validate
        if ((is_numeric($cost)) && (is_numeric($salvage)) && (is_numeric($life)) && (is_numeric($period)) && (is_numeric($month))) {
            $cost = (float) $cost;
            $salvage = (float) $salvage;
            $life = (int) $life;
            $period = (int) $period;
            $month = (int) $month;
            if ($cost == 0) {
                return 0.0;
            } elseif (($cost < 0) || (($salvage / $cost) < 0) || ($life <= 0) || ($period < 1) || ($month < 1)) {
                return Functions::NAN();
            }
            //    Set Fixed Depreciation Rate
            $fixedDepreciationRate = 1 - pow(($salvage / $cost), (1 / $life));
            $fixedDepreciationRate = round($fixedDepreciationRate, 3);

            //    Loop through each period calculating the depreciation
            $previousDepreciation = 0;
            for ($per = 1; $per <= $period; ++$per) {
                if ($per == 1) {
                    $depreciation = $cost * $fixedDepreciationRate * $month / 12;
                } elseif ($per == ($life + 1)) {
                    $depreciation = ($cost - $previousDepreciation) * $fixedDepreciationRate * (12 - $month) / 12;
                } else {
                    $depreciation = ($cost - $previousDepreciation) * $fixedDepreciationRate;
                }
                $previousDepreciation += $depreciation;
            }
            if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_GNUMERIC) {
                $depreciation = round($depreciation, 2);
            }

            return $depreciation;
        }

        return Functions::VALUE();
    }
public static function DB($cost, $salvage, $life, $period, $month = 12)
    {
        $cost = Functions::flattenSingleValue($cost);
        $salvage = Functions::flattenSingleValue($salvage);
        $life = Functions::flattenSingleValue($life);
        $period = Functions::flattenSingleValue($period);
        $month = Functions::flattenSingleValue($month);

        //    Validate
        if ((is_numeric($cost)) && (is_numeric($salvage)) && (is_numeric($life)) && (is_numeric($period)) && (is_numeric($month))) {
            $cost = (float) $cost;
            $salvage = (float) $salvage;
            $life = (int) $life;
            $period = (int) $period;
            $month = (int) $month;
            if ($cost == 0) {
                return 0.0;
            } elseif (($cost < 0) || (($salvage / $cost) < 0) || ($life <= 0) || ($period < 1) || ($month < 1)) {
                return Functions::NAN();
            }
            //    Set Fixed Depreciation Rate
            $fixedDepreciationRate = 1 - pow(($salvage / $cost), (1 / $life));
            $fixedDepreciationRate = round($fixedDepreciationRate, 3);

            //    Loop through each period calculating the depreciation
            $previousDepreciation = 0;
            for ($per = 1; $per <= $period; ++$per) {
                if ($per == 1) {
                    $depreciation = $cost * $fixedDepreciationRate * $month / 12;
                } elseif ($per == ($life + 1)) {
                    $depreciation = ($cost - $previousDepreciation) * $fixedDepreciationRate * (12 - $month) / 12;
                } else {
                    $depreciation = ($cost - $previousDepreciation) * $fixedDepreciationRate;
                }
                $previousDepreciation += $depreciation;
            }
            if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_GNUMERIC) {
                $depreciation = round($depreciation, 2);
            }

            return $depreciation;
        }

        return Functions::VALUE();
    }
public static function DB ( $ cost , $ salvage , $ life , $ period , $ month = 12 ) { $ cost = Functions :: flattenSingleValue ( $ cost ) ; $ salvage = Functions :: flattenSingleValue ( $ salvage ) ; $ life = Functions :: flattenSingleValue ( $ life ) ; $ period = Functions :: flattenSingleValue ( $ period ) ; $ month = Functions :: flattenSingleValue ( $ month ) ; //    Validate if ( ( is_numeric ( $ cost ) ) && ( is_numeric ( $ salvage ) ) && ( is_numeric ( $ life ) ) && ( is_numeric ( $ period ) ) && ( is_numeric ( $ month ) ) ) { $ cost = ( float ) $ cost ; $ salvage = ( float ) $ salvage ; $ life = ( int ) $ life ; $ period = ( int ) $ period ; $ month = ( int ) $ month ; if ( $ cost == 0 ) { return 0.0 ; } elseif ( ( $ cost < 0 ) || ( ( $ salvage / $ cost ) < 0 ) || ( $ life <= 0 ) || ( $ period < 1 ) || ( $ month < 1 ) ) { return Functions :: NAN ( ) ; } //    Set Fixed Depreciation Rate $ fixedDepreciationRate = 1 - pow ( ( $ salvage / $ cost ) , ( 1 / $ life ) ) ; $ fixedDepreciationRate = round ( $ fixedDepreciationRate , 3 ) ; //    Loop through each period calculating the depreciation $ previousDepreciation = 0 ; for ( $ per = 1 ; $ per <= $ period ; ++ $ per ) { if ( $ per == 1 ) { $ depreciation = $ cost * $ fixedDepreciationRate * $ month / 12 ; } elseif ( $ per == ( $ life + 1 ) ) { $ depreciation = ( $ cost - $ previousDepreciation ) * $ fixedDepreciationRate * ( 12 - $ month ) / 12 ; } else { $ depreciation = ( $ cost - $ previousDepreciation ) * $ fixedDepreciationRate ; } $ previousDepreciation += $ depreciation ; } if ( Functions :: getCompatibilityMode ( ) == Functions :: COMPATIBILITY_GNUMERIC ) { $ depreciation = round ( $ depreciation , 2 ) ; } return $ depreciation ; } return Functions :: VALUE ( ) ; }
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])

@category Financial Functions

@param float $cost Initial cost of the asset
@param float $salvage Value at the end of the depreciation.
(Sometimes called the salvage value of the asset)
@param int $life Number of periods over which the asset is depreciated.
(Sometimes called the useful life of the asset)
@param int $period The period for which you want to calculate the
depreciation. Period must use the same units as life.
@param int $month Number of months in the first year. If month is omitted,
it defaults to 12.

@return float
DB .