diff --git a/models/intermediate/screen_and_protect/int_screen_and_protect__verification_fees.sql b/models/intermediate/screen_and_protect/int_screen_and_protect__verification_fees.sql index f781140..a5629e2 100644 --- a/models/intermediate/screen_and_protect/int_screen_and_protect__verification_fees.sql +++ b/models/intermediate/screen_and_protect/int_screen_and_protect__verification_fees.sql @@ -256,6 +256,7 @@ select vr.id_booking, vr.id_user_partner, vr.id_accommodation, + vr.company_name, vr.is_protected, vr.protection_type, vr.protection_basic_amount_in_local_currency, @@ -273,33 +274,39 @@ select coalesce(bnf.nightly_fee_in_local_currency, 0) * vr.number_of_nights + coalesce(bbf.booking_fee_in_local_currency, 0) as total_fee_in_local_currency, ( - coalesce(bnf.nightly_fee_in_local_currency, 0) * vr.number_of_nights - + coalesce(bbf.booking_fee_in_local_currency, 0) - ) - * der.rate as total_fee_in_gbp, + ( + coalesce(bnf.nightly_fee_in_local_currency, 0) * vr.number_of_nights + + coalesce(bbf.booking_fee_in_local_currency, 0) + ) + * der.rate + )::decimal(19, 4) as total_fee_in_gbp, coalesce(bnf.discount_percentage, 0) as discount_percentage, coalesce(bnf.nightly_fee_in_local_currency, 0) * vr.number_of_nights * coalesce(bnf.discount_percentage, 0) / 100 as discount_amount_in_local_currency, - coalesce(bnf.nightly_fee_in_local_currency, 0) - * vr.number_of_nights - * coalesce(bnf.discount_percentage, 0) - / 100 - * der.rate as discount_amount_in_gbp, + ( + coalesce(bnf.nightly_fee_in_local_currency, 0) + * vr.number_of_nights + * coalesce(bnf.discount_percentage, 0) + / 100 + * der.rate + )::decimal(19, 4) as discount_amount_in_gbp, coalesce(bbf.booking_fee_in_local_currency, 0) + coalesce(bnf.nightly_fee_in_local_currency, 0) * vr.number_of_nights * (100 - coalesce(bnf.discount_percentage, 0)) / 100 as total_fee_after_discount_in_local_currency, ( - coalesce(bbf.booking_fee_in_local_currency, 0) - + coalesce(bnf.nightly_fee_in_local_currency, 0) - * vr.number_of_nights - * (100 - coalesce(bnf.discount_percentage, 0)) - / 100 - ) - * der.rate as total_fee_after_discount_in_gbp, + ( + coalesce(bbf.booking_fee_in_local_currency, 0) + + coalesce(bnf.nightly_fee_in_local_currency, 0) + * vr.number_of_nights + * (100 - coalesce(bnf.discount_percentage, 0)) + / 100 + ) + * der.rate + )::decimal(19, 4) as total_fee_after_discount_in_gbp, coalesce(bbf.invoice_date_utc, bnf.invoice_date_utc) as invoice_date_utc, vr.creation_at_utc, vr.creation_date_utc, diff --git a/models/intermediate/screen_and_protect/schema.yml b/models/intermediate/screen_and_protect/schema.yml index 496c155..ab2eff2 100644 --- a/models/intermediate/screen_and_protect/schema.yml +++ b/models/intermediate/screen_and_protect/schema.yml @@ -378,6 +378,10 @@ models: data_type: text description: "Identifier for the accommodation related to the booking." + - name: company_name + data_type: text + description: Name of the company associated with the booking. + - name: is_protected data_type: boolean description: "Indicates if the booking is protected or not." diff --git a/models/reporting/screen_and_protect/schema.yml b/models/reporting/screen_and_protect/schema.yml index d994c4f..24da229 100644 --- a/models/reporting/screen_and_protect/schema.yml +++ b/models/reporting/screen_and_protect/schema.yml @@ -281,6 +281,10 @@ models: data_type: text description: "Identifier for the accommodation related to the booking." + - name: company_name + data_type: text + description: Name of the company associated with the booking. + - name: is_protected data_type: boolean description: "Indicates if the booking is protected or not."