Call Ledger in full precision

This commit is contained in:
RunasSudo 2020-01-31 10:13:20 +11:00
parent caca8152ff
commit e4c8d2f398
Signed by: RunasSudo
GPG Key ID: 7234E476BF21C61A
2 changed files with 4 additions and 4 deletions

View File

@ -80,10 +80,10 @@ def pandl():
@app.template_filter('a')
def filter_amount(amt):
if amt > 0:
return flask.Markup('{:,} '.format(amt).replace(',', ' ')) # Narrow no-break space
return flask.Markup('{:,.2f} '.format(amt).replace(',', ' ')) # Narrow no-break space
else:
return flask.Markup('({:,})'.format(-amt).replace(',', ' '))
return flask.Markup('({:,.2f})'.format(-amt).replace(',', ' '))
@app.template_filter('b')
def filter_amount_positive(amt):
return flask.Markup('{:,}'.format(amt).replace(',', ' '))
return flask.Markup('{:,.2f}'.format(amt).replace(',', ' '))

View File

@ -43,7 +43,7 @@ class Account:
return result
def run_ledger(*args):
proc = subprocess.Popen(['ledger', '--args-only', '--file', config['ledger_file'], '-X', config['report_currency']] + config['ledger_args'] + list(args), encoding='utf-8', stdout=subprocess.PIPE, stderr=subprocess.PIPE)
proc = subprocess.Popen(['ledger', '--args-only', '--file', config['ledger_file'], '-X', config['report_currency'], '--unround'] + config['ledger_args'] + list(args), encoding='utf-8', stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout, stderr = proc.communicate()
if stderr: