Fixes #2622 - add depreciation to license report

This commit is contained in:
snipe 2016-09-20 02:58:08 -07:00
parent 998624ad68
commit aa92b93bd1
2 changed files with 13 additions and 6 deletions

View file

@ -329,7 +329,7 @@ class ReportsController extends Controller
} }
$allowed_columns = ['name','min_amt','order_number','purchase_date','purchase_cost','companyName','category']; $allowed_columns = ['created_at'];
$order = Input::get('order') === 'asc' ? 'asc' : 'desc'; $order = Input::get('order') === 'asc' ? 'asc' : 'desc';
$sort = in_array(Input::get('sort'), $allowed_columns) ? e(Input::get('sort')) : 'created_at'; $sort = in_array(Input::get('sort'), $allowed_columns) ? e(Input::get('sort')) : 'created_at';
@ -406,7 +406,7 @@ class ReportsController extends Controller
public function getLicenseReport() public function getLicenseReport()
{ {
$licenses = License::orderBy('created_at', 'DESC') $licenses = License::with('depreciation')->orderBy('created_at', 'DESC')
->with('company') ->with('company')
->get(); ->get();
@ -433,6 +433,7 @@ class ReportsController extends Controller
trans('admin/licenses/form.remaining_seats'), trans('admin/licenses/form.remaining_seats'),
trans('admin/licenses/form.expiration'), trans('admin/licenses/form.expiration'),
trans('admin/licenses/form.date'), trans('admin/licenses/form.date'),
trans('admin/licenses/form.depreciation'),
trans('admin/licenses/form.cost') trans('admin/licenses/form.cost')
]; ];
@ -448,6 +449,7 @@ class ReportsController extends Controller
$row[] = $license->remaincount(); $row[] = $license->remaincount();
$row[] = $license->expiration_date; $row[] = $license->expiration_date;
$row[] = $license->purchase_date; $row[] = $license->purchase_date;
$row[] = ($license->depreciation!='') ? '' : e($license->depreciation->name);
$row[] = '"' . Helper::formatCurrencyOutput($license->purchase_cost) . '"'; $row[] = '"' . Helper::formatCurrencyOutput($license->purchase_cost) . '"';
$rows[] = implode($row, ','); $rows[] = implode($row, ',');

View file

@ -33,7 +33,10 @@
<th class="col-sm-1">{{ trans('admin/licenses/form.remaining_seats') }}</th> <th class="col-sm-1">{{ trans('admin/licenses/form.remaining_seats') }}</th>
<th class="col-sm-1">{{ trans('admin/licenses/form.expiration') }}</th> <th class="col-sm-1">{{ trans('admin/licenses/form.expiration') }}</th>
<th class="col-sm-1">{{ trans('admin/licenses/form.date') }}</th> <th class="col-sm-1">{{ trans('admin/licenses/form.date') }}</th>
<th class="col-sm-1">{{ trans('admin/licenses/form.cost') }}</th> <th class="col-sm-1 text-right" class="col-sm-1">{{ trans('admin/licenses/form.cost') }}</th>
<th class="col-sm-1">{{ trans('admin/licenses/form.depreciation') }}</th>
<th class="col-sm-1 text-right">{{ trans('admin/hardware/table.book_value') }}</th>
<th class="col-sm-1 text-right">{{ trans('admin/hardware/table.diff') }}</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -47,9 +50,11 @@
<td>{{ $license->remaincount() }}</td> <td>{{ $license->remaincount() }}</td>
<td>{{ $license->expiration_date }}</td> <td>{{ $license->expiration_date }}</td>
<td>{{ $license->purchase_date }}</td> <td>{{ $license->purchase_date }}</td>
<td> <td class="text-right">
{{ \App\Models\Setting::first()->default_currency }} {{ \App\Models\Setting::getSettings()->default_currency }}{{ \App\Helpers\Helper::formatCurrencyOutput($license->purchase_cost) }}</td>
{{ number_format($license->purchase_cost) }}</td> <td>{{ ($license->depreciation) ? e($license->depreciation->name).' ('.$license->depreciation->months.' '.trans('general.months').')' : '' }}</td>
<td class="text-right">{{ \App\Models\Setting::getSettings()->default_currency }}{{ \App\Helpers\Helper::formatCurrencyOutput($license->getDepreciatedValue()) }}</td>
<td class="text-right">-{{ \App\Models\Setting::getSettings()->default_currency }}{{ \App\Helpers\Helper::formatCurrencyOutput(($license->purchase_cost - $license->getDepreciatedValue())) }}</td>
</tr> </tr>
@endforeach @endforeach
</tbody> </tbody>