Commit all views

This commit is contained in:
AzureAD\SylvainDUVERNAY
2026-05-11 14:01:13 +02:00
parent 3986882771
commit 3a3e715336
28 changed files with 5546 additions and 111 deletions

View File

@@ -17,7 +17,8 @@ CREATE OR REPLACE VIEW public.vw_bi_itsa_fct_full_pnl AS
contracts."Open Quantity Signed",
contracts."Price",
contracts."Open Cost Amount" AS amount,
contracts."Estimated BL Date" AS "Delivery Date"
contracts."Estimated BL Date" AS "Delivery Date",
contracts."Line Group"
FROM (vw_bi_itsa_physical_open_costs contracts
JOIN trade trade ON ((contracts."intTradeLineId" = trade."intTradeId")))
UNION ALL
@@ -28,7 +29,8 @@ UNION ALL
shipment."Shipped Quantity" AS "Open Quantity Signed",
shipment."Purchase Price" AS "Price",
(shipment."Shipped Quantity" * (shipment."Purchase Price")::double precision) AS amount,
shipment."BL Date" AS "Delivery Date"
shipment."BL Date" AS "Delivery Date",
'Purchase'::text AS "Line Group"
FROM vw_bi_itsa_fct_shipments shipment
UNION ALL
SELECT 3 AS "intPnlTypeId",
@@ -38,7 +40,8 @@ UNION ALL
shipment."Shipped Quantity" AS "Open Quantity Signed",
shipment."Sale Price" AS "Price",
(shipment."Shipped Quantity" * (shipment."Sale Price")::double precision) AS amount,
shipment."BL Date" AS "Delivery Date"
shipment."BL Date" AS "Delivery Date",
'Sale'::text AS "Line Group"
FROM vw_bi_itsa_fct_shipments shipment
UNION ALL
SELECT 3 AS "intPnlTypeId",
@@ -48,9 +51,21 @@ UNION ALL
shipment."Shipped Quantity" AS "Open Quantity Signed",
fees."Price",
(shipment."Shipped Quantity" * (fees."Price")::double precision) AS amount,
shipment."BL Date" AS "Delivery Date"
shipment."BL Date" AS "Delivery Date",
fees."Cost Group" AS "Line Group"
FROM (vw_bi_itsa_fct_shipment_fees fees
JOIN vw_bi_itsa_fct_shipments shipment ON ((fees."intShipmentId" = shipment."intShipmentId")))
UNION ALL
SELECT fees."intPnlTypeId",
fees."strConformedReferenceId",
fees."intPriceGroupId",
fees."Line Description",
fees."Open Quantity Signed",
fees."Price",
fees."Amount" AS amount,
fees."Delivery Date",
fees."Line Group"
FROM vw_bi_itsa_fct_inherited_expenses_on_shipments fees
UNION ALL
SELECT 1 AS "intPnlTypeId",
trade."strTradeId" AS "strConformedReferenceId",
@@ -59,7 +74,8 @@ UNION ALL
ctr."Contract Quantity" AS "Open Quantity Signed",
ctr."Avg Price" AS "Price",
(ctr."Contract Quantity" * ctr."Avg Price") AS amount,
ctr."Delivery Date"
ctr."Delivery Date",
'Expected'::text AS "Line Group"
FROM (vw_bi_itsa_fct_contract ctr
JOIN vw_bi_dim_trade trade ON ((ctr."TradeLineId" = trade."intTradeId")))
WHERE ((trade."Book")::text ~~ '%Projection%'::text);;