លំហសិក្សាធិការកម្ពុជា លំហសិក្សាធិការកម្ពុជា V1.0
ចូល ចុះឈ្មោះ

Cafe POS System

អ្នកចូលរួម
គ្រូដឹកនាំ: សេក សុជាតិ
មូលសង្ខេប / Abstract

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.

ពាក្យគន្លឹះ

 I: Introduction

1.1  Background of the Study

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.


1.2  Problem Statement

Manual cafe work can create several important problems:

  • Order entry can be slow and can cause billing mistakes, especially during busy hours.
  • Staff may not know the current stock level. The system may also not give automatic low-stock warnings.
  • Manual discount and Value-Added Tax (VAT) calculations can have mistakes.
  • There may be no central local report for daily sales, best-selling items, and total revenue.

1.3  Research Questions

  • How can a desktop interface made with PyQt6 make cafe orders and menu CRUD management easier?
  • How can SQLite3 store order details and automatically reduce stock?
  • How can input checking and automatic calculations help reduce billing mistakes?

1.4  Objectives

General Objective: Design, build, and test a standalone desktop Cafe POS System using PyQt6 and SQLite3.

  • Design an organized SQLite3 database with rules that keep related data correct.
  • Build responsive PyQt6 GUI windows using QVBoxLayout, QHBoxLayout, QGridLayout, and QFormLayout.
  • Implement full CRUD functions for cafe menu items, categories, and product records.
  • Implement services for VAT calculation, bill discounts, and stock deduction.
  • Test the system and check its accuracy and stability.

1.5  Scope and Limitations

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.

II: Literature Review

2.1  Software Development Life Cycle (SDLC)

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.

2.2  Requirements Engineering

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.

2.3  GUI and Event-Driven Programming

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.

2.4  SQLite3 Database Architecture

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


3.1  System Architecture

The application uses a 3-tier architecture. This means the system is divided into three main layers:

  •          Presentation layer: the PyQt6 graphical user interface (GUI).
  •          Business/service layer: the part that handles POS calculations, validation, discounts, VAT, and stock rules.
  •         Data persistence layer: the SQLite3 database that stores the system data.

This separation makes the program more modular, easier to test, and easier to maintain.

3.2  Database Schema & ERD Design

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.

IV: Results, Testing, and Evaluation

4.1  Implementation Artifacts

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.

4.2  System Test Cases & Results Matrix

 

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

V: Conclusion and Future Work

5.1  Fulfillment of Project Objectives

The developed Cafe POS System meets the main engineering requirements from Chapter I.

  •          The 3-tier architecture keeps the PyQt6 GUI separate from the SQLite3 transaction logic.
  •          The relational database uses CHECK, UNIQUE, and foreign-key rules to protect data integrity.
  •          Real-time search and CRUD forms help cafe staff manage product records and stock counts.
  •          The POS calculation services automatically calculate taxes and promotional discounts, so staff do not need to calculate them manually.
  •       The system supports organized order processing, receipt generation, and daily sales summaries.

5.2  System Limitations

  •          The standalone offline system works on one terminal only.
  •          Kitchen Display System (KDS) integration is not included.
  •          Automatic network printing is not included in this version.

5.3  Future Work

  •          Add a local network connection or cloud backend so cashier and preparation stations can share data.
  •          Add ESC/POS thermal printing for automatic receipts.
  •          Add Role-Based Access Control (RBAC) so only authorized users can change menu prices and management settings.
  •          Add more cafe reports, such as best-selling drinks, daily sales by category, and stock alerts.


References

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.

ចែករំលែក
រក្សាទុក
មតិយោបល់ 0
ចូលគណនី ដើម្បីបញ្ចេញមតិ