A web-based Inventory and Point-of-Sale (POS) System designed for small shops to manage products, process sales, track inventory, and maintain transaction history.
The system provides a simple POS interface where users can browse products, search or scan barcodes, add items to a cart, complete purchases, and automatically update stock levels.
password_hash()| Technology | Purpose |
|---|---|
| HTML5 | Application structure |
| CSS3 | Responsive UI and layouts |
| JavaScript | Cart logic, search, filtering, and API communication |
| PHP | Backend logic and authentication |
| MySQL | Database and data persistence |
| PDO | Database connection and queries |
| XAMPP | Local development environment |
The project uses vanilla HTML, CSS, JavaScript, PHP, and MySQL without Bootstrap, Tailwind, or other frontend frameworks.
inventory-pos/
โ
โโโ index.php
โโโ login.php
โโโ logout.php
โโโ setup.php
โโโ history.php
โโโ sale_details.php
โโโ database.sql
โ
โโโ admin/
โ โโโ products.php
โ โโโ add_product.php
โ โโโ edit_product.php
โ โโโ delete_product.php
โ
โโโ api/
โ โโโ get_products.php
โ โโโ checkout.php
โ โโโ get_sale_details.php
โ
โโโ config/
โ โโโ db.php
โ โโโ auth.php
โ
โโโ assets/
โโโ css/
โ โโโ style.css
โ
โโโ js/
โโโ app.js
Install XAMPP with:
Place the project inside the XAMPP htdocs directory:
C:\xampp\htdocs\inventory-pos
Open the XAMPP Control Panel and start:
Apache
MySQL
Open phpMyAdmin:
http://localhost/phpmyadmin
Import:
database.sql
The SQL file creates the:
inventory_pos
database and the required tables.
Open:
config/db.php
The default XAMPP configuration uses:
$user = 'root';
$pass = '';
If your MySQL installation uses a password, update the configuration accordingly.
Open:
http://localhost/inventory-pos/setup.php
The setup script creates the administrator account.
Open:
http://localhost/inventory-pos/
You will be redirected to the login page if authentication is required.
After running the setup script:
Username: admin
Password: admin123
For a real deployment, change the default credentials and remove or protect the setup script.
The system uses four main tables:
usersStores application users and authentication information.
id
username
password
created_at
productsStores inventory information.
id
name
category
barcode
price
stock
created_at
salesStores completed sales/invoices.
id
total
sale_date
sale_itemsStores the individual products included in each sale.
id
sale_id
product_id
product_name
quantity
price
subtotal
The database uses foreign keys to connect sales with their corresponding sale items.
The checkout process follows this general workflow:
Select Product
โ
Add to Cart
โ
Adjust Quantity
โ
Calculate Total
โ
Checkout
โ
Create Sale
โ
Create Sale Items
โ
Reduce Inventory
โ
Generate Invoice
The checkout operation uses a database transaction so that the sale, sale items, and stock updates are handled together.
If an operation fails, the transaction can be rolled back instead of leaving partially completed data.
The interface is designed to work across:
CSS Grid, Flexbox, and media queries are used to adapt the layout to different screen sizes.
| Page | Purpose |
|---|---|
login.php |
User login |
setup.php |
Initial administrator setup |
index.php |
Main POS interface |
admin/products.php |
Inventory management |
admin/add_product.php |
Add product |
admin/edit_product.php |
Edit product |
admin/delete_product.php |
Delete product |
history.php |
Sales history |
sale_details.php |
Individual invoice |
logout.php |
Logout |
The frontend communicates with PHP endpoints using JavaScript fetch() requests.
api/get_products.php
Returns available products as JSON.
api/checkout.php
Processes the current cart and creates the sale.
api/get_sale_details.php
Returns information about a specific completed sale.
The database includes sample products such as:
Products are organized into categories such as:
Dairy
Bakery
Grocery
Beverages
Snacks
A low-stock product is included so the inventory warning functionality can be tested.
This project demonstrates practical experience with:
Possible improvements include:
Ziad Sayed Ahmed (Zico)
๐ง z.hamzawyyy@gmail.com
This project was developed as a Web Programming course project and is intended primarily for educational and portfolio purposes.
For production use, additional security hardening, deployment configuration, user management, and validation would be recommended.