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=85810b03b231e59b40fe654a3407c4a9d50ddf46;hp=7e3f7852bba326f7213d7c592c4fe47938f6c659;hb=b980f9a0c4ed7902a2c57657d5971c13333f13ca;hpb=8feecd3de0d3293f8a26c05fc880415aee283e12 diff --git a/lib/App/HomeBank2Ledger/Formatter/Beancount.pm b/lib/App/HomeBank2Ledger/Formatter/Beancount.pm index 7e3f785..85810b0 100644 --- a/lib/App/HomeBank2Ledger/Formatter/Beancount.pm +++ b/lib/App/HomeBank2Ledger/Formatter/Beancount.pm @@ -11,7 +11,7 @@ use Scalar::Util qw(looks_like_number); use parent 'App::HomeBank2Ledger::Formatter'; -our $VERSION = '0.006'; # VERSION +our $VERSION = '0.007'; # VERSION my %STATUS_SYMBOLS = ( cleared => '*', @@ -223,9 +223,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}"; @@ -297,7 +301,7 @@ App::HomeBank2Ledger::Formatter::Beancount - Beancount formatter =head1 VERSION -version 0.006 +version 0.007 =head1 DESCRIPTION