Made a negative amount a positive as per #129

This commit is contained in:
James Cole 2015-12-11 18:49:07 +01:00
parent e332bfef7c
commit a0972d99fb

View File

@ -190,10 +190,7 @@ class ReportQuery implements ReportQueryInterface
public function spentInBudgetCorrected(Account $account, Budget $budget, Carbon $start, Carbon $end) public function spentInBudgetCorrected(Account $account, Budget $budget, Carbon $start, Carbon $end)
{ {
bcscale(2); return Auth::user()->transactionjournals()
return bcmul(
Auth::user()->transactionjournals()
->leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id') ->leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')
->leftJoin('budget_transaction_journal', 'budget_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id') ->leftJoin('budget_transaction_journal', 'budget_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id')
->transactionTypes([TransactionType::WITHDRAWAL]) ->transactionTypes([TransactionType::WITHDRAWAL])
@ -201,8 +198,7 @@ class ReportQuery implements ReportQueryInterface
->before($end) ->before($end)
->after($start) ->after($start)
->where('budget_transaction_journal.budget_id', $budget->id) ->where('budget_transaction_journal.budget_id', $budget->id)
->get(['transaction_journals.*'])->sum('amount'), -1 ->get(['transaction_journals.*'])->sum('amount');
);
} }
/** /**