Abrechnungsskript

This commit is contained in:
2022-04-01 12:04:33 +02:00
parent 452b4f69bd
commit d0771be1d1
3 changed files with 69 additions and 9 deletions

View File

@ -23,7 +23,7 @@ def perform(dbh, params):
{
"statement":
"""
select sum(ae.amount) as sum,
select (coalesce(sum(ae.amount), 0::numeric(10,2)) * -1) as sum,
aec.description as category,
aec.considerminusarea as considerminusarea
from account_t a,
@ -48,13 +48,13 @@ def perform(dbh, params):
where p.account = a.id and
ae.account = a.id and
aec.overhead_relevant = 't' and
aec.id not in (select distinct account_entry_category from account_entry_t) and
aec.id not in (select distinct account_entry_category from account_entry_t where fiscal_year = %(year)s) and
ae.fiscal_year = %(year)s and
p.id = %(premise)s
group by category, considerminusarea
union
select 120 as sum,
'Waschmaschine' as category,
'16. Waschmaschine' as category,
false as considerminusarea
from premise_t
where id = %(premise)s
@ -181,7 +181,7 @@ def perform(dbh, params):
for house in houses.values():
logger.debug(f"Processing item: {house}")
outputFile = f"{overviewPrefix}-{house['details']['id']}.{overviewSuffix}"
outputFile = f"./output/{overviewPrefix}-{house['details']['id']}.{overviewSuffix}"
tmpl = Template(file=overviewTemplate, searchList=[ house ])
logger.debug(tmpl)
with open(outputFile, 'w') as f: