Python Dbms Report
Python Dbms Report
SYSEM
MINI PROJECT REPORT
Submitted by
GOBIKA M 9517202309034
KARTHIKA S 9517202309051
in
BONAFIDE CERTIFICATE
SIGNATURE SIGNATURE
Sivakasi Sivakasi
ACKNOWLEDGEMENT
First and foremost, we praise and thank “The Almighty”, the lord of all
creations, who by his abundant grace has sustained us and helped us to work on
this project successfully.
With deep sense of gratitude, I would like to thank our Head of the
Artificial Intelligence & Data Science department for her insightful comments
and valuable suggestions which helped me to complete this project work
successfully.
The Grocery Store Management System serves as a comprehensive solution for grocery store
owners and customers, integrating various aspects of retail operations into a unified platform.
Developed using Python, the system leverages Tkinter for the graphical user interface (GUI) and
SQLite as a lightweight yet efficient database for storing and managing store data. The primary goal
of the system is to simplify day-to-day operations in grocery stores, improving efficiency and
enhancing customer experience.
This system provides an easy-to-use interface for both customers and store managers. For customers,
the application allows them to browse available items, add products to their shopping cart, specify
quantities in different units (e.g., kilograms, liters, pieces), and calculate the total price based on
selected items. The checkout process is seamless, allowing for the generation of a final bill and
facilitating the payment process. Upon successful payment, the system records the transaction in the
purchase history, which customers can review at any time.
For store owners, the system provides key functionalities to manage the store's inventory, including
adding new items, updating prices, and tracking stock levels. The system’s database ensures that
every transaction, whether it is a purchase or a stock update, is accurately recorded, helping owners
maintain real-time visibility into their store's operations.
The database design includes three primary tables: groceries, which stores product information;
purchases, which stores customer cart data before payment; and purchase_history, which stores
completed transactions. This database structure ensures smooth tracking of products, quantities,
prices, and customer information.
In addition to core functionalities, the system enables users to search for products, view a list of
available items, and filter the products by name. The application also provides a secure and efficient
mechanism for storing and retrieving transaction records, with detailed information on previous
purchases, including item names, quantities, units, prices, and the date of purchase. Future
improvements also include the potential for integrating online payment systems and expanding the
database to support multi-store operations.
TABLE OF CONTENTS
CHAPTER NO TITLE PAGE NO.
ABSTRACT 4
1 INTRODUCTION 7
1.1 Overview 7
1.2 Aim 7
1.3 Objective 7
2 PROJECT DESCRIPTION 9
3 SYSTEM ARCHIETECTURE 12
4 SYSTEM FUNCTIONALITY 17
5 SOURCE CODE 18
6 RESULTS 27
7 CONCLUSION 32
REFERENCES 33
LIST OF FIGURES
INTRODUCTION
1.1.OVERVIEW
1.2.AIM :
The aim of this project is to develop a Grocery Store Management System that automates
the management of inventory, customer purchases, and sales transactions. The system will streamline store
operations by efficiently tracking stock, processing purchases, and providing a user-friendly interface for
both customers and store owners. It aims to enhance business efficiency and improve the overall shopping
experience.
1.3.OBJECTIVE :
The objectives of the Grocery Store Management System are to automate inventory tracking,
facilitate customer purchases, and streamline sales transactions. It aims to provide a user-friendly interface
for customers and enable store owners to manage stock levels, update prices, and view purchase histories.
The system ensures real-time updates, improving overall store efficiency and enhancing the shopping
experience.
8
1.4.SCOPE OF THE PROJECT:
The Grocery Store Management System aims to streamline and optimize various aspects of grocery
store operations by providing an integrated platform for inventory management, purchase processing, and
transaction tracking. The scope of this project is designed to address both the operational needs of the store
and the user experience of customers.
1. Inventory Management: The system provides an organized way to manage the store’s inventory.
It allows for easy addition, update, and deletion of grocery items. Store managers can monitor
stock levels, prices, and product details, ensuring that the store is always well-stocked and offering
accurate pricing.
2. Customer Purchase Management: The system supports the entire purchasing process, from
browsing items to completing a transaction. Customers can view available items, add them to their
cart, and proceed to checkout. The application calculates the total cost of the purchase, ensuring the
pricing is accurate based on the quantity and type of items purchased.
3. Sales and Purchase History Tracking: Each purchase is recorded with details such as item
names, quantities, prices, and dates. This purchase history can be used for analysis and reporting
purposes, enabling store managers to track sales trends, identify popular products, and manage
customer relationships. Customers also benefit from having a record of their past transactions for
reference.
4. Real-time Data Updates: As purchases are made, the system updates the inventory and
transaction records in real time. This ensures that the data remains current, and the system always
reflects the latest stock levels and sales data.
5. User-friendly Interface: The project features an intuitive graphical user interface (GUI) built with
Tkinter. Customers and store managers can interact with the system easily, without requiring
technical expertise. The interface is designed to be simple, with clear navigation paths for
inventory management, checkout, and purchase history viewing.
6. Scalability and Future Enhancements: The system is designed with scalability in mind, allowing
for future updates and enhancements. Potential future improvements include:
o User authentication: Adding roles such as Admin and Cashier, each with different access
levels.
o Stock Management: Implementing automatic stock updates and low-stock alerts.
o Sales Reporting: Generating reports based on dates, product categories, or customer data.
o Online Payment Integration: Enabling secure online payments for customers through
integrated payment gateways.
9
CHAPTER 2
PROJECT DESCRIPTION
The system's inventory management feature allows store managers to easily add, update, and
delete grocery items, along with their respective quantities and prices. It provides an organized database of
available products, ensuring that stock levels are accurately recorded. The customer purchase
management functionality enables customers to browse the store's inventory, select products, and specify
quantities. Once customers add items to their cart, the system calculates the total price, ensuring that all
costs are clearly displayed before checkout.
Upon checkout, the system generates an invoice with a detailed list of purchased items, along
with their prices and quantities. The purchase history feature records every completed transaction in a
database, allowing customers to access past purchases for future reference. Store managers also benefit
from this feature as it provides valuable insights into customer preferences and sales trends over time.
The user interface (UI) is designed using Tkinter, a Python library that ensures the system is
easy to use for individuals with minimal technical experience.. SQLite is used as the database
management system, which stores the product, purchase, and transaction data. It is a lightweight yet
effective database system that allows efficient data management while maintaining fast response times.
The Grocery Store Management System aims to improve the operational efficiency of grocery
stores, making it easier for store managers to manage inventory and track sales. Customers benefit from an
enhanced shopping experience with transparent pricing and access to their purchase history. The system’s
ability to automate common tasks reduces the administrative workload, improves accuracy, and helps
maintain up-to-date records.
10
2.1.TOOLS AND TECHNOLOGIES USED:
Programming Language: Python is used for writing the core logic of the application.
GUI Framework: Tkinter is utilized for creating the graphical user interface (GUI), enabling user
interaction with the system.
Database: SQLite is used as the database management system to store information such as grocery
items, purchases, and transaction history.
Database Management: SQL queries are employed to handle tasks like adding, updating, and
retrieving data from the database.
Date and Time Management: The datetime module in Python is used to record and manage
transaction dates and times.
2.2.MODULES USED:
The following Python modules were used in the development of the Grocery Store Management
System:
Tkinter:
SQLite3:
Used to manage the local database for storing groceries, purchases, and purchase history.
SQLite is a serverless, self-contained, and highly reliable database engine, suitable for small to medium-
sized projects.
datetime:
Used for handling transaction timestamps, which helps in storing and managing the date and time of
each purchase.
os:
Used for file management, ensuring that the database file is properly created, accessed, and updated.
11
2.3.USE CASES:
The Grocery Store Management System provides a range of functionalities that enhance the user
experience, from managing items in a shopping cart to viewing purchase history. Below are the use cases
that describe the operations in the system:
12
CHAPTER-3
SYSTEM ARCHITECTURE
The Grocery Store Management System is designed using a client-server architecture, which separates
the user interface from the backend database. This approach ensures a streamlined interaction between the
user and the system, while also efficiently managing data.
Components of the System:
This architecture allows the frontend (GUI) to communicate with the backend (database) through SQL
queries. The user interacts with the GUI, which sends requests to the database for operations like adding
items to the cart, viewing the cart, and processing payments. The separation of frontend and backend
ensures that the system is modular, efficient, and easy to maintain.
13
3.1 DATABASE SETUP:
The database setup is crucial to the functionality of the Grocery Store Management System. Below is a
detailed breakdown of how the database is structured and how the tables are created, modified, and
populated in the system:
1. Connecting to SQLite Database:
The first step in the database setup is establishing a connection to the SQLite database. If the database file
doesn't exist, SQLite automatically creates it.
conn = sqlite3.connect('store.db')
c = conn.cursor()
2. Creating the Tables:
The database consists of three main tables: groceries, purchases, and purchase_history. If
these tables don't already exist, they will be created.
Groceries Table: This table stores details about the grocery items available for sale in the store.
Purchases Table: This table stores information about the items a customer selects to purchase but
has not yet paid for.
14
Purchase History Table:This table keeps a record of completed transactions after the customer
has made the payment.
4. Committing Changes:
After making changes to the database (such as creating tables or altering them), the changes are committed
to ensure they are saved.
conn.commit()
This ensures that all database operations are finalized and persisted in the database.
15
3.2.FRONTEND DESIGN:
The frontend of the Grocery Store Management System is built using Python's tkinter library, providing
an intuitive and user-friendly graphical user interface (GUI). The frontend includes several key
components, each aimed at enhancing the shopping experience. The application is organized into various
pages, each with specific functionality. Below is a detailed description of the different sections of the
frontend:
1. Welcome Page
The welcome page is the first screen that appears when the user opens the application. It serves as an
introduction to the system and gives the user an option to start the purchasing process. This page includes:
Label: "Enter Customer Name," guiding the user to input their name.
Text Entry Field: Where the user can type their name.
Confirm Button: When clicked, it saves the entered name and moves the user to the next page where they
can begin adding items to their cart.
Item Selection: A dropdown menu displays available items that the user can select from.
Quantity Input: A field where the user can enter the quantity of the selected item.
Unit Selection: A dropdown menu to choose the unit (e.g., Kg, Litre, Piece).
Buttons:
o Add to Cart: Adds the selected item and its quantity to the shopping cart.
o View Cart: Displays the current items in the cart.
o Checkout: Allows the user to proceed to payment.
16
4. Shopping Cart Display
The cart is displayed on the same page as the shopping area, showing the user the items they’ve added to
their cart. This section features:
Table Format: The cart is displayed using a table-like structure with columns for the item name, quantity,
unit, and price.
Real-Time Updates: As items are added to the cart, the table automatically updates to reflect the latest
selection.
Display Total: The total price of all the items in the cart is calculated and shown.
Payment Button: When clicked, it finalizes the purchase, moving the items from the cart to the purchase
history and clearing the cart.
Confirmation Message: After payment, a message confirms the successful transaction and thanks the user
for their purchase.
6. Purchase History
The system allows users to view their past purchases. A separate window is available for the purchase
history, displaying:
List of Past Purchases: Each entry includes the item name, quantity, unit, price, and the purchase date.
Button: "View Purchase History" on the main page opens the history window.
Design Features
Modern and Clean Interface: The overall interface has a light and clean aesthetic, using soft background
colors like light grey and green for a modern feel.
Intuitive Navigation: Each page is logically arranged, allowing users to move smoothly from one section to
another.
Responsive UI: The layout is designed to adjust well to different screen sizes, making the application
usable on various devices.
17
CHAPTER-4
SYSTEM FUNCTIONALITY
1. Database Initialization:
o The database is initialized using SQLite, and three tables are created: groceries, purchases, and
purchase_history.
o If the required columns (e.g., unit) are missing in existing tables, they are added dynamically.
2. Grocery Item Management:
o The system allows for adding items to the database (this can be done manually in the database or
extended with features to input items via the UI).
o The grocery list is fetched and displayed dynamically in a combo box for the user to select from.
3. Item Search:
o Customers can search for grocery items by name using the search feature, and the matching results
are displayed in a dropdown combo box.
4. Cart Management:
o Users can add items to their shopping cart by selecting the item, entering the quantity, and choosing
the unit (Kg, Litre, etc.).
o The item’s price is fetched from the database, and the total price is computed.
o The cart is displayed using a treeview, showing the items, their quantities, units, and the total price
for each.
5. Checkout and Payment:
o Once the user is ready to check out, they can view the total bill.
o After confirming the payment, the items are moved from the purchases table to the
purchase_history table, and the cart is cleared.
6. Purchase History:
o Users can view their past purchases in a separate window. The purchase history includes item
names, quantities, units, price, and purchase date.
7.GUI Features:
o Welcome Screen: A welcoming page with a button to start the purchasing process.
o Customer Input Screen: A screen to enter the customer’s name, which is required before
proceeding.
o Main Shopping Interface: Includes options to select items, add to cart, view cart, and checkout.
18
o Purchase History Window: A separate window showing the customer’s past purchases.
CHAPTER-5
SOURCE CODE
import sqlite3
import tkinter as tk
from tkinter import messagebox, ttk
from datetime import datetime
# Create the purchases table, making sure the 'unit' column exists
c.execute('''CREATE TABLE IF NOT EXISTS purchases (
purchase_id INTEGER PRIMARY KEY,
customer_name TEXT,
item_name TEXT,
quantity INTEGER,
19
unit TEXT,
price REAL,
purchase_date TEXT)''')
conn.commit()
conn.close()
20
def fetch_items():
conn = sqlite3.connect('store.db')
c = conn.cursor()
c.execute("SELECT name FROM groceries")
items = [item[0] for item in c.fetchall()]
conn.close()
return items
22
SELECT customer_name, item_name, quantity, unit,
price, purchase_date
FROM purchases
WHERE customer_name=?""", (customer_name,))
c.execute("DELETE FROM purchases WHERE customer_name=?",
(customer_name,))
conn.commit()
conn.close()
messagebox.showinfo("Success", "Payment successful! Thank you for
shopping.")
root.destroy()
25
# Buttons for Add to Cart, View Cart, and Payment
button_add_to_cart = ttk.Button(frame_main, text="Add to Cart",
command=add_item)
button_add_to_cart.grid(row=2, column=0, padx=10, pady=10)
26
tree_history = ttk.Treeview(history_window, columns=("Item Name",
"Quantity", "Unit", "Price", "Date"), show="headings", height=10)
tree_history.heading("Item Name", text="Item Name")
tree_history.heading("Quantity", text="Quantity")
tree_history.heading("Unit", text="Unit")
tree_history.heading("Price", text="Price")
tree_history.heading("Date", text="Purchase Date")
tree_history.column("Item Name", width=200)
tree_history.column("Quantity", width=100)
tree_history.column("Unit", width=100)
tree_history.column("Price", width=100)
tree_history.column("Date", width=150)
tree_history.pack(pady=20)
27
CHAPTER-6
RESULTS
28
Figure 6.3-Item name from the drop down menu
29
Figure 6.6-Viewing the cart items
30
Figure 6.7-Checkout Button
32
CHAPTER-7
CONCLUSION
The Grocery Store Management System is an efficient and user-friendly software solution aimed at
improving both the shopping experience for customers and the operational processes of grocery store
management. By utilizing Tkinter for the frontend and SQLite for the database backend, this system
provides a seamless interaction between the user interface and the storage of data. The core functionality
of the system includes features such as item search, shopping cart management, and the ability to view and
process customer purchase histories, all of which make grocery shopping more convenient and efficient.
One of the primary advantages of the system is its simplicity, allowing customers to quickly search for
products, add them to their cart, and proceed to checkout without any complicated procedures. The real-
time inventory tracking feature ensures that customers only see available items, which enhances the
shopping experience and reduces frustration. The purchase history functionality also benefits both the
customers and the store owners, providing customers with easy access to their previous transactions and
enabling store owners to monitor purchasing trends over time.
From an operational standpoint, the system reduces the reliance on paper-based records, making it easier
for store owners to track sales, manage inventories, and generate transaction histories. Furthermore, the
use of SQLite as the database allows for quick and reliable data storage, with the ability to easily add,
modify, and retrieve items, prices, and purchase records.
The Grocery Store Management System is designed with scalability in mind, and its modular nature
means that new features, such as discount management, loyalty programs, or even online shopping
capabilities, could be added as the business grows. Additionally, integrating real-time stock updates and
payment gateway solutions would enhance the system's capabilities and provide even more value to both
customers and store owners.
In conclusion, this project successfully integrates essential functionalities that cater to the needs of both
customers and store owners, making it an invaluable tool for grocery stores aiming to modernize their
operations. The system’s simplicity, combined with its potential for future enhancements, offers a solid
foundation for continuous improvement and long-term success.
33
REFERENCES:
1) https://docs.python.org/3/library/sqlite3.html
2) https://docs.python.org/3/library/tkinter.html
3) https://docs.python.org/3/library/tkinter.html
4) https://pythonprogramming.net/tkinter-python-3-tutorial/
5) https://www.pythontutorial.net/tkinter/tkinter-treeview/
6) https://docs.python.org/3/library/csv.html
7) https://github.com/search?q=tkinter
34