Add views of COSTS table, include effectivity details.
git-svn-id: http://locode01.ad.dom/svn/WEBMIP/trunk@3017 248e525c-4dfb-0310-94bc-949c084e9493
This commit is contained in:
25
Schema/V_AICO.vw
Normal file
25
Schema/V_AICO.vw
Normal file
@@ -0,0 +1,25 @@
|
||||
CREATE OR REPLACE VIEW V_AICO AS
|
||||
SELECT aico_code
|
||||
,description
|
||||
,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 aico_code
|
||||
,description
|
||||
,selling_price
|
||||
,cost_price
|
||||
,delivery_cost
|
||||
,regi_code
|
||||
,valid_from
|
||||
,valid_to
|
||||
,lead(valid_from) over(PARTITION BY cost.AICO_code, regi_code ORDER BY valid_from) AS next_valid_from
|
||||
FROM costs cost
|
||||
WHERE cost_type = 'AICO')
|
||||
25
Schema/V_BACO.vw
Normal file
25
Schema/V_BACO.vw
Normal file
@@ -0,0 +1,25 @@
|
||||
CREATE OR REPLACE VIEW V_BACO AS
|
||||
SELECT bas_code
|
||||
,description
|
||||
,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 bas_code
|
||||
,description
|
||||
,selling_price
|
||||
,cost_price
|
||||
,delivery_cost
|
||||
,regi_code
|
||||
,valid_from
|
||||
,valid_to
|
||||
,lead(valid_from) over(PARTITION BY cost.bas_code, regi_code ORDER BY valid_from) AS next_valid_from
|
||||
FROM costs cost
|
||||
WHERE cost_type = 'BACO');
|
||||
25
Schema/V_HOCO.vw
Normal file
25
Schema/V_HOCO.vw
Normal file
@@ -0,0 +1,25 @@
|
||||
CREATE OR REPLACE VIEW V_HOCO AS
|
||||
SELECT hou_code
|
||||
,description
|
||||
,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 hou_code
|
||||
,description
|
||||
,selling_price
|
||||
,cost_price
|
||||
,delivery_cost
|
||||
,regi_code
|
||||
,valid_from
|
||||
,valid_to
|
||||
,lead(valid_from) over(PARTITION BY cost.hou_code, regi_code ORDER BY valid_from) AS next_valid_from
|
||||
FROM costs cost
|
||||
WHERE cost_type = 'HOCO');
|
||||
25
Schema/V_MECO.vw
Normal file
25
Schema/V_MECO.vw
Normal file
@@ -0,0 +1,25 @@
|
||||
CREATE OR REPLACE VIEW V_MECO AS
|
||||
SELECT metr_code
|
||||
,description
|
||||
,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 metr_code
|
||||
,description
|
||||
,selling_price
|
||||
,cost_price
|
||||
,delivery_cost
|
||||
,regi_code
|
||||
,valid_from
|
||||
,valid_to
|
||||
,lead(valid_from) over(PARTITION BY cost.metr_code, regi_code ORDER BY valid_from) AS next_valid_from
|
||||
FROM costs cost
|
||||
WHERE cost_type = 'MECO');
|
||||
25
Schema/V_MOCO.vw
Normal file
25
Schema/V_MOCO.vw
Normal file
@@ -0,0 +1,25 @@
|
||||
CREATE OR REPLACE VIEW V_MOCO AS
|
||||
SELECT modu_code
|
||||
,description
|
||||
,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 modu_code
|
||||
,description
|
||||
,selling_price
|
||||
,cost_price
|
||||
,delivery_cost
|
||||
,regi_code
|
||||
,valid_from
|
||||
,valid_to
|
||||
,lead(valid_from) over(PARTITION BY cost.modu_code, regi_code ORDER BY valid_from) AS next_valid_from
|
||||
FROM costs cost
|
||||
WHERE cost_type = 'MOCO') moco;
|
||||
@@ -5,4 +5,9 @@
|
||||
@@v_enquiry_prty_supp.vw
|
||||
@@V_LAST_ENQUIRY_UPDATE.vw
|
||||
@@V_PRTY_ID_FOR_ENQUIRIES.vw
|
||||
@@v_party_addresses.vw
|
||||
@@v_party_addresses.vw
|
||||
@@V_MOCO.vw
|
||||
@@V_MECO.vw
|
||||
@@V_HOCO.vw
|
||||
@@V_BACO.vw
|
||||
@@V_AICO.vw
|
||||
|
||||
Reference in New Issue
Block a user