-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSource Code(No GUI).py
275 lines (258 loc) · 13.3 KB
/
Source Code(No GUI).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
from prettytable import PrettyTable
import datetime
import mysql.connector as mys
conn=mys.connect(host='localhost',user='root',passwd='15061917',database='couriermanagement')
cur=conn.cursor()
e = datetime.datetime.now()
Name=[]
Name1=[]
Phno1=[]
Phno=[]
MailId=[]
Pass=[]
Role=[]
Address=[]
Type=[]
Weight=[]
SerialNumber=[]
Company=[]
Bill=[]
dict={'Name':Name,'Phone Number':Phno,'Mail Id':MailId,'Password':Pass}
update=''
update1=''
a=1
while a!=0:
print("Welcome to Courier Management System")
print("************************************")
print("* 1.Login *")
print("* 2.Create An Account *")
print("* 0.Exit *")
print("************************************")
a = int(input("Enter your Option:- "))
if(a==1):
MAIL=input("Mail Id:- ")
PASS=input("Password:- ")
Index=MailId.index(MAIL)
if(MAIL!=MailId[Index] or PASS!=Pass[Index]):
print()
print("***************************")
print("-------Wrong Details-------")
print("--------Try Again----------")
print("***************************")
print()
print()
for i in range(0,len(MailId)):
ex=1
while ex!=0:
if (MAIL == MailId[i] and PASS == Pass[i]):
log = MAIL[MAIL.index(".") + 1:]
if (log == '[email protected]'):
print()
print("Thanks For Signing Up ")
print(" and Welcome To Our Page")
print("************************************")
print(" 1.Courier Your Package ")
print(" 2.Check the Package ")
print("************************************")
b = int(input("Enter your option:- "))
ex=0
if (b == 1):
print("Enter your Package Details")
NAME = input("Enter your Name:- ")
PHNO = input("Enter your Phone Number:- ")
ADDRESS = input("Enter the address to be delivered:- ")
TYPE = input("Enter Package Type:- ")
WEIGHT = float(input("Enter Package Weight(in Kg):- "))
SRNO = input("Enter Package Serial Number:- ")
company=''
x = slice(2)
typeofthepackage = SRNO[x]
if (typeofthepackage == 'AM'):
company = 'Amazon'
elif (typeofthepackage == 'FK'):
company = 'FlipKart'
elif (typeofthepackage == 'MS'):
company = 'Meesho'
elif (typeofthepackage == 'LK'):
company = 'Lenskart'
elif (typeofthepackage == 'DC'):
company = 'Decathlon'
else:
print("ERROR!")
print("**************************************")
Name1.append(NAME)
Phno1.append(PHNO)
Address.append(ADDRESS)
Type.append(TYPE)
Weight.append(WEIGHT)
Company.append(company)
SerialNumber.append(SRNO)
bill = WEIGHT * 200
Bill.append(bill)
print("Your expected to reach the package on %s/%s/%s" % (
e.day + 1, e.month, e.year) + " by %s:%s" % (e.hour, e.minute))
print("Bill Amount:- ", bill)
print()
print()
data = (
len(Name1), NAME, PHNO, ADDRESS, TYPE, WEIGHT, SRNO, company,
bill)
query = """insert into FINAL values(%s, %s, %s, %s, %s, %s, %s, %s, %s)"""
cur.execute(query, data)
conn.commit()
elif (b == 2):
print("********Update On Your Package********")
print("Dear ", NAME)
print("==============================================================================")
if (update == 'Y'):
print("Your Package has been packed")
print(" is ready to be Shipped")
elif (update == 'N'):
print("Your Package has not yet packed")
print(" still in the process of Packing")
else:
print("Services has been Offline")
print(" Will be Resumed Soon")
print("===============================================================================")
if (update1 == 'Y'):
print("Your Package has been already Delivered")
print(" Thank You ")
print("In Case if the Package is not yet Recived. Please do contact the Office")
elif (update1 == 'N'):
print("Your Package has not yet Delivered")
print(" still on its way to Reach You")
else:
print("Services has been Offline")
print(" Will be on its way Soon")
print("================================================================================")
print()
print()
break
elif (log == '[email protected]'):
print("Welcome to the Dashboard")
print(" Do Check the Package to be Packed")
print("*************************************************************")
print(" 1.Check The Package and Approve for verification ")
print(" 2.Check the Log In Details ")
print(" 0.EXIT ")
print("*************************************************************")
z = int(input("Enter your option:- "))
if (z==1):
print("*****************************************************************************************************************************")
myTable = PrettyTable(
["IndexNo", "Name", "PhoneNumber", "Address", "PackageType", "Weight", "SerialNumber",
"Company", "BillAmount"])
for i in range(0, len(Weight)):
myTable.add_row(
[i + 1, Name1[i] ,Phno1[i] , Address[i], Type[i], Weight[i], SerialNumber[i], Company[i],
Bill[i]])
print(myTable)
print("*****************************************************************************************************************************")
print()
print()
print("================================================")
update = input("Update about The package to be Packed(Y/N):- ")
print("================================================")
while (update != 'Y'):
update = input("Update about The package to be Packed(Y/N):- ")
print("================================================")
print()
print()
elif (z==2):
query2 = """select * from mail"""
cur.execute(query2)
rec=cur.fetchall()
print("|=============================================================================|")
for r in rec:
print(r)
print("|=============================================================================|")
elif (z==0):
break
elif (log == '[email protected]'):
print("Welcome to the Dashboard")
print(" Do Check the Package to be delivered")
print("*******************************************")
myTable = PrettyTable(
["IndexNo", "Name", "PhoneNumber", "Address", "PackageType", "Weight", "SerialNumber",
"Comapny", "BillAmount"])
for i in range(0, len(Weight)):
myTable.add_row(
[i + 1, Name1[i], Phno1[i], Address[i], Type[i], Weight[i], SerialNumber[i], Company[i],
Bill[i]])
print(myTable)
print()
print()
print("================================================")
update1 = input("Update about The package to be delivered(Y/N):- ")
print("================================================")
while (update1 != 'Y'):
update1 = input("Update about The package to be delivered(Y/N):- ")
print("================================================")
print()
print()
ex=0
else:
print()
ex=0
else:
print()
ex=0
elif(a==2):
print("-----------CREATE AN ACCOUNT------------")
name=input("Enter Your Name:- ")
phno=int(input("Enter Your Phone Number:- "))
mailId=input("Enter A Mail Id to create(.customer/.admin/.delivery):- ")
log = mailId[mailId.index(".") + 1:]
if (log=='[email protected]'):
log1="ADMIN"
elif (log=='[email protected]'):
log1='DELIVERY PERSON'
elif (log=='[email protected]'):
log1='CUSTOMER'
if(log=='[email protected]' or log=='[email protected]'):
secretcode=input("Enter the Authorized code to Create Account as Admin or Delivery Person:- ")
else:
secretcode='15061917'
Passw=input("Enter a New Password:- ")
conpass=input("Enter a Password to Confirm:- ")
if(Passw==conpass and secretcode=='15061917'):
print()
print("****************************")
print("Account Created Successfully")
print("****************************")
print()
print()
Name.append(name)
Phno.append(phno)
MailId.append(mailId)
Pass.append(Passw)
Role.append(log1)
data1 = (len(Name),mailId, Passw, log1, name, phno)
query1 = """insert into MAIL values(%s,%s, %s, %s, %s, %s)"""
cur.execute(query1, data1)
conn.commit()
else:
print()
if(secretcode!='15061917'):
print("***********************")
print("Wrong Authorized Code!!")
print("***********************")
print()
if Passw!=conpass:
print("******************************")
print("Wrong Confirm Password Entered")
print("Try Again!!")
print("******************************")
print()
print()
if(update=='Y' and update1=='Y'):
Name.clear()
Phno.clear()
Address.clear()
Type.clear()
Weight.clear()
SerialNumber.clear()
Company.clear()
Bill.clear()
#create table FINAL(SrNo int,Name varchar(20),PhoneNumber varchar(10),Address varchar(69),Type varchar(10),Weight int,SerialNumber varchar(10),Company varchar(10),Bill int);
# create table MAIL(SrNo int,MailID varchar(69),Password varchar(20),Role varchar(20),Name varchar(20),PhoneNo varchar(20));