Skip to content

Firefly III: a personal finances manager

Add some rounding to make forms more neat.

James Cole19e9f382e45b
diff --git a/app/Http/Controllers/AccountController.php b/app/Http/Controllers/AccountController.php
index 7fed6c5cf0..4b0573363c 100644
--- a/app/Http/Controllers/AccountController.php
+++ b/app/Http/Controllers/AccountController.php
@@ -146,7 +146,7 @@ class AccountController extends Controller
'ccMonthlyPaymentDate' => $account->getMeta('ccMonthlyPaymentDate'),
'openingBalanceDate' => $openingBalanceDate,
'openingBalance' => $openingBalanceAmount,
- 'virtualBalance' => round($account->virtual_balance, 2),
+ 'virtualBalance' => $account->virtual_balance,
];
Session::flash('preFilled', $preFilled);
Session::flash('gaEventCategory', 'accounts');
diff --git a/app/Support/ExpandedForm.php b/app/Support/ExpandedForm.php
index 495fd2d75c..caefbaf73d 100644
--- a/app/Support/ExpandedForm.php
+++ b/app/Support/ExpandedForm.php
@@ -40,10 +40,11 @@ class ExpandedForm
*/
public function amount(string $name, $value = null, array $options = []): string
{
- $label = $this->label($name, $options);
- $options = $this->expandOptionArray($name, $label, $options);
- $classes = $this->getHolderClasses($name);
- $value = $this->fillFieldValue($name, $value);
+ $label = $this->label($name, $options);
+ $options = $this->expandOptionArray($name, $label, $options);
+ $classes = $this->getHolderClasses($name);
+ $value = round($this->fillFieldValue($name, $value), 2);
+ var_dump($value);
$options['step'] = 'any';
$options['min'] = '0.01';
$defaultCurrency = isset($options['currency']) ? $options['currency'] : Amt::getDefaultCurrency();
@@ -93,7 +94,7 @@ class ExpandedForm
$label = $this->label($name, $options);
$options = $this->expandOptionArray($name, $label, $options);
$classes = $this->getHolderClasses($name);
- $value = $this->fillFieldValue($name, $value);
+ $value = round($this->fillFieldValue($name, $value), 2);
$options['step'] = 'any';
$defaultCurrency = isset($options['currency']) ? $options['currency'] : Amt::getDefaultCurrency();
$currencies = Amt::getAllCurrencies();