Improve budget limit.

This commit is contained in:
James Cole
2025-08-03 17:42:07 +02:00
parent 56f1eb03e0
commit 4ff5f5883d
13 changed files with 244 additions and 71 deletions

View File

@@ -88,9 +88,9 @@ class PiggyBankTransformer extends AbstractTransformer
if (0 !== bccomp($targetAmount, '0')) { // target amount is not 0.00
$leftToSave = bcsub($piggyBank->target_amount, $currentAmount);
$percentage = (int) bcmul(bcdiv($currentAmount, $targetAmount), '100');
$targetAmount = app('steam')->bcround($targetAmount, $currency->decimal_places);
$leftToSave = app('steam')->bcround($leftToSave, $currency->decimal_places);
$savePerMonth = app('steam')->bcround($this->piggyRepos->getSuggestedMonthlyAmount($piggyBank), $currency->decimal_places);
$targetAmount = Steam::bcround($targetAmount, $currency->decimal_places);
$leftToSave = Steam::bcround($leftToSave, $currency->decimal_places);
$savePerMonth = Steam::bcround($this->piggyRepos->getSuggestedMonthlyAmount($piggyBank), $currency->decimal_places);
}
$startDate = $piggyBank->start_date?->format('Y-m-d');
$targetDate = $piggyBank->target_date?->format('Y-m-d');