-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadmin_cashes.py
157 lines (129 loc) · 6.5 KB
/
admin_cashes.py
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
from tkinter import *
import sqlite3
import cash
def record_of_cashes(main, vendingState):
'''
@params: main as param
added record button
if clicked cash window will be displayed
'''
frame1_1 = Frame(main, width=1700,height=800,bg="#000000")
frame1_1.place(x=90, y=1)
listbox1_1 = Listbox(main, width=130, height=35,bg="#6A6161",fg="#FFFFFF")
listbox1_1.place(x=90,y=60)
def update_record_of_cashes():
'''
@params: no
added update button
if clicked update form appears
'''
add_user1 = Frame(main, width=250,height=200,bg="#141414")
add_user1.place(x=900, y=60)
def create_cash_button():
'''
@params: no
added create button
if clicked create cash in DB
'''
cash.update_cash(ID.get(), Value.get(), Quantity.get())
added_user = Frame(main, width=250,height=200,bg="#000000")
added_user.place(x=900, y=60)
Label(added_user,text="Cash Has Been Updated",font=("Arial",10,"bold"),fg="white",bg="#000000").place(x=15,y=10)
Label(added_user,text="Press Okey To Return Back To \n Cashes Info",font=("Arial",10,"bold"),fg="white",bg="#000000").place(x=15,y=30)
Button(added_user,text="Update Cash Again",command=record_of_cashes,border=4,bg="#00FF7F",pady=2,activebackground="#000000",activeforeground="#FFFFFF").place(x=90,y=160)
def use(usee):
ID.config(state=NORMAL)
ID.delete(0, END)
def pas(passs):
Value.config(state=NORMAL)
Value.delete(0, END)
def emai(emaii):
Quantity.config(state=NORMAL)
Quantity.delete(0, END)
Label(add_user1,text="Update Cashes",font=("Arial",10,"bold"),fg="white",bg="#000000").place(x=90,y=10)
ID = Entry(add_user1,width=30)
ID.place(x=30,y=40,height=20)
ID.insert(0," ID")
ID.bind("<Button-1>",use)
Value = Entry(add_user1,width=30)
Value.place(x=30,y=70,height=20)
Value.insert(0," Value")
Value.bind("<Button-1>",pas)
Quantity = Entry(add_user1,width=30)
Quantity.place(x=30,y=100,height=20)
Quantity.insert(0, "Quantity")
Quantity.bind("<Button-1>",emai)
Button(add_user1,text="Update Cash",command=create_cash_button,border=4,bg="#00FF7F",pady=2,activebackground="#000000",activeforeground="#FFFFFF").place(x=90,y=160)
def create_record_of_cashes():
'''
@params: no
added create button
if clicked create form appears
'''
add_user1 = Frame(main, width=250,height=200,bg="#141414")
add_user1.place(x=900, y=60)
def create_cash_button():
cash.add_cash(ID.get(), Value.get(), Quantity.get())
added_user = Frame(main, width=250,height=200,bg="#000000")
added_user.place(x=900, y=60)
Label(added_user,text="Cash Has Been Added",font=("Arial",10,"bold"),fg="white",bg="#000000").place(x=15,y=10)
Label(added_user,text="Press Okey To Return Back To \n Cashes Info",font=("Arial",10,"bold"),fg="white",bg="#000000").place(x=15,y=30)
Button(added_user,text="Add Cash Again",command=record_of_cashes,border=4,bg="#00FF7F",pady=2,activebackground="#000000",activeforeground="#FFFFFF").place(x=90,y=160)
def use(usee):
ID.config(state=NORMAL)
ID.delete(0, END)
def pas(passs):
Value.config(state=NORMAL)
Value.delete(0, END)
def emai(emaii):
Quantity.config(state=NORMAL)
Quantity.delete(0, END)
Label(add_user1,text="For Cashes",font=("Arial",10,"bold"),fg="white",bg="#000000").place(x=90,y=10)
ID = Entry(add_user1,width=30)
ID.place(x=30,y=40,height=20)
ID.insert(0," ID")
ID.bind("<Button-1>",use)
Value = Entry(add_user1,width=30)
Value.place(x=30,y=70,height=20)
Value.insert(0," Value")
Value.bind("<Button-1>",pas)
Quantity = Entry(add_user1,width=30)
Quantity.place(x=30,y=100,height=20)
Quantity.insert(0, "Quantity")
Quantity.bind("<Button-1>",emai)
Button(add_user1,text="Add Cash",command=create_cash_button,border=4,bg="#00FF7F",pady=2,activebackground="#000000",activeforeground="#FFFFFF").place(x=90,y=160)
def show_cash_record():
'''
@params: no
added show record button
if clicked it will show records of cashes
'''
try:
records = cash.query_all_cashes()
listbox1_1.delete(0, END)
for record in records:
listbox1_1.insert(END, record)
except sqlite3.Error as e:
print(e)
def delete():
'''
@params: no
added delete button
if clicked delete the records
'''
clear = Frame(main, width=250,height=200,bg="#141414")
clear.place(x=900, y=60)
def delete_selected_user_record():
try:
selected_item = listbox1_1.get(ACTIVE)
user_id = selected_item[0]
cash.delete_cash(user_id)
show_cash_record()
except sqlite3.Error as e:
print(e)
Label(clear,text="Delete The Selected Record",font=("Arial",10,"bold"),fg="white",bg="#000000").place(x=40,y=20)
Button(clear, text="Delete Record",command=delete_selected_user_record,border=4,bg="#00FF7F",pady=2,activebackground="#000000",activeforeground="#FFFFFF").place(x=85,y=60)
Button(frame1_1, text="Create Record Of Cashes",command=create_record_of_cashes,border=4,bg="#00FF7F",pady=2,activebackground="#000000",activeforeground="#FFFFFF").place(x=95,y=25)
Button(frame1_1, text="Show Cashes Records",command=show_cash_record,border=4,bg="#00FF7F",pady=2,activebackground="#000000",activeforeground="#FFFFFF").place(x=255,y=25)
Button(frame1_1, text="Update Cashes Record",command=update_record_of_cashes,border=4,bg="#00FF7F",pady=2,activebackground="#000000",activeforeground="#FFFFFF").place(x=398,y=25)
Button(frame1_1, text="Delete Cashes Record",command=delete,border=4,bg="#00FF7F",pady=2,activebackground="#000000",activeforeground="#FFFFFF").place(x=547,y=25)