fn_booking_room_net_revenue


Description

SUM(sp_booking_rates_breakdown.room_net) for one booking item = the REVENUE_CALC_TYPE = 2 basis at pickup time. Summed per night without multiplying room_qty, matching fn_booking_rate_revenue.

Takes only booking_item. It still passes i_booking_id down to the breakdown – leaving that NULL makes the nested sp_meal_plan run unfiltered across every booking (254 ms per item versus 55 ms on aonestar) – but it reads the id from booking_items instead of trusting the caller, because rsv_pickup.booking_id drifts from the item’s real booking after a rebook.

Returns NULL when the item no longer exists or has no rate rows; callers fall back to the gross figure.

Parameters

Name Type Mode
p_booking_item integer IN

Definition