update booking_fee calculation
This commit is contained in:
parent
3d2477f8f9
commit
79b408f3d2
1 changed files with 24 additions and 8 deletions
|
|
@ -49,7 +49,7 @@ with
|
|||
then 1
|
||||
else 0
|
||||
end as is_price_increase_active
|
||||
from intermediate.int_screen_and_protect__verification_requests vr
|
||||
from int_screen_and_protect__verification_requests vr
|
||||
where upper(vr.verification_status) in {{ approved_flagged_status }}
|
||||
),
|
||||
approved_verifications as (
|
||||
|
|
@ -57,7 +57,7 @@ with
|
|||
vr.id_user_partner,
|
||||
date_trunc('month', vr.checkout_date_utc) as verification_month,
|
||||
count(*) as monthly_verifications
|
||||
from intermediate.int_screen_and_protect__verification_requests vr
|
||||
from int_screen_and_protect__verification_requests vr
|
||||
where upper(vr.verification_status) in {{ approved_flagged_status }}
|
||||
group by vr.id_user_partner, date_trunc('month', vr.checkout_date_utc)
|
||||
),
|
||||
|
|
@ -97,11 +97,19 @@ select
|
|||
then
|
||||
bp.long_stay_fee_in_local_currency
|
||||
* vr.number_of_nights
|
||||
* (1 + vr.price_increase / 100 * ad.is_price_increase_active)
|
||||
* (
|
||||
1
|
||||
- vr.monthly_volume_discount * ad.is_monthly_volume_discount_active
|
||||
- vr.monthly_general_discount * ad.is_monthly_general_discount_active
|
||||
+ vr.price_increase * ad.is_price_increase_active
|
||||
- vr.monthly_volume_discount
|
||||
/ 100
|
||||
* ad.is_monthly_volume_discount_active
|
||||
)
|
||||
* (
|
||||
1
|
||||
- vr.monthly_general_discount
|
||||
/ 100
|
||||
* ad.is_monthly_general_discount_active
|
||||
+ vr.price_increase / 100 * ad.is_price_increase_active
|
||||
)
|
||||
when
|
||||
upper(vr.verification_status) in {{ approved_flagged_status }}
|
||||
|
|
@ -109,11 +117,19 @@ select
|
|||
then
|
||||
bp.short_stay_fee_in_local_currency
|
||||
* vr.number_of_nights
|
||||
* (1 + vr.price_increase / 100 * ad.is_price_increase_active)
|
||||
* (
|
||||
1
|
||||
- vr.monthly_volume_discount * ad.is_monthly_volume_discount_active
|
||||
- vr.monthly_general_discount * ad.is_monthly_general_discount_active
|
||||
+ vr.price_increase * ad.is_price_increase_active
|
||||
- vr.monthly_volume_discount
|
||||
/ 100
|
||||
* ad.is_monthly_volume_discount_active
|
||||
)
|
||||
* (
|
||||
1
|
||||
- vr.monthly_general_discount
|
||||
/ 100
|
||||
* ad.is_monthly_general_discount_active
|
||||
+ vr.price_increase / 100 * ad.is_price_increase_active
|
||||
)
|
||||
else 0
|
||||
end as booking_fee_in_local_currency,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue