2024-12-27 12:22:19 +00:00
|
|
|
with
|
2025-05-30 12:51:10 +00:00
|
|
|
int_booking_summary as (select * from {{ ref("int_booking_summary") }}),
|
2024-12-27 12:22:19 +00:00
|
|
|
int_core__deal as (select * from {{ ref("int_core__deal") }}),
|
|
|
|
|
int_hubspot__deal as (select * from {{ ref("int_hubspot__deal") }})
|
|
|
|
|
|
|
|
|
|
select
|
|
|
|
|
b.id_booking as id_booking,
|
2025-02-19 16:00:33 +01:00
|
|
|
b.has_verification_request as has_verification_request,
|
2024-12-27 12:22:19 +00:00
|
|
|
b.id_deal as id_deal,
|
|
|
|
|
d.main_deal_name as main_deal_name,
|
|
|
|
|
hd.deal_name as hubspot_deal_name,
|
|
|
|
|
d.main_billing_country_iso_3_per_deal as main_billing_country,
|
|
|
|
|
hd.account_manager as account_manager,
|
|
|
|
|
b.booking_status as booking_status,
|
|
|
|
|
b.program_name as program_name,
|
|
|
|
|
b.booking_created_date_utc as booking_created_date_utc,
|
|
|
|
|
b.booking_check_in_date_utc as booking_check_in_date_utc,
|
|
|
|
|
b.booking_check_out_date_utc as booking_check_out_date_utc,
|
2025-05-28 12:37:43 +00:00
|
|
|
date_trunc('month', b.booking_created_date_utc)::date as booking_created_month,
|
|
|
|
|
date_trunc('month', b.booking_check_in_date_utc)::date as booking_check_in_month,
|
|
|
|
|
date_trunc('month', b.booking_check_out_date_utc)::date as booking_check_out_month,
|
2024-12-27 12:22:19 +00:00
|
|
|
b.booking_number_of_nights as booking_number_of_nights,
|
|
|
|
|
b.host_currency_code as host_currency_code,
|
|
|
|
|
b.new_dash_version as new_dash_version,
|
|
|
|
|
date(b.user_in_new_dash_since_timestamp_at_utc) as user_in_new_dash_since_date_utc,
|
|
|
|
|
b.booking_total_price_in_gbp as booking_total_price_in_gbp,
|
|
|
|
|
b.service_first_chargeable_date_utc as service_first_chargeable_date_utc,
|
|
|
|
|
b.service_last_chargeable_date_utc as service_last_chargeable_date_utc,
|
|
|
|
|
b.number_of_applied_services as number_of_applied_services,
|
|
|
|
|
b.number_of_applied_upgraded_services as number_of_applied_upgraded_services,
|
|
|
|
|
b.is_booking_chargeable as is_booking_chargeable,
|
|
|
|
|
b.is_booking_cancelled as is_booking_cancelled,
|
|
|
|
|
b.has_upgraded_services as has_upgraded_services,
|
|
|
|
|
b.has_screening_service_business_type as has_screening_service_business_type,
|
2025-04-08 12:09:08 +02:00
|
|
|
b.has_upgraded_screening_service_business_type
|
|
|
|
|
as has_upgraded_screening_service_business_type,
|
2024-12-27 12:22:19 +00:00
|
|
|
b.has_deposit_management_service_business_type
|
|
|
|
|
as has_deposit_management_service_business_type,
|
|
|
|
|
b.has_protection_service_business_type as has_protection_service_business_type
|
2025-05-30 12:51:10 +00:00
|
|
|
from int_booking_summary b
|
2024-12-27 12:22:19 +00:00
|
|
|
left join int_core__deal d on b.id_deal = d.id_deal
|
|
|
|
|
left join int_hubspot__deal hd on b.id_deal = hd.id_deal
|
|
|
|
|
-- Select only New Dash bookings
|
|
|
|
|
where b.is_missing_id_deal = false and b.is_user_in_new_dash = true
|