my $format = "\% .$commodity->{frac}f";
my ($whole, $fraction) = split(/\./, sprintf($format, $amount));
+ $fraction ||= 0;
# beancount doesn't support different notations
- my $num = join('.', commify($whole), $fraction);
+ my $num = commify($whole);
+ if ($commodity->{frac}) {
+ $num .= ".$fraction";
+ }
$num = "$num $commodity->{iso}";
my $format = "\% .$commodity->{frac}f";
my ($whole, $fraction) = split(/\./, sprintf($format, $amount));
+ $fraction ||= 0;
- my $num = join($commodity->{dchar}, commify($whole, $commodity->{gchar}), $fraction);
+ my $num = commify($whole, $commodity->{gchar});
+ if ($commodity->{frac}) {
+ $num .= $commodity->{dchar} . $fraction;
+ }
my $symbol = $commodity->{symbol};
$symbol = $self->_quote_string($symbol) if $symbol =~ /[0-9\s]/;