Fixed depreciation bug

This commit is contained in:
snipe
2013-12-03 02:05:00 -05:00
parent b8ebcf769a
commit ae05f27015
2 changed files with 10 additions and 2 deletions
+1 -1
View File
@@ -21,7 +21,7 @@ class Asset extends Elegant {
public function depreciate()
{
$depreciation_id = Model::find($this->model_id)->depreciation_id;
if (isset($depreciation_id)) {
if ($depreciation_id) {
$depreciation_term = Depreciation::find($depreciation_id)->months;
if($depreciation_term>0) {
+9 -1
View File
@@ -19,7 +19,7 @@ Depreciation Report
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li><a href="{{ route('reports/export') }}">Download as CSV</a></li>
<li><a href="#">Download as CSV</a></li>
<li><a href="#">Download as PDF</a></li>
</ul>
</div>
@@ -66,9 +66,17 @@ Depreciation Report
@endif
</td>
<td>{{ $asset->purchase_date }}</td>
@if ($asset->purchase_cost > 0)
<td class="align-right">${{ number_format($asset->purchase_cost) }}</td>
<td class="align-right">${{ number_format($asset->depreciate()) }}</td>
<td class="align-right">-${{ number_format(($asset->purchase_cost - $asset->depreciate())) }}</td>
@else
<td></td>
<td></td>
<td></td>
@endif
</tr>
@endforeach