mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2024-11-30 20:54:04 -06:00
Simplified the in and out-box.
This commit is contained in:
parent
7abeece3f0
commit
2432af7883
@ -2,7 +2,6 @@
|
||||
|
||||
use Amount;
|
||||
use Auth;
|
||||
use DB;
|
||||
use FireflyIII\Helpers\Report\ReportQueryInterface;
|
||||
use FireflyIII\Models\Account;
|
||||
use FireflyIII\Models\Bill;
|
||||
@ -37,22 +36,16 @@ class JsonController extends Controller
|
||||
$box = Input::get('box');
|
||||
$set = $reportQuery->journalsByExpenseAccount($start, $end, true);
|
||||
|
||||
|
||||
foreach ($set as $entry) {
|
||||
$amount += $set->queryAmount;
|
||||
$amount += $entry->queryAmount;
|
||||
}
|
||||
break;
|
||||
case 'out':
|
||||
$box = Input::get('box');
|
||||
$in = Auth::user()->transactionjournals()
|
||||
->leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')
|
||||
->before($end)
|
||||
->after($start)
|
||||
->transactionTypes(['Withdrawal'])
|
||||
->where('transactions.amount', '>', 0)
|
||||
->first([DB::Raw('SUM(transactions.amount) as `totalAmount`')]);
|
||||
if (!is_null($in)) {
|
||||
$amount = floatval($in->totalAmount);
|
||||
$set = $reportQuery->incomeByPeriod($start, $end, true);
|
||||
|
||||
foreach ($set as $entry) {
|
||||
$amount += $entry->queryAmount;
|
||||
}
|
||||
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user