mirror of
https://github.com/brmlab/brmbar.git
synced 2025-06-07 12:54:05 +02:00
brmbar-cli userlog
This commit is contained in:
parent
0e306912d7
commit
8f6776f3d0
1 changed files with 9 additions and 0 deletions
|
@ -19,6 +19,7 @@ Usage: brmbar-cli.py COMMAND ARGS...
|
|||
You can use negative AMT to undo a sale.
|
||||
restock ITEM AMT
|
||||
userinfo USER
|
||||
userlog USER TIMESTAMP
|
||||
iteminfo ITEM
|
||||
|
||||
2. Management commands
|
||||
|
@ -142,6 +143,14 @@ elif sys.argv[1] == "userinfo":
|
|||
res = db.execute_and_fetchall("SELECT barcode FROM barcodes WHERE account = %s", [acct.id])
|
||||
print("Barcodes: " + ", ".join(map((lambda r: r[0]), res)))
|
||||
|
||||
elif sys.argv[1] == "userlog":
|
||||
acct = load_user(sys.argv[2])
|
||||
timestamp = sys.argv[3]
|
||||
|
||||
res = db.execute_and_fetchall("SELECT transactions.time,transactions.description FROM transactions INNER JOIN accounts ON accounts.id=transactions.responsible WHERE accounts.name=%s and time > TIMESTAMP %s ORDER BY time", [acct.name,timestamp])
|
||||
for transaction in res:
|
||||
print("{}\t{}\t".format(transaction[0],transaction[1]))
|
||||
|
||||
elif sys.argv[1] == "iteminfo":
|
||||
acct = load_item(sys.argv[2])
|
||||
print("{} (id {}): {} pcs".format(acct.name, acct.id, acct.balance()))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue