Commit all views for ITSA

This commit is contained in:
AzureAD\SylvainDUVERNAY
2026-03-24 14:40:53 +01:00
parent 091bd4ce00
commit 832a142e87
62 changed files with 2397 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
CREATE OR REPLACE VIEW public.vw_bi_itsa_fct_contract AS
SELECT 'Purchase'::text AS "TradeType",
pc."intPurchaseLineId" AS "TradeLineId",
pc."dblQuantity" AS "Quantity",
pc."dblTheoriticalQuantity" AS "TheoriticalQuantity",
pc."dblInInstructedQuantity" AS "InstructedQuantity",
CASE
WHEN (pc."ysnFinished" = true) THEN (0)::numeric(18,3)
WHEN ((pc."dblTheoriticalQuantity")::double precision > pc."dblInInstructedQuantity") THEN (((pc."dblTheoriticalQuantity")::double precision - pc."dblInInstructedQuantity"))::numeric(18,3)
ELSE (0)::numeric(18,3)
END AS "OpenQuantity",
pc."dblUnitPrice" AS "Price",
COALESCE(pc."dtmEstimatedBLDate", pc."dtmDeliveryDateFrom") AS "DeliveryDate"
FROM vw_utility_purchase_physical_contract pc
WHERE (1 = 1)
UNION ALL
SELECT 'Sale'::text AS "TradeType",
pc."intSaleLineId" AS "TradeLineId",
pc."dblQuantity" AS "Quantity",
pc."dblTheoreticalQuantity" AS "TheoriticalQuantity",
pc."dblInstructedQuantity" AS "InstructedQuantity",
CASE
WHEN (pc."ysnFinished" = true) THEN (0)::numeric(18,3)
WHEN ((pc."dblTheoreticalQuantity")::double precision > pc."dblInstructedQuantity") THEN (((pc."dblTheoreticalQuantity")::double precision - pc."dblInstructedQuantity"))::numeric(18,3)
ELSE (0)::numeric(18,3)
END AS "OpenQuantity",
pc."dblUnitPrice" AS "Price",
COALESCE(pc."dtmEstimatedBLDate", pc."dtmDeliveryDateFrom") AS "DeliveryDate"
FROM vw_utility_sale_physical_contract pc
WHERE (1 = 1);;