Files
wyndham-ARR/.project-docs/10-decisions/ADR-001-automatic-monthly-trigger-and-total-price-formula.md
2026-07-29 16:38:05 +08:00

35 lines
2.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# ADR-001: Automatic Monthly Trigger And TOTAL PRICE Formula
- Status: Accepted
- Date: 2026-07-29
- Source: User correction in the current session
## Context
Earlier discussion incorrectly treated monthly-report generation as a separate user action and described year, month, or cutoff date as user-submitted values. An earlier report specification also treated generated price cells as static values.
## Decision
1. The user's workflow begins and ends with uploading the XML.
2. The Agent processes the XML and returns structured data for validation and database persistence.
3. Only after that structured result is successfully committed does the business system automatically trigger the monthly-report processing program.
4. `report_year`, `report_month`, `as_of_date`, or equivalent values may remain as internal execution and audit fields, but the backend must derive them. They are not user inputs in the primary workflow.
5. The report keeps the `TOTAL PRICE` dimension/field. Each XLSX data-row cell must contain a formula with the business meaning:
`TOTAL PRICE = REAL PRICE × NIGHTS × NO_OF_ROOMS`
With the current 19-column layout, this is equivalent to `=R2*C2*G2` for row 2 and must fill relatively for later rows.
## Consequences
- A manual month/as-of form or endpoint is not the primary product flow and must not be presented as a required user step.
- The monthly processor may still accept internally supplied month/cutoff arguments from its orchestrator.
- Existing manual-trigger UI/API code and static-cell workbook generation are implementation gaps, not the accepted requirement.
- The exact internal event/outbox/worker mechanism and cutoff derivation policy remain implementation details to design and verify; they must not be delegated to the user.
## Supersedes
- Any conversation or planning note that says the user submits the report year, month, or cutoff date.
- The intermediate correction that said the user clicks a monthly-report button while the backend derives those values.
- Any report-output rule requiring `TOTAL PRICE` data cells to be static values or requiring a zero-formula workbook.