PRINCE Combined
PRINCE Combined
Introduction
Welcome to the Crackers Store Management System! This
project is designed to help efficiently manage a store that sells
firecrackers. The system allows the store owner or operator to
handle key operations such as adding new products, searching
for products by ID or name, modifying existing products,
deleting products, and calculating the total bill for purchases.
The system is built using Python, with MySQL as the database
for storing the firecracker inventory.
Purpose
The primary goal of this project is to simplify the management
of firecracker products by providing a user-friendly interface to
interact with the store's inventory. This includes adding new
records for firecrackers, searching for existing products,
updating product information, and calculating bills based on
customer purchases.
Main Functions
1. Adding New Products: The system allows users to add a
new firecracker product to the inventory by entering its ID,
name, and price.
2. Searching for Products: Users can search for a firecracker
by its unique ID or by its name, making it easy to find
details such as the price of the item.
3. Modifying Product Details: If a product's price or name
needs to be updated, the user can modify these details in the
system.
4. Deleting Products: If a product is no longer available,
users can remove it from the system using its ID.
5. Displaying All Products: The system can display all
available firecracker products, showing their IDs, names,
and prices.
6. Calculating the Total Bill: When customers make a
purchase, the system helps calculate the total bill based on
the quantity of each firecracker item. If the total exceeds a
certain limit, a discount is applied automatically.
7. Exiting the System: The system also provides an option to
safely exit the program after operations are complete.
Conclusion
The Crackers Store Management System ensures that all
operations related to the firecracker inventory are handled
efficiently and effectively. It allows the store to keep track of its
products and transactions seamlessly, reducing manual errors
and improving productivity.
-
con = mysql.connector.connect(user='root',
passwd='1234', host='localhost', database='crackers')
c = con.cursor()
print('-------------------********** GREETINGS!!
**********--------------------------')
print()
print('------------------****** WELCOME TO THE CRACKERS
STORE!! ******---------------------- ')
def display():
c.execute('SELECT * FROM firecracker')
for i in c:
print(i)
def search_by_id(id):
c.execute('SELECT * FROM firecracker WHERE
cracker_id={}'.format(id))
for i in c:
print(i)
def search_by_name(pname):
c.execute("SELECT * FROM firecracker WHERE
cracker_name='{}'".format(pname))
for i in c:
print(i)
def delete(cracker_id):
display()
c.execute("DELETE FROM firecracker WHERE
pid={}".format(cracker_id))
con.commit()
while True:
print('1. Add new record')
print('2. Search a record according to cracker ID')
print('3. Search a record according to cracker name')
print('4. Delete a record according to cracker ID')
print('5. Modify a record according to cracker ID')
print('6. Display all records')
print('7. Calculate bill')
print('8. Exit')
if choice == 1:
id = int(input('Enter new cracker ID: '))
name = input('Enter cracker name: ')
price = int(input('Enter cracker price: '))
add(id, name, price)
elif choice == 2:
id = int(input('Enter cracker ID for search: '))
search_by_id(id)
elif choice == 3:
name = input('Enter cracker name for search: ')
search_by_name(name)
elif choice == 4:
id = int(input('Enter cracker ID for deletion: '))
delete(id)
elif choice == 5:
id = int(input('Enter cracker ID to modify: '))
name = input('Enter new cracker name: ')
price = int(input('Enter new cracker price: '))
modify(id, name, price)
elif choice == 6:
display()
elif choice == 7:
display()
grand_total = 0
while True:
name = input('Enter cracker name: ')
quantity = int(input('Enter quantity: '))
total = calculate_total(name, quantity)
print('Total for this item:', total)
grand_total += total
more = input('Purchase more? (y/n): ')
if more.lower() == 'n':
break
print('Grand total:', grand_total)
if grand_total > 10000:
discounted_price = grand_total * 0.9
print('Discounted price is:', discounted_price)
elif choice == 8:
break
else:
print('Enter a valid number')
-Adding a product