git-svn-id: http://locode01.ad.dom/svn/WEBMIP/trunk@3241 248e525c-4dfb-0310-94bc-949c084e9493

This commit is contained in:
mullenm
2008-01-15 11:20:32 +00:00
parent c6ffb8aa4b
commit eb64acbad1

View File

@@ -1,3 +1,9 @@
/**
This view shows details of each of the quotes for an enquiry.
The total cost does NOT include any lifting gear or purging that
may be required.
*/
CREATE OR REPLACE VIEW V_QUOTE_DETAILS AS 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" 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 FROM (SELECT q.enqu_id AS enquiry_id
@@ -16,9 +22,23 @@ SELECT "ENQUIRY_ID","QUOTE_ID","ENTY_CODE","MODULE_CODE","LEAD_TIME","ADDITIONAL
,row_number() over(PARTITION BY qute_id ORDER BY qute_id) AS row_number ,row_number() over(PARTITION BY qute_id ORDER BY qute_id) AS row_number
FROM quote_items t FROM quote_items t
,quotes q ,quotes q
WHERE t.qute_id = q.id WHERE t.qute_id = q.ID
and not (quit_type = 'AQI' and adit_code in ('LIFTING GEAR','PURGING'))
ORDER BY enqu_id ORDER BY enqu_id
,quote_id ,quote_id
,t.id) all_quote_items ,t.id) all_quote_items
WHERE row_number = 1 WHERE row_number = 1;
COMMENT ON TABLE v_quote_details IS 'This view shows details of each of the quotes for an enquiry.';
COMMENT ON COLUMN v_quote_details.enquiry_id IS 'The ID of the enquiry this quote relates to.';
COMMENT ON COLUMN v_quote_details.quote_id IS 'The unique ID for this particular quote.';
COMMENT ON COLUMN v_quote_details.enty_code IS 'The type of enquiry quoted for.';
COMMENT ON COLUMN v_quote_details.module_code IS 'The name of the module quoted for.';
COMMENT ON COLUMN v_quote_details.lead_time IS 'The lead time for installation. This is the max of any additional item''s lead times.';
COMMENT ON COLUMN v_quote_details.additional_items IS 'Any additional items included in the quote.';
COMMENT ON COLUMN v_quote_details.bas_code IS 'The module base code.';
COMMENT ON COLUMN v_quote_details.qmax IS 'The meter module''s Q max.';
COMMENT ON COLUMN v_quote_details.inlet_orientation IS 'The orientation of the meter inlet.';
COMMENT ON COLUMN v_quote_details.outlet_orientation IS 'The orientatino of the meter outlet.';
COMMENT ON COLUMN v_quote_details.total_cost IS 'The total cost of the quote. This figure excludes any lifting gear or purging.';