diff options
author | Sebastian Reichel <sre@ring0.de> | 2013-02-23 17:35:33 +0100 |
---|---|---|
committer | Sebastian Reichel <sre@ring0.de> | 2013-02-23 17:35:33 +0100 |
commit | 94539d42b632ff8365550505a464beb3b6ddaa41 (patch) | |
tree | 69db023047dd36b7d02731d650b13e28335ad6ba /invoice | |
parent | 09c958d426761fe34a05edcc618782e5ff96aa34 (diff) | |
download | serial-barcode-scanner-94539d42b632ff8365550505a464beb3b6ddaa41.tar.bz2 |
remove support for weekly stock mail
Diffstat (limited to 'invoice')
-rwxr-xr-x | invoice/generate-invoice.py | 46 |
1 files changed, 2 insertions, 44 deletions
diff --git a/invoice/generate-invoice.py b/invoice/generate-invoice.py index 9592191..aa5072d 100755 --- a/invoice/generate-invoice.py +++ b/invoice/generate-invoice.py @@ -360,51 +360,9 @@ def backup(): send_mail(msg, "shop-backup@kreativitaet-trifft-technik.de") -def get_stock_data(): - connection = sqlite3.connect('shop.db') - c = connection.cursor() - result = [] - - c.execute("SELECT name,amount FROM products") - - for row in c: - result.append((row[0],row[1])) - - c.close() - - return result - -def gen_stock_asciitable(): - stock = get_stock_data() - longest_name = 0 - longest_amount = 0 - asciitable = "" - for element in stock: - if len(element[0]) > longest_name: - longest_name = len(element[0]) - if len(str(element[1])) > longest_amount: - longest_amount = len(str(element[1])) - - asciitable = "+-" + longest_name * "-" + "-+-" + longest_amount * "-" + "-+\n" - asciitable += "| " + "Produkt" + (longest_name - len("Produkt")) * " " + " | " + (longest_amount - 1) * " " + "#" + " |\n" - asciitable += "+-" + longest_name * "-" + "-+-" + longest_amount * "-" + "-+\n" - for product in stock: - asciitable += "| " + product[0] + (longest_name - len(product[0])) * " " + " | " + (longest_amount - len(str(product[1]))) * " " + str(product[1]) + " |\n" - asciitable += "+-" + longest_name * "-" + "-+-" + longest_amount * "-" + "-+\n" - - return asciitable - -def gen_stock_mail(): - msg = MIMEMultipart() - msg["From"] = "KtT-Shopsystem <shop@kreativitaet-trifft-technik.de>" - msg["To"] = "KtT Einkaufsteam <einkauf@kreativitaet-trifft-technik.de>" - msg["Subject"] = Header("Aktueller Warenbestand", 'utf-8') - msg.preamble = "Please use a MIME aware email client!" - msg.attach(MIMEText(gen_stock_asciitable(), 'plain', 'utf-8')) - return msg - def weekly(): - send_mail(gen_stock_mail(), "einkauf@kreativitaet-trifft-technik.de") + #send_mail("", "einkauf@kreativitaet-trifft-technik.de") + pass if sys.argv[1] == "daily": daily() |