no message

This commit is contained in:
AzureAD\SylvainDUVERNAY
2026-02-02 15:52:52 +01:00
parent 7f99b78c8a
commit 0fa522ece6
6 changed files with 134 additions and 5 deletions

View File

@@ -0,0 +1,26 @@
CREATE OR REPLACE VIEW vw_bi_fct_trade_fulfillment_event AS
SELECT
SM."intPurchaseLineId" AS "inTradeId",
'Physical' AS "Trade Category",
'Delivered' AS "Event Type",
SM."dtmBLDate" AS "Event Date",
SM."dblQuantity" AS "Quantity"
FROM "vw_utility_stock_movements" AS SM
WHERE 1=1
AND COALESCE( SM."intPurchaseLineId" , 0 ) > 0
UNION ALL
SELECT
SM."intSaleLineId" AS "inTradeId",
'Physical' AS "Trade Category",
'Delivered' AS "Event Type",
SM."dtmBLDate" AS "Event Date",
SM."dblQuantity" AS "Quantity"
FROM "vw_utility_stock_movements" AS SM
WHERE 1=1
AND COALESCE( SM."intSaleLineId" , 0 ) > 0;
-- UNION ALL
-- Derivative contracts can be added here in the future (Settled, Exercised, Expired, etc.)
ALTER TABLE public.vw_bi_fct_trade_fulfillment_event
OWNER TO postgres;