diff --git a/Database Backups/SQL Views/vw_bi_dim_purchase_physical_contract.sql b/Database Backups/SQL Views/vw_bi_dim_purchase_physical_contract.sql index b9f70ac..97f3fdf 100644 --- a/Database Backups/SQL Views/vw_bi_dim_purchase_physical_contract.sql +++ b/Database Backups/SQL Views/vw_bi_dim_purchase_physical_contract.sql @@ -41,5 +41,6 @@ CREATE OR REPLACE VIEW public.vw_bi_dim_purchase_physical_contract AS WHEN (("strBookName")::text ~~ '%Projection%'::text) THEN 'Yes'::text ELSE 'No'::text END AS "Is Projection", - "strIncotermCode" AS "Incoterm Code" + "strIncotermCode" AS "Incoterm Code", + "dtmEstimatedBLDate" AS "Estimated BL Date" FROM vw_utility_dim_physical_purchase_contract dpc;; diff --git a/Database Backups/SQL Views/vw_bi_dim_sale_physical_contract.sql b/Database Backups/SQL Views/vw_bi_dim_sale_physical_contract.sql index 3e546b5..74c32b6 100644 --- a/Database Backups/SQL Views/vw_bi_dim_sale_physical_contract.sql +++ b/Database Backups/SQL Views/vw_bi_dim_sale_physical_contract.sql @@ -41,5 +41,6 @@ CREATE OR REPLACE VIEW public.vw_bi_dim_sale_physical_contract AS WHEN (("strBookName")::text ~~ '%Projection%'::text) THEN 'Yes'::text ELSE 'No'::text END AS "Is Projection", - "strIncotermCode" AS "Incoterm Code" + "strIncotermCode" AS "Incoterm Code", + "dtmEstimatedBLDate" AS "Estimated BL Date" FROM vw_utility_dim_physical_sale_contract dpc;; diff --git a/Database Backups/SQL Views/vw_utility_dim_physical_purchase_contract.sql b/Database Backups/SQL Views/vw_utility_dim_physical_purchase_contract.sql index 722c08a..3db7dc8 100644 --- a/Database Backups/SQL Views/vw_utility_dim_physical_purchase_contract.sql +++ b/Database Backups/SQL Views/vw_utility_dim_physical_purchase_contract.sql @@ -26,7 +26,8 @@ CREATE OR REPLACE VIEW public.vw_utility_dim_physical_purchase_contract AS ''::character varying AS "strStrategyName", ''::character varying AS "strBookName", ''::character varying AS "strQuantityUom", - ''::character varying AS "strIncotermCode" + ''::character varying AS "strIncotermCode", + NULL::date AS "dtmEstimatedBLDate" UNION ALL SELECT pl.id AS "intPurchaseLineId", pc.number AS "strContractNb", @@ -60,8 +61,9 @@ UNION ALL strategy."strValueName" AS "strStrategyName", book."strValueName" AS "strBookName", pu1.name AS "strQuantityUom", - COALESCE(inc.code, ''::character varying) AS "strIncotermCode" - FROM ((((((((((((((((((purchase_line pl + COALESCE(inc.code, ''::character varying) AS "strIncotermCode", + COALESCE(bl.estimated_date, pl.to_del) AS "dtmEstimatedBLDate" + FROM (((((((((((((((((((purchase_line pl JOIN purchase_purchase pc ON ((pl.purchase = pc.id))) JOIN party_party pty ON ((pc.party = pty.id))) JOIN currency_currency cur ON ((pc.currency = cur.id))) @@ -80,4 +82,5 @@ UNION ALL LEFT JOIN vw_utility_last_counterparty_address ad ON ((pty.id = ad."intPartyId"))) LEFT JOIN vw_utility_strategy_dimension strategy ON (((pl.id = strategy."intTradeLineId") AND (strategy."strTradeCategory" = 'Physical'::text) AND (strategy."strTradeType" = 'Purchase'::text)))) LEFT JOIN vw_utility_book_dimension book ON (((pl.id = book."intTradeLineId") AND (book."strTradeCategory" = 'Physical'::text) AND (book."strTradeType" = 'Purchase'::text)))) + LEFT JOIN pricing_estimated bl ON (((pl.id = bl.line) AND ((bl.trigger)::text = 'bldate'::text)))) WHERE ((1 = 1) AND ((pl.type)::text = 'line'::text) AND ((pc.line_type)::text = 'goods'::text));; diff --git a/Database Backups/SQL Views/vw_utility_dim_physical_sale_contract.sql b/Database Backups/SQL Views/vw_utility_dim_physical_sale_contract.sql index 8ea0fa9..7de4a81 100644 --- a/Database Backups/SQL Views/vw_utility_dim_physical_sale_contract.sql +++ b/Database Backups/SQL Views/vw_utility_dim_physical_sale_contract.sql @@ -26,7 +26,8 @@ CREATE OR REPLACE VIEW public.vw_utility_dim_physical_sale_contract AS ''::character varying AS "strRegion", ''::character varying AS "strStrategyName", ''::character varying AS "strBookName", - ''::character varying AS "strIncotermCode" + ''::character varying AS "strIncotermCode", + NULL::date AS "dtmEstimatedBLDate" UNION ALL SELECT sl.id AS "intSaleLineId", sc.number AS "strContractNb", @@ -55,8 +56,9 @@ UNION ALL ad."strRegion", strategy."strValueName" AS "strStrategyName", book."strValueName" AS "strBookName", - COALESCE(inc.code, ''::character varying) AS "strIncotermCode" - FROM ((((((((((((((((((sale_line sl + COALESCE(inc.code, ''::character varying) AS "strIncotermCode", + COALESCE(bl.estimated_date, sl.to_del) AS "dtmEstimatedBLDate" + FROM (((((((((((((((((((sale_line sl JOIN sale_sale sc ON ((sl.sale = sc.id))) JOIN party_party pty ON ((sc.party = pty.id))) JOIN currency_currency cur ON ((sc.currency = cur.id))) @@ -75,4 +77,5 @@ UNION ALL LEFT JOIN vw_utility_last_counterparty_address ad ON ((pty.id = ad."intPartyId"))) LEFT JOIN vw_utility_strategy_dimension strategy ON (((sl.id = strategy."intTradeLineId") AND (strategy."strTradeCategory" = 'Physical'::text) AND (strategy."strTradeType" = 'Sale'::text)))) LEFT JOIN vw_utility_book_dimension book ON (((sl.id = book."intTradeLineId") AND (book."strTradeCategory" = 'Physical'::text) AND (book."strTradeType" = 'Sale'::text)))) + LEFT JOIN pricing_estimated bl ON (((sl.id = bl.line) AND ((bl.trigger)::text = 'bldate'::text)))) WHERE ((1 = 1) AND ((sl.type)::text = 'line'::text));;