account statement stuff
This commit is contained in:
parent
2be6a6e140
commit
0d4e33505e
@ -20,10 +20,6 @@ def perform(dbh, params):
|
|||||||
)
|
)
|
||||||
|
|
||||||
template = getParam(params, 'template', 'accountStatement.tmpl')
|
template = getParam(params, 'template', 'accountStatement.tmpl')
|
||||||
prefix = getParam(params, 'prefix', 'accountStatement')
|
|
||||||
suffix = getParam(params, 'suffix', 'tex')
|
|
||||||
input = { 'year': year, 'entries': accountEntries }
|
input = { 'year': year, 'entries': accountEntries }
|
||||||
outputFile = f"{prefix}-{year}.{suffix}"
|
|
||||||
tmpl = Template(file=template, searchList=[ input ])
|
tmpl = Template(file=template, searchList=[ input ])
|
||||||
with open(outputFile, 'w') as f:
|
print(tmpl)
|
||||||
f.write(str(tmpl))
|
|
||||||
|
45
cli/AccountStatement.sh
Executable file
45
cli/AccountStatement.sh
Executable file
@ -0,0 +1,45 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
SHOW="0"
|
||||||
|
PRINT="0"
|
||||||
|
while getopts "y:sphP:" flag
|
||||||
|
do
|
||||||
|
case "${flag}" in
|
||||||
|
h)
|
||||||
|
echo "y ... year for statement";
|
||||||
|
echo "s ... show output using evince";
|
||||||
|
echo "p ... print output";
|
||||||
|
echo "P ... printer name";
|
||||||
|
exit 1;
|
||||||
|
;;
|
||||||
|
y)
|
||||||
|
YEAR=${OPTARG}
|
||||||
|
;;
|
||||||
|
s)
|
||||||
|
SHOW="1"
|
||||||
|
;;
|
||||||
|
p)
|
||||||
|
PRINT="1"
|
||||||
|
;;
|
||||||
|
P)
|
||||||
|
PRINTER="-P ${OPTARG}"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ "$YEAR" = "" ]; then
|
||||||
|
echo "give year for statement as argument"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
python3.10 hv2cli.py -o AccountStatement -p '{"year":'$YEAR'}' > $YEAR.tex
|
||||||
|
pdflatex $YEAR.tex
|
||||||
|
|
||||||
|
if [ "$SHOW" = "1" ]; then
|
||||||
|
evince $YEAR.pdf
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$PRINT" = "1" ]; then
|
||||||
|
lpr $PRINTER $YEAR.pdf
|
||||||
|
fi
|
||||||
|
|
@ -11,26 +11,26 @@
|
|||||||
|
|
||||||
\subsection*{Kontoauszug $year}
|
\subsection*{Kontoauszug $year}
|
||||||
|
|
||||||
\begin{longtable}{rrp{5cm}rrrp{3cm}l}
|
\begin{longtable}{|r|r|p{5cm}|r|r|r|p{3cm}|r|p{5cm}|}
|
||||||
\bf{id} & \bf{createdAt} & \bf{description} & \bf{amount} & \bf{documentNo} & \bf{fiscalYear} & \bf{category} & \bf{account} \\ \hline
|
\hline \textcolor{blue}{\tt{id}} & \textcolor{blue}{\tt{date}} & \textcolor{blue}{\tt{description}} & \textcolor{blue}{\tt{amount}} & \textcolor{blue}{\tt{docNo}} & \textcolor{blue}{\tt{year}} & \textcolor{blue}{\tt{category}} & \textcolor{blue}{\tt{isRef}} & \textcolor{blue}{\tt{baseAccount}} \\ \hline \hline
|
||||||
\endfirsthead
|
\endfirsthead
|
||||||
\bf{id} & \bf{createdAt} & \bf{description} & \bf{amount} & \bf{documentNo} & \bf{fiscalYear} & \bf{category} & \bf{account} \\ \hline
|
\hline \textcolor{blue}{\tt{id}} & \textcolor{blue}{\tt{date}} & \textcolor{blue}{\tt{description}} & \textcolor{blue}{\tt{amount}} & \textcolor{blue}{\tt{docNo}} & \textcolor{blue}{\tt{year}} & \textcolor{blue}{\tt{category}} & \textcolor{blue}{\tt{isRef}} & \textcolor{blue}{\tt{baseAccount}} \\ \hline \hline
|
||||||
\endhead
|
\endhead
|
||||||
\hline \multicolumn{8}{r}{\em{to be continued}}
|
\multicolumn{9}{r}{\em{to be continued}}
|
||||||
\endfoot
|
\endfoot
|
||||||
\hline
|
|
||||||
\endlastfoot
|
\endlastfoot
|
||||||
|
|
||||||
#for $entry in $entries
|
#for $entry in $entries
|
||||||
\tt{$entry['id']} & \tt{$entry['created_at']} & \tt{$entry['description']} & #slurp
|
\tt{$entry['id']} & \tt{$entry['created_at']} & \tt{$entry['description']} & #slurp
|
||||||
#if not $entry['income']
|
#if $entry['amount'] <= 0
|
||||||
\textcolor{red}{#slurp
|
\textcolor{red}{#slurp
|
||||||
#end if
|
#end if
|
||||||
\tt{$entry['amount']}#slurp
|
\tt{$entry['amount']}#slurp
|
||||||
#if not $entry['income']
|
#if $entry['amount'] <= 0
|
||||||
}#slurp
|
}#slurp
|
||||||
#end if
|
#end if
|
||||||
& \tt{$entry['document_no']} & \tt{$entry['fiscal_year']} & \tt{$entry['category']} & \tt{{ $entry['account'].replace('_', '\\textunderscore ') }} \\
|
& \tt{$entry['document_no']} & \tt{$entry['fiscal_year']} & \tt{$entry['category']} & \tt{$entry['is_reference']} & \tt{{$entry['base_account'].replace('_', ' ') }} \\ \hline
|
||||||
#end for
|
#end for
|
||||||
\end{longtable}
|
\end{longtable}
|
||||||
|
|
||||||
|
@ -6,12 +6,15 @@ create or replace view account_statement_v as
|
|||||||
ae.document_no as document_no,
|
ae.document_no as document_no,
|
||||||
ae.fiscal_year as fiscal_year,
|
ae.fiscal_year as fiscal_year,
|
||||||
aec.description as category,
|
aec.description as category,
|
||||||
aec.income as income,
|
ac.description as account,
|
||||||
ac.description as account
|
ae.is_reference as is_reference,
|
||||||
from account_entry_t ae,
|
bac.description as base_account
|
||||||
|
from joined_account_entry_v ae,
|
||||||
account_entry_category_t aec,
|
account_entry_category_t aec,
|
||||||
account_t ac
|
account_t ac,
|
||||||
|
account_t bac
|
||||||
where ae.account_entry_category = aec.id and
|
where ae.account_entry_category = aec.id and
|
||||||
ae.account = ac.id and
|
ae.account = ac.id and
|
||||||
aec.id not in (3, 4)
|
ae.base_account = bac.id and
|
||||||
|
ac.id = 1000
|
||||||
order by created_at;
|
order by created_at;
|
||||||
|
@ -5,7 +5,7 @@ CREATE TABLE account_entry_reference_t (
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
CREATE OR REPLACE VIEW joined_account_entry_t AS
|
CREATE OR REPLACE VIEW joined_account_entry_v AS
|
||||||
SELECT ae.id as id,
|
SELECT ae.id as id,
|
||||||
ae.description as description,
|
ae.description as description,
|
||||||
ae.account as account,
|
ae.account as account,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user