X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fhomebank2ledger;a=blobdiff_plain;f=lib%2FApp%2FHomeBank2Ledger%2FFormatter%2FBeancount.pm;fp=lib%2FApp%2FHomeBank2Ledger%2FFormatter%2FBeancount.pm;h=dc9893499e9a8c3186e03410237dcef7e668282d;hp=748a0bf31ecdcfd2dd71edc413eefc8dd5f512a3;hb=0a9b998a9cba27a0be036954c8451eb8bb3e498c;hpb=809727a3740f74a8836fa49dbf24bd672c58d39e diff --git a/lib/App/HomeBank2Ledger/Formatter/Beancount.pm b/lib/App/HomeBank2Ledger/Formatter/Beancount.pm index 748a0bf..dc98934 100644 --- a/lib/App/HomeBank2Ledger/Formatter/Beancount.pm +++ b/lib/App/HomeBank2Ledger/Formatter/Beancount.pm @@ -278,9 +278,13 @@ sub _format_amount { 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}";