លំហសិក្សាធិការកម្ពុជា
V1.0
This project is about designing and making a desktop Cafe Point of Sale (POS) System. The system is developed with Python 3.14+, PyQt6, and SQLite3. Many small and medium cafes still use paper orders, paper bills, calculators, or simple spreadsheets. These methods can cause wrong calculations, slow orders, and stock shortages. To solve these problems, the system uses an event-driven design. This means the program waits for user actions, such as button clicks, and then runs the correct action. The system also separates the user interface, business services, and database parts so that the program is easier to manage and test. The main parts of the software are cafe menu and drink management, CRUD operations, order management, bill calculation, VAT and discount calculation, and stock updates. The system was tested to check that data is saved correctly, user input is checked, and calculations are correct. The final system is an offline solution for daily sales and POS work in small and medium cafes.
Cafes have many fast and regular
transactions every day. These include
drinks, food items,
customer orders, stock use,
and checkout bills. Large businesses often use computerized POS systems, but
many small and medium cafes still use manual tickets, calculators, or simple
spreadsheets.
These manual
methods can increase
the work for staff. They can also make order processing slower and make it
harder to check daily revenue. A POS system can help the cafe do these tasks in
a more organized way.
Manual cafe work can create several important problems:
General Objective: Design, build, and test a standalone desktop Cafe POS System using PyQt6 and SQLite3.
In Scope:
The project includes
a local desktop POS application, cafe menu and catalog management, customer order processing, itemized receipt generation, stock
deduction, and daily sales summaries.
Limitations: The system is a standalone application, so it does not support multi-terminal cloud synchronization.
Receipts are shown locally and do not use external thermal-printer drivers.
Payment processing is simulated for offline use.
Software
engineering uses planned methods to help make software reliable and easy to
follow. This project follows the ISO/IEC/IEEE 12207:2017 guideline. The main
development steps are: defining requirements, designing the system, implementing the modules, testing
the system, and preparing maintenance documents.
The project follows
ISO/IEC/IEEE 29148:2018. The system features
are divided into two groups.
Functional requirements describe what the system must do. Non-functional
requirements describe qualities such as data integrity, ease of use, and speed.
User input is checked carefully
before the program
sends it to the database. This helps stop invalid values
from entering the system.
A desktop
application uses an event loop.
In PyQt6, QApplication.exec() keeps the application running and listens
for user and operating-system events.
PyQt6 uses signals and slots. For example, QPushButton.clicked can send a signal when a user clicks a button,
and QLineEdit.textChanged can send a signal when text changes. The correct
Python function can then run.
Layout managers
help place widgets
in the window. They allow the interface to adjust better instead of using
fixed screen coordinates.
SQLite3 is an embedded
database. It does not need a separate
database server. Python can access
it directly through the
sqlite3 module. It supports safe transactions and helps keep data correct.
The database
uses primary keys,
NOT NULL rules,
CHECK rules, and foreign keys. These rules help protect the data and keep relationships
between tables correct.
III: Methodology and System Design
The application uses a 3-tier architecture. This means the system is divided into three main layers:
This separation makes the program more modular, easier to test, and easier
to maintain.
The database uses several
related tables. Each table has a main purpose and rules for its data.
|
Table Name |
Primary Key |
Foreign Keys |
Key Columns &
Constraints |
Purpose |
|
categories |
category_id |
None |
name TEXT
UNIQUE NOT NULL |
Stores
cafe categories, for example Coffee, Tea, and
Food. |
|
menu_items |
item_id |
category_id |
price REAL CHECK(price >=
0); stock_qty INTEGER
DEFAULT 0 |
Stores cafe food/drink
items, prices, categories, and stock counts. |
|
orders |
order_id |
None / optional order ref |
order_date TEXT; grand_total REAL
NOT NULL |
Stores finalized customer POS bills and order information. |
|
order_items |
order_item_id |
order_id,
item_id |
quantity INT CHECK(quantity >
0); line_total REAL |
Stores the individual
products, quantities, and line totals in each customer order. |
Menu & Product Management View: The system can filter
products in real time. Staff can work with the QTableWidget and QFormLayout controls
to view and change product data.
POS Order
View: Staff can choose cafe products, enter
quantities, review the order lines,
and calculate the bill.
Calculation Engine: The system calculates discounts, applies VAT, and checks
that balances are not negative.
Inventory Service: The system
reduces product stock when an order is finalized.
|
ID |
Module / Feature |
Test Condition /
Input |
Expected Output |
Verdict |
|
TC-01 |
Database Init |
Launch main.py
when cafe_pos.db is missing |
The SQLite schema and tables are created automatically with the needed constraints. |
PASS |
|
TC-02 |
Menu Item Entry |
Insert “Iced
Latte”, Price: $3.50, Stock: 20 |
The new row is inserted and the catalog refreshes
immediately. |
PASS |
|
TC-03 |
Duplicate Validation |
Insert the existing unique
item “Iced Latte” again |
The system rejects the duplicate and shows a warning. |
PASS |
|
TC-04 |
Search & Filter |
Type “Lat” into the catalog filter |
Matching products appear immediately. |
PASS |
|
TC-05 |
Record Update |
Change Iced
Latte price to $4.00 and click Update |
The database and user interface show
the new price. |
PASS |
|
TC-06 |
Deletion Guard |
Select an item,
click Delete, and confirm Yes |
The item is removed from SQLite. |
PASS |
|
TC-07 |
Financial Logic |
Subtotal $100, Discount 10%, Tax 10% |
Discount = $10, taxable amount = $90, tax
= $9, total = $99. |
PASS |
|
TC-08 |
Boundary Guard |
Enter a 120% discount |
The system shows
a validation error
and stops the invalid calculation. |
PASS |
The developed Cafe POS System meets
the main engineering requirements from Chapter
I.
IEEE Author Center, “IEEE Reference Guide,”
IEEE, 2025.
ISO/IEC/IEEE, ISO/IEC/IEEE 12207:2017 Systems and Software Engineering — Software Life Cycle
Processes, 2017.
ISO/IEC/IEEE, ISO/IEC/IEEE 29148:2018 Systems and Software Engineering — Requirements Engineering, 2018.
The Qt Company, “Signals
and Slots - Qt for Python Documentation,” Qt Documentation, 2026.
Python Software
Foundation, “sqlite3 — DB-API 2.0 Interface for SQLite,” Python
Documentation, 2026. SQLite
Consortium, “SQLite Foreign Key Support & ACID Transactions,” SQLite
Documentation, 2026.
I. Sommerville, Software Engineering, 10th ed., Pearson,
2016.
R. S. Pressman and B. R. Maxim,
Software Engineering: A Practitioner’s Approach, 9th ed., McGraw-Hill, 2020.