-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathexpirycheck.py
More file actions
59 lines (44 loc) · 1.69 KB
/
expirycheck.py
File metadata and controls
59 lines (44 loc) · 1.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#Name - Rohit Shankarrao Ukirde
#Email - rukir2@uis.edu
#Python 2.7
from Tkinter import *
from sqlite3 import dbapi2 as sqlite
import time
columns=('Item_No', 'Item_Name', 'Item_Type', 'Quantity_Remain', 'Item_Cost', 'Expiry_Date','Manufactured_By')
c=sqlite.connect("grocery.sqlite")
cur=c.cursor()
def expiry():
''' Expiry GUI '''
global expirychk, expdate,c, cur, flag
total=0.0
today=str(time.localtime()[2])+'/'+str(time.localtime()[1])+'/'+str(time.localtime()[0])
flag='expirychk'
groitem=[]
cur.execute("select * from grocerylist")
for i in cur:
groitem.append(i[1])
c.commit()
expirychk=Tk()
expirychk.title('Check Expiry of the Items')
expirychk.wm_iconbitmap('favicon.ico')
Label(expirychk,text='Today: '+today).grid(row=0,column=0,columnspan=3)
Label(expirychk,text='Its Illegal to sell expired items').grid(row=1, column=0,columnspan=3)
Label(expirychk,text='-'*80).grid(row=2, column=0,columnspan=3)
expdate=Spinbox(expirychk,values=groitem)
expdate.grid(row=3, column=0)
Button(expirychk,text='Check Expiry date', command=chkexpiry).grid(row=3, column=1)
Label(expirychk,text='-'*80).grid(row=4, column=0,columnspan=3)
Button(expirychk,text='Main Menu',command=mainmenu).grid(row=5, column=2)
expirychk.mainloop()
def chkexpiry():
''' Check Expiry Date button will navigate here '''
global c, cur, expdate, expirychk
cur.execute("select * from grocerylist")
for i in cur:
if(i[1]==expdate.get()):
Label(expirychk, text=i[5]).grid(row=3, column=2)
c.commit()
def mainmenu():
if flag=='expirychk':
expirychk.destroy()
# expiry()