mirror of
https://github.com/Findus23/invoices.git
synced 2024-09-19 15:13:47 +02:00
minor fixes
This commit is contained in:
parent
cd2edbc539
commit
087f8b1aab
4 changed files with 24 additions and 6 deletions
|
@ -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")
|
|
@ -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
|
||||
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
|
||||
|
|
|
@ -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)
|
||||
|
|
7
utils.py
7
utils.py
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue