mirror of
https://github.com/snipe/snipe-it.git
synced 2025-02-02 08:21:09 -08:00
Avoid trying to divide by zero
This commit is contained in:
parent
da8999f59a
commit
1098b8cd9d
|
@ -61,7 +61,7 @@ class DepreciationReportTransformer
|
||||||
/**
|
/**
|
||||||
* Override the previously set null values if there is a valid model and associated depreciation
|
* Override the previously set null values if there is a valid model and associated depreciation
|
||||||
*/
|
*/
|
||||||
if (($asset->model) && ($asset->model->depreciation)) {
|
if (($asset->model) && ($asset->model->depreciation) && ($asset->model->depreciation->months !== 0)) {
|
||||||
$depreciated_value = Helper::formatCurrencyOutput($asset->getDepreciatedValue());
|
$depreciated_value = Helper::formatCurrencyOutput($asset->getDepreciatedValue());
|
||||||
$monthly_depreciation =Helper::formatCurrencyOutput($asset->purchase_cost / $asset->model->depreciation->months);
|
$monthly_depreciation =Helper::formatCurrencyOutput($asset->purchase_cost / $asset->model->depreciation->months);
|
||||||
$diff = Helper::formatCurrencyOutput(($asset->purchase_cost - $asset->getDepreciatedValue()));
|
$diff = Helper::formatCurrencyOutput(($asset->purchase_cost - $asset->getDepreciatedValue()));
|
||||||
|
|
Loading…
Reference in a new issue