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..bd24592 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 @@ -273,33 +273,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,