From 01b5b4c9791d3c75fa1e8bdd54bc616fb57d2f5f Mon Sep 17 00:00:00 2001 From: hardya Date: Mon, 7 Jan 2008 17:29:06 +0000 Subject: [PATCH] Add V_LACO.vw - shows labour costs git-svn-id: http://locode01.ad.dom/svn/WEBMIP/trunk@3149 248e525c-4dfb-0310-94bc-949c084e9493 --- Schema/V_LACO.vw | 29 +++++++++++++++++++++++++++++ Schema/mipViews.sql | 1 + 2 files changed, 30 insertions(+) create mode 100644 Schema/V_LACO.vw diff --git a/Schema/V_LACO.vw b/Schema/V_LACO.vw new file mode 100644 index 0000000..419fabd --- /dev/null +++ b/Schema/V_LACO.vw @@ -0,0 +1,29 @@ +CREATE OR REPLACE VIEW V_LACO AS +SELECT enty_code + ,mety_code + ,svcpt_code + ,mesc_code + ,selling_price + ,cost_price + ,delivery_cost + ,regi_code + ,valid_from AS effective_from + ,least(nvl(valid_to + ,to_date('2099' + ,'yyyy')) + ,nvl(next_valid_from + ,to_date('2099' + ,'yyyy'))) AS effective_to + FROM (SELECT enty_code + ,mety_code + ,svcpt_code + ,mesc_code + ,selling_price + ,cost_price + ,delivery_cost + ,regi_code + ,valid_from + ,valid_to + ,lead(valid_from) over(PARTITION BY enty_code, mety_code, svcpt_code, mesc_code, regi_code ORDER BY valid_from) AS next_valid_from + FROM costs cost + WHERE cost_type = 'LACO'); diff --git a/Schema/mipViews.sql b/Schema/mipViews.sql index 2f0f98c..5c6f7eb 100644 --- a/Schema/mipViews.sql +++ b/Schema/mipViews.sql @@ -11,5 +11,6 @@ @@V_HOCO.vw @@V_BACO.vw @@V_AICO.vw +@@V_LACO.vw @@V_CURRENT_PARTY_ADDRESSES.vw @@v_current_contact_mechanisms.vw \ No newline at end of file