summaryrefslogtreecommitdiffstats
path: root/invoice
diff options
context:
space:
mode:
authorSebastian Reichel <sre@ring0.de>2012-12-08 23:35:33 +0100
committerSebastian Reichel <sre@ring0.de>2012-12-08 23:35:33 +0100
commit79b7424746c7636cd23a7869169431afa6941b06 (patch)
tree820a40d120a62e6f5b9b081b40e3e266d4c7a323 /invoice
parentb57876577516c00693ab36970a746f986bc37b66 (diff)
downloadserial-barcode-scanner-79b7424746c7636cd23a7869169431afa6941b06.tar.bz2
rename table sells -> sales
Diffstat (limited to 'invoice')
-rwxr-xr-xinvoice/generate-invoice.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/invoice/generate-invoice.py b/invoice/generate-invoice.py
index 56db6ec..452d23f 100755
--- a/invoice/generate-invoice.py
+++ b/invoice/generate-invoice.py
@@ -58,7 +58,7 @@ def get_invoice_data(user, start=0, stop=0):
if stop > 0:
stopcondition = " AND timestamp <= %d" % stop
- c.execute("SELECT date(timestamp, 'unixepoch', 'localtime'), time(timestamp, 'unixepoch', 'localtime'), products.name, sells.product, sells.timestamp FROM sells, products WHERE user = ? AND products.id = sells.product" + startcondition + stopcondition + " ORDER BY timestamp;", (user,))
+ c.execute("SELECT date(timestamp, 'unixepoch', 'localtime'), time(timestamp, 'unixepoch', 'localtime'), products.name, sales.product, sales.timestamp FROM sales, products WHERE user = ? AND products.id = sales.product" + startcondition + stopcondition + " ORDER BY timestamp;", (user,))
result = []
for row in c:
@@ -194,7 +194,7 @@ def get_invoice_amount(user, start=0, stop=0):
if user < 0:
return 0
else:
- query = "SELECT SUM(memberprice) FROM users, sells purch, prices \
+ query = "SELECT SUM(memberprice) FROM users, sales purch, prices \
WHERE users.id = ? AND users.id = purch.user AND purch.product = prices.product \
AND purch.timestamp >= ? AND purch.timestamp <= ? AND prices.valid_from = \
(SELECT valid_from FROM prices WHERE product = purch.product AND \
@@ -265,7 +265,7 @@ def get_users_with_purchases(start, stop):
connection = sqlite3.connect('shop.db')
c = connection.cursor()
- c.execute("SELECT user FROM sells WHERE timestamp >= ? AND timestamp <= ? GROUP BY user ORDER BY user;", (start,stop))
+ c.execute("SELECT user FROM sales WHERE timestamp >= ? AND timestamp <= ? GROUP BY user ORDER BY user;", (start,stop))
for row in c:
result.append(row[0])