Seasonal Pricing & Rate Matrix
Charter replaces annual spreadsheet tariff updates with a yearless Central Rates Manager (RateMatrixService) and an exact minor-unit PricingEngine.
1. Yearless RecurringRateCalendar & Precedence
Section titled “1. Yearless RecurringRateCalendar & Precedence”Each yacht defines recurring seasonal rate blocks that roll over automatically every calendar year without manual date duplication. PricingEngine::calculate() (max duration MAX_CHARTER_DAYS = 730) resolves nightly/weekly/hourly fees in exact Money + DecimalMath arithmetic in strict precedence order:
- Date Range Rate: Specific yearless calendar windows (for example
Dec 20 - Jan 05festive holiday tariff) take highest priority. - Monthly Rate: Assigned month pills (for example
May, Octobervs.July, August). - Pro-Rata Math: Shorter or longer charters divide weekly rates using
pro_rata_divisor(7nights standard or6days divisor). - Discounts: Evaluates stackable vs. non-stackable discount competition, capped by
max_discount_percent(default20%). - VAT Override Chain: Yacht override -> Destination VAT -> Marina VAT -> Global
default_vat_rate. - APA (
default_apa_percent): Applied to the VAT-excluded net charter fee (automatically0%forCharterTerms::Bareboat). - Extras: Separated cleanly into
extrasWithBooking(ExtraPayableAt::WithBooking) andextrasAtBase(ExtraPayableAt::AtBase).
2. Fail-Closed Multi-Currency Conversion (CurrencyConverter)
Section titled “2. Fail-Closed Multi-Currency Conversion (CurrencyConverter)”CurrencyConverter delegates formatting and exchange rates directly to ProcessWire\Currency (applySpread: true). If a requested currency pair has no active exchange rate or a zero rate, CurrencyConverter throws a WireException instead of silently falling back to 1.0.
3. Central Rates Manager & Bulk Adjustments (RateMatrixService)
Section titled “3. Central Rates Manager & Bulk Adjustments (RateMatrixService)”- Filter the entire fleet by yacht name/ref, category, destination, currency, or pricing state (
All,Missing,Priced). - Inspect live color-coded month states (Full month, Partial / date range, Overlap conflict, Unassigned) computed by
RecurringRateCalendar::analyzeMonthStates(). - Save individual yacht rates (
./rates-save/) undersetExpectedModifiedoptimistic concurrency locking. - Click Bulk Adjust (
./rates-bulk/) to preview (dryRun: true) and commit percentage or fixed-amount tariff adjustments across filtered or selected yachts in exactMoneyarithmetic.
Example PriceBreakdown JSON Output
Section titled “Example PriceBreakdown JSON Output”{ "currencyCode": "EUR", "baseCurrency": "EUR", "fxRate": 1, "nights": 7, "baseFee": "29150.00", "discountTotal": "2915.00", "netCharterFee": "26235.00", "vatRate": 20, "vatAmount": "5247.00", "apaPercent": 30, "apaAmount": "7870.50", "extrasWithBooking": "950.00", "extrasAtBase": "400.00", "grandTotal": "40302.50", "totalWithBaseExtras": "40702.50"}Step-by-Step: Updating Fleet Tariffs for a New Season (Admin UI)
Section titled “Step-by-Step: Updating Fleet Tariffs for a New Season (Admin UI)”- Open Setup -> Charter -> Rates Manager and click the Priced filter pill (or filter by category such as
Gulets). - Click Bulk Adjust in the top-right corner, choose Percentage (+5%), and enable Dry Run Preview first to inspect every yacht’s before/after weekly rate.
- Confirm the preview looks accurate and click Apply Adjustments to commit all rows atomically in exact minor-unit math.