1
0
Fork 0
mirror of https://github.com/Findus23/invoices.git synced 2024-09-19 15:13:47 +02:00

minor fixes

This commit is contained in:
Lukas Winkler 2018-03-19 18:55:22 +01:00
parent cd2edbc539
commit 087f8b1aab
No known key found for this signature in database
GPG key ID: 94AFBE7C2656A5B5
4 changed files with 24 additions and 6 deletions

View file

@ -18,8 +18,7 @@ def create_invoice():
"date": ask("date", "date", default="today"),
"mode": ask("Mode", "set", set=["single", "hourly"], default="hourly"),
"description": ask("description"),
"start": ask("from", "date"),
"end": ask("to", "date"),
"range": ask("range"),
}
if invoice["mode"] == "single":
single = {
@ -29,11 +28,16 @@ def create_invoice():
elif invoice["mode"] == "hourly":
hourly = {
"hours": ask("hours", "int"),
"minutes": ask("hours", "int"),
"per_hour": ask("per hour", "money", default=config["default_hourly_rate"])
}
invoice.update(hourly)
directory = invoice_dir + "/" + str(invoice["id"])
os.mkdir(directory)
if os.path.exists(directory):
if not ask("overwrite", "boolean"):
exit()
else:
os.mkdir(directory)
print(invoice)
save_yaml(invoice, directory + "/data.yaml")
save_yaml(config, "config.yaml")
@ -106,7 +110,7 @@ if __name__ == "__main__":
if sys.argv[1] == "compile":
if len(sys.argv) == 3:
try:
invoice_id = int(sys.argv[1])
invoice_id = int(sys.argv[2])
except ValueError:
invoice_id = False
print("invalid id")

View file

@ -20,5 +20,9 @@ taxexception:
de: Umsatzsteuerfrei aufgrund der Kleinunternehmerregelung gemäß §6(1)27 UStG
en: VAT-exempt because of small-business regulation (§6(1)27 UStG)
transfer:
de: Ich bitte Sie, den Gesamtbetrag innerhalb der nächsten 10 Tage auf folgendes Konto zu überweisen
en: Please transfer the due invoice amount to the following account
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

View file

@ -67,6 +67,9 @@
\setkomavar{invoice}{\VAR{invoice.id}}
\setkomavar{date}{\VAR{invoice.date}}
\newkomavar*[\VAR{"range"|t}]{range}
\setkomavar{range}{\VAR{invoice.range}}
\pdfinfo{
/Author (\Name)

View file

@ -57,4 +57,11 @@ def ask(question, validator=None, default=None, set=None):
if answer not in set:
print("only [{formats}] are allowed".format(formats=", ".join(set)))
continue
if validator == "boolean":
if answer.lower() in ['true', '1', 't', 'y', 'yes']:
return True
elif answer.lower() in ["false", "0", "f", "n", "no"]:
return False
else:
continue
return answer