decimals issue with currency exchange rate

This commit is contained in:
Joaquin Ossa 2025-02-18 14:25:56 +01:00
parent 30e77c4877
commit ae410b4dc5

View file

@ -272,26 +272,31 @@ select
vr.cancelled_date_utc,
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,
* 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,
* 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)
@ -299,7 +304,8 @@ select
* (100 - coalesce(bnf.discount_percentage, 0))
/ 100
)
* der.rate as total_fee_after_discount_in_gbp,
* 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,