mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-17 02:05:34 +00:00
Fix #2543
This commit is contained in:
@@ -434,6 +434,9 @@ class BillController extends Controller
|
||||
if (false === $bill['active']) {
|
||||
continue;
|
||||
}
|
||||
if (0 === count($bill['pay_dates'])) {
|
||||
continue;
|
||||
}
|
||||
/** @var TransactionCurrency $currency */
|
||||
$currencyId = $bill['currency_id'];
|
||||
$sums[$currencyId] = $sums[$currencyId] ?? [
|
||||
@@ -444,7 +447,9 @@ class BillController extends Controller
|
||||
'currency_decimal_places' => $bill['currency_decimal_places'],
|
||||
'avg' => '0',
|
||||
];
|
||||
|
||||
$avg = bcdiv(bcadd((string)$bill['amount_min'], (string)$bill['amount_max']), '2');
|
||||
$avg = bcmul($avg, (string)count($bill['pay_dates']));
|
||||
$sums[$currencyId]['avg'] = bcadd($sums[$currencyId]['avg'], $avg);
|
||||
}
|
||||
|
||||
|
@@ -197,6 +197,7 @@ return [
|
||||
'button_register' => 'Register',
|
||||
'authorization' => 'Authorization',
|
||||
'active_bills_only' => 'active bills only',
|
||||
'active_exp_bills_only' => 'active and expected bills only',
|
||||
'average_per_bill' => 'average per bill',
|
||||
'expected_total' => 'expected total',
|
||||
// API access
|
||||
|
@@ -119,7 +119,7 @@
|
||||
{% for sum in sums %}
|
||||
<tr>
|
||||
<td style="text-align:right;" colspan="3">
|
||||
{{ 'sum'|_ }} ({{ sum.currency_name }}) ({{ 'active_bills_only'|_ }})<br />
|
||||
{{ 'sum'|_ }} ({{ sum.currency_name }}) ({{ 'active_exp_bills_only'|_ }})<br />
|
||||
</td>
|
||||
<td style="text-align:right;" colspan="1">
|
||||
<span style="margin-right:5px;">
|
||||
|
Reference in New Issue
Block a user