fix zaporne spot ceny v nakupu
This commit is contained in:
@@ -153,10 +153,21 @@ as $fn$
|
||||
case
|
||||
when s3.market_config_id is null then null::numeric
|
||||
when s3.energy_czk is null then null::numeric
|
||||
else
|
||||
coalesce(s3.buy_margin_fixed_czk, 0)
|
||||
when upper(trim(coalesce(s3.purchase_pricing_mode, ''))) = 'FIXED'
|
||||
and s3.buy_fixed_energy_nt_czk_kwh is not null
|
||||
then
|
||||
s3.energy_czk
|
||||
+ coalesce(s3.buy_margin_fixed_czk, 0)
|
||||
+ (s3.energy_czk * coalesce(s3.buy_margin_percent, 0) / 100.0)
|
||||
end as buy_margin_part
|
||||
else
|
||||
case
|
||||
when s3.buy_spot >= 0 then
|
||||
s3.buy_spot * (1 + coalesce(s3.buy_margin_percent, 0) / 100.0)
|
||||
else
|
||||
s3.buy_spot * (1 - coalesce(s3.buy_margin_percent, 0) / 100.0)
|
||||
end
|
||||
+ coalesce(s3.buy_margin_fixed_czk, 0)
|
||||
end as buy_pre_dist_margin_sum
|
||||
from slot3 s3
|
||||
),
|
||||
slot5 as (
|
||||
@@ -167,11 +178,10 @@ as $fn$
|
||||
when s4.energy_czk is null then null::numeric
|
||||
else round(
|
||||
(
|
||||
s4.energy_czk
|
||||
s4.buy_pre_dist_margin_sum
|
||||
+ coalesce(s4.dist_rate, 0)
|
||||
+ coalesce(s4.system_services_czk_kwh, 0)
|
||||
+ coalesce(s4.ote_fee_czk_kwh, 0)
|
||||
+ s4.buy_margin_part
|
||||
) * (1 + coalesce(s4.vat_rate, 0.21)),
|
||||
6
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user