Parameters
| Name | Type | Mode |
|---|---|---|
| register_id | integer | IN |
| guest_id | integer | OUT |
| visit_count | integer | OUT |
| visit_nights | integer | OUT |
| last_arrival | date | OUT |
| last_departure | date | OUT |
| total_revenue | t_money | OUT |
| revenues | json | OUT |
Sync one registration into public.guest_history then recompute that guest’s roll-up columns. Idempotent — safe to call repeatedly for the same register_id (the old additive version double-counted). Called from sp_check_out and sp_cancel_checkout; when the registration is no longer checked out the stay row is removed and the roll-up shrinks accordingly.
| Name | Type | Mode |
|---|---|---|
| register_id | integer | IN |
| guest_id | integer | OUT |
| visit_count | integer | OUT |
| visit_nights | integer | OUT |
| last_arrival | date | OUT |
| last_departure | date | OUT |
| total_revenue | t_money | OUT |
| revenues | json | OUT |