-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSCHOOL MANAGEMENT SYSTEM BY GAGAN CHAUHAN CLASS 12 E.py
297 lines (248 loc) · 8.16 KB
/
SCHOOL MANAGEMENT SYSTEM BY GAGAN CHAUHAN CLASS 12 E.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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
# ***************************************************************
# SCHOOL Management System
# ****************************************************************
# ***************************************************************
# Packages USED IN PROJECT
# ****************************************************************
import mysql.connector as a
con = a.connect(host="localhost", user="root", passwd="9907",)
c = con.cursor()
# TO BE RUN ONLY ONCE
# ***************************************************************
# Creating DATABASE/TABLES USED IN PROJECT
# ****************************************************************
c.execute("create database school")
c.execute("use school")
c.execute("create table student(name char(30),class int,roll_no int,address char(50),phone int)")
c.execute("create table teacher(name char(30),post char(30),salary int,address char(220),phone int,acno int)")
c.execute("create table cattendence(year int,month char(30),date varchar(30),class varchar(30),absent varchar(220))")
c.execute("create table tattendence(year int,month char(30),date varchar(30),absent varchar(220))")
c.execute("create table fees(name char(30),class int,roll_no int,Month varchar(22),fees int,date int)")
c.execute("create table salary(name char(30),month varchar(30),paid varchar(234))")
# CREATING DEAFULT TABLE
def deaf():
c = con.cursor()
c.execute("create table deafaultstudent(name char(30),class varchar(30),roll_no int,address varchar(220),phone int)")
c.execute("insert into deafaultstudent(name,class,roll_no,address,phone) values('{}',{},{},'{}',{})".format(
'raj kapoor', 12, 10, 'rdr', 233455))
c.execute("insert into deafaultstudent(name,class,roll_no,address,phone) values('{}',{},{},'{}',{})".format(
'jatin kalra', 12, 1, 'dineshpur', 238655))
c.execute("select*from deafaultstudent")
print("select from this table any student you want to remove")
for i in c:
print(i)
l = int(input("class :"))
r = int(input("Roll no:"))
k = "delete from deafaultstudent where roll_no={} and class={}".format(
r, l)
c.execute(k)
con.commit()
print("STUDENT DETAILS DELETED SUCESSFULLY")
print(">-------------------------<")
main()
# TO STORE STUDENT DEATILS
def ast():
n = int(input("class:"))
m = input("names:")
p = int(input("enter roll:"))
ph = int(input("enter phone:"))
d = input("enter address:")
k = "insert into student(class,roll_no,phone,name,address) values({},{},{},'{}','{}')".format(
n, p, ph, m, d)
c = con.cursor()
c.execute(k)
con.commit()
print("STUDENT ADDED sucessfully")
print(">-------------------------<")
main()
# TO REMOVE STUDENT
def rst():
c = con.cursor()
z = "select*from student"
c.execute(z)
for i in c:
print(i)
l = int(input("Class:"))
r = int(input("Roll no:"))
c = con.cursor()
k = "delete from student where roll_no={} and class={}".format(r, l)
c.execute(k)
con.commit()
print("STUDENT DELETED SUCCESSFULLY.")
print(">-------------------------<")
main()
# TO ADD TEACHER
def addt():
n = input("teacher name:")
c = input("post:")
r = int(input("Salary:"))
a = input("address:")
p = int(input("phone:"))
m = int(input("Account no:"))
k = "insert into teacher(name,post,salary,address,phone,acno) values('{}','{}',{},'{}',{},{})".format(
n, c, r, a, p, m)
c = con.cursor()
c.execute(k)
con.commit()
print("TEACHER ADDED sucesssfully")
print(">-------------------------<")
main()
# TO REMOVE TEACHER
def remt():
c = con.cursor()
z = "select*from teacher"
c.execute(z)
for i in c:
print(i)
m = input("name:")
r = int(input("Ac no. :"))
c = con.cursor()
k = "delete from teacher where acno={}".format(r)
c.execute(k)
con.commit()
print("TEACHER REMOVED")
print(">-------------------------<")
# TO STORE ABSENT STUDENT NAME
def abclass():
y = int(input("year:"))
m = input("month:")
d = eval(input("date:"))
cl = int(input("class:"))
ab = input("name of absent students:")
sql = "insert into cattendence values({},'{}','{}',{},'{}')".format(
y, m, d, cl, ab)
c = con.cursor()
c.execute(sql)
con.commit()
print("ABSENT STUDENT ADDED SUCCESSFULLY.")
print(">-------------------------<")
main()
# TO STORE ABSENT TEACHER NAME
def abteacher():
y = int(input("year:"))
m = input("month:")
d = int(input("date:"))
ab = input("name of absent Teacher:")
sql = "insert into tattendence values({},'{}','{}','{}')".format(
y, m, d, ab)
c = con.cursor()
c.execute(sql)
con.commit()
print("ABSENT TEACHER ADDED SUCCESSFULLY.")
print(">-------------------------<")
main()
# TO STORE FEES OF STUDENT
def submitf():
n = input("student name:")
c = int(input("class :"))
r = input("Roll no:")
m = input("month")
f = int(input("fees:"))
d = int(input("date:"))
sql = "insert into fees values('{}',{},'{}','{}',{},{})".format(
n, c, r, m, f, d)
c = con.cursor()
c.execute(sql)
con.commit()
print("FEES SUBMITTED sucesssfully")
print(">-------------------------<")
main()
# TO STORE SALARY DEATILS
def pays():
n = input("teacher name:")
m = input("Month:")
p = input("PAID Yes/No:")
sql = "insert into salary values('{}','{}','{}')".format(n, m, p)
c = con.cursor()
c.execute(sql)
con.commit()
print("data entered sucesssfully")
print(">-------------------------<")
main()
# TO DISPLAY STUDENTS
def dclass():
sql = "select*from student "
c = con.cursor()
c.execute(sql)
d = c.fetchall()
for i in d:
print("NAME:", i[0])
print("CLASS:", i[1])
print("ROLL NO:", i[2])
print("ADDRESS:", i[3])
print("PHONE:", i[4])
print(">-------<")
print(">-------------------------<")
main()
# TO DISPLAY TEACHER
def dteacher():
sql = "select*from teacher"
c = con.cursor()
c.execute(sql)
d = c.fetchall()
for i in d:
print("NAME:", i[0])
print("POST", i[1])
print("SALARY:", i[2])
print("ADDRESS:", i[3])
print("PHONE:", i[4])
print("ACNO:", i[5])
print(">-------<")
print(">-------------------------<")
main()
# ***************************************************************
# THE MAIN FUNCTION OF PROGRAM
# ****************************************************************
# The Main()
def main():
print(""" JAYCEES PUBLIC SCHOOL
1. ADD STUDENT 2. REMOVE STUDENT
3. ADD TEACHER 4. REMOVE TEACHER
5. CLASS Attendence(ADD ABSENT STUDENTS)
6. TEACHER Attendence(ADD ABSENT TEACHERS)
7. SUBMIT FEES 8. PAY SALARY
9. dISPLAY CLASS 10. TEACHER LIST
*for removing/displaying teacher first Add Teacher(use "3")*
# TO BE RUN ONLY ONCE
""")
Choice = input("ENTER TASK NO:")
if (Choice == "1"):
ast()
elif (Choice == "2"):
n = input("you want to remove student from 'default stored table' or table you have 'created now' ??? enter 'd' for default or 'c' for created now: ")
if n == "c":
rst()
else:
deaf()
elif (Choice == "3"):
addt()
elif (Choice == "4"):
remt()
elif (Choice == "5"):
abclass()
elif (Choice == "6"):
abteacher()
elif (Choice == "7"):
submitf()
elif (Choice == "8"):
pays()
elif (Choice == "9"):
dclass()
elif (Choice == "10"):
dteacher()
else:
print("WRONG CHOICE!!!!!!!!")
main()
def pasd():
p = input("PASSWORD:")
print("use '1234' to access")
if p == "1234":
main()
else:
print("access denied!")
print("Enter again:")
pasd()
pasd()
# ***************************************************
# **************** END OF PROJECT ***************
# ***************************************************