Skip to content

Firefly III: a personal finances manager

Fixed amountPerPeriod not respecting bill skips

Mirko Berger5ab156c7ad7e
diff --git a/app/Http/Controllers/Bill/IndexController.php b/app/Http/Controllers/Bill/IndexController.php
index 07ccf42f9b..cf1dc14139 100644
--- a/app/Http/Controllers/Bill/IndexController.php
+++ b/app/Http/Controllers/Bill/IndexController.php
@@ -211,8 +211,8 @@ class IndexController extends Controller
'monthly' => '12',
'weekly' => '52.17',
];
- $yearAmount = bcmul($avg, $multiplies[$bill['repeat_freq']]);
- Log::debug(sprintf('Amount per year is %s (%s * %s)', $yearAmount, $avg, $multiplies[$bill['repeat_freq']]));
+ $yearAmount = bcmul($avg, bcdiv($multiplies[$bill['repeat_freq']], ''.($bill['skip'] + 1)));
+ Log::debug(sprintf('Amount per year is %s (%s * %s / %s)', $yearAmount, $avg, $multiplies[$bill['repeat_freq']], ''.($bill['skip'] + 1)));
// per period:
$division = [