# Service Order System - Event Planning Form

## Overview
This system provides a formalized event planning process for gathering information to auto-create events. It does not affect the current event and dinner system, but rather serves as an information gathering tool.

## Setup Instructions

### 1. Create the Database Table
Run the SQL script to create the `EventsServiceOrder` table:

```bash
mysql -u root -p el_paraiso < create-event-service-order-table.sql
```

Or manually execute the SQL in `create-event-service-order-table.sql` using phpMyAdmin or your MySQL client.

### 2. Access the System
- **Form Entry**: `event-service-order-form.php` - Create new service orders
- **Order List**: `event-service-order-list.php` - View and manage all orders
- **View Order**: `event-service-order-view.php?id=X` - View detailed order information
- **Export**: `event-service-order-export.php` - Export to Excel or CSV

### 3. Required Access
Admin privileges are required to access all service order pages.

## Features

### Data Entry Form (`event-service-order-form.php`)
- **Basic Event Information**: Event name, dates, time, event type (Golf/Dinner)
- **Organiser Information**: Name, email, telephone
- **Registration Dates**: Open date and cutoff date
- **Golf Event Details** (shown when Golf is selected):
  - Group (Epic, Ladies, White tees)
  - Group Type (Stableford, Medal)
  - Event Format (Pairs, Scramble, Shambles)
  - Max places, Tee start type
  - Print options (Scorecards, Buggy Sheets)
  - Tee positions (Women's/Men's: 60, 58, 56, 52, 50, 45)
  - Slope percentage
  - Payment details (TeeOne, Credit Card)
  - Prizes (Nearest Pin 1/2, Longest Drive with hole numbers)
- **Dinner Event Details** (shown when Dinner is selected):
  - Event name, time, number of tables, max places
  - Kitchen deadline date
  - Menu (Starters, Mains, Desserts)
  - Entertainment (Y/N with details)
  - Payment method and cost per participant

### Order Management (`event-service-order-list.php`)
- View all service orders in a table
- Filter by status (Draft, Submitted, Approved, Completed)
- Update order status
- Edit orders
- View detailed order information
- Export to Excel or CSV

### Export Functionality (`event-service-order-export.php`)
- **Excel Export**: Full-featured Excel file with formatting
- **CSV Export**: Simple CSV format for data import
- Includes all fields from the service order

### View Order (`event-service-order-view.php`)
- Detailed view of a single service order
- Organized by sections (Basic Info, Organiser, Golf Details, Dinner Details)
- Read-only display with edit link

## Database Table Structure

The `EventsServiceOrder` table includes:
- Basic event information (name, dates, times)
- Event type flags (has_golf, has_dinner)
- Organiser details
- Registration dates
- Complete golf event configuration
- Complete dinner event configuration
- Status tracking (Draft, Submitted, Approved, Completed)
- Timestamps (created_at, updated_at)

## Status Workflow

1. **Draft** - Initial creation, can be edited
2. **Submitted** - Order submitted for review
3. **Approved** - Order approved and ready for processing
4. **Completed** - Order has been processed/fulfilled

## Notes

- The system is designed for a test simulation phase where fields may be added/modified
- All forms include validation for required fields
- The system automatically creates the table if it doesn't exist when first accessed
- Admin access is required for all operations

## Future Enhancements

- Auto-create events from service orders
- Email notifications
- Additional status options
- Search and filtering capabilities
- Bulk operations






