-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproject code 2.py
More file actions
110 lines (109 loc) · 5.65 KB
/
Copy pathproject code 2.py
File metadata and controls
110 lines (109 loc) · 5.65 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
import json #IMPORTING MODULES
import random
import mysql.connector as sql
from choosefile import menu
from choosefile import choose_class
from tabulate import tabulate as tub
mycon=sql.connect(host='localhost',user='root',passwd='7654321',database='kvsfee')
print(" PYTHON PROGRAM FOR PROJECT SYNOPSIS FOR TOPIC: UBI FEE COLLECTION SYSTEM")
print(" ========================================================================") #TITLES
print(" 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:"))
D={}
if ask==1:
print("\n UNION FEES IMFORMATION")
print(" ======================")
username=input("\nEnter your username:") #LOGGING IN
password=int(input("Enter your password here:"))
cls=input("enter the your class:")
cursor=mycon.cursor()
cursor.execute("select password from login where username = '{}'".format(username))
data=cursor.fetchone()
for i in data:
if password==i:
tabl=choose_class(cls)
print(tabl)
tech=menu(username)
if tech==1:
any ='yes'
while any=='yes':
print("\n CREATING UNIQUE ID FOR STUDENT") #PROGRAM TO REGISTER STUDENTS
print(" ==============================")
nam=input("\n\tEnter the name of student:") #INPUTTING STUDENT INFORMATION
father=input("\tEnter the Father's name:")
mother=input("\tEnter the Mother's name:")
dob=input("\tEnter the date of birth of student(yyyy/mm/dd):")
cls=int(input("\tEnter 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="nil"
if cls>10:
stream=input("\tEnter stream(BIO/CS):")
if stream not in ["CS","BIO",'cs','bio']:
print("\n\n\t\tYOU ENTERED INVALID INFORMATION")
break
gen=input("\tEnter Gender of student(M/F):")
if gen not in ["M","F",'m','f']:
print("\n\n\t\tYOU ENTERED INVALID INFORMATION")
break
SGSC="False"
if gen=="F":
SGSCcon=input("\tIs the student a Single Girl Child(y/n):")
if SGSCcon=="y":
SGSC="True"
adi=eval(input("\tEnter the admission number:"))
UID=int(random.random()*(10**14)) #GENERATING 14 DIGIT UID
print("\nThe generated Unique ID of student is:",UID)
feestat="Pending" #STUDENT INFO DICTIONARY
dictionary={UID:{"Student Name":nam,"Gender":gen,"SGSC":SGSC,"Admission number":adi,"DOB":dob,"Class":cls,"Stream":stream,"Father's name":father,"Mother's name":mother,"Fee Status":feestat}}
D.update(dictionary)
print('\nThe given imformation is:\n\t')
print(json.dumps(dictionary,indent=1))
print("\n\n\t\tSTUDENTS REGISTERED\n\n\n")
print("\t\tNAME\t\tUID\n")
for o in D:
print("\t ",D[o]["Student Name"],"\t\t",o)
print("\n\n STUDENT INFO") #SHOWING INFO OF REGISTERED STUDENTS
print(" ------------\n\n")
print(json.dumps(D,indent=1))
tabl=choose_class(cls)
print(tabl)
cursor=mycon.cursor()
st="insert into\t"+tabl+"(UNIQUE_ID,STUDENT_NAME,GENDER,SGSC,ADMISSION_NO,DOB,FATHERS_NAME,MOTHERS_NAME) VALUES({},'{}','{}','{}',{},'{}','{}','{}')".format(UID,nam,gen,SGSC,adi,dob,father,mother)
cursor.execute(st)
mycon.commit()
mycon.close()
any=input("\n\t Do you want to enter new student(yes/no):")
if any=='no':
tech=menu(username)
if tech==2:
if cls == 1:
table='class_1'
elif cls==2:
table='class_2'
elif cls==3:
table='class_3'
elif cls==4:
table='class_4'
elif cls==5:
table='class_5'
elif cls==6:
table='class_6'
elif cls==7:
table='class_7'
elif cls==8:
table='class_8'
elif cls==9:
table='class_9'
elif cls==10:
table='class_10'
elif cls==11:
table='class_11'
elif cls==12:
table='class_12'
print(table)