This commit is contained in:
James Cole 2017-02-23 17:43:29 +01:00
parent fc36f9cd8c
commit 063ca3121a
No known key found for this signature in database
GPG Key ID: C16961E655E74B5E
2 changed files with 7 additions and 1 deletions

View File

@ -386,9 +386,14 @@ class BudgetController extends Controller
]
);
}
/*
* amount: amount of budget limit
* left: amount of budget limit min spent, or 0 when < 0.
* spent: spent, or amount of budget limit when > amount
*/
$amount = $budgetLimit->amount;
$left = bccomp(bcadd($amount, $expenses), '0') < 1 ? '0' : bcadd($amount, $expenses);
$spent = $expenses;
$spent = bccomp($expenses, $amount) === 1 ? $expenses : bcmul($amount, '-1');
$overspent = bccomp(bcadd($amount, $expenses), '0') < 1 ? bcadd($amount, $expenses) : '0';
$return[$name] = [
'left' => $left,

View File

@ -207,6 +207,7 @@ function stackedColumnChart(URI, container) {
var options = defaultChartOptions;
options.stacked = true;
options.scales.xAxes[0].stacked = true;
options.scales.yAxes[0].stacked = true;
var chartType = 'bar';