mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-29 18:20:01 +00:00
Fix #9650
This commit is contained in:
@@ -79,7 +79,6 @@ class IndexController extends Controller
|
||||
$total = $collection->count();
|
||||
|
||||
|
||||
|
||||
$parameters = new ParameterBag();
|
||||
// sub one day from temp start so the last paid date is one day before it should be.
|
||||
$tempStart = clone $start;
|
||||
@@ -173,6 +172,7 @@ class IndexController extends Controller
|
||||
'currency_symbol' => $bill['currency_symbol'],
|
||||
'currency_decimal_places' => $bill['currency_decimal_places'],
|
||||
'avg' => '0',
|
||||
'total_left_to_pay' => '0',
|
||||
'period' => $range,
|
||||
'per_period' => '0',
|
||||
];
|
||||
@@ -183,6 +183,17 @@ class IndexController extends Controller
|
||||
$avg = bcmul($avg, (string)count($bill['pay_dates']));
|
||||
$sums[$groupOrder][$currencyId]['avg'] = bcadd($sums[$groupOrder][$currencyId]['avg'], $avg);
|
||||
}
|
||||
// only fill in total_left_to_pay when bill is not yet paid.
|
||||
if (count($bill['paid_dates']) < count($bill['pay_dates'])) {
|
||||
$count = count($bill['pay_dates']) - count($bill['paid_dates']);
|
||||
if ($count > 0) {
|
||||
$avg = bcdiv(bcadd((string)$bill['amount_min'], (string)$bill['amount_max']), '2');
|
||||
$avg = bcmul($avg, (string)$count);
|
||||
$sums[$groupOrder][$currencyId]['total_left_to_pay'] = bcadd($sums[$groupOrder][$currencyId]['total_left_to_pay'], $avg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// fill in per period regardless:
|
||||
$sums[$groupOrder][$currencyId]['per_period'] = bcadd($sums[$groupOrder][$currencyId]['per_period'], $this->amountPerPeriod($bill, $range));
|
||||
}
|
||||
|
@@ -56,6 +56,7 @@ class SubscriptionEnrichment implements EnrichmentInterface
|
||||
$this->collectPaidDates();
|
||||
$this->collectPayDates();
|
||||
|
||||
|
||||
// TODO clean me up.
|
||||
|
||||
$notes = $this->notes;
|
||||
|
@@ -110,8 +110,8 @@ class BillDateCalculator
|
||||
$currentStart = clone $nextExpectedMatch;
|
||||
|
||||
++$loop;
|
||||
if ($loop > 12) {
|
||||
Log::debug('Loop is more than 12, so we break.');
|
||||
if ($loop > 31) {
|
||||
Log::debug('Loop is more than 31, so we break.');
|
||||
|
||||
break;
|
||||
}
|
||||
|
@@ -1864,6 +1864,7 @@ return [
|
||||
'remove_budgeted_amount' => 'Remove budgeted amount in :currency',
|
||||
|
||||
// bills:
|
||||
'left_to_pay_active_bills' => 'active, expected and not yet paid subscriptions',
|
||||
'left_to_pay_lc' => 'left to pay',
|
||||
'less_than_expected' => 'less than expected',
|
||||
'more_than_expected' => 'more than expected',
|
||||
|
@@ -158,8 +158,8 @@
|
||||
<td style="width:33%;">{{ 'amount'|_ }}</td>
|
||||
<td>
|
||||
{{ formatAmountBySymbol(limit.amount, limit.transactionCurrency.symbol, limit.transactionCurrency.decimal_places) }}
|
||||
{% if convertToPrimary and 0 != limit.pc_amount %}
|
||||
({{ formatAmountBySymbol(limit.pc_amount, primaryCurrency.symbol, primaryCurrency.decimal_places) }})
|
||||
{% if convertToPrimary and null != limit.native_amount %}
|
||||
({{ formatAmountBySymbol(limit.native_amount, primaryCurrency.symbol, primaryCurrency.decimal_places) }})
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
|
@@ -189,6 +189,21 @@
|
||||
<td class="hidden-sm hidden-xs"> </td><!-- repeats -->
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% if '0' != sum.total_left_to_pay %}
|
||||
<tr>
|
||||
<td class="hidden-sm hidden-xs"> </td> <!-- handle -->
|
||||
<td class="hidden-sm hidden-xs"> </td> <!-- buttons -->
|
||||
<td colspan="2" style="text-align: right;"> <!-- title -->
|
||||
<small>{{ 'sum'|_ }} ({{ sum.currency_name }}) ({{ 'left_to_pay_active_bills'|_ }})</small>
|
||||
</td>
|
||||
<td style="text-align: right;"> <!-- amount -->
|
||||
{{ formatAmountBySymbol(sum.total_left_to_pay, sum.currency_symbol, sum.currency_decimal_places) }}
|
||||
</td>
|
||||
<td> </td> <!-- paid in period -->
|
||||
<td class="hidden-sm hidden-xs"> </td> <!-- next expected match -->
|
||||
<td class="hidden-sm hidden-xs"> </td><!-- repeats -->
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% if '0' != sum.per_period %}
|
||||
<tr>
|
||||
<td class="hidden-sm hidden-xs"> </td> <!-- handle -->
|
||||
|
Reference in New Issue
Block a user