format of output
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
from db import dbGetMany
|
||||
from db import dbGetMany, dbGetOne
|
||||
from loguru import logger
|
||||
import datetime
|
||||
import iso8601
|
||||
@ -15,11 +15,40 @@ def perform(dbh, params):
|
||||
"params": {
|
||||
'year': year
|
||||
}
|
||||
|
||||
}
|
||||
)
|
||||
|
||||
overview = dbGetMany(
|
||||
dbh,
|
||||
{
|
||||
"statement": "select sum(amount), category from account_statement_v where fiscal_year = %(year)s group by category",
|
||||
"params": {
|
||||
'year': year
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
sum_related = dbGetOne(
|
||||
dbh,
|
||||
{
|
||||
"statement": "select coalesce(sum(amount), 0::numeric(10,2)) as sum from account_statement_v where fiscal_year = %(year)s and category != 'nicht abrechenbare Positionen'",
|
||||
"params": {
|
||||
'year': year
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
sum_unrelated = dbGetOne(
|
||||
dbh,
|
||||
{
|
||||
"statement": "select coalesce(sum(amount), 0::numeric(10,2)) as sum from account_statement_v where fiscal_year = %(year)s and category = 'nicht abrechenbare Positionen'",
|
||||
"params": {
|
||||
'year': year
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
template = getParam(params, 'template', 'accountStatement.tmpl')
|
||||
input = { 'year': year, 'entries': accountEntries }
|
||||
input = { 'year': year, 'entries': accountEntries, 'overview': overview, 'related': sum_related, 'unrelated': sum_unrelated }
|
||||
tmpl = Template(file=template, searchList=[ input ])
|
||||
print(tmpl)
|
||||
|
Reference in New Issue
Block a user