From 28a1c94434a0219b3441157c35bcc6ba8f940216 Mon Sep 17 00:00:00 2001 From: PriestJ Date: Thu, 3 Apr 2008 16:36:38 +0000 Subject: [PATCH] Fix for ticket #473 (SC5003) The code for displaying the existing meter details was incorrectly using the meter type code instead of the description. Added a new function to get the description for a given meter code. git-svn-id: http://locode01.ad.dom/svn/WEBMIP/trunk@4720 248e525c-4dfb-0310-94bc-949c084e9493 --- Modules/mip_quotation_document.pck | 40 +++++++++++++++++++----------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/Modules/mip_quotation_document.pck b/Modules/mip_quotation_document.pck index 9084446..b208269 100644 --- a/Modules/mip_quotation_document.pck +++ b/Modules/mip_quotation_document.pck @@ -73,6 +73,29 @@ CREATE OR REPLACE PACKAGE mip_quotation_document IS END mip_quotation_document; / CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS + + + /* + function get_meter_type_code_desc + --recives a meter code and returns the corresponding meter type description + %param p_meter_type_code - the meter type code you want the description for + */ + function get_meter_type_code_desc(p_meter_type_code varchar2) return varchar2 is + --Meter Description + CURSOR c_get_meter_type_desc(cp_metertypecode varchar2) IS + SELECT description + FROM meter_types + WHERE code = cp_metertypecode; + l_meter_type_desc meter_types.description%TYPE; --The description of the meter + begin + IF NOT c_get_meter_type_desc%ISOPEN THEN + OPEN c_get_meter_type_desc(p_meter_type_code); + END IF; + FETCH c_get_meter_type_desc + INTO l_meter_type_desc; + CLOSE c_get_meter_type_desc; + return l_meter_type_desc; + end get_meter_type_code_desc; /* PROCEDURE print_caveats --Prints the supplied caveats to the current PLPDF page @@ -416,11 +439,6 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS SELECT * FROM quote_items WHERE qute_id = cp_quoteid; - --Meter Description - CURSOR c_get_meter_type_desc(cp_metertypecode varchar2) IS - SELECT description - FROM meter_types - WHERE code = cp_metertypecode; --Module data l_module_row modules%ROWTYPE; --Additional Items @@ -434,7 +452,6 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS l_counter number; l_service_pressure varchar2(80); --these three used to determine whether to set l_meter_type varchar2(80); --the lifting gear item or not - l_meter_type_desc meter_types.description%TYPE; --The description of the meter l_enqu_type varchar2(80); begin @@ -532,13 +549,8 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS end if; --other module details l_module_row := get_module_row (quote_item_rec.modu_code); - IF NOT c_get_meter_type_desc%ISOPEN THEN - OPEN c_get_meter_type_desc(l_meter_type); - END IF; - FETCH c_get_meter_type_desc - INTO l_meter_type_desc; - CLOSE c_get_meter_type_desc; - l_works(3) := 'Meter Type: '|| l_meter_type_desc || ' ' || p_quote_data.meter_reference; + + l_works(3) := 'Meter Type: '|| get_meter_type_code_desc(l_meter_type) || ' ' || p_quote_data.meter_reference; p_quote_data.outlet_termninal_size := l_module_row.outlet_size; --module technical details p_quote_data.module_dimensions(1) := l_module_row.dim_a; @@ -593,7 +605,7 @@ CREATE OR REPLACE PACKAGE BODY mip_quotation_document IS --get existing meter if appropriate if quote_item_rec.enty_code is not null then if quote_item_rec.enty_code <>'INSTALL' and quote_item_rec.enty_code <>'STD INSTALL' then - l_works(5) := 'Existing Meter Type: '|| p_enqu_row.existing_mesc_code ||' '||p_enqu_row.existing_mety_code||', MSN: '||p_enqu_row.existing_meter_serial_no ; + l_works(5) := 'Existing Meter Type: '|| p_enqu_row.existing_mesc_code ||' '||get_meter_type_code_desc(p_enqu_row.existing_mety_code)||', MSN: '||p_enqu_row.existing_meter_serial_no ; end if; --if it's not an install or exchange get the existing meter type (will overwrite --current value if already set in the code above)