Make budget tables multi-currency

This commit is contained in:
James Cole
2019-08-27 10:25:23 +02:00
parent 33d0b8ca22
commit 7eb9086a28
5 changed files with 54 additions and 39 deletions

View File

@@ -182,10 +182,8 @@ class BillRepository implements BillRepositoryInterface
*/
public function getBillsForAccounts(Collection $accounts): Collection
{
$fields = ['bills.id', 'bills.created_at', 'bills.updated_at', 'bills.deleted_at', 'bills.user_id', 'bills.name', 'bills.match', 'bills.amount_min',
'bills.amount_max', 'bills.date', 'bills.transaction_currency_id', 'bills.repeat_freq', 'bills.skip', 'bills.automatch', 'bills.active',
'bills.name_encrypted',
'bills.match_encrypted',];
$fields = ['bills.id', 'bills.created_at', 'bills.updated_at', 'bills.deleted_at', 'bills.user_id', 'bills.name', 'bills.amount_min',
'bills.amount_max', 'bills.date', 'bills.transaction_currency_id', 'bills.repeat_freq', 'bills.skip', 'bills.automatch', 'bills.active',];
$ids = $accounts->pluck('id')->toArray();
$set = $this->user->bills()
->leftJoin(
@@ -206,7 +204,6 @@ class BillRepository implements BillRepositoryInterface
->orderBy('bills.name', 'ASC')
->groupBy($fields)
->get($fields);
return $set;
}
@@ -457,7 +454,7 @@ class BillRepository implements BillRepositoryInterface
$currentStart = clone $nextExpectedMatch;
}
$simple = $set->each(
function (Carbon $date) {
static function (Carbon $date) {
return $date->format('Y-m-d');
}
);