mirror of
https://github.com/Findus23/invoices.git
synced 2024-09-19 15:13:47 +02:00
support bank fees
This commit is contained in:
parent
0fac5f73f9
commit
b437952550
3 changed files with 13 additions and 5 deletions
9
main.py
9
main.py
|
@ -14,7 +14,7 @@ def create_invoice():
|
|||
"locale": ask("locale", "set", set=["de", "en"], default="de"),
|
||||
"id": ask("id", "int", default=current_id),
|
||||
"title": ask("title"),
|
||||
"recipient": ask("recipient", "set", set=get_possible_recipents(), default="innocraft"),
|
||||
"recipient": ask("recipient", "set", set=get_possible_recipents(), default=config["default_recipient"]),
|
||||
"date": ask("date", "date", default="today"),
|
||||
"mode": ask("Mode", "set", set=["single", "hourly"], default="hourly"),
|
||||
"description": ask("description"),
|
||||
|
@ -32,6 +32,7 @@ def create_invoice():
|
|||
"per_hour": ask("per hour", "money", default=config["default_hourly_rate"])
|
||||
}
|
||||
invoice.update(hourly)
|
||||
invoice["bank_fee"] = ask("bank_fee", "boolean")
|
||||
directory = invoice_dir + "/" + str(invoice["id"])
|
||||
if os.path.exists(directory):
|
||||
if not ask("overwrite", "boolean"):
|
||||
|
@ -63,11 +64,13 @@ def compile_invoice(id):
|
|||
loader=jinja2.FileSystemLoader(os.path.abspath('.'))
|
||||
)
|
||||
if invoice["mode"] == "hourly":
|
||||
invoice["total"] = invoice["per_hour"] * (invoice["hours"] + invoice["minutes"] / 60)
|
||||
invoice["hourtotal"] = invoice["per_hour"] * (invoice["hours"] + invoice["minutes"] / 60)
|
||||
invoice["total"] = invoice["hourtotal"] + config["bank_fee"]
|
||||
data = {
|
||||
"from": load_yaml("from.yaml"),
|
||||
"to": load_yaml("recipients/{id}.yaml".format(id=invoice["recipient"])),
|
||||
"invoice": invoice
|
||||
"invoice": invoice,
|
||||
"config": config
|
||||
}
|
||||
|
||||
strings = load_yaml("strings.yaml")
|
||||
|
|
|
@ -22,7 +22,9 @@ taxexception:
|
|||
transfer:
|
||||
de: Ich bitte Sie, den Gesamtbetrag innerhalb der nächsten 10 Werktage auf folgendes Konto zu überweisen
|
||||
en: Please transfer the due invoice amount to the following account
|
||||
|
||||
range:
|
||||
de: Leistungszeitraum
|
||||
en: period
|
||||
bank_fee:
|
||||
de: Überweisungsgebühr
|
||||
en: Bank Fees
|
||||
|
|
|
@ -105,8 +105,11 @@
|
|||
\VAR{invoice.description} &
|
||||
\EUR{\VAR{invoice.per_hour | formatdigit }} &
|
||||
\VAR{invoice.hours}:\VAR{invoice.minutes} &
|
||||
\EUR{\VAR{invoice.total | formatdigit }} \\
|
||||
\EUR{\VAR{invoice.hourtotal | formatdigit }} \\
|
||||
|
||||
\BLOCK{if invoice.bank_fee}
|
||||
\VAR{"bank_fee"|t} & & & \EUR{\VAR{config.bank_fee| formatdigit}} \\
|
||||
\BLOCK{endif}
|
||||
|
||||
|
||||
\midrule %\cmidrule{4-4}
|
||||
|
|
Loading…
Reference in a new issue