-
Notifications
You must be signed in to change notification settings - Fork 0
/
Bookstore main.py
144 lines (117 loc) · 4.2 KB
/
Bookstore main.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
import pandas as pd
import matplotlib.pyplot as plt
import os
from time import sleep
import datetime
_ = os.system('cls')
print("----------------------------------------------")
print("----------------------------------------------")
print(" WELCOME TO XYZ BOOK STORE")
print("----------------------------------------------")
print("----------------------------------------------")
print("Please wait loading in prgress")
sleep(2)
def allbooks():
bdf = pd.read_csv('Book.csv')
print(bdf.to_string())
def chemistry():
bdf = pd.read_csv('Book.csv')
chem = (bdf.loc[[0, 1, 2, 10]])
print(chem.to_string())
def physics():
bdf = pd.read_csv('Book.csv')
chem = (bdf.loc[[3, 4, 5]])
print(chem.to_string())
def maths():
bdf = pd.read_csv('Book.csv')
chem = (bdf.loc[[6, 7, 8, 9]])
print(chem.to_string())
def ip():
bdf = pd.read_csv('Book.csv')
chem = (bdf.loc[[11, 12, 13, 14]])
print(chem.to_string())
def novel():
bdf = pd.read_csv('Book.csv')
chem = (bdf.loc[[15, 16, 17, 18]])
print(chem.to_string())
def bidc():
idfb = int(input("PLEASE ENTER BOOK ID = "))
bdf = pd.read_csv('Book.csv')
df = bdf.loc[bdf["BOOK ID"] == idfb]
if df.empty:
print("INVALID BOOK ID")
print("please enter again")
sleep(1)
bidc()
else:
index = bdf.index
condition = bdf["BOOK ID"] == idfb
rowIndex = index[condition]
quan = int(input("PLEASE ENTER BOOK QUANTITY = "))
_ = os.system('cls')
inp = input("Customer Name: ")
mob = int(input("MOBILE NO: "))
_ = os.system('cls')
print("PLS WAIT WHILE THE MACHINE GENERATING THE INVOICE")
sleep(2)
_ = os.system('cls')
print("--------------------------------------------------------------")
print("--------------------------------------------------------------")
print(" XYZ BOOKSTORE INVOICE")
print("--------------------------------------------------------------")
print("--------------------------------------------------------------")
x = datetime.datetime.now()
print("NAME :",inp, " ", x.strftime("%x"))
print("MOBILE NO:",mob)
print("_______________________________________________________________")
print("BOOK-ID BOOKNAME QTY Unit-Price TOTAL")
print(idfb, " ", bdf.loc[rowIndex[0]][1], " ", quan, " ", bdf.loc[rowIndex[0]][5], " ",
bdf.loc[rowIndex[0]][5] * quan)
sleep(10)
""" FINAL """
status = True
while status:
_ = os.system('cls')
print("Press 1 - To see all Books")
print("Press 2 - To see Chemistry Books")
print("Press 3 - To see Physics Books")
print("Press 4 - To see Maths Books")
print("Press 5 - To see IP Books")
print("Press 6 - To see Novel Books")
print("Press 7 - Exit")
print("----------------------------------------------")
choice = int(input("ENTER YOUR CHOICE: "))
print("----------------------------------------------")
_ = os.system('cls')
if choice == 1:
allbooks()
elif choice == 2:
chemistry()
elif choice == 3:
physics()
elif choice == 4:
maths()
elif choice == 5:
ip()
elif choice == 6:
novel()
elif choice == 7:
status = False
else:
print("INVALID OPTION SELECTED")
if choice >= 1 and choice <= 6:
print("----------------------------------------------")
print("----------------------------------------------")
print("DO U WANT TO PURCHASE ANY BOOK?")
print("PRESS 1 - YES")
print("PRESS 2 - NO")
print("----------------------------------------------")
ans = int(input("ENTER YOUR CHOICE: "))
print("----------------------------------------------")
if ans == 1:
bidc()
elif ans == 2:
print("THANK U FOR VISTING OUR BOOKSTORE")
else:
print("INVALID CHOICE")
sleep(1)