POS Interface

This document describes the Point-of-Sale (POS) Interface within the Hotelaro hotel management system. It covers the technical structure, user interaction flow, and main code entities that implement the POS counter, cart management, and order submission workflow. The focus is on the POS counter interface used by restaurant staff to process dine-in, takeaway, and in-room orders.

For details on menu configuration, see Menu Management. For order lifecycle, payment, and receipt generation, see Order Processing.

Overview

The POS Interface is a web-based module that allows staff to:

The interface is tightly integrated with the multi-tenant backend, ensuring all data is filtered by admin_uid for property isolation.

Key code entry points:

System Context

Diagram: POS Interface in System Architecture

User Interface Structure

The POS interface is rendered by poscounter.php and consists of:

Main UI Elements and Data Sources

UI Element Data Source/Table Code Reference
Category List hotel_booking_item_category poscounter.php:4, 70-77
Product Grid hotel_booking_item_foods poscounter.php:5, 104-107
Table Assignment hotel_booking_table_number poscounter.php:11, 735-737
Customer Assignment hotel_booking_clients poscounter.php:10, 410-419
Cart Management localStorage, dynamic JS addtocartfunction.php:64-246
Order Submission hotel_booking_orders Restaurant.php:273-339

Code Entity Mapping

renders UI, loads data

AJAX POST

insert/update

fetches

fetches

fetches

fetches

inc/core/Restaurant/Views/poscounter.php

app/Views/common_script/addtocartfunction.php

inc/core/Restaurant/Controllers/Restaurant.php

hotel_booking_orders

hotel_booking_item_foods

hotel_booking_item_category

hotel_booking_table_number

hotel_booking_clients
    

Cart Management and Product Selection

Cart management is handled on the client side using JavaScript and localStorage. The main logic is in addtocartfunction.php:

Cart Data Structure

Field Description
id Unique cart item ID
pro_id Product ID
pro_qty Quantity
price Unit price
tax Tax rate/value
name Product name

Order Type and Contextual Assignment

The POS interface supports three order types:

The UI dynamically shows or hides relevant fields based on the selected order type. This is managed by the showAccordingOrderType function.

Customer Search and Assignment

Order Submission Workflow

Order submission is handled via AJAX POST to the posOrdetdata method in the Restaurant controller.

Order Submission Flow

"hotel_booking_orders"
"Restaurant.php::posOrdetdata"
"addtocartfunction.js"
"poscounter.php"
"POS User"
"hotel_booking_orders"
"Restaurant.php::posOrdetdata"
"addtocartfunction.js"
"poscounter.php"
"POS User"
Selects products, fills order details
Updates cart, applies discounts/taxes
Clicks payment/draft/submit
AJAX POST order data
Insert/Update order
Success/Error response
Show notification, clear cart if success
    

Data Model: Orders

Orders are stored in the hotel_booking_orders table. Key fields include:

Field Description
id Primary key
order_id Sequential order number
admin_uid Tenant identifier
client_id Customer ID
table_id Table number (if dine-in)
room_id Room number (if in-room)
employee_id Waiter/staff ID
cartdata JSON-encoded cart contents
totalprice Total before discounts/taxes
totaldiscount Discount applied
totalgrandtotal Final total after tax/discount
order_method Payment method or draft
status Order status
created_at Timestamp

Error Handling and Validation

Integration Points

Summary

The POS Interface is a dynamic, multi-tenant-aware module for restaurant order entry, cart management, and order submission. It is implemented as a combination of PHP views, JavaScript for client-side cart logic, and a backend controller for order persistence and validation. The design supports flexible order types, real-time cart updates, and robust error handling.