Files
wyndham-ARR/opera-daily-channel-report/references/field-contracts.md
2026-07-29 16:38:05 +08:00

111 lines
4.3 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.

# Field Contracts
## XML structure
Root: `/RES_DETAIL`
Reservation sequence:
`/RES_DETAIL/LIST_G_GROUP_BY1/G_GROUP_BY1/LIST_G_RESERVATION/G_RESERVATION`
| Reservation source | Daily field |
|---|---|
| `ADULTS` | `ADULTS` |
| `BLOCK_CODE` | `BLOCK_CODE` |
| `CF_CHILDREN` | `CHILDREN` |
| `COMPANY_NAME` | `COMPANY_NAME` |
| `CONFIRMATION_NO` | `CONFIRMATION_NO` |
| `DISP_ROOM_NO` | `DISP_ROOM_NO` |
| `EFFECTIVE_RATE_AMOUNT` | `EFFECTIVE_RATE_AMOUNT` |
| `FULL_NAME` | `FULL_NAME` |
| `LIST_G_COMMENT_RESV_NAME_ID/G_COMMENT_RESV_NAME_ID/RES_COMMENT` | `RES_COMMENT` |
| `LIST_G_DEPT_ID/G_DEPT_ID/TRACE_TEXT` | `TRACE_TEXT` |
| `NO_OF_ROOMS` | `NO_OF_ROOMS` |
| `PRODUCTS` | `PRODUCTS` |
| `RATE_CODE` | `RATE_CODE` |
| `ROOM_CATEGORY_LABEL` | `ROOM_CATEGORY_LABEL` |
| `TRUNC_BEGIN` | `ARRIVAL` |
| `TRUNC_END` | `DEPARTURE` |
| computed | `NIGHTS` |
| approved zero-price exception or price reference | `REAL PRICE` |
| computed `REAL PRICE * NO_OF_ROOMS * NIGHTS` | `TOTAL PRICE` |
The group business-date candidates are `GROUPBY1_SORT_COL` (`YYYYMMDD`) and `GROUPBY1_COL` (`DD-MM-YY`). Every retained reservation `TRUNC_BEGIN` must equal that business date.
For direct XML processing, `source_sequence` is the one-based `G_RESERVATION` order and `source_location` is `reservation[N]`. Because XML is not an Excel source, `source_worksheet` and `source_row_no` are both null. The deterministic channel destination is stored separately as `channel_key`, including in daily mode where no monthly workbook is created.
The structured Group Code comes only from the selected `RES_COMMENT`:
```text
group_code_key = upper(trim(RES_COMMENT))
```
When the trimmed comment is empty, `group_code_key` is null and `booking_source_match_status` is `missing_group_code`. Never substitute `BLOCK_CODE` or another XML value.
## Daily XLSX exact columns
1. `BLOCK_CODE`
2. `ADULTS`
3. `CHILDREN`
4. `COMPANY_NAME`
5. `CONFIRMATION_NO`
6. `DISP_ROOM_NO`
7. `EFFECTIVE_RATE_AMOUNT`
8. `FULL_NAME`
9. `RES_COMMENT`
10. `TRACE_TEXT`
11. `NO_OF_ROOMS`
12. `PRODUCTS`
13. `RATE_CODE`
14. `ROOM_CATEGORY_LABEL`
15. `ARRIVAL`
16. `DEPARTURE`
17. `NIGHTS`
18. `REAL PRICE`
19. `TOTAL PRICE`
## Monthly channel XLSX exact columns
Every ordinary monthly worksheet has exactly 19 columns:
1. `ARRIVAL`
2. `DEPARTURE`
3. `NIGHTS`
4. `ADULTS`
5. `CHILDREN`
6. `BLOCK_CODE`
7. `NO_OF_ROOMS`
8. `COMPANY_NAME`
9. `CONFIRMATION_NO`
10. `DISP_ROOM_NO`
11. `RATE_AMOUNT`
12. `FULL_NAME`
13. `RES_COMMENT`
14. `TRACE_TEXT`
15. `PRODUCTS`
16. `RATE_CODE`
17. `ROOM_CATEGORY_LABEL`
18. `REAL PRICE`
19. `TOTAL PRICE`
The fixed `DY-AI-Easy-KB` worksheet has exactly the same first 19 columns plus:
20. `KB100/晚/间)`
Map daily `EFFECTIVE_RATE_AMOUNT` to monthly `RATE_AMOUNT`. Map all other monthly fields, including `REAL PRICE` and `TOTAL PRICE`, by field name rather than by the daily column index. In both reports, enforce `TOTAL PRICE = REAL PRICE * NO_OF_ROOMS * NIGHTS`. On `DY-AI-Easy-KB`, compute `KB100/晚/间) = NO_OF_ROOMS * 100`; do not multiply KB by `NIGHTS` and do not add it to `TOTAL PRICE`. Store all derived values as static numbers, including numeric zeros produced by the approved company-plus-rate-code exception.
The Finance payload uses the same named values without reopening either workbook:
- `EFFECTIVE_RATE_AMOUNT` / monthly `RATE_AMOUNT``effective_rate_amount`
- `ROOM_CATEGORY_LABEL``room_category_label`
- `REAL PRICE``real_price`
- `TOTAL PRICE``total_price`
- `KB100/晚/间)``kb_amount`
- destination worksheet → `channel_key`
## Required retained-reservation values
`RATE_CODE`, `COMPANY_NAME`, `CONFIRMATION_NO`, `DISP_ROOM_NO`, `EFFECTIVE_RATE_AMOUNT`, `FULL_NAME`, `ADULTS`, `CF_CHILDREN`, `NO_OF_ROOMS`, `ARRIVAL`, and `DEPARTURE` must be present and valid after whitelist filtering. Adults and children must be non-negative, room count must be positive, the effective rate amount must be non-negative, and departure must not be earlier than arrival. Same-day arrival and departure is valid and produces `NIGHTS = 0`. `BLOCK_CODE`, `PRODUCTS`, `ROOM_CATEGORY_LABEL`, `RES_COMMENT`, and `TRACE_TEXT` may be blank.
The complete Finance JSON field list and nullability rules are authoritative in [structured-result.schema.json](structured-result.schema.json); database-adapter semantics are in [structured-output.md](structured-output.md).