mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-09 23:24:06 -08:00
Merge pull request #11642 from Godmartinz/monthly_depreciation_calculation
Fixes Monthly depreciation calculation if EOL is blank
This commit is contained in:
commit
a834ac6ec2
|
@ -63,10 +63,16 @@ class DepreciationReportTransformer
|
||||||
*/
|
*/
|
||||||
if (($asset->model) && ($asset->model->depreciation)) {
|
if (($asset->model) && ($asset->model->depreciation)) {
|
||||||
$depreciated_value = Helper::formatCurrencyOutput($asset->getDepreciatedValue());
|
$depreciated_value = Helper::formatCurrencyOutput($asset->getDepreciatedValue());
|
||||||
$monthly_depreciation = Helper::formatCurrencyOutput(($asset->model->eol > 0 ? ($asset->purchase_cost / $asset->model->eol) : 0));
|
if($asset->model->eol==0 || $asset->model->eol==null ){
|
||||||
|
$monthly_depreciation = Helper::formatCurrencyOutput($asset->purchase_cost / $asset->model->depreciation->months);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$monthly_depreciation = Helper::formatCurrencyOutput(($asset->model->eol > 0 ? ($asset->purchase_cost / $asset->model->eol) : 0));
|
||||||
|
}
|
||||||
$diff = Helper::formatCurrencyOutput(($asset->purchase_cost - $asset->getDepreciatedValue()));
|
$diff = Helper::formatCurrencyOutput(($asset->purchase_cost - $asset->getDepreciatedValue()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ($asset->assigned) {
|
if ($asset->assigned) {
|
||||||
$checkout_target = $asset->assigned->name;
|
$checkout_target = $asset->assigned->name;
|
||||||
if ($asset->checkedOutToUser()) {
|
if ($asset->checkedOutToUser()) {
|
||||||
|
|
Loading…
Reference in a new issue