-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSynopsis Test 1.py
More file actions
484 lines (307 loc) · 19.2 KB
/
Copy pathSynopsis Test 1.py
File metadata and controls
484 lines (307 loc) · 19.2 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
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
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
#PYTHON PROGRAM FOR PROJECT SYNOPSIS FOR TOPIC: UBI FEE COLLECTION SYSTEM
import json #IMPORTING MODULES
import random
import mysql.connector as sql
from tabulate import tabulate as tub
mycon=sql.connect(host='localhost',user="root",passwd= "7654321" ,database='kvsfee')
cursor=mycon.cursor()
cursor.execute('set autocommit=1')
print("PYTHON PROGRAM FOR PROJECT SYNOPSIS FOR TOPIC: UBI FEE COLLECTION SYSTEM")
print("========================================================================") #TITLES
def teacher(): #DEFINING TEACHER MODULE
table=' '
print("\n UNION FEES IMFORMATION")
print(" ======================")
any="no"
username=input("\nEnter your username:") #LOGGING IN
password=eval(input("Enter your password here:"))
cursor.execute("select password from login where username='"+username+"'")
data=cursor.fetchall()
if data[0][0]==password:
print("\n\n\n\n LOGIN SUCCESSFUL\n\n\n")
any="yes"
if username=="SHAILESH":
table="class_1"
if username=="VISHAL":
table="class_2"
if username=="PRANAM":
table="class_3"
if username=="SHUBHAM":
table="class_4"
if username=="RAHUL":
table="class_5"
if username=="RAJA":
table="class_6"
if username=="RANI":
table="class_7"
if username=="PRIYANKA GUMBAR":
table="class_8"
if username=="AISHWARYA V S":
table="class_9"
if username=="RINKA A P":
table="class_10"
if username=="VINOD KUMAR MAHAWAR":
table="class_11"
if username=="SUNIL KUMAR T":
table="class_12"
while any=='yes':
print("\n WELCOME",username)
print(" ==================")
print("\n\nWhat do you want to do?\n") #CHOICES WITHIN TEACHER MODULE
print("1.Add students")
print("2.Remove students")
print("3.Check Fee status")
print("4.Exit")
tech=int(input("\nEnter choice(1-4):"))
if tech==1:
while any=='yes':
print("\n CREATING UNIQUE ID FOR STUDENT") #PROGRAM TO REGISTER STUDENTS
print(" ==============================")
nam=input("\nEnter the name of student:") #INPUTTING STUDENT INFORMATION
father=input("Enter the Father's name:")
mother=input("Enter the Mother's name:")
dob=input("Enter the date of birth of student(YYYY/MM/DD):")
cls=int(input("Enter the class of student(1-12):")) #CHECKING ERRORS IN INPUT
if cls not in [1,2,3,4,5,6,7,8,9,10,11,12]:
print("\n\n\t\tYOU ENTERED INVALID INFORMATION")
break
stream="NULL"
if cls>10:
stream=input("Enter stream(BIO/CS):")
if stream not in ["CS","BIO"]:
print("\n\n\t\tYOU ENTERED INVALID INFORMATION")
break
gen=input("Enter Gender of student(M/F):")
if gen not in ["M","F"]:
print("\n\n\t\tYOU ENTERED INVALID INFORMATION")
break
SGSC="NO"
if gen=="F":
SGSCcon=input("Is the student a Single Girl Child(y/n):")
if SGSCcon=="y":
SGSC="YES"
adi=eval(input("Enter Admission number:"))
UID=int(random.random()*(10**14)) #GENERATING 14 DIGIT UID
print("\n\t\t\t\t\t\t\tThe generated Unique ID of student is:",UID)
feestat="PENDING"
cursor.execute("insert into "+table+" (UNIQUE_ID,STUDENT_NAME,GENDER,SGSC,ADMISSION_NO,DOB,CLASS,STREAM,FATHERS_NAME,MOTHERS_NAME)VALUES({},'{}','{}','{}',{},'{}',{},'{}','{}','{}')".format(UID,nam,gen,SGSC,adi,dob,cls,stream,father,mother))
cursor.execute("select unique_id,student_name,gender,sgsc,admission_no,dob,class,stream,fathers_name,mothers_name from "+table+" where unique_id={}".format(UID))
data=cursor.fetchall()
print("\n\n")
print(tub(data,headers=['UNIQUE_ID','STUDENT NAME','GENDER','SGSC','ADMISSION NO','DOB','CLASS','STREAM','FATHERS NAME','MOTHERS NAME'],tablefmt='psql'))
print("\n\n\t\t\t\t\t\t\t\tSTUDENT RECORD INSERTED SUCCESSFULLY\n\n")
cursor.execute('select unique_id,student_name,gender,sgsc,admission_no,dob,class,stream,fathers_name,mothers_name from '+table)
data=cursor.fetchall()
print(tub(data,headers=['UNIQUE_ID','STUDENT NAME','GENDER','SGSC','ADMISSION NO','DOB','CLASS','STREAM','FATHERS NAME','MOTHERS NAME'],tablefmt='psql'))
any=input("\n\t\t\t\t\t\t\t Do you want to enter new student(yes/no):")
if any!="yes":
print("\n\nWhat do you want to do?")
print("\n1.Add students")
print("2.Remove students")
print("3.Check Fee status")
print("4.Exit")
tech=int(input("\nEnter choice:"))
if tech==2:
choice="yes"
while choice=="yes": #STUDENT REMOVING MODULE
print("\n\n\t\tREMOVING STUDENT INFO")
print("\t\t=====================")
print("\n\n REGISTERED STUDENTS") #DISPLAYING REGISTERED STUDENTS
print(" -------------------\n\n")
cursor.execute('select unique_id,student_name from '+table)
data=cursor.fetchall()
print(tub(data,headers=['UNIQUE_ID','STUDENT NAME'],tablefmt='psql'))
UID=int(input("\n\nEnter UID of Student:"))
print("\n\n")
cursor.execute('select * from '+table+' where UNIQUE_ID={}'.format(UID))
data=cursor.fetchall()
CONFIRM=input("\n\nDo you want to remove record(y/n)")
if CONFIRM=='y':
cursor.execute("DELETE FROM "+table+" WHERE UNIQUE_ID={}".format(UID))
print("\n\n\t\tRECORD SUCCESSFULLY DELETED")
else:
print("\n\n\t\tTHANK YOU\n\n")
print("\n\n REGISTERED STUDENTS") #DISPLAYING REGISTERED STUDENTS
print(" -------------------\n\n")
cursor.execute('select unique_id,student_name from '+table)
data=cursor.fetchall()
print(tub(data,headers=['UNIQUE_ID','STUDENT NAME'],tablefmt='psql'))
choice=input("\n\n\t\tRemove more students?(yes/no):")
if choice!="yes":
print("\n\nWhat do you want to do?")
print("\n1.Add students")
print("2.Remove students")
print("3.Check Fee status")
print("4.Exit")
tech=int(input("\nEnter choice:"))
if tech==3:
choose="yes"
while choose=="yes":
print("\n\n\t\t\t\t\t\t\tFEE STATUS OF REGISTERED STUDENTS")
print("\t\t\t\t\t\t\t=================================\n\n")
cursor.execute("select unique_id,student_name,fee_status,class,stream,gender,sgsc,admission_no,dob,fathers_name,mothers_name from "+table)
data=cursor.fetchall()
print(tub(data,headers=['UNIQUE_ID','STUDENT NAME','FEE STATUS','CLASS','STREAM','GENDER','SGSC','ADMISSION NO','DOB','FATHERS NAME','MOTHERS NAME'],tablefmt='psql'))
choose="no"
if choose!="yes":
print("\n\nWhat do you want to do?")
print("\n1.Add students")
print("2.Remove students")
print("3.Check Fee status")
print("4.Exit")
tech=int(input("\nEnter choice:"))
if tech==4:
print("\n\n\t\t\t\tTHANK YOU\n\n\n") #EXITING TEACHER MODULE
any="no"
break
else:
print("\n\n\t\t\t\tRETRY\n\n\n") #IF ENTERED WRONG CHOICE
else:
print("\n\n\t\t\tINVALID INFORMATION\n\n") #IF ENTERED WRONG PASSWORD
print("\n\n\t\t\tENTER DETAILS AGAIN\n\n")
def parent(): #FEE PAYMENT MODULE
print("\n\n\t\t\tFEE PAYMENT")
print("\t\t\t===========")
UID2=int(input("\n\nEnter Student Unique ID:")) #INPUT STUDENT INFO
dob=input("Enter Date of birth(YYYY/MM/DD):")
cls=input("Enter class(1-12):")
table="class_"+cls
cursor.execute("select UNIQUE_ID FROM "+table+" WHERE DOB='"+dob+"'")
data=cursor.fetchall()
if data[0][0]==UID2:
cursor.execute("select unique_id,student_name,gender,sgsc,admission_no,dob,class,stream,fathers_name,mothers_name from "+table+" where unique_id={}".format(UID2))
record=cursor.fetchall()
print("\n\n\t\t\tLOGIN SUCCESSFUL")
print("\n\n\t\tPRINTING STUDENT DETAILS\n\n")
print("\tUnique Identification Number:",record[0][0]) #DISPLAY INPUTTED STUDENT INFO
print("\tStudent name:",record[0][1])
print("\tDate of Birth:",record[0][5])
print("\tClass:",record[0][6])
print("\tStream:",record[0][7])
print("\tGender:",record[0][2])
print("\tSGSC Status:",record[0][3])
print("\tAdmission No.:",record[0][4])
print("\tFather's Name:",record[0][8])
print("\tMother's Name:",record[0][9])
mob=int(input("\n\t\tEnter your mobile number:"))
PAY=input("\n\n\t\t\tMake payment(y/n):")
print("\n\n\n\n")
if PAY=="y":
def receipt(amt,AF,RF,TF,CF,VV): #ASKING BANK DETAILS
card=input("Enter your mode of Payment(DebitCard[DC]/CreditCard[CC]:")
cardnum=input("Enter Card Number:")
exp=input("Enter Expiration Date(mm/yyyy):")
cvv=input("CVV/CVC:")
cardnam=input("Enter Card Holder Name:")
print("\n\n\t\t\tMERCHANT DETAILS")
print("\t\t\t================\n")
print("\n\t\tMerchant:KVS")
print("\t\tAmount:",amt,"Rs")
print("\t\tCard Number:XXXX XXXX XXXX ",cardnum[12::])
otp=int(random.random()*(10**4))
print("\n\n\t\tThe OTP:",otp," is sent to Phone No.",mob) #OTP SENT TO GIVEN PHONE NO.
OTP=int(input("\n\nEnter OTP sent to your number:"))
if OTP==otp:
payy=input("\n\n\t\tPay the fees amount of "+str(amt)+"Rs?(y/n):") #CONFIRMING PAYMENT
print("\n\n\n")
if payy=="y":
TO=AF+RF+TF+CF+VV
cursor.execute("select unique_id,student_name,gender,sgsc,admission_no,dob,class,stream,fathers_name,mothers_name from "+table+" where unique_id={}".format(UID2))
record=cursor.fetchall()
print("\n\n\nUnique Identification Number:",record[0][0]) #GENERATING FEE RECEIPT
print("Student name:",record[0][1])
print("Date of Birth:",record[0][5])
print("Class:",record[0][6])
print("\n\n\t\t\tPayment Succesful\n\n\n")
print("______________________________________________")
print("| RECIEPT ")
print("| ")
print("|Unique Identification Number:",record[0][0]," ")
print("|Student name:",record[0][1]," ")
print("|Date of Birth:",record[0][5]," ")
print("|Class:",record[0][6]," ")
print("|Stream:",record[0][7]," ")
print("|Father's name:",record[0][8]," ")
print("|Mother's name:",record[0][9]," ")
print("|SGSC Status:",record[0][3]," ")
print("|Gender:",record[0][2]," ")
print("|_____________________________________________")
print("|FEE PARTICULAR | AMOUNT ")
print("|---------------------------------------------")
print("|Admission Fees | ",AF," ")
print("|Registration Fees | ",RF," ")
print("|Tution fee | ",TF," ")
print("|Late fee(Tution) | 0 ")
print("|Vidyalaya Vikas Nidhi(VVN)| ",VV," ")
print("|Late Fee(VVN) | 0 ")
print("|Computer Education Fee | ",CF," ")
print("|Project Fee | 0 ")
print("|Others(VVN) | 0 ")
print("|Others(SF) | 0 ")
print("|=============================================")
print("|Total | ",TO," .00 ")
print("|_____________________________________________")
cursor.execute("UPDATE "+table+" SET FEE_STATUS='PAID' WHERE UNIQUE_ID={}".format(UID2))
mycon.commit()
else:
print("\n\n\t\t\tTHANK YOU") #IF DENY PAYMENT
else: #IF ENTERED WRONG OTP
print("\n\n")
print("\t\t\tYou have entered the wrong OTP")
print("\n")
OTP=int(input("\n\nEnter OTP sent to your number:"))
#GENERATING FEES ACCORDING TO EACH STUDENT
cursor.execute("select unique_id,student_name,gender,sgsc,admission_no,dob,class,stream,fathers_name,mothers_name from "+table+" where unique_id={}".format(UID2))
record=cursor.fetchall()
if record[0][6]==1:
receipt(1925,100,25,0,300,1500)
if record[0][6] in [2,3,4,5,6,7,8] and record[0][3]=="NO":
receipt(1800,0,0,0,300,1500)
if record[0][6] in [2,3,4,5] and record[0][3]=="YES":
receipt(1800,0,0,0,300,1500)
if record[0][6] in [6,7,8,9,10,11,12] and record[0][3]=="YES":
receipt(0,0,0,0,0,0)
if (record[0][6]==9 or record[0][6]==10) and record[0][3]=="NO":
if record[0][2]=="M":
receipt(2400,0,0,600,300,1500)
if record[0][2]=="F":
receipt(1800,0,0,0,300,1500)
if (record[0][6]==11 or record[0][6]==12) and record[0][3]=="NO":
if record[0][2]=="M":
if record[0][7]=="CS":
receipt(3150,0,0,1200,450,1500)
if record[0][7]=="BIO":
receipt(3000,0,0,1200,300,1500)
if record[0][2]=="F":
if record[0][7]=="CS":
receipt(1950,0,0,0,450,1500)
if record[0][7]=="BIO":
receipt(1800,0,0,0,300,1500)
else:
print("\n\n\n\t\t\tTHANK YOU") #IF DENIED PAYMENT
print("Login as\n1.Teacher\n2.Parent")
ask=int(input("\nEnter the choice(1,2) here:"))
else: #ON ENTERING WRONG INFO
print("\n\n\t\t\tYou have entered INVALID information")
print("\t\t\t\tTry again")
while True: #KEEPING PROGRAM IN A LOOP
#TEACHER MODULE
print("\n\n\n Union Bank of India")
print(" -------------------")
print(" Kendriya Vidyalaya Sangathan")
print(" ----------------------------")
print("Login as\n1.Teacher\n2.Parent") #CHOOSING PROGRAM
ask=int(input("\nEnter the choice(1,2) here:"))
while ask==1:
teacher()
break
print("\n\n\n\t\t\tTHANK YOU")
print("\n\nLogin as\n1.Teacher\n2.Parent")
ask=int(input("\nEnter the choice(1,2) here:"))
#FEE PAYMENT/PARENT MODULE
while ask==2:
parent()
print("\n\n\n\t\t\tTHANK YOU")
print("\n\nLogin as\n1.Teacher\n2.Parent")
ask=int(input("\nEnter the choice(1,2) here:"))
mycon.close()