Add some rounding to make forms more neat.

This commit is contained in:
James Cole 2016-10-23 16:56:18 +02:00
parent 446eaf6588
commit 19e9f382e4
2 changed files with 7 additions and 6 deletions

View File

@ -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');

View File

@ -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();