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