diff --git a/Schema/V_QUOTE_DETAILS.vw b/Schema/V_QUOTE_DETAILS.vw index bd2b5ca..da96c57 100644 --- a/Schema/V_QUOTE_DETAILS.vw +++ b/Schema/V_QUOTE_DETAILS.vw @@ -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 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 @@ -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 FROM quote_items t ,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 ,quote_id ,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.';