code import

This commit is contained in:
Ruzicka Pavel 2017-12-29 18:53:46 +01:00
parent 5a102fcd5a
commit fc36d54062
18 changed files with 1809 additions and 1 deletions

14
stats.sh Executable file
View file

@ -0,0 +1,14 @@
#!/bin/bash
# Display various stats from brmbar
DB="./brmbar.db"
overflow=$(echo "SELECT sum(cash)*(-1) FROM users WHERE name like '%overflow';" | sqlite3 $DB)
cash=$(echo "SELECT (SELECT sum(profit) FROM transactions)-($overflow);" | sqlite3 $DB)
inv=$(echo "SELECT sum(quan*buyprice) FROM stock;" | sqlite3 $DB)
mate=$(echo "SELECT sum(amount) FROM transhuman WHERE strftime('%Y-%m-%d',age)=date('now','localtime') AND (stuff like '%mate%' OR stuff like '%Mate%');" | sqlite3 $DB)
echo "Overflow: $overflow"
echo "Cash: $cash"
echo "Inventory: $inv"
echo "Clubmate sold today: $mate bottles"