Reservation Processing

This document covers the reservation processing system within Hotelaro's core booking module. This system handles the creation, modification, retrieval, and management of hotel reservations, including search functionality, status tracking, payment monitoring, and integration with room management.

For information about the interactive calendar interface used for creating reservations, see Calendar Interface. For room configuration and availability management, see Room Management.

System Architecture

The reservation processing system is built around the Bookings controller class and follows a model-view-controller pattern with heavy AJAX integration for real-time updates. The system manages reservations in the hotel_booking_bookings table with tenant isolation using admin_uid.

Supporting Systems

Data Layer

Controller Layer

Frontend Interface

Bookingslist.php
Search & Filter UI

content.php
Individual Booking View

frontjavascript.php
AJAX Operations

Bookings.php
Main Controller

index()
List View

get()
AJAX Data Retrieval

edit()
Edit Form

datasetup()
CRUD Operations

deleteit()
Delete Operations

BookingsModel
Database Operations

hotel_booking_bookings
Multi-tenant Table

hotel_booking_rooms
Room Reference

PeginationController
Pagination Logic

universalpdf()
Document Generation

noshowactivate()
No-Show Detection
    

CRUD Operations

The reservation processing system implements full CRUD operations through the Bookings controller class, with operations filtered by tenant using the admin_uid session value.

Core Controller Methods

Method Purpose HTTP Method Key Operations
index() Display booking list page GET Renders main booking interface
get() Retrieve booking data GET AJAX endpoint for paginated results
edit($id) Show booking edit form GET Load individual booking details
add() Show booking creation form GET Display empty booking form
datasetup() Process form submissions POST Create/update booking records
deleteit() Remove booking POST Delete booking with permission check

The datasetup() method handles both creation and updates using a conditional approach based on the presence of an edit parameter:

Yes

No

Form Submission
datasetup()

Edit Parameter
Present?

Validate Existing Record
getById()

Set Creation Data
uid, status, admin_uid

updateit()
Update Database

insertit()
Insert New Record

JSON Response
Success/Error
    

Search and Filtering System

The booking list implements a comprehensive search and filtering system using AJAX for real-time results without page reloads. The system supports multiple search criteria and maintains filter state in the frontend.

Search Interface Components

The search interface in Bookingslist.php provides filters for:

AJAX Search Implementation

The frontend JavaScript implements search through the ajaxSend() function which handles various search scenarios:

User Input
#searching.click()

Filter Button
#filtering.click()

Reset Button
#reseting.click()

ajaxSend()
Function

Build Filter Object
filterValues

Clear All Filters
Reset Values

GET /bookings/get
With Parameters

Process Response
joinmainData()

Update Booking Table
Dynamic HTML
    

The search system handles special formatting for booking IDs that contain the "SIE001" prefix, automatically stripping the prefix for database queries while maintaining display formatting.

Booking Status Management

The system implements a comprehensive status management system that tracks both reservation status and payment status, with additional no-show detection capabilities.

Status Color Coding

The system uses color-coded status badges defined in the controller's get() method:

Status Color Hex Code Status Label Meaning
Green #198754 Check In Guest has checked in
Yellow #ffca2c Reserved Confirmed reservation
Blue #0d6efd Temporary Reserved Temporary hold
Gray #6c757d Hold On hold status

Payment Status Tracking

Equal

Less Than

Greater Than

Payment Status Check
getPaymentStatus()

Compare total_received
vs outstanding_total

'Paid'
text-success

'Unpaid'
text-danger

'Partial'
text-warning
    

No-Show Detection

The system implements automatic no-show detection using the noshowactivate() function, which considers:

Real-time Interface Operations

The booking interface uses extensive AJAX operations for seamless user experience, with all table updates happening without page reloads.

Dynamic Table Updates

The joinmainData() function dynamically generates table rows with:

Pagination Integration

The system integrates with PeginationController to handle large booking datasets:

User Clicks Page
.pagechange

Extract page-id
data-page-id

ajaxSend()
with page offset

Bookings.get()
with pagination

PeginationController
createLinks()

Update Table & Pagination
joinmainData() + joinpagiData()
    

Row Limit Management

Users can adjust the number of rows displayed per page, with the setting persisted in localStorage as rowsToShow. The system defaults to 10 rows if no preference is set.

PDF Generation and Document Management

The system includes document generation capabilities through the universalpdf() method, which creates printable booking documents using the Dompdf library.

PDF Generation Workflow

Print Button Click
#printit

generatepdf()
AJAX Call

universalpdf()
Controller Method

Dompdf Instance
loadHtml()

render()
Generate PDF

Save to writable/pdfs/
Return Path

window.open()
Display PDF
    

The PDF generation accepts parameters for page size, orientation, and template selection, providing flexibility for different document formats.

No-Show Management

The system provides functionality to mark bookings as no-show through the markasnoshow() controller method, which updates the booking's no_show field to 'noshow' status.

Integration with Room Management

The reservation processing system integrates closely with the room management system to ensure data consistency and provide comprehensive booking information.

Room Data Integration

Booking records reference rooms through room_id, and the frontend JavaScript uses helper functions to resolve room information:

Multi-Room Booking Support

The system supports bookings that span multiple rooms, with individual room records stored separately but linked by book_id. The detail view displays each room as a collapsible section with individual pricing and guest information.

book_id

room_id

Main Booking Record
hotel_booking_bookings

Individual Room Bookings
Same book_id

Room Information
hotel_booking_rooms

Room Detail Display
joinRoomData()

Price Calculations
Per Room

Overall Booking Info
Guest Details