-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCode #final.py
500 lines (480 loc) · 16.8 KB
/
Code #final.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
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
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
# -*- coding: utf-8 -*-
"""
Created on Thu Nov 10 19:21:40 2022
@author: anany
"""
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
def display_menu():
print("----------------------------------------------------")
print(" ")
print("Welcome to Courier Management System")
print(" ")
print("----------------------------------------------------")
print(" ")
print("1. Signup")
print(" ")
print("2. Login")
print(" ")
print("3. Quit")
print(" ")
print("----------------------------------------------------")
def add_user():
print("-------------------------")
print(" ")
print("Registration ...")
print(" ")
print("-------------------------")
n = input('Name:')
print(" ")
mobile=int(input('MobileNo:'))
print(" ")
email=input('Email_IC:')
print(" ")
pas=input('Password:')
print(" ")
df=pd.read_csv("C:\\Downloads\\userlogin.csv")
df = df.append({'Name':'n','mob':'mobile','email':'email','password':'pas'},ignore_index=True)
df.to_csv("C:\\Downloads\\userlogin.csv",index=False)
print('User Created')
print(" ")
input("Press any key to continue")
display_menu()
def login_user():
print("-------------------------")
print(" ")
print("-------- Login ---------")
print(" ")
print("-------------------------")
df=pd.read_csv("C:\\Downloads\\userlogin.csv")
a=int(input("Enter Mobile Number:- "))
x=df[df["mob"]==a]
if x.empty==False:
print("----- Login Successful -----")
loginmenu()
o=input("Enter your choice:- ")
if o=='1':
order()
elif o=='2':
delete()
elif o=='3':
service_track()
elif o=='4':
net()
elif o=='5':
input("PRESS ANY KEY TO CONTINUE")
else:
print("There is no such option")
print("Do you want to return to main menu?")
print(" ")
input("If yes,PRESS ANY KEY TO CONTINUE")
print(" ")
if a==123456:
adminmenu()
print(" ")
input("RETURN TO MAIN MENU(ADMIN PANEL)?")
print(" ")
adminmenu()
else:
print("----------------------------")
print(" ")
print("-------Invalid Number-------")
print(" ")
print("----------------------------")
display_menu()
def adminmenu():
print("----------------------------------------------------")
print(" ")
print(" Courier Management System(ADMIN PANEL)")
print(" ")
print("----------------------------------------------------")
print("1. Customer Details")
print(" ")
print("2. Employee Details")
print(" ")
print("3. Add Employee")
print(" ")
print("4. Customers and Orders")
print(" ")
print("5. Return to Login Window")
print(" ")
print("----------------------------------------------------")
i=input("Enter your Choice:- ")
if i=='1':
print("-------------------------")
print(" ")
print("Customer Details")
print(" ")
print("-------------------------")
dfr=pd.read_csv("C:\\Downloads\\orderdet.csv")
print(dfr)
elif i=='2':
print("-------------------------")
print(" ")
print("Employee Details")
print(" ")
print("-------------------------")
emp=pd.read_csv("C:\\Downloads\\empdet.csv")
print(emp)
elif i=='3':
print("-------------------------")
print(" ")
print("Add Employee")
print(" ")
print("-------------------------")
nam=input("Enter Full Name:- ")
numb=int(input("Enter Mobile Number:- "))
em=input("Enter Employee Email:- ")
iD=int(input("Enter ID Number:- "))
sal=int(input("Enter Salary:- "))
emp=pd.read_csv("C:\\Downloads\\empdet.csv")
emp=emp.append({'Name':nam,'MobileNumber':numb,'Email':em,'EmployeeID':iD,'Salary':sal},ignor
e_index=True)
emp.to_csv("C:\\Downloads\\empdet.csv",index=False)
print("---------------------------")
print("Employee Successfully Added")
print("---------------------------")
elif i=='4':
print("================================================")
print("================== SERVICES ================")
print("================================================")
service()
elif i=='5':
display_menu()
def delete():
print(""),
de=pd.read_csv("C:\\Downloads\\orderdet.csv")
bid=int(input("Please confirm your Mobile Number:- "))
if bid in de['mob'].values:
print("Are you sure you want to cancel your order?")
response=input("Enter 'Y' for Yes and 'N' for no:- ")
if response=='Y' or response=='y':
de.drop(de[de['mob']==bid].index,inplace=True)
print(" ")
print("YOUR ORDER HAS BEEN CANCELLED")
print(" ")
input("PRESS ANY KEY TO RETURN TO MAIN MENU")
else:
print(" ")
input("PRESS ANY KEY TO RETURN TO MAIN MENU")
print(" ")
else:
print(" ")
print("Order does not exist")
print(" ")
input("PRESS ANY KEY TO RETURN TO MAIN MENU")
print(" ")
def net():
print("=============================================================================
==================================================================================
=============================================================================")
print(" ")
print("1:National")
print(" ")
print("2:International")
print(" ")
print("3:Return to main menu")
print(" ")
print("=============================================================================
==================================================================================
=============================================================================")
me=int(input("INPUT ONE OPTION FROM ABOVE:-"))
if me==1:
dfr=pd.read_csv('C:\\Downloads\\pct.csv')
print(dfr)
print(" ")
input("PRESS ANY KEY TO CONTINUE")
print(" ")
loginmenu()
elif me==2:
db=pd.read_csv('C:\\Downloads\\int.csv')
print(db)
print(" ")
input("PRESS ANY KEY TO CONTINUE")
print(" ")
loginmenu()
elif me==3:
print("Do you want to return to main menu?")
print(" ")
input("If yes,PRESS ANY KEY TO CONTINUE")
print(" ")
def service():
print("=============================================================================
==================================================================================
=============================================================================")
print(" ")
print("1:Postcards")
print(" ")
print("2:Letters")
print(" ")
print("3:Registered Newspapers")
print(" ")
print("4:Parcels")
print(" ")
print("5:Packets")
print(" ")
print("=============================================================================
==================================================================================
=============================================================================")
mm=int(input("INPUT ONE OPTION FROM ABOVE:-"))
if mm==1:
df=pd.read_csv("C:\\Downloads\\postcard.csv")
for row in df:
a=df.data
b=df.year
plt.bar(b,a,width=0.5)
plt.xticks([2018,2019,2020])
plt.yticks([10,20,30,40,50,60,70])
plt.xlabel("Year")
plt.ylabel("Total Deliveries(in lakhs)")
plt.title("Postcard Deliveries per year(in lakhs)")
plt.show()
elif mm==2:
df=pd.read_csv("C:\\Downloads\\letters.csv")
for row in df:
a=df.data
b=df.year
plt.bar(b,a,width=0.5)
plt.xticks([2018,2019,2020])
plt.yticks([10,20,30,40,50,60,70])
plt.xlabel("Year")
plt.ylabel("Total Deliveries(in lakhs)")
plt.title("Letter Deliveries per year(in lakhs)")
plt.show()
elif mm==3:
df=pd.read_csv("C:\\Downloads\\RegNewspapers.csv")
for row in df:
a=df.data
b=df.year
plt.bar(b,a,width=0.5)
plt.xticks([2018,2019,2020])
plt.yticks([10,20,30,40,50,60,70])
plt.xlabel("Year")
plt.ylabel("Total Deliveries(in lakhs)")
plt.title("Registered Newspaper Deliveries per year(in lakhs)")
plt.show()
elif mm==4:
df=pd.read_csv("C:\\Downloads\\Parcels.csv")
for row in df:
a=df.data
b=df.year
plt.bar(b,a,width=0.5)
plt.xticks([2018,2019,2020])
plt.yticks([10,20,30,40,50,60,70])
plt.xlabel("Year")
plt.ylabel("Total Deliveries(in lakhs)")
plt.title("Parcel Deliveries per year(in lakhs)")
plt.show()
elif mm==5:
df=pd.read_csv("C:\\Downloads\\Packets.csv")
for row in df:
a=df.data
b=df.year
plt.bar(b,a,width=0.5)
plt.xticks([2018,2019,2020])
plt.yticks([10,20,30,40,50,60,70])
plt.xlabel("Year")
plt.ylabel("Total Deliveries(in lakhs)")
plt.title("Packet Deliveries per year(in lakhs)")
plt.show()
else:
print("There is no such option")
print(" ")
def order():
print("--------------------------------------")
print(" ")
print(" Make Your order here ")
print(" ")
print("--------------------------------------")
print(" ")
print(" ")
n=input('Name: ')
print(" ")
mobile=int(input('MobileNo: '))
print(" ")
email=input('Email_IC: ')
print(" ")
print("Product fees")
print("Letter:-Rs55 each for any place in India;")
print(" Rs150 each for International Delivery")
print("PostcarC:-Rs35 each for any place in India;")
print(" Rs100 each for International Delivery")
print("Registered Newspaper:-Rs20 each for any place in India;")
print(" Rs170 each for International Delivery")
print("[FOR MONTHLY SUBSCRIPTION PLEASE CONTACT THROUGH EMAIL TO
XsCourierservice@gmail.com]")
print("Parcel:-Rs70 each for any place in India;")
print(" Rs150 each for International Delivery")
print("Packet:-Rs60 each for any place in India;")
print(" Rs130 each for International Delivery")
product=input('Enter Product Name: ')
print(" ")
amountprod=int(input("Enter No of Items: "))
print(" ")
loc=input("Is this a National delivery or International Delivery? ")
if loc=='National' or loc=='national':
from_loc=input('Pickup Location(City): ')
print(" ")
destination_loc=input('Delivery Location(City): ')
print(" ")
if product=='Letter' or 'letter':
pay=amountprod*55
print("Amount to be payeC:- ",pay)
elif product=='Postcard' or 'postcard':
pay=amountprod*35
print("Amount to be payeC:- ",pay)
elif product=='Registered Newspaper' or 'registered newspaper':
pay=amountprod*20
print("Amount to be payeC:- ",pay)
elif product=='Parcel' or 'parcel':
pay=amountprod*70
print("Amount to be payeC:- ",pay)
elif product=='Packet' or 'packet':
pay=amountprod*60
print("Amount to be payeC:- ",pay)
elif loc=='International' or loc=='international':
from_loc=input('Pickup Location(Country,City): ')
print(" ")
destination_loc=input('Delivery Location(Country,City): ')
print(" ")
if product=='Letter' or 'letter':
pay=amountprod*150
print("Amount to be payeC:- ",pay)
elif product=='Postcard' or 'postcard':
pay=amountprod*100
print("Amount to be payeC:- ",pay)
elif product=='Registered Newspaper' or 'registered newspaper':
pay=amountprod*170
print("Amount to be payeC:- ",pay)
elif product=='Parcel' or 'parcel':
pay=amountprod*150
print("Amount to be payeC:- ",pay)
elif product=='Packet' or 'packet':
pay=amountprod*130
print("Amount to be payeC:- ",pay)
else:
print("delivery location not available")
status=("Processing")
df=pd.read_csv("C:\\Downloads\\orderdet.csv")
df=df.append({'mob':mobile,'Name':n,'Email':email,'Product':product,'ProductCount':amountprod,'P
ayment':pay,'from_loc':from_loc,'destination_loc':destination_loc,'Status':status},ignore_index=True
)
df.to_csv("C:\\Downloads\\orderdet.csv",index=False)
print(" ")
print('Make order successfully')
print(" ")
print("+========================================+")
print("|")
print("|Name: ",n)
print("|Mobile: ",mobile)
print("|Product:",product)
print("|Amount: ",pay)
print("|")
print("+========================================+")
print(" ")
print("Payment is only accepted by means of CASH ON DELIVERY")
print(" ")
print("Sorry for the inconvienience")
print(" ")
input("PRESS ANY KEY TO RETURN TO MAIN MENU")
def service_track():
df1=pd.read_csv("C:\\Downloads\\orderdet.csv")
roll=int(input("Please confirm Mobile Number:- "))
n=df1.loc[df1["mob"]==roll]
if n.empty==False:
print(n)
else:
print("Order does not Exist")
print(" ")
input("PRESS ANY KEY TO CONTINUE")
def loginmenu():
print("----------------------------------------------------")
print(" ")
print(" Welcome to Courier Management System")
print(" ")
print("----------------------------------------------------")
print("1. Make an Order")
print(" ")
print("2. Cancel an Order")
print(" ")
print("3. Service Track")
print(" ")
print("4. Our Service Network")
print(" ")
print("5. Return to Login Window")
print(" ")
print("----------------------------------------------------")
o=input("Enter your choice:- ")
if o=='1':
order()
elif o=='2':
delete()
elif o=='3':
service_track()
elif o=='4':
net()
elif o=='5':
display_menu()
else:
print("There is no such option")
print("Do you want to return to main menu?")
print(" ")
input("If yes,PRESS ANY KEY TO CONTINUE")
print(" ")
while True:
loginmenu()
print("----------------------------------------------------")
print(" ")
print(" Welcome to Courier Management System")
print(" ")
print("----------------------------------------------------")
print(" ")
print("1. Signup")
print(" ")
print("2. Login")
print(" ")
print("3. Quit")
print(" ")
print("----------------------------------------------------")
print(" ")
choice = input("Enter your choice: ")
print(" ")
if choice == '1':
add_user()
elif choice == '2':
login_user()
elif choice == '3':
quit()
else:
print("There is no such option")
print("-------------------------------")
print(" ")
print(" Thank you for using our system")
print(" ")
print("-------------------------------")
def display_menu():
print("----------------------------------------------------")
print(" ")
print(" Welcome to Courier Management System")
print(" ")
print("----------------------------------------------------")
print(" ")
print("1. Signup")
print(" ")
print("2. Login")
print(" ")
print("3. Quit")
print(" ")
print("----------------------------------------------------")
choice = input("Enter your choice: ")
if choice == '1':
add_user()
elif choice == '2':
login_user()
elif choice == '3':
quit()
else:
print("There is no such option")
while True:
display_menu()