Files
SQL-Scripts/vw_bi_dim_purchase_physical_contract.sql
AzureAD\SylvainDUVERNAY 7f99b78c8a no message
2026-02-02 13:15:58 +01:00

36 lines
1.6 KiB
SQL

-- View: public.vw_bi_dim_purchase_physical_contract
-- DROP VIEW public.vw_bi_dim_purchase_physical_contract;
CREATE OR REPLACE VIEW public.vw_bi_dim_purchase_physical_contract AS
SELECT "intPurchaseLineId",
"strContractNb" AS "Contract Nb",
"strCounterparty" AS "Supplier",
"strReference" AS "Contract Ref",
"dtmContractDate" AS "Contract Date",
CASE
WHEN "strContractStatus"::text = 'Draft'::text THEN ("strContractStatus"::text || ' 🧾'::text)::character varying
WHEN "strContractStatus"::text = 'Confirmed'::text THEN ("strContractStatus"::text || ''::text)::character varying
WHEN "strContractStatus"::text = 'Validated'::text THEN ("strContractStatus"::text || ' ✔️'::text)::character varying
WHEN "strContractStatus"::text = 'Processing'::text THEN ("strContractStatus"::text || ''::text)::character varying
ELSE "strContractStatus"
END AS "Contract Status",
"strPaymentTerm" AS "Payment Terms",
"strCurrency" AS "Currency",
"strWeightBasis" AS "Weight Basis",
"strBroker" AS "Broker",
"strCertif" AS "Certification",
"strAssociation" AS "Association",
"strCrop" AS "Crop",
"dblTolMinPct" AS "Tolerance Min %",
"dblTolMaxPct" AS "Tolerance Max %",
"strIncoterm" AS "Inco Terms",
"strLoadingPlace" AS "Loading Place",
"strDestinationPlace" AS "Destination Place",
"strProduct" AS "Product",
"strDeliveryPeriod" AS "Delivery Period"
FROM vw_utility_dim_physical_purchase_contract dpc;
ALTER TABLE public.vw_bi_dim_purchase_physical_contract
OWNER TO postgres;