Hardware Shop PDF
Hardware Shop PDF
Objectives
Key Features
1
Technology Stack
This system serves as a foundational tool for hardware shop owners to manage
their business operations more effectively, ultimately leading to improved
profitability and customer satisfaction. As the project evolves, additional features
can be implemented, such as user authentication, advanced reporting, and a
graphical user interface (GUI).
2
FRONT END: PYTHON
BACK END :MYSQL
PYTHON:
Python is an interpreted, object-oriented, high-level programming language with
dynamic semantics developed by Guido van Rossum. It was originally released in
1991. Designed to be easy as well as fun, the name "Python" is a nod to the British
comedy group Monty Python. Python has a reputation as a beginner-friendly
language, replacing Java as the most widely used introductory language because it
handles much of the complexity for the user, allowing beginners to focus on fully
grasping programming concepts rather than minute details.
3
MYSQL:
MySQL is a SQL-based relational database management system for web databases.
Use MySQL for various applications, including data cleansing, data warehousing,
online shopping, logging software, and portals. MySQL can store everything from
a single record to a complete product inventory. The application of MySQL varies
based on the need. It can associate with any scripting language like PHP or Perl
and create websites.
4
Source Code:
import mysql.connector
# Database connection
def get_db_connection():
return mysql.connector.connect(
host='localhost',
user='root',
password='admin',
database='hardware_shop'
# Product Management
conn = get_db_connection()
cursor = conn.cursor()
sql = "INSERT INTO products (name, price, quantity) VALUES (%s, %s, %s)"
conn.commit()
cursor.close()
conn.close()
print("Product added!")
5
def list_products():
conn = get_db_connection()
cursor = conn.cursor()
products = cursor.fetchall()
cursor.close()
conn.close()
return products
def low_stock_products(threshold=5):
conn = get_db_connection()
cursor = conn.cursor()
low_stock = cursor.fetchall()
cursor.close()
conn.close()
return low_stock
# Sales Management
6
conn = get_db_connection()
cursor = conn.cursor()
# Check stock
product = cursor.fetchone()
print("Insufficient stock!")
cursor.close()
conn.close()
return
# Insert sale
7
conn.commit()
cursor.close()
conn.close()
print("Sale recorded!")
# Customer Management
conn = get_db_connection()
cursor = conn.cursor()
conn.commit()
cursor.close()
conn.close()
print("Customer added!")
def list_customers():
conn = get_db_connection()
cursor = conn.cursor()
customers = cursor.fetchall()
8
cursor.close()
conn.close()
return customers
# Main Menu
def main():
while True:
print("7. Exit")
if choice == '1':
9
add_product(name, price, quantity)
products = list_products()
print(product)
low_stock = low_stock_products()
print(product)
add_customer(name, contact)
customers = list_customers()
10
for customer in customers:
print(customer)
print("Exiting...")
break
else:
if __name__ == '__main__':
main()
11
Python Output:
12
13
14
15
MYSQL Output:
16
17
18