The report endpoint's totalPickup/totalRooms summed every day's
pickup override regardless of whether the day had already passed,
even though a past day's actual accommodation revenue already
supersedes it (fAccomm ignores pickup for those days). This
overstated Probable Pickup and the month's rooms estimate. Also
fixed pickup.accomm to sum each day's own rate instead of
multiplying the total by a flat session rate.
Adds a utilities-client.js mirroring the existing forecasting-client
HTTP pattern (UTILITIES_URL/UTILITIES_API_KEY). Directors report
response gains a separate `utilities` field; degrades gracefully with
an error string if the utilities app is unreachable or unconfigured.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Worksheet save now persists forecast_dry/forecast_wet per day to day_overrides
so the report page always shows the same totals the user saw on the worksheet,
rather than making a second independent forecasting API call that can return
slightly different values.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Checkbox in the header switches between 364-day same-weekday comparison
and same calendar-date last year. Default remains DOW-aligned.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Backend:
- Always fetch full calendar month (not truncated at week ending)
- Add month_daily[] to response (per-day TY/LY by dept, is_actual flag)
Frontend:
- New 'Sales History' section with:
- Monthly dept line chart: 12-month x-axis, TY vs prior year per dept
(Rooms/Dry/Wet solid, LY dashed — same colour per dept)
- Rolling 12-month average trend (moved from Month Progress)
- Month Progress section gains cumulative line chart:
- X-axis = day of month, 6 lines (3 TY solid + 3 LY dashed)
- TY lines stop at week ending; LY spans full month
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Stacked bar chart (Rooms/Dry/Wet) for the previous 12 months and last
12 months side by side, with a reference line marking the boundary.
No extra API calls — data comes from the existing 36-month fetch.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace raw monthly totals with a proper rolling 12-month average trend.
Fetches 36 months of data; the 12 display points each show the average
of the 12 months ending on that point (TY) and the same window shifted
back a year (LY), producing a smooth upward trend vs last year.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Full weekly actuals report matching the spreadsheet layout:
- Week summary table (Rooms/Dry/Wet vs Budget vs Last Year vs Last Week)
- Grouped bar chart + dept split pie chart
- 5-week rolling summary table
- Occupancy table by day of week (rooms, occ%, ARR, RevPAR)
- Month progress to date (totals + dept split) with progress bar chart
- 12-month turnover trend line chart by dept
- Utilities placeholder (pending meter readings app)
Budget values come from the forecasting API which distributes monthly
budget proportionally to daily sales — so high-demand weeks (e.g.
Christmas) carry a higher budget share. Gross shown as net × 1.20.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Switch from a single total_rooms scalar to rm.available_rooms per day,
now that the forecasting public API returns it from daily_occupancy.
Fixes worksheet Avail column showing 80 (total physical beds) instead
of the correct occupancy-reportable room count.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace queryForecast/forecast-db.js with fetch() calls to the
forecasting app's public API (/forecasting/api/public/forecast/revenue
and /forecast/rooms). This removes the need for cross-DB grants and the
FORECAST_DATABASE_URL — all data comes from FORECASTING_API_KEY +
FORECASTING_URL. The DOW-history algorithm is also removed since the
covers model in the forecasting API already handles dry/wet future
forecasts.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Embeds a Directors Forecast section in the Reports sidebar (hard-coded
under "Directors Reports"). Worksheet tab: day-by-day OTB grid with
editable pickup rooms, dry/wet overrides, ML suggestion column and live
forecast recalculation. Report tab: forecast vs budget vs last-year
comparison, occupancy summary, weekly revenue bands and snapshot tracking.
Backend: forecast-db.js (read-only pool to forecasting_db), new tables
(forecast_sessions, day_overrides, forecast_snapshots) and full REST
routes under /api/directors-forecast. docker-compose FORECAST_DATABASE_URL
added.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>