-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcp.py
177 lines (145 loc) · 9.3 KB
/
cp.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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
from tkinter import *
import cx_Oracle
import os
connectString = os.getenv('con_connect')
con = cx_Oracle.connect('system/<password>@localhost:1521/orcle19')
cursor = con.cursor()
root = Tk()
root.configure(background='white')
l3 = Label(root, text="BLOOD BANK MANAGEMENT SYSTEM", bg='pink', font="Helvetica 15 bold",fg='Black').place(x=420, y=40, w=400, h=40)
b1 = Button(root, text="Click to enter the details of the donor",command=lambda:donordetails(), bg='orange', font="Helvetica 12").place(x=80, y=100,w=300, h=40)
b2 = Button(root, text="Click to enter the details of the blood",command=lambda:blooddetails(),bg='magenta', font="Helvetica 12").place(x=80, y=200,w=300, h=40)
b3 = Button(root, text="Click to make a request for blood",command=lambda:requestblood(), bg='cyan', font="Helvetica 12").place(x=80, y=300, w=300,
h=40)
b2 = Button(root, text="EXIT", bg='red',font='Helvetica 18 bold',command=lambda: stop(root)).place(x=170, y=400,w=90)
v = StringVar()
def insertDonor(name, age, gender, address, contactno,id):
insert = "INSERT INTO donor(name,age,gender,address,contactno,id) VALUES(:1,:2,:3,:4,:5,:6)"
cursor.execute(insert,(name,int(age),gender,address,int(contactno),int(id)))
con.commit()
def insertBlood(bloodgroup, platelet, rbc,id):
insert = "INSERT INTO blood(bloodgroup,platelet,rbc,regdate,id) VALUES(:1,:2,:3,SYSDATE,:4)"
cursor.execute(insert,(bloodgroup,platelet,rbc,id))
con.commit()
def retrieve(bg):
request = "select * from donor d,blood b where d.id=b.id and b.bloodgroup='" + bg + "'"
cursor.execute(request)
rows = cursor.fetchall()
con.commit()
print(len(rows))
return rows
def sel():
selection = "You selected the option " + str(v.get())
print(selection)
def donordetails():
# global v
root = Toplevel()
root.title("BLOOD BANK MANAGEMENT SYSTEM")
root.geometry("480x480")
root.configure(background='#FF8F8F')
l1 = Label(root, text="Name:", bg='white', font="Helvetica 12",background='#FF8F8F').place(x=80, y=40)
l2 = Label(root, text="Age:", bg='white', font="Helvetica 12",background='#FF8F8F').place(x=80, y=80)
l3 = Label(root, text="Gender:", bg='white', font="Helvetica 12",background='#FF8F8F').place(x=80, y=120)
l4 = Label(root, text="Address:", bg='white', font="Helvetica 12",background='#FF8F8F').place(x=80, y=220)
l5 = Label(root, text="Contact:", bg='white', font="Helvetica 12",background='#FF8F8F').place(x=80, y=260)
l6 = Label(root, text="ID:", bg='white', font="Helvetica 12",background='#FF8F8F').place(x=80, y=300)
e1 = Entry(root)
e1.place(x=160, y=40)
e2 = Entry(root)
e2.place(x=160, y=80)
r1 = Radiobutton(root, text="Male", variable=v, value="Male",command=sel,background='#FF8F8F').place(x=160, y=120)
v.set(3)
r2 = Radiobutton(root, text="Female", variable=v, value="Female", command=sel,background='#FF8F8F').place(x=160, y=150)
r3 = Radiobutton(root, text="Other", variable=v, value="Other", command=sel,background='#FF8F8F').place(x=160, y=180)
# e3=Entry(root)
# e3.place(x=100,y=120)
e4 = Entry(root)
e4.place(x=160, y=220)
e5 = Entry(root)
e5.place(x=160, y=260)
e6=Entry(root)
e6.place(x=160,y=300)
b2=Button(root,text="Back",command=lambda : stop(root)).place(x=160,y=340)
b1=Button(root,text="Submit",command=lambda : insertDonor(e1.get(),e2.get(),str(v.get()),e4.get(),e5.get(),e6.get())).place(x=80,y=340)
root.mainloop()
def blooddetails():
root = Tk()
root.title("BLOOD BANK MANAGEMENT SYSTEM")
root.geometry("500x360")
root.configure(background='#FF8F8F')
l1 = Label(root, text="ID:", font="Helvetica 12",background='#FF8F8F').place(x=40, y=40, w=250, h=20)
l1 = Label(root, text="Blood Group:", font="Helvetica 12",background='#FF8F8F').place(x=40, y=80, w=250, h=20)
l2 = Label(root, text="PLatetelet count (in 100 thousands):", font="Helvetica 12",background='#FF8F8F').place(x=40, y=120, w=250, h=20)
l3 = Label(root, text="RBC count (in millions):", font="Helvetica 12",background='#FF8F8F').place(x=40, y=160, w=250, h=20)
# l4=Label(root,text="Date Of Entry count:").place(x=40,y=160)
e4=Entry(root)
e4.place(x=350,y=40)
e1 = Entry(root)
e1.place(x=350, y=80)
e2 = Entry(root)
e2.place(x=350, y=120)
e3 = Entry(root)
e3.place(x=350, y=160)
b2 = Button(root, text="Back", command=lambda: stop(root)).place(x=200, y=200)
b1 = Button(root, text="Submit", command=lambda: insertBlood(e1.get(), e2.get(), e3.get(),e4.get())).place(x=40, y=200)
root.mainloop()
def grid1(bg):
root = Tk()
root.title("LIST OF MATCHING DONORS")
root.geometry("1280x480")
root.configure(background='#0C43F0')
rows = retrieve(bg)
Label(root, text='NAME', bg="#0C43F0", font="Verdana 15 bold").grid(row=0, column=0, sticky='E', padx=5,
pady=5, ipadx=5, ipady=5)
Label(root, text='AGE', bg="#0C43F0", font="Verdana 15 bold").grid(row=0, column=1, sticky='E', padx=5,
pady=5, ipadx=5, ipady=5)
Label(root, text='GENDER', bg="#0C43F0", font="Verdana 15 bold").grid(row=0, column=2, sticky='E', padx=5,
pady=5, ipadx=5, ipady=5)
Label(root, text='ADDRESS', bg="#0C43F0", font="Verdana 15 bold").grid(row=0, column=3, sticky='E', padx=5,
pady=5, ipadx=5, ipady=5)
Label(root, text='CONTACT NO', bg="#0C43F0", font="Verdana 15 bold").grid(row=0, column=4, sticky='E', padx=5,
pady=5, ipadx=5, ipady=5)
Label(root, text='ID', bg="#0C43F0", font="Verdana 15 bold").grid(row=0, column=5, sticky='E', padx=5,
pady=5, ipadx=5, ipady=5)
Label(root, text='BLOOD GROUP', bg="#0C43F0", font="Verdana 15 bold").grid(row=0, column=6, sticky='E', padx=5,
pady=5, ipadx=5, ipady=5)
Label(root, text='PLATELET', bg="#0C43F0", font="Verdana 15 bold").grid(row=0, column=7, sticky='E', padx=5,
pady=5, ipadx=5, ipady=5)
Label(root, text='RBC', bg="#0C43F0", font="Verdana 15 bold").grid(row=0, column=8, sticky='E', padx=5,
pady=5, ipadx=5, ipady=5)
x = 1
for row in rows:
Label(root, text=row[0], bg="#1EDEF2", font="Verdana 15 bold").grid(row=x, column=0, sticky='E', padx=5,
pady=5, ipadx=5, ipady=5)
Label(root, text=row[1], bg="#1EDEF2", font="Verdana 15 bold").grid(row=x, column=1, sticky='E', padx=5,
pady=5, ipadx=5, ipady=5)
Label(root, text=row[2], bg="#1EDEF2", font="Verdana 15 bold").grid(row=x, column=2, sticky='E', padx=5,
pady=5, ipadx=5, ipady=5)
Label(root, text=row[3], bg="#1EDEF2", font="Verdana 15 bold").grid(row=x, column=3, sticky='E', padx=5,
pady=5, ipadx=5, ipady=5)
Label(root, text=row[4], bg="#1EDEF2", font="Verdana 15 bold").grid(row=x, column=4, sticky='E', padx=5,
pady=5, ipadx=5, ipady=5)
Label(root, text=row[5], bg="#1EDEF2", font="Verdana 15 bold").grid(row=x, column=5, sticky='E', padx=5,
pady=5, ipadx=5, ipady=5)
Label(root, text=row[6], bg="#1EDEF2", font="Verdana 15 bold").grid(row=x, column=6, sticky='E', padx=5,
pady=5, ipadx=5, ipady=5)
Label(root, text=row[7], bg="#1EDEF2", font="Verdana 15 bold").grid(row=x, column=7, sticky='E', padx=5,
pady=5, ipadx=5, ipady=5)
Label(root, text=row[8], bg="#1EDEF2", font="Verdana 15 bold").grid(row=x, column=8, sticky='E', padx=5,
pady=5, ipadx=5, ipady=5)
x = x + 1
root.mainloop()
def requestblood():
root = Tk()
root.title("BLOOD BANK")
root.geometry("720x360")
root.configure(background='#FF8F8F')
l = Label(root, text="Enter the blood group").place(x=50, y=50, w=400, h=40)
e = Entry(root)
e.place(x=500, y=50)
b2 = Button(root, text="Back", command=lambda: stop(root)).place(x=600, y=100)
b = Button(root, text="ENTER", command=lambda: grid1(e.get())).place(x=500, y=100)
root.mainloop()
def stop(root):
root.destroy()
root.mainloop()