mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-12-21 10:41:22 +00:00
Better chart for bills.
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
use App;
|
use App;
|
||||||
use Auth;
|
use Auth;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
|
use Crypt;
|
||||||
use DB;
|
use DB;
|
||||||
use Exception;
|
use Exception;
|
||||||
use FireflyIII\Helpers\Report\ReportQueryInterface;
|
use FireflyIII\Helpers\Report\ReportQueryInterface;
|
||||||
@@ -26,7 +27,6 @@ use Preferences;
|
|||||||
use Response;
|
use Response;
|
||||||
use Session;
|
use Session;
|
||||||
use Steam;
|
use Steam;
|
||||||
use Crypt;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class GoogleChartController
|
* Class GoogleChartController
|
||||||
@@ -291,22 +291,18 @@ class GoogleChartController extends Controller
|
|||||||
} else {
|
} else {
|
||||||
$start = new Carbon;
|
$start = new Carbon;
|
||||||
}
|
}
|
||||||
$end = new Carbon;
|
|
||||||
while ($start <= $end) {
|
$results = $bill->transactionjournals()->after($start)->get();
|
||||||
$result = $bill->transactionjournals()->before($end)->after($start)->first();
|
/** @var TransactionJournal $result */
|
||||||
if ($result) {
|
foreach ($results as $result) {
|
||||||
|
$amount = 0;
|
||||||
/** @var Transaction $tr */
|
/** @var Transaction $tr */
|
||||||
foreach ($result->transactions()->get() as $tr) {
|
foreach ($result->transactions()->get() as $tr) {
|
||||||
if (floatval($tr->amount) > 0) {
|
if (floatval($tr->amount) > 0) {
|
||||||
$amount = floatval($tr->amount);
|
$amount = floatval($tr->amount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
$chart->addRow(clone $result->date, $bill->amount_max, $bill->amount_min, $amount);
|
||||||
$amount = 0;
|
|
||||||
}
|
|
||||||
unset($result);
|
|
||||||
$chart->addRow(clone $start, $bill->amount_max, $bill->amount_min, $amount);
|
|
||||||
$start = Navigation::addPeriod($start, $bill->repeat_freq, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$chart->generate();
|
$chart->generate();
|
||||||
|
|||||||
Reference in New Issue
Block a user