# Implementation Plan for Wepesi System Integration

This plan outlines the automated fixes to deeply connect the Wepesi Hotel Management Solution settings globally and wire the accounting module fully across all transactions.

## 1. Global Settings Standardization (Wepesi Hotel)
Currently, "Deluxe Hotel" is hardcoded in several fallback values across helpers and controllers. I will standardize the global footprint.
* **[app/Helpers/SettingsHelper.php](file:///c:/Users/Admin/DELUX-SYSTEM/app/Helpers/SettingsHelper.php)**: I will update the [hotelName()](file:///c:/Users/Admin/DELUX-SYSTEM/app/Helpers/SettingsHelper.php#15-19) fallback from `'Deluxe Hotel'` to `'Wepesi Hotel Management Solution'`. This ensures that any report, invoice, or receipt lacking a specific hotel name defaults to your main branding.
* **[app/Http/Controllers/InOutController.php](file:///c:/Users/Admin/DELUX-SYSTEM/app/Http/Controllers/InOutController.php) & [ReceiptGenerator.php](file:///c:/Users/Admin/DELUX-SYSTEM/app/Helpers/ReceiptGenerator.php)**: Search and replace the hardcoded fallback `'DELUXE HOTEL'` with `'Wepesi Hotel Management Solution'`, ensuring that it seamlessly scales across logged-in hotels while falling back gracefully.
* **[app/Services/SettingsService.php](file:///c:/Users/Admin/DELUX-SYSTEM/app/Services/SettingsService.php)**: Ensure that when fetching settings for the current user session, it correctly defers to the authenticated hotel ID.

## 2. Automated Accounting Sync Connectivity
The accounting module uses a [SyncsToAccounting](file:///c:/Users/Admin/DELUX-SYSTEM/app/Traits/SyncsToAccounting.php#10-27) trait that automatically pushes finished transactions into your Journal Entries via the [AccountingSyncService](file:///c:/Users/Admin/DELUX-SYSTEM/app/Services/Accounting/AccountingSyncService.php#20-818). However, several core models are missing this trait entirely! 

I will inject the [SyncsToAccounting](file:///c:/Users/Admin/DELUX-SYSTEM/app/Traits/SyncsToAccounting.php#10-27) trait into the following models so they instantly trigger journal items when completed:
* **`App\Models\Reservation`**: To trigger [syncReservations()](file:///c:/Users/Admin/DELUX-SYSTEM/app/Services/Accounting/AccountingSyncService.php#320-433) upon checkout.
* **`App\Models\PosOrder`**: To trigger [syncPosOrders()](file:///c:/Users/Admin/DELUX-SYSTEM/app/Services/Accounting/AccountingSyncService.php#63-185) upon completed POS sales.
* **`App\Models\PurchaseOrder`**: To trigger [syncPurchaseOrders()](file:///c:/Users/Admin/DELUX-SYSTEM/app/Services/Accounting/AccountingSyncService.php#454-557) upon receiving inventory.
*(Note: [ServiceRequest](file:///c:/Users/Admin/DELUX-SYSTEM/app/Models/ServiceRequest.php#13-975), [Order](file:///c:/Users/Admin/DELUX-SYSTEM/app/Models/Order.php#9-71), and [Expense](file:///c:/Users/Admin/DELUX-SYSTEM/app/Services/Accounting/AccountingSyncService.php#583-686) already possess this hook and are functioning).*

## 3. Database Integrity & Model Consistency Tests
I will also quickly patch the `$fillable` array properties on the aforementioned models to ensure `accounting_synced` and `accounting_sync_at` are mass-assignable, which prevents the auto-sync service from failing during model updates.

## Verification Plan
After applying, I will run simulations through `php artisan tinker` verifying that creating a completed [PosOrder](file:///c:/Users/Admin/DELUX-SYSTEM/app/Services/Accounting/AccountingSyncService.php#63-185) or [Reservation](file:///c:/Users/Admin/DELUX-SYSTEM/app/Models/Reservation.php#14-927) automatically generates corresponding `JournalEntry` items mapped to the respective chart of accounts (e.g. `11241` for Cash/Bank and `21111` for Revenue). I will also verify [hotelName()](file:///c:/Users/Admin/DELUX-SYSTEM/app/Helpers/SettingsHelper.php#15-19) globally returns the Wepesi branding when accessed.
