merge email sending
Merge branch 'master' of https://github.com/ulrichknecht/baroness
@@ -170,6 +170,7 @@ def get_consumed(user=None, startdate=None, enddate=None):
|
|||||||
consumed.append(c)
|
consumed.append(c)
|
||||||
return consumed
|
return consumed
|
||||||
|
|
||||||
|
|
||||||
def add_consume(username, productid):
|
def add_consume(username, productid):
|
||||||
|
|
||||||
consumerid = query_db("SELECT ID FROM USERS WHERE NAME = ?", [username], one=True)
|
consumerid = query_db("SELECT ID FROM USERS WHERE NAME = ?", [username], one=True)
|
||||||
@@ -184,6 +185,19 @@ def add_consume(username, productid):
|
|||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
|
def get_debt(name=None):
|
||||||
|
consumptions = get_consumed(name)
|
||||||
|
debt = 0
|
||||||
|
for consumption in consumptions:
|
||||||
|
debt += consumption.price
|
||||||
|
|
||||||
|
deposits = get_deposits(get_user_by_name(name).id)
|
||||||
|
for deposit in deposits:
|
||||||
|
debt -= deposit.amount
|
||||||
|
return debt
|
||||||
|
|
||||||
|
|
||||||
def get_deposits(userid = None):
|
def get_deposits(userid = None):
|
||||||
#ID|USERID|AMOUNT|TIME
|
#ID|USERID|AMOUNT|TIME
|
||||||
if userid == None:
|
if userid == None:
|
||||||
|
|||||||
105
app/gui.py
@@ -1,26 +1,33 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
import wx
|
import wx
|
||||||
|
import wx.lib.buttons
|
||||||
|
import wx.lib.platebtn
|
||||||
from plot import *
|
from plot import *
|
||||||
from database import *
|
from database import *
|
||||||
|
from settings import *
|
||||||
import flask as fla
|
import flask as fla
|
||||||
|
|
||||||
|
|
||||||
class MainWindow(wx.Frame):
|
class MainWindow(wx.Frame):
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super(MainWindow, self).__init__(*args, **kwargs)
|
super(MainWindow, self).__init__(*args, **kwargs)
|
||||||
self.init_ui()
|
|
||||||
|
|
||||||
def init_ui(self):
|
|
||||||
self.SetSize((480, 320))
|
|
||||||
self.SetTitle('Baroness Control')
|
|
||||||
|
|
||||||
self.panelStart = PanelStart(self)
|
self.panelStart = PanelStart(self)
|
||||||
self.panelDrinks = PanelDrinks(self)
|
self.panelDrinks = PanelDrinks(self)
|
||||||
self.panelUsers = PanelUsers(self)
|
self.panelUsers = PanelUsers(self)
|
||||||
self.panelThanks = PanelThanks(self)
|
self.panelThanks = PanelThanks(self)
|
||||||
self.panelSorry = PanelSorry(self)
|
self.panelSorry = PanelSorry(self)
|
||||||
|
|
||||||
|
self.settings = Settings()
|
||||||
self.user = User()
|
self.user = User()
|
||||||
|
self.drinkl = str()
|
||||||
|
self.active = 0
|
||||||
|
|
||||||
|
self.init_ui()
|
||||||
|
|
||||||
|
def init_ui(self):
|
||||||
|
self.SetSize((480, 320))
|
||||||
|
self.SetTitle('Baroness Control')
|
||||||
|
|
||||||
self.active = 0
|
self.active = 0
|
||||||
self.switchPanels()
|
self.switchPanels()
|
||||||
@@ -38,6 +45,9 @@ class MainWindow(wx.Frame):
|
|||||||
return self.user.id
|
return self.user.id
|
||||||
# return self.user
|
# return self.user
|
||||||
|
|
||||||
|
def getDrink(self):
|
||||||
|
return self.drink
|
||||||
|
|
||||||
def onExit(self, e=None):
|
def onExit(self, e=None):
|
||||||
self.active = 0
|
self.active = 0
|
||||||
self.switchPanels()
|
self.switchPanels()
|
||||||
@@ -56,8 +66,8 @@ class MainWindow(wx.Frame):
|
|||||||
def onProduct(self, e):
|
def onProduct(self, e):
|
||||||
self.active = 3
|
self.active = 3
|
||||||
print self.user.longname + ' consumes'
|
print self.user.longname + ' consumes'
|
||||||
buttonl = e.GetEventObject().GetLabelText()
|
self.drinkl = e.GetEventObject().GetLabelText()
|
||||||
drink = get_product_by_name(buttonl.split('\n')[0]).id
|
drink = get_product_by_name(self.drinkl.split('\n')[0]).id
|
||||||
with app.app_context():
|
with app.app_context():
|
||||||
for i in range(0, int(self.panelDrinks.GetAmount())):
|
for i in range(0, int(self.panelDrinks.GetAmount())):
|
||||||
add_consume(self.user.name, drink)
|
add_consume(self.user.name, drink)
|
||||||
@@ -73,12 +83,19 @@ class MainWindow(wx.Frame):
|
|||||||
if self.active == 0:
|
if self.active == 0:
|
||||||
self.panelStart.Show()
|
self.panelStart.Show()
|
||||||
elif self.active == 1:
|
elif self.active == 1:
|
||||||
|
if not settings.onlyOneDrink:
|
||||||
|
self.panelDrinks.l_amount.SetLabel("%02d" % 1)
|
||||||
self.panelDrinks.l_user.SetLabel(self.user.longname)
|
self.panelDrinks.l_user.SetLabel(self.user.longname)
|
||||||
self.panelDrinks.Show()
|
self.panelDrinks.Show()
|
||||||
elif self.active == 2:
|
elif self.active == 2:
|
||||||
self.panelUsers.Show()
|
self.panelUsers.Show()
|
||||||
elif self.active == 3:
|
elif self.active == 3:
|
||||||
self.panelThanks.label_1.SetLabel(self.user.longname)
|
self.panelThanks.label_1.SetLabel(self.user.longname + "\n" + "%02d x " % int(self.panelDrinks.GetAmount()) + self.drinkl.split('\n')[0])
|
||||||
|
self.panelThanks.label_1.Wrap(340)
|
||||||
|
try:
|
||||||
|
self.panelThanks.bitmap_2.SetBitmap(wx.Bitmap("./app/static/product_%s.png" % self.drinkl.split('\n')[0], wx.BITMAP_TYPE_ANY))
|
||||||
|
except:
|
||||||
|
print "no picture for drink:", self.drinkl.split('\n')
|
||||||
self.panelThanks.Show()
|
self.panelThanks.Show()
|
||||||
self.delayExit()
|
self.delayExit()
|
||||||
elif self.active == 4:
|
elif self.active == 4:
|
||||||
@@ -89,9 +106,10 @@ class MainWindow(wx.Frame):
|
|||||||
class PanelStart (wx.Panel):
|
class PanelStart (wx.Panel):
|
||||||
|
|
||||||
def __init__(self, parent):
|
def __init__(self, parent):
|
||||||
wx.Panel.__init__(self, parent, id=wx.ID_ANY, pos = wx.DefaultPosition, size=(480, 320))
|
wx.Panel.__init__(self, parent, id=wx.ID_ANY, pos=(0, 0), size=(480, 320))
|
||||||
#panel = wx.Panel(self, -1)
|
#panel = wx.Panel(self, -1)
|
||||||
self.bitmap_1 = wx.StaticBitmap(self, wx.ID_ANY, wx.Bitmap("./gui/start.png", wx.BITMAP_TYPE_ANY))
|
self.bitmap_1 = wx.StaticBitmap(self, wx.ID_ANY, wx.Bitmap("./gui/start.png", wx.BITMAP_TYPE_ANY), pos=(0, 0))
|
||||||
|
if not settings.hideGuiList:
|
||||||
self.Bind(wx.EVT_LEFT_DOWN, parent.onStart)
|
self.Bind(wx.EVT_LEFT_DOWN, parent.onStart)
|
||||||
self.bitmap_1.Bind(wx.EVT_LEFT_DOWN, parent.onStart)
|
self.bitmap_1.Bind(wx.EVT_LEFT_DOWN, parent.onStart)
|
||||||
|
|
||||||
@@ -103,12 +121,18 @@ class PanelStart (wx.Panel):
|
|||||||
class PanelThanks (wx.Panel):
|
class PanelThanks (wx.Panel):
|
||||||
|
|
||||||
def __init__(self, parent):
|
def __init__(self, parent):
|
||||||
wx.Panel.__init__(self, parent, id=wx.ID_ANY, pos = wx.DefaultPosition, size=(480, 320))
|
wx.Panel.__init__(self, parent, id=wx.ID_ANY, pos=(0, 0), size=(480, 320))
|
||||||
#panel = wx.Panel(self, -1)
|
#panel = wx.Panel(self, -1)
|
||||||
self.bitmap_1 = wx.StaticBitmap(self, wx.ID_ANY, wx.Bitmap("./gui/thanks.png", wx.BITMAP_TYPE_ANY))
|
self.bitmap_1 = wx.StaticBitmap(self, wx.ID_ANY, wx.Bitmap("./gui/thanks.png", wx.BITMAP_TYPE_ANY), pos=(0, 0))
|
||||||
self.bitmap_1.Bind(wx.EVT_LEFT_DOWN, parent.onExit)
|
self.bitmap_2 = wx.StaticBitmap(self, wx.ID_ANY, wx.NullBitmap, pos=(10, 10))
|
||||||
self.label_1 = wx.StaticText(self, wx.ID_ANY, 'bla blub', pos=(100,100))
|
|
||||||
self.label_1.SetFont(wx.Font(30, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Humor Sans"))
|
self.label_1 = wx.StaticText(self, wx.ID_ANY, 'bla blub', pos=(120, 50), size=(340, 100))
|
||||||
|
self.label_1.SetFont(wx.Font(25, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Humor Sans"))
|
||||||
|
self.label_1.SetForegroundColour("white")
|
||||||
|
|
||||||
|
#self.l_product = wx.StaticText(self, wx.ID_ANY, 'bla blub', pos=(120, 100), size=(340, 100))
|
||||||
|
#self.l_product.SetFont(wx.Font(30, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Humor Sans"))
|
||||||
|
#self.l_product.SetForegroundColour("white")
|
||||||
|
|
||||||
def on_quit(self, e):
|
def on_quit(self, e):
|
||||||
print "close"
|
print "close"
|
||||||
@@ -118,9 +142,9 @@ class PanelThanks (wx.Panel):
|
|||||||
class PanelSorry (wx.Panel):
|
class PanelSorry (wx.Panel):
|
||||||
|
|
||||||
def __init__(self, parent):
|
def __init__(self, parent):
|
||||||
wx.Panel.__init__(self, parent, id=wx.ID_ANY, pos = wx.DefaultPosition, size=(480, 320))
|
wx.Panel.__init__(self, parent, id=wx.ID_ANY, pos=(0, 0), size=(480, 320))
|
||||||
#panel = wx.Panel(self, -1)
|
#panel = wx.Panel(self, -1)
|
||||||
self.bitmap_1 = wx.StaticBitmap(self, wx.ID_ANY, wx.Bitmap("./gui/sorry.png", wx.BITMAP_TYPE_ANY))
|
self.bitmap_1 = wx.StaticBitmap(self, wx.ID_ANY, wx.Bitmap("./gui/sorry.png", wx.BITMAP_TYPE_ANY), pos=(0, 0))
|
||||||
self.bitmap_1.Bind(wx.EVT_LEFT_DOWN, parent.onExit)
|
self.bitmap_1.Bind(wx.EVT_LEFT_DOWN, parent.onExit)
|
||||||
self.label_1 = wx.StaticText(self, wx.ID_ANY, 'bla blub', pos=(100,100))
|
self.label_1 = wx.StaticText(self, wx.ID_ANY, 'bla blub', pos=(100,100))
|
||||||
self.label_1.SetFont(wx.Font(30, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Humor Sans"))
|
self.label_1.SetFont(wx.Font(30, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Humor Sans"))
|
||||||
@@ -133,9 +157,9 @@ class PanelSorry (wx.Panel):
|
|||||||
class PanelRfid (wx.Panel):
|
class PanelRfid (wx.Panel):
|
||||||
|
|
||||||
def __init__(self, parent):
|
def __init__(self, parent):
|
||||||
wx.Panel.__init__(self, parent, id=wx.ID_ANY, pos = wx.DefaultPosition, size=(480, 320))
|
wx.Panel.__init__(self, parent, id=wx.ID_ANY, pos=(0, 0), size=(480, 320))
|
||||||
#panel = wx.Panel(self, -1)
|
#panel = wx.Panel(self, -1)
|
||||||
self.bitmap_1 = wx.StaticBitmap(self, wx.ID_ANY, wx.Bitmap("./gui/rfid.png", wx.BITMAP_TYPE_ANY))
|
self.bitmap_1 = wx.StaticBitmap(self, wx.ID_ANY, wx.Bitmap("./gui/rfid.png", wx.BITMAP_TYPE_ANY), pos=(0, 0))
|
||||||
self.bitmap_1.Bind(wx.EVT_LEFT_DOWN, parent.onExit)
|
self.bitmap_1.Bind(wx.EVT_LEFT_DOWN, parent.onExit)
|
||||||
self.label_1 = wx.StaticText(self, wx.ID_ANY, 'bla blub', pos=(100,100))
|
self.label_1 = wx.StaticText(self, wx.ID_ANY, 'bla blub', pos=(100,100))
|
||||||
self.label_1.SetFont(wx.Font(30, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Humor Sans"))
|
self.label_1.SetFont(wx.Font(30, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Humor Sans"))
|
||||||
@@ -148,9 +172,9 @@ class PanelRfid (wx.Panel):
|
|||||||
class PanelDrinks (wx.Panel):
|
class PanelDrinks (wx.Panel):
|
||||||
|
|
||||||
def __init__(self, parent):
|
def __init__(self, parent):
|
||||||
wx.Panel.__init__(self, parent, id=wx.ID_ANY, pos = wx.DefaultPosition, size=(480, 320))
|
wx.Panel.__init__(self, parent, id=wx.ID_ANY, pos=(0, 0), size=(480, 320))
|
||||||
|
|
||||||
self.bitmap_1 = wx.StaticBitmap(self, wx.ID_ANY, wx.Bitmap("./gui/products.png", wx.BITMAP_TYPE_ANY))
|
self.bitmap_1 = wx.StaticBitmap(self, wx.ID_ANY, wx.Bitmap("./gui/products.png", wx.BITMAP_TYPE_ANY), pos=(0, 0))
|
||||||
|
|
||||||
products = get_products()
|
products = get_products()
|
||||||
buttonids = []
|
buttonids = []
|
||||||
@@ -158,17 +182,19 @@ class PanelDrinks (wx.Panel):
|
|||||||
for product in products:
|
for product in products:
|
||||||
if product.isshown:
|
if product.isshown:
|
||||||
#480x320
|
#480x320
|
||||||
self.but = wx.Button(self, id=wx.ID_ANY, label=product.name + u"\n" + "%0.2f" % product.price, pos=(0+i*120, 0), size=(120, 120))
|
self.but = wx.Button(self, id=wx.ID_ANY, label=product.name + u"\n" + u"%0.2f" % product.price, pos=(0+i*120, 0), size=(120, 120))
|
||||||
|
self.but.SetBackgroundColour((255-(i*20 % 40), (160+(i*50 % 100)), 0))
|
||||||
|
#self.but.SetForegroundColour("#006699")
|
||||||
self.but.SetFont(wx.Font(23, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Humor Sans"))
|
self.but.SetFont(wx.Font(23, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Humor Sans"))
|
||||||
print "Button %s created" % product.name
|
|
||||||
self.but.Bind(wx.EVT_LEFT_DOWN, parent.onProduct, id=self.but.Id)
|
self.but.Bind(wx.EVT_LEFT_DOWN, parent.onProduct, id=self.but.Id)
|
||||||
i = i+1
|
i += 1
|
||||||
|
|
||||||
|
if not settings.onlyOneDrink:
|
||||||
self.b_less = wx.Button(self, id = wx.ID_ANY, label=u"-", pos=(0,240), size=(120, 80))
|
self.b_less = wx.Button(self, id = wx.ID_ANY, label=u"-", pos=(0,240), size=(120, 80))
|
||||||
self.b_less.SetFont(wx.Font(60, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Humor Sans"))
|
self.b_less.SetFont(wx.Font(60, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Humor Sans"))
|
||||||
self.b_less.Bind(wx.EVT_LEFT_DOWN, self.onLess, id=self.b_less.Id)
|
self.b_less.Bind(wx.EVT_LEFT_DOWN, self.onLess, id=self.b_less.Id)
|
||||||
|
|
||||||
self.l_amount = wx.StaticText(self, wx.ID_ANY, "1", pos=(145,245), style=wx.ALIGN_CENTER)
|
self.l_amount = wx.StaticText(self, wx.ID_ANY, "%2d" % 0, pos=(137, 245), style=wx.ALIGN_CENTER)
|
||||||
self.l_amount.SetFont(wx.Font(50, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
|
self.l_amount.SetFont(wx.Font(50, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))
|
||||||
|
|
||||||
self.b_more = wx.Button(self, id = wx.ID_ANY, label=u"+", pos=(240,240), size=(120, 80))
|
self.b_more = wx.Button(self, id = wx.ID_ANY, label=u"+", pos=(240,240), size=(120, 80))
|
||||||
@@ -187,13 +213,14 @@ class PanelDrinks (wx.Panel):
|
|||||||
|
|
||||||
def onMore(self,e, id=-1):
|
def onMore(self,e, id=-1):
|
||||||
self.amount = int(self.l_amount.GetLabelText()) + 1
|
self.amount = int(self.l_amount.GetLabelText()) + 1
|
||||||
self.l_amount.SetLabel(str(self.amount))
|
if self.amount <= settings.drinkLimit:
|
||||||
|
self.l_amount.SetLabel("%02d" % self.amount)
|
||||||
self.Layout()
|
self.Layout()
|
||||||
|
|
||||||
def onLess(self,e, id=-1):
|
def onLess(self,e, id=-1):
|
||||||
self.amount = int(self.l_amount.GetLabelText()) - 1
|
self.amount = int(self.l_amount.GetLabelText()) - 1
|
||||||
if self.amount > 0:
|
if self.amount > 0:
|
||||||
self.l_amount.SetLabel(str(self.amount))
|
self.l_amount.SetLabel( "%02d" % self.amount)
|
||||||
self.Layout()
|
self.Layout()
|
||||||
|
|
||||||
def GetAmount(self):
|
def GetAmount(self):
|
||||||
@@ -207,9 +234,9 @@ class PanelDrinks (wx.Panel):
|
|||||||
class PanelUsers (wx.Panel):
|
class PanelUsers (wx.Panel):
|
||||||
|
|
||||||
def __init__(self, parent):
|
def __init__(self, parent):
|
||||||
wx.Panel.__init__(self, parent, id=wx.ID_ANY, size=(480, 320))
|
wx.Panel.__init__(self, parent, id=wx.ID_ANY, pos=(0, 0), size=(480, 320))
|
||||||
|
|
||||||
self.bitmap_1 = wx.StaticBitmap(self, wx.ID_ANY, wx.Bitmap("./gui/users.png", wx.BITMAP_TYPE_ANY))
|
self.bitmap_1 = wx.StaticBitmap(self, wx.ID_ANY, wx.Bitmap("./gui/users.png", wx.BITMAP_TYPE_ANY), pos=(0, 0))
|
||||||
|
|
||||||
users = get_users()
|
users = get_users()
|
||||||
names = list()
|
names = list()
|
||||||
@@ -217,13 +244,19 @@ class PanelUsers (wx.Panel):
|
|||||||
if user.isshown:
|
if user.isshown:
|
||||||
names.append(user.longname)
|
names.append(user.longname)
|
||||||
|
|
||||||
|
|
||||||
self.but_names = list()
|
self.but_names = list()
|
||||||
i = 0
|
i = 0
|
||||||
for name in names:
|
for name in names:
|
||||||
#480x320
|
#480x320
|
||||||
self.but = wx.Button(self, id=wx.ID_ANY, label=name, pos=(0,0+i*80), size=(400, 80))
|
#self.but = wx.Button (self, id=wx.ID_ANY, label=name, pos=(0,0+i*80), size=(400, 80))
|
||||||
self.but.SetFont(wx.Font(20, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Humor Sans"))
|
self.but = wx.lib.platebtn.PlateButton(self, label=name, pos=(3, 3+i*80),
|
||||||
|
style=wx.BU_EXACTFIT | wx.lib.platebtn.PB_STYLE_SQUARE)
|
||||||
|
self.but.SetSize((392, 74))
|
||||||
|
|
||||||
|
self.but.SetBackgroundColour((255-(i*20 % 40), (160+(i*50 % 100)), 0))
|
||||||
|
#self.but.SetForegroundColour("#006699")
|
||||||
|
self.but.SetPressColor(wx.Color(255,255,255,0))
|
||||||
|
self.but.SetFont(wx.Font(25, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Humor Sans"))
|
||||||
self.but.Bind(wx.EVT_LEFT_DOWN, parent.onUser, id=self.but.Id)
|
self.but.Bind(wx.EVT_LEFT_DOWN, parent.onUser, id=self.but.Id)
|
||||||
self.but_names.append(self.but)
|
self.but_names.append(self.but)
|
||||||
i += 1
|
i += 1
|
||||||
@@ -251,7 +284,7 @@ class PanelUsers (wx.Panel):
|
|||||||
self.Layout()
|
self.Layout()
|
||||||
|
|
||||||
def on_up(self,e , id=-1):
|
def on_up(self,e , id=-1):
|
||||||
if self.but_names[0].GetPosition()[1] == 0:
|
if self.but_names[0].GetPosition()[1] >= 0:
|
||||||
return
|
return
|
||||||
for button in self.but_names:
|
for button in self.but_names:
|
||||||
button.SetPosition((button.GetPosition()[0], button.GetPosition()[1]+320))
|
button.SetPosition((button.GetPosition()[0], button.GetPosition()[1]+320))
|
||||||
@@ -262,6 +295,10 @@ class PanelUsers (wx.Panel):
|
|||||||
print id
|
print id
|
||||||
#if id == self.b_down.Id:
|
#if id == self.b_down.Id:
|
||||||
|
|
||||||
|
def trap(self, e):
|
||||||
|
e.Skip()
|
||||||
|
return
|
||||||
|
|
||||||
def on_quit(self, e):
|
def on_quit(self, e):
|
||||||
print "close"
|
print "close"
|
||||||
self.Destroy()
|
self.Destroy()
|
||||||
46
app/settings.py
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
################################################################
|
||||||
|
# Settings #
|
||||||
|
################################################################
|
||||||
|
#
|
||||||
|
# This is the settings file!
|
||||||
|
# Edit settings to your preference and restart the device
|
||||||
|
#
|
||||||
|
# The default for everything is False,
|
||||||
|
# default numbers are given in comments
|
||||||
|
#
|
||||||
|
# Web interface colours and styles
|
||||||
|
# can be changed in app/static/style.css
|
||||||
|
#
|
||||||
|
# Gui Backgrounds can be replaced in gui/ folder (.png files)
|
||||||
|
#
|
||||||
|
################################################################
|
||||||
|
|
||||||
|
|
||||||
|
class Settings:
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
##User Interaction
|
||||||
|
#Gui
|
||||||
|
self.hideGuiList = False #Show the consumers in the gui
|
||||||
|
self.disableRFID = False #Disable RFID Reading
|
||||||
|
self.allowHiding = False #Allow a user to hide from the gui consumer list
|
||||||
|
self.onlyOneDrink = False #Hide selection for amount in the gui
|
||||||
|
self.drinkLimit = 20 #Max amount of consumptions in the gui (default 20)
|
||||||
|
#Web Interface
|
||||||
|
self.disableWebIF = False #Disable Web Interface
|
||||||
|
self.disableStats = False #Disable All Statistics
|
||||||
|
|
||||||
|
##Payment Incentives
|
||||||
|
#Money Limit
|
||||||
|
self.autoBlock = False #Automatically block user if money owed > limit
|
||||||
|
self.autoUnblock = False #Automatically unblock user if money owed < limit
|
||||||
|
self.blockLimit = 150 #Money limit for automatic blocking (default 150)
|
||||||
|
#Mail Spam
|
||||||
|
self.autoAnnoy = False #Automatically send payment eMails
|
||||||
|
self.annoyDays = 20 #Automatically send mails every x days (default 20)
|
||||||
|
self.annoyLimit = 100 #Money limit for autoAnnoy (default 100)
|
||||||
|
|
||||||
|
##Developer Settings
|
||||||
|
self.debug = False #Show debug output in console
|
||||||
|
|
||||||
|
settings = Settings()
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td>{{user.longname}}</td>
|
<td>{{user.longname}}</td>
|
||||||
<td>{% if user.isblack %} ☑ {% else %} ☐ {% endif %}</td>
|
<td>{% if user.isblack %} ☑ {% else %} ☐ {% endif %}</td>
|
||||||
<td>{{dept}} € </td>
|
<td>{{debt[user.id-1]}} € </td>
|
||||||
<td> <input type="number" name="{{user.name}}_payed" step="any" required value="0" /> € </td>
|
<td> <input type="number" name="{{user.name}}_payed" step="any" required value="0" /> € </td>
|
||||||
<td>Einzelne Rechnung <a href="/billing/send_personal_bill/{{user.name}}">versenden</a></td>
|
<td>Einzelne Rechnung <a href="/billing/send_personal_bill/{{user.name}}">versenden</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
<p>Total: {{ "%0.2f" % (deposited - owed)}} €</p>
|
<p>Total: {{ "%0.2f" % (deposited - owed)}} €</p>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<h2>Einzahlungen (TODO)</h2>
|
<h2>Einzahlungen</h2>
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Datum</th>
|
<th>Datum</th>
|
||||||
|
|||||||
@@ -273,7 +273,10 @@ def billing():
|
|||||||
|
|
||||||
return render_template('billing.html', users=users, success="Writing to database is not implemented", dept=0, user=get_user_by_name(session.get('name')))
|
return render_template('billing.html', users=users, success="Writing to database is not implemented", dept=0, user=get_user_by_name(session.get('name')))
|
||||||
if request.method == 'GET':
|
if request.method == 'GET':
|
||||||
return render_template('billing.html', users=users, dept=0, user=get_user_by_name(session.get('name')))
|
debt = [0 for user in users]
|
||||||
|
for user in users:
|
||||||
|
debt[user.id-1] = get_debt(user.name)
|
||||||
|
return render_template('billing.html', users=users, debt=debt, user=get_user_by_name(session.get('name')))
|
||||||
|
|
||||||
|
|
||||||
@app.route('/billing/send_personal_bill/<name>', methods=['GET', 'POST'])
|
@app.route('/billing/send_personal_bill/<name>', methods=['GET', 'POST'])
|
||||||
|
|||||||
BIN
gui/products.png
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
BIN
gui/products.xcf
BIN
gui/start.png
|
Before Width: | Height: | Size: 35 KiB After Width: | Height: | Size: 38 KiB |
BIN
gui/thanks.png
|
Before Width: | Height: | Size: 6.4 KiB After Width: | Height: | Size: 9.0 KiB |
BIN
gui/users.png
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 2.4 KiB |