diff --git a/Schema/V_QUOTE_DETAILS.vw b/Schema/V_QUOTE_DETAILS.vw new file mode 100644 index 0000000..bd2b5ca --- /dev/null +++ b/Schema/V_QUOTE_DETAILS.vw @@ -0,0 +1,24 @@ +CREATE OR REPLACE VIEW V_QUOTE_DETAILS AS +SELECT "ENQUIRY_ID","QUOTE_ID","ENTY_CODE","MODULE_CODE","LEAD_TIME","ADDITIONAL_ITEMS","BAS_CODE","QMAX","INLET_ORIENTATION","OUTLET_ORIENTATION","TOTAL_COST","ROW_NUMBER" + FROM (SELECT q.enqu_id AS enquiry_id + ,t.qute_id AS quote_id + ,MAX(t.enty_code) over(PARTITION BY qute_id) AS enty_code + ,MAX(t.modu_code) over(PARTITION BY qute_id) AS module_code + ,MAX(t.lead_time) over(PARTITION BY qute_id ORDER BY qute_id) AS lead_time + ,get_quote_items(qute_id) AS additional_items + ,MAX(t.bas_code) over(PARTITION BY qute_id) AS bas_code + ,MAX(t.qmax) over(PARTITION BY qute_id) AS qmax + ,MAX(t.inlet_orientation) over(PARTITION BY qute_id) AS inlet_orientation + ,MAX(t.outlet_orientation) over(PARTITION BY qute_id) AS outlet_orientation + ,SUM(nvl(t.selling_price + ,0) + nvl(t.delivery_price + ,0)) over(PARTITION BY qute_id ORDER BY qute_id) AS total_cost + ,row_number() over(PARTITION BY qute_id ORDER BY qute_id) AS row_number + FROM quote_items t + ,quotes q + WHERE t.qute_id = q.id + ORDER BY enqu_id + ,quote_id + ,t.id) all_quote_items + WHERE row_number = 1 + diff --git a/Schema/mipViews.sql b/Schema/mipViews.sql index 5c6f7eb..e039664 100644 --- a/Schema/mipViews.sql +++ b/Schema/mipViews.sql @@ -13,4 +13,5 @@ @@V_AICO.vw @@V_LACO.vw @@V_CURRENT_PARTY_ADDRESSES.vw -@@v_current_contact_mechanisms.vw \ No newline at end of file +@@v_current_contact_mechanisms.vw +@@V_QUOTE_DETAILS.vw \ No newline at end of file