Improvement and bug of expenses report #1958

This commit is contained in:
Hillel Coren 2018-03-25 13:18:21 +03:00
parent 2c98aaceb3
commit 7e272e1a75
3 changed files with 15 additions and 0 deletions

View File

@ -44,6 +44,11 @@ class ExpensePresenter extends EntityPresenter
return Utils::formatMoney($this->entity->amountWithTax(), $this->entity->expense_currency_id);
}
public function currencyCode()
{
return Utils::getFromCache($this->entity->expense_currency_id, 'currencies')->code;
}
public function taxAmount()
{
return Utils::formatMoney($this->entity->taxAmount(), $this->entity->expense_currency_id);

View File

@ -27,6 +27,10 @@ class ExpenseReport extends AbstractReport
$columns['tax'] = ['columnSelector-false'];
}
if ($this->isExport) {
$columns['currency'] = ['columnSelector-false'];
}
return $columns;
}
@ -85,6 +89,10 @@ class ExpenseReport extends AbstractReport
$row[] = $expense->present()->taxAmount;
}
if ($this->isExport) {
$row[] = $expense->present()->currencyCode;
}
$this->data[] = $row;
$this->addToTotals($expense->expense_currency_id, 'amount', $amount);

View File

@ -7,6 +7,7 @@
<td>{{ trans('texts.expense_date') }}</td>
<td>{{ trans('texts.amount') }}</td>
<td>{{ trans('texts.tax') }}</td>
<td>{{ trans('texts.currency') }}</td>
<td>{{ trans('texts.category') }}</td>
<td>{{ trans('texts.status') }}</td>
<td>{{ trans('texts.public_notes') }}</td>
@ -25,6 +26,7 @@
<td>{{ $expense->present()->expense_date }}</td>
<td>{{ $expense->present()->amount }}</td>
<td>{{ $expense->present()->taxAmount }}</td>
<td>{{ $expense->present()->currencyCode }}</td>
<td>{{ $expense->present()->category }}</td>
<td>{{ $expense->statusLabel() }}</td>
<td>{{ $expense->public_notes }}</td>