diff --git a/Modules/mip_quotation_document.pck b/Modules/mip_quotation_document.pck index d6e283d..103c55c 100644 --- a/Modules/mip_quotation_document.pck +++ b/Modules/mip_quotation_document.pck @@ -795,8 +795,14 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS l_add_item_row := get_additional_item(quote_item_rec.adit_code); --only show the lifting gear/purging description, not the materials bit IF quote_item_rec.adit_code = 'LIFTING GEAR' or quote_item_rec.adit_code ='PURGING' THEN - p_quote_data.quote_costs(l_counter).cost_description := l_add_item_row.description; - p_quote_data.quote_costs(l_counter).cost_price := quote_item_rec.selling_price; + --If AH's build quote items has left the cost as null then the additional item + --must be costed on time and materials (as part of purging changes '09) + IF quote_item_rec.selling_price IS NULL THEN + p_quote_data.quote_costs(l_counter).cost_description := l_add_item_row.description||' (if required)(On Time and Materials Basis)'; + ELSE + p_quote_data.quote_costs(l_counter).cost_description := l_add_item_row.description; + p_quote_data.quote_costs(l_counter).cost_price := quote_item_rec.selling_price; + END IF; ELSE IF quote_item_rec.adit_code <> 'AMR' THEN p_quote_data.quote_costs(l_counter).cost_description := l_add_item_row.description || @@ -810,7 +816,7 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS ' Delivery cost'; p_quote_data.quote_costs(l_counter).cost_price := quote_item_rec.delivery_price; END IF; - --set the list of add-ons for this quote, but don't add lifting gear or purging + --set the list of add-ons for this quote, but don't add lifting gear IF quote_item_rec.adit_code <> 'LIFTING GEAR' AND NOT quote_item_rec.adit_code IS NULL THEN l_addons := l_addons || ', ' || l_add_item_row.description; @@ -995,17 +1001,32 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS FROM parties WHERE id = cp_party_id; --The caveats - CURSOR c_get_caveats(cp_enty_code VARCHAR2, cp_mety_code VARCHAR2, cp_svcpt_code VARCHAR2) IS - SELECT * - FROM caveat_texts t - WHERE enty_code = cp_enty_code - AND mety_code = cp_mety_code - AND svcpt_code = cp_svcpt_code + CURSOR c_get_caveats(cp_enty_code VARCHAR2, cp_mety_code VARCHAR2, cp_svcpt_code VARCHAR2, cp_quoteid NUMBER) IS + SELECT t.* + FROM caveat_texts t, quote_items qi + WHERE t.enty_code = cp_enty_code + AND t.mety_code = cp_mety_code + AND t.svcpt_code = cp_svcpt_code + AND qi.qute_id = cp_quoteid + and qi.adit_code is null + and t.adit_code is null + union + SELECT t.* + FROM caveat_texts t, quote_items qi + WHERE t.enty_code = cp_enty_code + AND t.mety_code = cp_mety_code + AND t.svcpt_code = cp_svcpt_code + AND qi.qute_id = cp_quoteid + and qi.adit_code is not null + and t.adit_code is not null + AND t.adit_code = qi.adit_code + AND REGEXP_LIKE(DECODE(qi.selling_price, NULL, 'NULL', qi.selling_price),t.condition) ORDER BY 1 ,2 ,3 ,4 - ,5; + ,5 +; --Agent Name l_agent_first_name VARCHAR2(80); l_agent_last_name VARCHAR2(80); @@ -1102,7 +1123,8 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS l_csqa_counter := 1; FOR rec IN c_get_caveats(l_enqu_row.enty_code ,l_quote_data.mety_code - ,l_quote_data.svcpt_code) LOOP + ,l_quote_data.svcpt_code + ,p_quoteid) LOOP CASE rec.document_position WHEN 'TERM_COND' THEN --terms and conditions/specialfeatures caveat point