Restaurant & POS System

The Restaurant & POS System provides comprehensive point-of-sale functionality integrated with the hotel management platform. This system handles restaurant operations including menu management, order processing, table management, and payment processing. The system supports multiple order types (dine-in, takeaway, room service) and integrates with the hotel booking system for in-room dining services.

For information about the overall system architecture, see System Architecture. For customer management functionality, see Administration System.

System Architecture

The Restaurant & POS system follows a modular architecture with clear separation between frontend interface components, backend processing, and data management.

The system is organized into several key components:

Component Purpose Key Files
POS Interface Customer-facing order entry poscounter.php, addtocartfunction.php
Order Management Order tracking and status orderlist.php, orderscript.php
Menu Configuration Item and category setup Configuration pages for each menu type
Backend Processing Data handling and validation Restaurant.php, RestaurantModel.php

POS Interface Architecture

The POS counter interface provides a comprehensive point-of-sale experience with real-time cart management and order processing.

Payment Processing

Cart Management

Product Selection

Order Configuration

Order Type
order_type select

Customer Search
customersearch input

Table Selection
table_ids select

Waiter Assignment
employee_ids select

Category Filter
categories click

Product Search
productsearch input

Product Grid
productarea div

Add to Cart
productpos_add click

Cart Display
cartadd tbody

Quantity Controls
inc/dec buttons

LocalStorage
guest_cart

Discount Input
discountInput

Tax Calculation
calculateTotalOutstanding()

Payment Methods
method buttons

Order Submission
posform submit
    

Cart Functionality

The cart system uses localStorage persistence and real-time updates:

// Key cart management functions from addtocartfunction.php
storageGetdata()           // Load cart from localStorage
joinaddtocart()           // Update cart display
calculateTotalOutstanding() // Calculate taxes and totals
forEverySelectedProduct()  // Update product selection UI
    

Cart data structure stored in localStorage.guest_cart:

{
  id: "random_id",
  pro_id: "product_id",
  pro_qty: "quantity",
  price: "item_price",
  tax: "tax_amount",
  name: "product_name"
}
    

Order Type Handling

The system supports three order types with dynamic UI updates:

Order Type Code Value Additional Fields
Restaurant Dining din-in Table selection, Waiter assignment
Takeaway takeway No additional fields
In-Room Service hotel_customer Booking selection, Room selection

Menu Management System

The menu management system provides hierarchical organization of restaurant items with support for categories, variants, and add-ons.

Variant Management

Food Item Management

Category Management

Add-ons & Tables

Add-ons Config
add_ons page

hotel_booking_add_ons

Table Config
table_number page

hotel_booking_table_number

Item Category Config
item_category page

Category Form
pages/item_category.php

hotel_booking_item_category

Item Food Config
item_food page

Food Item Form
pages/item_food.php

hotel_booking_item_foods

Variant Config
item_food_variant page

Variant Form
pages/item_food_variant.php

hotel_booking_item_food_variant
    

Menu Configuration Structure

The configuration system defines menu items through the Config.php structure:

'menu' => [
    'sub_menu' => [
        'add_ons' => ['table' => 'hotel_booking_add_ons'],
        'item_category' => ['table' => 'hotel_booking_item_category'],
        'item_food' => ['table' => 'hotel_booking_item_foods'],
        'item_food_variant' => ['table' => 'hotel_booking_item_food_variant'],
        'table_number' => ['table' => 'hotel_booking_table_number']
    ]
]
    

Order Processing Workflow

The order processing system handles the complete lifecycle from draft creation to completion with support for different payment methods and order statuses.

"hotel_booking_orders"
"RestaurantModel"
"Restaurant Controller"
"addtocartfunction.js"
"POS Interface"
"hotel_booking_orders"
"RestaurantModel"
"Restaurant Controller"
"addtocartfunction.js"
"POS Interface"
Add items to cart
Store in localStorage
Select order type & customer
Validate required fields
Click payment method
Submit posform (posOrdetdata)
Process order data
Insert/update order record
Generate order_id
Return success response
Clear cart & show confirmation
    

Order Data Structure

Orders are stored in the hotel_booking_orders table with the following key fields:

Field Purpose Source
order_id Sequential order number (#001, #002, etc.) Auto-generated
order_method Payment method (cash, online, add_to_bill, draft) User selection
order_type Service type (din-in, takeway, hotel_customer) User selection
cartdata JSON cart contents Cart array
table_id Assigned table (for dine-in) Table selection
employee_id Assigned waiter Employee selection
client_id Customer information Customer lookup

Payment Methods and Order States

The system supports multiple payment processing flows:

Draft Order
order_method: draft

Cash Payment
order_method: cash

Online Payment
order_method: online

Add to Bill
order_method: add_to_bill

Cart Items

Validate Fields
firstname, lastname, phone, email

Generate Receipt
gernerateReciept()

Editable Order
openposedit class
    

Tax and Pricing System

The POS system includes comprehensive tax calculation with support for inclusive/exclusive tax types and percentage/fixed amount configurations.

Tax Configuration

Tax settings are retrieved from the hotel_booking_setup table:

Setting Field Purpose
Tax Rate tax_amount Percentage or fixed amount
Tax Type tax_option 'inclusive' or 'exclusive'
Tax Amount Type tax_amount_type 'Percentage' or 'Fixed'
Tax Name tax_type Display name (e.g., 'VAT')

Tax Calculation Logic

The calculateTotalOutstanding() function handles complex tax scenarios:

// Tax calculation from addtocartfunction.php:308-342
if (taxAmountType === 'Percentage') {
    if (taxType === 'inclusive') {
        taxAmount = total - (total * (100 / (100 + taxRate)));
        netAmount = total - taxAmount;
        totalWithTax = total;
    } else {
        taxAmount = (total * taxRate / 100);
        netAmount = total;
        totalWithTax = total + taxAmount;
    }
}
    

Database Schema

The restaurant system uses several interconnected database tables following the hotel_booking_* naming convention:

hotel_booking_orders
int
id
PK
string
order_id
string
order_method
string
order_type
json
cartdata
int
client_id
FK
int
table_id
FK
int
employee_id
FK
string
admin_uid
datetime
created_at
    
hotel_booking_clients
hotel_booking_table_number
hotel_booking_employee
hotel_booking_bookings
hotel_booking_item_foods
int
id
PK
string
ProductName
int
CategoryID
FK
decimal
bigthumb
string
ProductImage
string
admin_uid
int
status
    
hotel_booking_item_category
int
id
PK
string
Name
string
CategoryImage
int
parentid
string
admin_uid
int
status
    
hotel_booking_item_food_variant
client_id
table_id
employee_id
booking_id
CategoryID
menuid
    

Multi-Tenant Data Isolation

All restaurant tables implement multi-tenancy through the admin_uid field:

// From RestaurantModel.php getSearchAll method
$builder = $this->db->table($table)->where('admin_uid', $this->session->get('uid'));
    

This ensures each hotel property maintains separate restaurant data while sharing the same database infrastructure.