From 5942ecf3407354eb9dbabaa6a3906c1a61b0bcb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Fromme?= Date: Wed, 11 Nov 2026 16:35:49 +0100 Subject: [PATCH] docs: document pooled room contingents --- docs/buspro-database-reference.md | 30 ++++++++++++++++++++++--- docs/buspronet-schema/travel-queries.md | 16 ++++++++----- 2 files changed, 37 insertions(+), 9 deletions(-) diff --git a/docs/buspro-database-reference.md b/docs/buspro-database-reference.md index a26c07f7..ce9ec53f 100644 --- a/docs/buspro-database-reference.md +++ b/docs/buspro-database-reference.md @@ -181,15 +181,37 @@ JOIN dbo.PartnerPreis pp ON pp.IDPartnerPreisKategorie_FS=pk.IDPartnerPreisKateg WHERE pk.IDAdresse_FS=@HotelAddressId AND pk.IDArtPartnerPreisCode_FS=@PriceCode AND pk.IDArtVerpflegung_FS=@BoardId AND pk.EK_VK='VK' AND pp.IDPartnerSaisonTafel_FS=@SaisonTafelId AND pp.Naechte=@Nights; --- room availability (flat, reproducible) +-- room allotment (remaining = allotment − bookings, computed by BusPro; see below) SELECT IDZimmer_FS,Anzahl,BuchungsStatus FROM dbo.PartnerKontingent WHERE IDAdresse_FS=@HotelAddressId AND IDZimmer_FS=@ZimmerartId AND TerminVon<=@Abreise AND TerminBis>=@Anreise; ``` - V: `EK_VK` = `EK` purchase / `VK` sale. **Always filter `VK`** for customer prices. -- V: `PartnerKontingent.Anzahl` IS the available room count. Gate with `BuchungsStatus` - (`''` bookable, `S` stop, `A` on request). +- V 2026-11-11: `PartnerKontingent.Anzahl` is the room **allotment**, not what is left + (hotel 163113, room type 2366: `Anzahl=6` while the export reported `verfuegbar="1"`). + BusPro computes the remaining count; read it from the export, not from this table. Gate with + `BuchungsStatus` (`''` bookable, `S` stop, `A` on request). +- V 2026-11-11: **pooled room contingents.** `PartnerZimmer.IDPartnerZimmer_FS_KontiAus` + points at the `PartnerZimmer` (same hotel) whose contingent a room type uses; `0` = own. + Used for selling one room at several occupancies ("Unterbelegung"): at hotel 163113 room + types 2367–2369 (7/6/5 pax) point at `PartnerZimmer` 8709 (2366, 8 pax). Only the parent + has `PartnerKontingent` rows; the export reports the parent's remaining count on every room + of the pool. The link is per hotel × room type (the same `Zimmerart` ids recur at other + hotels), and room codes do not reveal it. `Zimmerart.Teilzimmer`/`TeilzimmerAus` were 0 for + all four rooms and are not this link. + +```sql +-- room type → room type owning its contingent, one hotel +SELECT pz.IDZimmerart_FS, COALESCE(m.IDZimmerart_FS, pz.IDZimmerart_FS) AS PoolZimmerart +FROM dbo.PartnerZimmer pz +LEFT JOIN dbo.PartnerZimmer m ON m.IDPartnerZimmer = pz.IDPartnerZimmer_FS_KontiAus +WHERE pz.IDAdresse_FS = @HotelAddressId; +``` + +- V 2026-11-11: BusPro's booking check does not sum a booking's rooms per pool. One booking with two room + types of one pool is accepted against a remaining count of 1 and drives it to −1 + (2026-11-11, travel 1591, rooms 2366 + 2367). - A: `PartnerZimmer.PreisJeZimmer` flags per-room vs per-person. Observed booking responses returned the room price **per person** — check the flag before multiplying. - Service availability is a different, harder problem — see A10. @@ -326,6 +348,8 @@ guides · `Kalkulation*`/`VorplanungRaster*` costing and pre-planning. - `BuchungTNZuschlag` holds the departure surcharge. → `ArtZuschlag` has no such entry (A7). - `sys.objects.create_date` shows when a table was added. → Every object reported the same date: that of the last DB restore. Use `modify_date` after the restore instead. +- `PartnerKontingent.Anzahl` is the remaining room count. → Hotel 163113, room type 2366: + `Anzahl=6` against export `verfuegbar="1"` on the same day (A6). It is the allotment. # A12. Maintenance diff --git a/docs/buspronet-schema/travel-queries.md b/docs/buspronet-schema/travel-queries.md index de897248..e167de52 100644 --- a/docs/buspronet-schema/travel-queries.md +++ b/docs/buspronet-schema/travel-queries.md @@ -261,15 +261,18 @@ WHERE pk.IDAdresse_FS = @HotelAddressId > customer price. `PartnerZimmer.PreisJeZimmer` flags per-room vs. per-person pricing. ```sql --- availability (XML 'verfuegbar') — VALIDATED: = PartnerKontingent.Anzahl for the --- (hotel, room-type, date-span). IDZimmer_FS = the XML idbuspro_zimmer (a Zimmerart). --- Sample: IDAdresse_FS=224923, IDZimmer_FS=1413, 2026-12-11 → Anzahl=25 = XML verfuegbar. +-- allotment behind XML 'verfuegbar' for the (hotel, room-type, date-span). +-- IDZimmer_FS = the XML idbuspro_zimmer (a Zimmerart). Anzahl is the allotment, NOT what is +-- left: 2026-11-11, hotel 163113 / 2366 → Anzahl=6 against XML verfuegbar=1. The earlier +-- sample 224923 / 1413 / 2026-12-11 (Anzahl=25 = verfuegbar) presumably had no bookings yet. SELECT IDZimmer_FS, Anzahl, BuchungsStatus FROM dbo.PartnerKontingent WHERE IDAdresse_FS = @HotelAddressId AND IDZimmer_FS = @ZimmerartId -- the room type (XML idbuspro_zimmer) AND TerminVon <= @Abreise AND TerminBis >= @Anreise; ``` -> `verfuegbar` is a **flat column** (`PartnerKontingent.Anzahl`) — reproducible by SQL. +> `verfuegbar` is **computed** by BusPro: allotment minus bookings (see +> `live-api-queries.md`), and for a pooled room type the parent's figure +> (`PartnerZimmer.IDPartnerZimmer_FS_KontiAus`, `buspro-database-reference.md` A6). > Gate it with `BuchungsStatus` (`''` bookable, `S` stop, `A` on-request). > `` (the headline "from" price) is still **computed** (cheapest valid room + > mandatory services) — recompute in the proxy from the per-room prices above. @@ -298,8 +301,9 @@ ORDER BY gs.Position, sg.Position; 4. ~~**Partner room pricing**~~ — ✅ fully validated end-to-end: room `1413` (MBZ) → code `38` → category `9478` → season `15420` × `Naechte=2` × `VK` × schema `1` = **`269,00`**. (XML `abpreis 289,00` = room + mandatory services = computed.) -5. ~~**`verfuegbar`**~~ — ✅ flat: `PartnerKontingent.Anzahl` for `(IDAdresse_FS, IDZimmer_FS, - date-span)`; `1413 / 2026-12-11 → 25`. `` remains computed (recompute in proxy). +5. **`verfuegbar`** — computed, not flat (corrected 2026-11-11): `PartnerKontingent.Anzahl` + is the allotment; `1413 / 2026-12-11 → 25` presumably matched because nothing was booked + yet. `` remains computed (recompute in proxy). 6. ~~**Minimum-services filter**~~ — ✅ defined: "included services" = (A2a) `Leistung`s with sales price `0.00` (schema 1) **+** (A2b) selection items from the hardcoded "Leistungen" `Selektionsgruppenstamm` ids, merged into one plain list.