CREATE OR REPLACE PACKAGE BODY efnow210$intz IS -- -- -- g_base_package_name CONSTANT VARCHAR2(30) := 'efnow210$'; g_package_name CONSTANT VARCHAR2(30) := g_base_package_name||'intz'; g_title CONSTANT VARCHAR2(100) := caco_utilities.get_module_text(3800); g_boolean BOOLEAN; -- PROCEDURE page_head IS BEGIN -- htp.p(' '); htp.p(' '); -- wsgl.openpagehead(g_title); wsgl.metatag; htp.p(' ' || chr(10)); htp.p(' ' || chr(10)); htp.p(' ' || chr(10)); -- htp.p(' '); -- htp.p(wsgjsl.openscript); wsgjsl.output_invoke_cal_js(g_base_package_name||'intr' ,'scrollbars=no,resizable=no,width=320,height=350'); htp.p(wsgjsl.closescript); -- wsgl.closepagehead; wsgl.openpagebody(FALSE); htp.p(caco_system.menu); -- htp.p('
'); htp.p('
'); htp.HEADER(nsize => 1 ,cheader => g_title); -- END page_head; -- FUNCTION display_message (p_error_number IN VARCHAR2 ,p_error_text IN VARCHAR2 DEFAULT NULL ,p_substitution_list IN caco_utilities.g_t_substitution_list DEFAULT caco_utilities.c_empty_substitution_list ,p_error_type IN VARCHAR2 ) RETURN BOOLEAN IS -- v_message exception_messages.message%TYPE; v_exme_type exception_messages.exme_type%TYPE; -- l_return BOOLEAN; -- BEGIN -- IF p_error_type = wsgl.MESS_ERROR THEN -- l_return := FALSE; -- IF p_error_text IS NOT NULL THEN -- v_message := p_error_text; -- ELSE -- caco_utilities.get_exception_message(p_exception_number => p_error_number ,p_message => v_message ,p_exme_type => v_exme_type ,p_substitution_list => p_substitution_list); -- END IF; -- ELSE -- l_return := TRUE; -- IF p_error_text IS NOT NULL THEN -- v_message := p_error_text; -- ELSE -- v_message := caco_utilities.get_module_text(p_text_number => p_error_number); -- END IF; -- END IF; -- wsgl.displaymessage( p_error_type , v_message , g_title , NULL ); -- RETURN l_return; -- END display_message; -- FUNCTION display_error (p_error_number IN VARCHAR2 ,p_substitution_list IN caco_utilities.g_t_substitution_list DEFAULT caco_utilities.c_empty_substitution_list ) RETURN BOOLEAN IS -- BEGIN -- RETURN display_message(p_error_number => p_error_number ,p_substitution_list => p_substitution_list ,p_error_type => WSGL.MESS_ERROR ); -- END display_error; -- FUNCTION display_success (p_error_number IN VARCHAR2 ,p_error_text IN VARCHAR2 DEFAULT NULL ,p_substitution_list IN caco_utilities.g_t_substitution_list DEFAULT caco_utilities.c_empty_substitution_list ) RETURN BOOLEAN IS -- BEGIN -- RETURN display_message(p_error_number => p_error_number ,p_error_text => p_error_text ,p_substitution_list => p_substitution_list ,p_error_type => WSGL.MESS_SUCCESS ); -- END display_success; -- FUNCTION display_warning (p_error_number IN VARCHAR2 ,p_error_text IN VARCHAR2 DEFAULT NULL ,p_substitution_list IN caco_utilities.g_t_substitution_list DEFAULT caco_utilities.c_empty_substitution_list ) RETURN BOOLEAN IS -- BEGIN -- RETURN display_message(p_error_number => p_error_number ,p_error_text => p_error_text ,p_substitution_list => p_substitution_list ,p_error_type => WSGL.MESS_WARNING ); -- END display_warning; -- FUNCTION delete_interruption ( p_int_id IN interruptions.int_id%TYPE ) RETURN BOOLEAN IS -- l_return BOOLEAN := TRUE; -- BEGIN -- -- Inner block to catch any exeptions an rollback transaction -- BEGIN -- DELETE int_conp_coca_vals iccv WHERE iccv.int_id = p_int_id; -- DELETE interruptions int WHERE int.int_id = p_int_id; -- EXCEPTION WHEN OTHERS THEN -- ROLLBACK; l_return := FALSE; END; -- RETURN l_return; -- END delete_interruption; -- FUNCTION return_func( p_coca_id IN contract_categories.coca_id%TYPE , p_conp_id IN cont_network_points.conp_id%TYPE ) RETURN VARCHAR2 IS -- l_return VARCHAR2(1000); -- BEGIN -- FOR rec IN (SELECT SUM(DECODE(SUBSTR(pars.code, length(pars.code)-2), 'MIN', cnppv.value, 0)) as con_min ,SUM(DECODE(SUBSTR(pars.code, length(pars.code)-2), 'MAX', cnppv.value, 0)) as con_max FROM cont_net_point_param_vals cnppv ,contract_parameters copa ,parameters pars ,contract_categories coca ,categories cate WHERE cnppv.copa_id = copa.copa_id AND copa.pars_id = pars.pars_id AND coca.cate_id = pars.cate_id AND cate.cate_id = coca.cate_id AND cate.interuptible = 'Y' AND ( pars.code like '%.MAX' OR pars.code like '%.MIN') AND coca.coca_id = p_coca_id AND cnppv.conp_id = p_conp_id ) LOOP -- l_return := 'id="'||p_coca_id||':'||p_conp_id||'" onchange="return checklimit(this, this.value, '||rec.con_min||', '||rec.con_max||')"'; -- EXIT; -- END LOOP; -- RETURN l_return; -- END return_func; -- -- Public routines -- PROCEDURE css IS -- -- BEGIN -- owa_util.mime_header('text/css' ,TRUE); -- htp.p(' #custlistdiv { width : 146px; float : left; overflow-x : scroll; } #nepolistdiv { width : 147px; float : left; overflow-x : scroll; } #iccvDiv { overflow-x : scroll; overflow-y : hidden; } * html #iccvDiv { width : 100%; } * html body centrecontent{ /*IE6 hack*/ padding: 175px 0 45px 0; /*Set value to (HeightOfTopFrameDiv 0 HeightOfBottomFrameDiv 0)*/ } .custlist { border-left-width : 1px; border-left-style : solid; border-top-width : 1px; border-top-style : solid; border-bottom-width : 1px; border-bottom-style : solid; } .custnepo { border-top-width : 1px; border-top-style : solid; border-bottom-width : 1px; border-bottom-style : solid; } .custnepoth { background-color : #D9D9D9; text-align : center; width : 165px; border-left-width : 1px; border-left-style : solid; border-left-color : #F21C0A; border-right-width : 1px; border-right-style : solid; border-right-color : #F21C0A; border-top-width : 1px; border-top-style : solid; border-top-color : #F21C0A; border-bottom-width : 1px; border-bottom-style : solid; border-bottom-color : #F21C0A; font-weight : normal; height : 48px; } .custnepotr1 { background-color : #FFFFFF; color : #000000; text-shadow : none; text-decoration : none; border-style : none; width : 165px; height : 16px; padding : 0px; margin : 0px; } .custnepotr2 { background-color : #F5F5F5; color : #000000; text-shadow : none; text-decoration : none; border-style : none; width : 165px; height : 16px; padding : 0px; margin : 0px; } .iccvTable { border : 1px solid; } .iccvTable tr { height: 22px; } .iccvTH { background-color : #D9D9D9; text-align : center; font-weight : normal; border-left-width : 1px; border-left-style : solid; border-left-color : #F21C0A; border-right-width : 1px; border-right-style : solid; border-right-color : #F21C0A; border-top-width : 1px; border-top-style : solid; border-top-color : #F21C0A; border-bottom-width : 1px; border-bottom-style : solid; border-bottom-color : #F21C0A; height : 24px; white-space : nowrap; overflow : hidden; } .iccvtr1 { background-color : #D9D9D9; text-align : center; font-weight : normal; border-left-width : 1px; border-left-style : solid; border-left-color : #F21C0A; border-right-width : 1px; border-right-style : solid; border-right-color : #F21C0A; border-top-width : 0px; border-top-style : solid; border-top-color : #F21C0A; border-bottom-width : 0px; border-bottom-style : solid; border-bottom-color : #F21C0A; height : 24px; white-space : nowrap; overflow : hidden; padding: 0; margin: 0; } .iccvinput1 { width : 161px; text-align : right; padding-right : 5px; } .iccvinputd { width : 161px; text-align : right; padding-right : 5px; background-color : #D9D9D9; border-width: 0px; } .iccvinput2 { width : 161px; text-align : left; padding-left : 5px; } '); -- END; -- PROCEDURE js IS -- -- BEGIN -- owa_util.mime_header('application/x-javascript' ,TRUE); -- htp.p('var formmodified = false; function fieldFocus(obj) { obj.focus(); } function checkAll( field ) { formmodified=true; var i=0 var j=-1 var x=new Array() while (document.getElementById(field+"_"+i)!=null){ x[i]= document.getElementById(field+"_"+i) if (document.getElementById(field+"_"+i).type == "checkbox" && j==-1) { j=i; } i++ } if (j!=-1) { if (document.getElementById("p_"+field+"_"+j).value == "N") { for (i = 0; i < x.length; i++) { x[i].checked = true; if (document.getElementById(field+"_"+i).type == "checkbox"){ if (document.getElementById("p_"+field+"_"+i)!=null){ document.getElementById("p_"+field+"_"+i).value = "Y"; } } } } else { for (i = 0; i < x.length; i++) { x[i].checked = false; if (document.getElementById(field+"_"+i).type == "checkbox"){ if (document.getElementById("p_"+field+"_"+i)!=null){ document.getElementById("p_"+field+"_"+i).value = "N"; } } } } } } function changeCheckBox( objName ) { formmodified=true; var obj = document.getElementById(objName); if (obj.value == "N") { obj.value = "Y"; } else { obj.value = "N"; } } function checklimit(obj, objval, minval, maxval) { formmodified=true; var len = objval.length; var strCheck = "0123456789"; var tmpstr = ""; for(i=0; i < len; i++) if (strCheck.indexOf(objval.charAt(i))!=-1) tmpstr += objval.charAt(i); obj.value = tmpstr; var error ="'||caco_utilities.get_module_text(3583)||': '||caco_utilities.get_module_text(915)||'"; if ( (obj.value.length < 1) || (obj.value < minval) || (obj.value > maxval)) { error = error.replace(/ /,"'||caco_utilities.get_module_text(3803)||'"); error = error.replace(//,minval); error = error.replace(//,maxval); setTimeout(function(){fieldFocus(obj)}, 100); alert(error); return false; } else {thousandSeparator(obj.id,obj.value); return true;}; } function confirmmodified() { if (formmodified) { alert("'||caco_utilities.get_module_text(924)||'"); return false; } else { return true; } } function checkform() { // check all elements with name p_iccv_val that are not hidden var x=document.getElementsByName("p_iccv_val") var i=0 var retval=true; for (i=0; i < x.length; i++) { if (x[i].type != "hidden") { x[i].focus(); if (! x[i].onchange()) { retval=false; break; } } } if (retval) { formmodified=false; } return retval; } '); caco_utilities.thousand_separator_js; -- END js; -- FUNCTION check_contract_span ( p_start_date IN DATE , p_end_date IN DATE ) RETURN BOOLEAN IS -- l_return BOOLEAN := TRUE; l_empty_substitution_list caco_utilities.g_t_substitution_list; -- BEGIN -- IF p_start_date IS NOT NULL AND p_end_date IS NOT NULL THEN -- FOR cont IN ( SELECT cust_id, COUNT(*) AS num FROM contracts cont WHERE EXISTS ( SELECT NULL -- only interruptible contracts FROM contract_categories coca ,categories cate WHERE coca.cate_id = cate.cate_id AND cate.interuptible = 'Y' AND coca.cont_id = cont.cont_id ) AND (cont.valid_from BETWEEN p_start_date AND p_end_date OR cont.valid_until BETWEEN p_start_date AND p_end_date) AND cont.status = 'O' HAVING COUNT(*) > 1 GROUP BY cust_id ) LOOP -- l_return := display_error(-20541, l_empty_substitution_list); -- EXIT; -- END LOOP; -- IF l_return THEN -- FOR x IN ( SELECT TO_NUMBER(TO_CHAR(p_start_date,'YYYY')) + DECODE(SIGN(TO_NUMBER(TO_CHAR(p_start_date,'MM'))-6),-1,-1,0,-1,0) AS start_year ,TO_NUMBER(TO_CHAR(p_end_date,'YYYY'))+DECODE(SIGN(TO_NUMBER(TO_CHAR(p_end_date,'MM'))-6),-1,-1,0,-1,0) AS end_year FROM DUAL ) LOOP -- IF x.start_year <> x.end_year THEN -- l_return := display_error(-20542, l_empty_substitution_list); -- END IF; -- END LOOP; -- END IF; -- END IF; -- RETURN l_return; -- END check_contract_span; -- PROCEDURE check_interruption_limits ( p_int_id IN interruptions.int_id%TYPE , p_action IN VARCHAR2 , p_start_date IN DATE , p_end_date IN DATE ) IS -- l_empty_substitution_list caco_utilities.g_t_substitution_list; l_return BOOLEAN; l_exit BOOLEAN := FALSE; -- BEGIN -- IF p_end_date IS NULL AND p_action = 'I' THEN -- l_return := display_warning(p_error_number => 3845 ,p_substitution_list => l_empty_substitution_list ); -- END IF; -- -- -- Check the values -- FOR int_vals IN (SELECT TO_CHAR(inte.gas_day_start ,'YYYY') + DECODE(SIGN(TO_NUMBER(TO_CHAR(inte.gas_day_start ,'MM')) - 7) ,-1 ,0 ,0 ,0 ,1) gas_year ,cate.name category_name ,conp.conp_id ,itcp.max_interruptions ,itcp.max_interruption_days ,itcp.max_interruption_length ,COUNT(DISTINCT(inte.int_id)) no_of_interruptions ,SUM((inte.gas_day_end - inte.gas_day_start)+1) accumulated_time FROM interruptions inte ,int_conp_coca_vals iccp ,inty_conp_params itcp ,interruption_types inty ,cont_network_points conp ,network_points nepo ,contract_categories coca ,categories cate WHERE inte.int_id = iccp.int_id AND iccp.coca_id = coca.coca_id AND coca.cate_id = cate.cate_id AND iccp.conp_id = conp.conp_id AND nepo.nepo_id = conp.nepo_id AND itcp.conp_id = conp.conp_id AND itcp.inty_id = inty.inty_id AND inty.cate_id = cate.cate_id AND iccp.send_to_customer = 'Y' AND itcp.limits_enabled = 'Y' AND inty.status = 'A' AND TO_CHAR(inte.gas_day_start ,'YYYY') + decode(sign(to_number(to_char(inte.gas_day_start ,'MM')) - 7) ,-1 ,-1 ,0 ,1 ,0) = TO_NUMBER(TO_CHAR(p_start_date,'YYYY')) + LEAST(SIGN(TO_NUMBER(TO_CHAR(p_start_date,'MM'))-7),0) AND (iccp.coca_id, iccp.conp_id) IN ( SELECT iccp_sq1.coca_id ,iccp_sq1.conp_id FROM int_conp_coca_vals iccp_sq1 WHERE iccp_sq1.int_id = p_int_id AND iccp_sq1.send_to_customer = 'Y') GROUP BY cate.NAME ,conp.conp_id ,itcp.max_interruptions ,itcp.max_interruption_days ,itcp.max_interruption_length ,TO_CHAR(inte.gas_day_start ,'YYYY') + DECODE(SIGN(TO_NUMBER(TO_CHAR(inte.gas_day_start ,'MM')) - 7) ,-1 ,0 ,0 ,0 ,1)) LOOP -- IF int_vals.max_interruptions < int_vals.no_of_interruptions THEN -- l_return := display_warning(p_error_number => 3846 ,p_substitution_list => l_empty_substitution_list ); -- l_exit := TRUE; -- END IF; -- IF p_end_date IS NOT NULL AND int_vals.max_interruption_days < int_vals.accumulated_time THEN -- l_return := display_warning(p_error_number => 3847 ,p_substitution_list => l_empty_substitution_list ); -- l_exit := TRUE; -- END IF; -- IF p_end_date IS NOT NULL AND int_vals.max_interruption_length < ((p_end_date - p_start_date)+1) THEN -- l_return := display_warning(p_error_number => 3856 -- The maximum interruption length exceeded for one or more categories ,p_substitution_list => l_empty_substitution_list ); -- l_exit := TRUE; -- END IF; -- IF l_exit THEN -- EXIT; -- END IF; -- END LOOP; -- END check_interruption_limits; -- FUNCTION insert_ints ( p_int_id IN OUT interruptions.int_id%TYPE , p_int_code IN interruptions.name%TYPE , p_int_start IN interruptions.gas_day_start%TYPE , p_int_end IN interruptions.gas_day_end%TYPE , p_int_notes IN interruptions.notes%TYPE ) RETURN BOOLEAN IS -- l_success BOOLEAN := TRUE; l_conf_id confirmations.conf_id%TYPE; -- CURSOR cur_conf ( p_cont_id IN contracts.cont_id%TYPE ) IS SELECT conf.conf_id FROM confirmations conf WHERE conf.cont_id = p_cont_id AND conf.gas_day <= p_int_start AND conf.confirmation_type = 'CO' AND conf.approved = 'Y' ORDER BY gas_day DESC ,created_on DESC; -- BEGIN -- INSERT INTO interruptions ( name , gas_day_start , gas_day_end , notes ) VALUES ( p_int_code , p_int_start , p_int_end , p_int_notes ) RETURNING int_id INTO p_int_id; -- FOR cont IN ( SELECT cont.cont_id FROM contracts cont WHERE cont.status = 'O' AND p_int_start BETWEEN cont.valid_from AND cont.valid_until AND EXISTS ( SELECT NULL FROM cont_net_point_param_vals cnppv ,contract_parameters copa ,parameters pars ,contract_categories coca ,categories cate WHERE cnppv.copa_id = copa.copa_id AND copa.cont_id = cont.cont_id AND copa.pars_id = pars.pars_id AND coca.cate_id = pars.cate_id AND coca.cont_id = cont.cont_id AND cate.cate_id = coca.cate_id AND cate.interuptible = 'Y' AND cnppv.value > 0 AND pars.code like '%.MAX' ) ) LOOP -- -- lookup the last commercial confirmation prior to the interruption -- OPEN cur_conf(p_cont_id => cont.cont_id); FETCH cur_conf INTO l_conf_id; -- IF cur_conf%NOTFOUND THEN -- l_conf_id := NULL; -- END IF; -- CLOSE cur_conf; -- FOR cnpcv IN (SELECT sq1.coca_id, sq1.conp_id, sq1.value, sq2.conf_val FROM (SELECT coca.coca_id ,cnppv.conp_id ,cnppv.value FROM cont_net_point_param_vals cnppv ,contract_parameters copa ,parameters pars ,contract_categories coca ,categories cate WHERE cnppv.copa_id = copa.copa_id AND copa.cont_id = cont.cont_id AND copa.pars_id = pars.pars_id AND coca.cate_id = pars.cate_id AND coca.cont_id = cont.cont_id AND cate.cate_id = coca.cate_id AND cate.interuptible = 'Y' AND pars.code like '%.MAX') sq1 , (SELECT cnpcv.value conf_val , cnpcv.coca_id , cnpcv.conp_id FROM conf_net_point_cat_vals cnpcv WHERE cnpcv.conf_id = l_conf_id ) sq2 WHERE sq1.coca_id = sq2.coca_id (+) AND sq1.conp_id = sq2.conp_id (+) AND EXISTS (SELECT NULL FROM cont_net_point_param_vals cnppv ,contract_parameters copa ,parameters pars ,contract_categories coca ,categories cate WHERE cnppv.copa_id = copa.copa_id AND copa.cont_id = cont.cont_id AND copa.pars_id = pars.pars_id AND coca.cate_id = pars.cate_id AND coca.cont_id = cont.cont_id AND cate.cate_id = coca.cate_id AND cate.interuptible = 'Y' AND cnppv.value > 0 AND pars.code like '%.MAX' AND cnppv.conp_id = sq1.conp_id ) ) LOOP -- INSERT INTO int_conp_coca_vals ( int_id ,coca_id ,conp_id ,contracted_value ,interrupted_value ,confirmed_value ,send_to_customer ) VALUES (p_int_id ,cnpcv.coca_id ,cnpcv.conp_id ,cnpcv.value ,cnpcv.value ,cnpcv.conf_val ,'N' ); -- END LOOP; --cnpcv -- END LOOP; --cont -- RETURN l_success; -- END insert_ints; -- PROCEDURE action ( p_action IN VARCHAR2 , p_int_id IN interruptions.int_id%TYPE DEFAULT NULL , p_int_code IN VARCHAR2 DEFAULT NULL , p_int_start IN VARCHAR2 DEFAULT NULL , p_int_end IN VARCHAR2 DEFAULT NULL , p_int_notes IN interruptions.notes%TYPE DEFAULT NULL , p_iccv_id IN owa_util.vc_arr DEFAULT g_vc_arr , p_iccv_val IN owa_util.vc_arr DEFAULT g_vc_arr , p_checkbox IN owa_util.vc_arr DEFAULT g_vc_arr , p_intm_id IN interruption_templates.intm_id%TYPE DEFAULT NULL ) IS -- c_create CONSTANT VARCHAR2(30) := 'create'; c_populate CONSTANT VARCHAR2(30) := 'populate'; c_edit CONSTANT VARCHAR2(30) := 'edit'; c_query CONSTANT VARCHAR2(30) := 'query'; c_delete CONSTANT VARCHAR2(30) := 'delete'; c_template CONSTANT VARCHAR2(30) := 'template'; -- l_success BOOLEAN := TRUE; -- l_disabled VARCHAR2(8); l_int_id interruptions.int_id%TYPE; -- lr_interruption interruptions%ROWTYPE; l_empty_substitution_list caco_utilities.g_t_substitution_list; l_dummy_date DATE; -- CURSOR cur_grid ( p_int_id IN interruptions.int_id%TYPE ) IS SELECT iccv.iccv_id , cust.code cust , iccv.conp_id , iccv.coca_id , coca.cate_id , iccv.send_to_customer , iccv.contracted_value , iccv.interrupted_value , iccv.confirmed_value , nepo.name||':'||cust.name neponame , cate.display_sequence ,ROW_NUMBER() OVER (PARTITION BY cate.name ORDER BY cont.contract_number,cust.code,nepo.code NULLS LAST) grid_row FROM int_conp_coca_vals iccv ,contract_categories coca ,categories cate ,cont_network_points conp ,network_points nepo ,contracts cont ,customers cust WHERE iccv.int_id = p_int_id AND iccv.coca_id = coca.coca_id AND coca.cate_id = cate.cate_id AND iccv.conp_id = conp.conp_id AND coca.cont_id = cont.cont_id AND conp.nepo_id = nepo.nepo_id AND cont.cust_id = cust.cust_id ORDER BY cont.contract_number ,cust.code ,nepo.code ,cate.display_sequence; -- lr_grid_row cur_grid%ROWTYPE; -- TYPE r_tot IS RECORD ( int_qty NUMBER , con_qty NUMBER ); TYPE t_tot IS TABLE OF r_tot INDEX BY BINARY_INTEGER; -- lt_tot t_tot; lt_empty_tot t_tot; -- l_grid_disabled BOOLEAN := FALSE; l_end_date_disabled BOOLEAN := FALSE; -- -- array to contain p_iccv_val array contents with no thousand separators l_val_no_thou_sep owa_util.vc_arr; -- BEGIN -- -- security check -- IF NOT caco_security.security_check(g_package_name) THEN RETURN; END IF; -- -- remove thousand separators from p_iccv_val array -- l_val_no_thou_sep := caco_utilities.thousand_separated_to_char(p_iccv_val); -- -- Output standard page header -- page_head; -- -- Check Supplied Parameters -- IF (p_action = c_create) OR (p_action = c_populate) OR (p_action = c_edit AND p_int_id IS NOT NULL) OR (p_action = c_query AND p_int_id IS NOT NULL) OR (p_action = c_template AND p_intm_id IS NOT NULL AND p_int_id IS NOT NULL) OR (p_action = c_delete AND p_int_id IS NOT NULL) THEN -- -- if we are editing an existing interruption, get the details -- IF p_action IN (c_edit, c_query, c_populate, c_template, c_delete) THEN -- l_int_id := p_int_id; -- END IF; -- IF p_action = c_template THEN -- htp.p(''); -- END IF; -- IF p_action = c_edit THEN -- SELECT intr.* INTO lr_interruption FROM interruptions intr WHERE intr.int_id = l_int_id; -- IF p_int_start IS NULL THEN -- l_empty_substitution_list(1) := caco_utilities.get_module_text(2489); l_success := display_error(-20100, l_empty_substitution_list); -- ELSIF p_int_start IS NOT NULL AND l_success THEN -- BEGIN -- l_dummy_date := TO_DATE(p_int_start, cout_system_configuration.get_configuration_item('G_DATE_FORMAT')); -- EXCEPTION WHEN OTHERS THEN -- l_empty_substitution_list(1) := caco_utilities.get_module_text(2489); l_success := display_error(-20102, l_empty_substitution_list); -- END; -- END IF; -- IF p_int_start IS NOT NULL AND l_success THEN -- IF TO_DATE(p_int_start, cout_system_configuration.get_configuration_item('G_DATE_FORMAT')) < TRUNC(SYSDATE - (cout_system_configuration.get_configuration_item('GAS_DAY_OFFSET')/24)) AND TO_DATE(p_int_start, cout_system_configuration.get_configuration_item('G_DATE_FORMAT')) < lr_interruption.gas_day_start THEN -- l_empty_substitution_list(1) := p_int_start; l_success := display_error(-20545, l_empty_substitution_list); -- END IF; -- END IF; -- IF p_int_end IS NOT NULL AND l_success THEN -- BEGIN -- l_dummy_date := TO_DATE(p_int_end, cout_system_configuration.get_configuration_item('G_DATE_FORMAT')); -- EXCEPTION WHEN OTHERS THEN -- l_empty_substitution_list(1) := caco_utilities.get_module_text(2490); l_success := display_error(-20102, l_empty_substitution_list); -- END; -- END IF; -- IF p_int_end IS NOT NULL AND l_success THEN -- IF TO_DATE(p_int_end, cout_system_configuration.get_configuration_item('G_DATE_FORMAT')) < TRUNC(SYSDATE - (cout_system_configuration.get_configuration_item('GAS_DAY_OFFSET')/24)) THEN -- l_empty_substitution_list(1) := p_int_end; l_success := display_error(-20545, l_empty_substitution_list); -- END IF; -- END IF; -- IF p_int_start IS NOT NULL AND p_int_end IS NOT NULL AND l_success THEN -- IF TO_DATE(p_int_start, cout_system_configuration.get_configuration_item('G_DATE_FORMAT')) > TO_DATE(p_int_end, cout_system_configuration.get_configuration_item('G_DATE_FORMAT')) THEN -- l_empty_substitution_list(1) := p_int_end; l_empty_substitution_list(2) := p_int_start; l_success := display_error(-20509, l_empty_substitution_list); -- END IF; -- END IF; -- -- Check interruption doesn't span more than one contract period -- IF l_success THEN -- l_success := check_contract_span ( p_start_date => TO_DATE(p_int_start, cout_system_configuration.get_configuration_item('G_DATE_FORMAT')) , p_end_date => TO_DATE(p_int_end, cout_system_configuration.get_configuration_item('G_DATE_FORMAT')) ); -- END IF; -- -- Check overlaps -- IF l_success THEN -- -- Now check for overlap -- FOR existing_interruption IN ( SELECT int.name FROM interruptions int WHERE (int.gas_day_start BETWEEN TO_DATE(p_int_start, cout_system_configuration.get_configuration_item('G_DATE_FORMAT')) AND NVL(TO_DATE(p_int_end, cout_system_configuration.get_configuration_item('G_DATE_FORMAT')),int.gas_day_start) OR NVL(int.gas_day_end, GREATEST(NVL(int.gas_day_start, NVL(TO_DATE(p_int_end, cout_system_configuration.get_configuration_item('G_DATE_FORMAT')),TO_DATE(p_int_start, cout_system_configuration.get_configuration_item('G_DATE_FORMAT')))))) BETWEEN TO_DATE(p_int_start, cout_system_configuration.get_configuration_item('G_DATE_FORMAT')) AND NVL(TO_DATE(p_int_end, cout_system_configuration.get_configuration_item('G_DATE_FORMAT')),int.gas_day_start) OR TO_DATE(p_int_start, cout_system_configuration.get_configuration_item('G_DATE_FORMAT')) BETWEEN int.gas_day_start AND NVL(int.gas_day_end,TO_DATE(p_int_start, cout_system_configuration.get_configuration_item('G_DATE_FORMAT')))) AND int.int_id <> p_int_id ) LOOP -- l_empty_substitution_list(1) := existing_interruption.name; l_success := display_error(-20540, l_empty_substitution_list); EXIT; -- END LOOP; -- END IF; -- -- Check for changed header attributes -- IF l_success AND TO_DATE(p_int_start, cout_system_configuration.get_configuration_item('G_DATE_FORMAT')) <> NVL(lr_interruption.gas_day_start, TO_DATE(p_int_start, cout_system_configuration.get_configuration_item('G_DATE_FORMAT'))+1) THEN -- UPDATE interruptions i SET i.gas_day_start = DECODE(p_int_start, NULL, NULL, TO_DATE(p_int_start, cout_system_configuration.get_configuration_item('G_DATE_FORMAT'))) WHERE i.int_id = p_int_id; -- END IF; -- IF l_success AND TO_DATE(p_int_end, cout_system_configuration.get_configuration_item('G_DATE_FORMAT')) <> NVL(lr_interruption.gas_day_end, TO_DATE(p_int_end, cout_system_configuration.get_configuration_item('G_DATE_FORMAT'))+1) THEN -- UPDATE interruptions i SET i.gas_day_end = DECODE(p_int_end, NULL, NULL, TO_DATE(p_int_end, cout_system_configuration.get_configuration_item('G_DATE_FORMAT'))) WHERE i.int_id = p_int_id; -- END IF; -- IF l_success AND p_int_notes <> lr_interruption.notes THEN -- UPDATE interruptions i SET i.notes = p_int_notes WHERE i.int_id = p_int_id; -- END IF; -- -- Now update the details -- IF l_success THEN -- FOR i IN 1..p_iccv_id.COUNT LOOP -- UPDATE int_conp_coca_vals iccv SET iccv.interrupted_value = l_val_no_thou_sep(i) ,iccv.send_to_customer = p_checkbox(i) WHERE iccv.iccv_id = p_iccv_id(i); -- END LOOP; -- l_success := display_success( p_error_number => 0 , p_error_text => caco_utilities.get_module_text(3843) , p_substitution_list => l_empty_substitution_list ); -- END IF; -- -- Check interruption limits -- IF l_success THEN -- check_interruption_limits ( p_int_id => p_int_id , p_action => 'U' , p_start_date => TO_DATE(p_int_start, cout_system_configuration.get_configuration_item('G_DATE_FORMAT')) , p_end_date => TO_DATE(p_int_end, cout_system_configuration.get_configuration_item('G_DATE_FORMAT')) ); -- END IF; -- ELSIF p_action = c_populate THEN -- -- validate parameters -- IF p_int_code IS NULL THEN -- l_empty_substitution_list(1) := caco_utilities.get_module_text(3801); l_success := display_error(-20100, l_empty_substitution_list); -- ELSE -- FOR z IN (SELECT NULL FROM interruptions intr WHERE UPPER(intr.name) = UPPER(p_int_code)) LOOP -- l_empty_substitution_list(1) := caco_utilities.get_module_text(3801); l_success := display_error(-20501, l_empty_substitution_list); -- EXIT; -- END LOOP; -- END IF; -- IF p_int_start IS NULL AND l_success THEN -- l_empty_substitution_list(1) := caco_utilities.get_module_text(2489); l_success := display_error(-20100, l_empty_substitution_list); -- ELSIF p_int_start IS NOT NULL AND l_success THEN -- BEGIN -- l_dummy_date := TO_DATE(p_int_start, cout_system_configuration.get_configuration_item('G_DATE_FORMAT')); -- EXCEPTION WHEN OTHERS THEN -- l_empty_substitution_list(1) := caco_utilities.get_module_text(2489); l_success := display_error(-20102, l_empty_substitution_list); -- END; -- END IF; -- IF p_int_start IS NOT NULL AND l_success THEN -- IF TO_DATE(p_int_start, cout_system_configuration.get_configuration_item('G_DATE_FORMAT')) < TRUNC(SYSDATE - (cout_system_configuration.get_configuration_item('GAS_DAY_OFFSET')/24)) THEN -- l_empty_substitution_list(1) := p_int_start; l_success := display_error(-20545, l_empty_substitution_list); -- END IF; -- END IF; -- IF p_int_end IS NOT NULL AND l_success THEN -- BEGIN -- l_dummy_date := TO_DATE(p_int_end, cout_system_configuration.get_configuration_item('G_DATE_FORMAT')); -- EXCEPTION WHEN OTHERS THEN -- l_empty_substitution_list(1) := caco_utilities.get_module_text(2490); l_success := display_error(-20102, l_empty_substitution_list); -- END; -- END IF; -- IF p_int_end IS NOT NULL AND l_success THEN -- IF TO_DATE(p_int_end, cout_system_configuration.get_configuration_item('G_DATE_FORMAT')) < TRUNC(SYSDATE - (cout_system_configuration.get_configuration_item('GAS_DAY_OFFSET')/24)) THEN -- l_empty_substitution_list(1) := p_int_end; l_success := display_error(-20545, l_empty_substitution_list); -- END IF; -- END IF; -- IF p_int_start IS NOT NULL AND p_int_end IS NOT NULL AND l_success THEN -- IF TO_DATE(p_int_start, cout_system_configuration.get_configuration_item('G_DATE_FORMAT')) > TO_DATE(p_int_end, cout_system_configuration.get_configuration_item('G_DATE_FORMAT')) THEN -- l_empty_substitution_list(1) := p_int_end; l_empty_substitution_list(2) := p_int_start; l_success := display_error(-20509, l_empty_substitution_list); -- END IF; -- END IF; -- -- Check interruption doesn't span more than one contract period -- IF l_success THEN -- l_success := check_contract_span ( p_start_date => TO_DATE(p_int_start, cout_system_configuration.get_configuration_item('G_DATE_FORMAT')) , p_end_date => TO_DATE(p_int_end, cout_system_configuration.get_configuration_item('G_DATE_FORMAT')) ); -- END IF; -- IF l_success THEN -- -- Now check for overlap -- FOR existing_interruption IN ( SELECT int.name FROM interruptions int WHERE int.gas_day_start BETWEEN TO_DATE(p_int_start, cout_system_configuration.get_configuration_item('G_DATE_FORMAT')) AND NVL(TO_DATE(p_int_end, cout_system_configuration.get_configuration_item('G_DATE_FORMAT')),int.gas_day_start) OR NVL(int.gas_day_end, GREATEST(NVL(int.gas_day_start, NVL(TO_DATE(p_int_end, cout_system_configuration.get_configuration_item('G_DATE_FORMAT')),TO_DATE(p_int_start, cout_system_configuration.get_configuration_item('G_DATE_FORMAT')))))) BETWEEN TO_DATE(p_int_start, cout_system_configuration.get_configuration_item('G_DATE_FORMAT')) AND NVL(TO_DATE(p_int_end, cout_system_configuration.get_configuration_item('G_DATE_FORMAT')),int.gas_day_start) OR TO_DATE(p_int_start, cout_system_configuration.get_configuration_item('G_DATE_FORMAT')) BETWEEN int.gas_day_start AND NVL(int.gas_day_end,TO_DATE(p_int_start, cout_system_configuration.get_configuration_item('G_DATE_FORMAT'))) ) LOOP -- l_empty_substitution_list(1) := existing_interruption.name; l_success := display_error(-20540, l_empty_substitution_list); EXIT; -- END LOOP; -- END IF; -- -- Check interruption limits -- IF l_success THEN -- check_interruption_limits ( p_int_id => p_int_id , p_action => 'I' , p_start_date => TO_DATE(p_int_start, cout_system_configuration.get_configuration_item('G_DATE_FORMAT')) , p_end_date => TO_DATE(p_int_end, cout_system_configuration.get_configuration_item('G_DATE_FORMAT')) ); -- END IF; -- IF l_success THEN -- -- Looks OK, create the details -- l_success := insert_ints ( p_int_id => l_int_id , p_int_code => p_int_code , p_int_start => TO_DATE(p_int_start, cout_system_configuration.get_configuration_item('G_DATE_FORMAT')) , p_int_end => TO_DATE(p_int_end, cout_system_configuration.get_configuration_item('G_DATE_FORMAT')) , p_int_notes => p_int_notes ); -- l_success := display_success( p_error_number => 0 , p_error_text => caco_utilities.get_module_text(3844) , p_substitution_list => l_empty_substitution_list ); -- END IF; -- END IF; -- IF (p_action = c_edit) OR (p_action = c_query) OR (p_action = c_populate AND l_success) OR (p_action = c_delete) OR (p_action = c_template) THEN -- l_disabled := 'readonly'; -- SELECT intr.* INTO lr_interruption FROM interruptions intr WHERE intr.int_id = l_int_id; -- -- IF p_action = c_query AND lr_interruption.gas_day_end < TRUNC(SYSDATE) THEN -- disabled grid once interruption started - on request of INT015 IF p_action = c_query AND lr_interruption.gas_day_start < (TRUNC(SYSDATE)+(cout_system_configuration.get_configuration_item('GAS_DAY_OFFSET')/24)) THEN -- l_grid_disabled := TRUE; -- END IF; -- IF p_action = c_query AND lr_interruption.gas_day_end < (TRUNC(SYSDATE+(cout_system_configuration.get_configuration_item('GAS_DAY_OFFSET')/24))) THEN -- added INT015 -- l_end_date_disabled := TRUE; -- END IF; -- END IF; -- -- now build the screen -- IF p_action IN (c_create, c_populate, c_edit, c_query, c_template) THEN -- htp.p('
'); htp.p(''); htp.p(''); htp.p(''); htp.p(''); htp.p(''); -- IF NOT l_grid_disabled THEN -- htp.p(''); -- ELSE -- htp.p(''); -- END IF; -- IF (p_action = c_edit) OR (p_action = c_query) OR (p_action = c_template) OR (p_action = c_populate AND l_success) THEN -- IF NOT l_grid_disabled THEN -- htp.p(''); -- ELSE -- htp.p(''); -- END IF; -- END IF; -- htp.p(''); htp.p(''); htp.p(''); -- -- Allow date from to be updated if in the future -- IF (lr_interruption.gas_day_start > TRUNC(SYSDATE-cout_system_configuration.get_configuration_item('GAS_DAY_OFFSET')/24)) OR p_action = c_create OR (p_action = c_populate AND l_success=FALSE) THEN -- htp.p(''); -- IF (p_action = c_edit) OR (p_action = c_query) OR (p_action = c_template) OR (p_action = c_populate AND l_success) THEN -- htp.p(''); htp.p(''); -- END IF; -- htp.p(''); htp.p(''); htp.p(''); -- IF NOT l_end_date_disabled THEN -- htp.p(''); -- IF (p_action = c_edit) OR (p_action = c_query) OR (p_action = c_template) OR (p_action = c_populate AND l_success) THEN -- -- IF NOT l_grid_disabled THEN IF NOT l_end_date_disabled THEN -- htp.p(''); htp.p(''); -- ELSE -- htp.p(''); htp.p(''); -- END IF; -- END IF; -- htp.p(''); htp.p('
'||caco_utilities.get_module_text(3801)||'*:'||caco_utilities.get_module_text(1151)||':
'||caco_utilities.get_module_text(2489)||'*:'); -- htp.p(wsgjsl.calbutton(field_name => 'p_int_start', p_calbut => htf.img(curl => caco_system.images_path || 'lov.gif', calign => 'TOP', cattributes => 'ALT="List Values" WIDTH=18 HEIGHT=22 BORDER'), p_form => 'interruption', field_format => cout_system_configuration.get_configuration_item('G_DATE_FORMAT'), p_field_prompt => caco_utilities.get_module_text(1142))); -- ELSE -- htp.p(''); -- END IF; -- htp.p('
'||caco_utilities.get_module_text(2490)||':'); htp.p(wsgjsl.calbutton(field_name => 'p_int_end', p_calbut => htf.img(curl => caco_system.images_path || 'lov.gif', calign => 'TOP', cattributes => 'ALT="List Values" WIDTH=18 HEIGHT=22 BORDER'), p_form => 'interruption', field_format => cout_system_configuration.get_configuration_item('G_DATE_FORMAT'), p_field_prompt => caco_utilities.get_module_text(1142))); -- ELSE -- htp.p(''); -- END IF; -- htp.p('
'); htp.br; htp.p('
'); -- IF (p_action = c_create) OR (p_action = c_populate AND NOT l_success) THEN -- htp.p(''); htp.p(''); -- ELSIF (p_action = c_edit) OR (p_action = c_query) OR (p_action = c_template) OR (p_action = c_populate AND l_success) THEN -- htp.p(''); htp.p(''); -- IF NOT l_end_date_disabled THEN -- htp.p(''); -- ELSE -- htp.p(''); -- END IF; -- htp.p(''); htp.br; htp.br; -- -- Detail grid -- htp.p('
'); htp.p(''); htp.p(''); htp.p(''); -- Contract htp.p(''); -- Customer htp.p(''); -- FOR custnepo IN ( SELECT rownum AS rowcount ,sq.* FROM ( SELECT cont.contract_number cont , cust.code cust , nepo.code nepo , nepo.name neponame FROM int_conp_coca_vals iccv ,cont_network_points conp ,network_points nepo ,contracts cont ,customers cust WHERE iccv.int_id = l_int_id AND iccv.conp_id = conp.conp_id AND conp.cont_id = cont.cont_id AND conp.nepo_id = nepo.nepo_id AND cont.cust_id = cust.cust_id GROUP BY cont.contract_number , cust.code , nepo.code , nepo.name ORDER BY cont.contract_number ,cust.code ,nepo.code ) sq ) LOOP -- IF MOD(custnepo.rowcount,2) = 0 THEN -- htp.p(''); -- ELSE -- htp.p(''); -- END IF; -- htp.p(''); htp.p(''); htp.p(''); -- END LOOP; -- -- last line to balance total line on main grid -- htp.p(''); -- htp.p('
'||caco_utilities.get_module_text(3552)||''||caco_utilities.get_module_text(1047)||'
'); htp.p('
'); -- htp.p('
'); htp.p(''); htp.p(''); htp.p(''); -- Network Point htp.p(''); -- Network Code htp.p(''); -- FOR custnepo IN ( SELECT rownum AS rowcount ,sq.* FROM ( SELECT cust.code cust , nepo.code nepo , nepo.name neponame FROM int_conp_coca_vals iccv ,cont_network_points conp ,network_points nepo ,contracts cont ,customers cust WHERE iccv.int_id = l_int_id AND iccv.conp_id = conp.conp_id AND conp.cont_id = cont.cont_id AND conp.nepo_id = nepo.nepo_id AND cont.cust_id = cust.cust_id GROUP BY cont.contract_number , cust.code , nepo.code , nepo.name ORDER BY cont.contract_number ,cust.code ,nepo.code ) sq ) LOOP -- IF MOD(custnepo.rowcount,2) = 0 THEN -- htp.p(''); -- ELSE -- htp.p(''); -- END IF; -- htp.p(''); htp.p(''); htp.p(''); -- END LOOP; -- -- last line to balance total line on main grid -- htp.p(''); -- htp.p('
'||caco_utilities.get_module_text(2023)||''||caco_utilities.get_module_text(1005)||'
'); htp.p('
'); -- htp.p('
'); htp.p(''); -- htp.p(''); -- -- main grid headers -- FOR iccvhead IN (SELECT rownum, cate_id, name FROM ( SELECT coca.cate_id , cate.name , cate.display_sequence FROM int_conp_coca_vals iccv ,contract_categories coca ,categories cate WHERE iccv.int_id = l_int_id AND iccv.coca_id = coca.coca_id AND coca.cate_id = cate.cate_id GROUP BY coca.cate_id , cate.name , cate.display_sequence ORDER BY cate.display_sequence )) LOOP -- htp.p(''); -- END LOOP; -- htp.p(''); -- -- secondary grid headers -- FOR iccvhead IN (SELECT rownum, cate_id, name FROM ( SELECT coca.cate_id , cate.name , cate.display_sequence FROM int_conp_coca_vals iccv ,contract_categories coca ,categories cate WHERE iccv.int_id = l_int_id AND iccv.coca_id = coca.coca_id AND coca.cate_id = cate.cate_id GROUP BY coca.cate_id , cate.name , cate.display_sequence ORDER BY cate.display_sequence )) LOOP -- htp.p(''); -- interruption type htp.p(''); -- contracted amount htp.p(''); -- IF NOT l_grid_disabled THEN -- htp.p(''); -- ELSE -- htp.p(''); -- END IF; -- END LOOP; -- htp.p(''); -- -- loop over each customer/nepo -- OPEN cur_grid(p_int_id => l_int_id); FETCH cur_grid INTO lr_grid_row; -- FOR custnepo IN ( SELECT rownum AS rowcount ,sq.* FROM ( SELECT cust.code cust , nepo.code nepo , nepo.name neponame , iccv.conp_id conp FROM int_conp_coca_vals iccv ,cont_network_points conp ,network_points nepo ,contracts cont ,customers cust WHERE iccv.int_id = l_int_id AND iccv.conp_id = conp.conp_id AND conp.cont_id = cont.cont_id AND conp.nepo_id = nepo.nepo_id AND cont.cust_id = cust.cust_id GROUP BY cont.contract_number , cust.code , nepo.code , nepo.name , iccv.conp_id ORDER BY cont.contract_number ,cust.code ,nepo.code ) sq ) LOOP -- htp.p(''); -- FOR griddetail IN (SELECT rownum, cate_id, name, inty_code FROM ( SELECT coca.cate_id , cate.name , inty.code AS inty_code , cate.display_sequence FROM int_conp_coca_vals iccv ,contract_categories coca ,categories cate ,interruption_types inty WHERE iccv.int_id = l_int_id AND iccv.coca_id = coca.coca_id AND coca.cate_id = cate.cate_id AND inty.cate_id (+) = cate.cate_id AND inty.status (+) = 'A' GROUP BY coca.cate_id , cate.name , inty.code , cate.display_sequence ORDER BY cate.display_sequence )) LOOP -- --fetch cursor -- IF lr_grid_row.cate_id = griddetail.cate_id AND lr_grid_row.conp_id = custnepo.conp THEN -- --output details -- IF NVL(p_action, 'X') = c_template THEN -- FOR tmp IN ( SELECT itcv.interrupted_value ,itcv.send_to_customer FROM intm_conp_coca_vals itcv WHERE itcv.intm_id = p_intm_id AND itcv.coca_id = lr_grid_row.coca_id AND itcv.conp_id = lr_grid_row.conp_id ) LOOP -- lr_grid_row.interrupted_value := tmp.interrupted_value; lr_grid_row.send_to_customer := tmp.send_to_customer; -- EXIT; -- END LOOP; -- END IF; -- htp.p(''); htp.p(''); -- IF NOT l_grid_disabled AND lr_grid_row.contracted_value > 0 THEN -- htp.p(''); -- ELSIF l_grid_disabled AND lr_grid_row.contracted_value > 0 THEN -- htp.p(''); -- ELSE -- htp.p(''); -- END IF; -- htp.p(''); -- -- Store total for later -- IF custnepo.rowcount = 1 THEN -- lt_tot(griddetail.rownum).int_qty := lr_grid_row.interrupted_value; -- lt_tot(griddetail.rownum).con_qty := lr_grid_row.confirmed_value; -- ELSE -- lt_tot(griddetail.rownum).int_qty := lr_grid_row.interrupted_value + lt_tot(griddetail.rownum).int_qty; -- lt_tot(griddetail.rownum).con_qty := lr_grid_row.confirmed_value + lt_tot(griddetail.rownum).con_qty; -- END IF; -- IF lr_grid_row.send_to_customer = 'N' THEN -- htp.p(''); -- IF NOT l_grid_disabled AND lr_grid_row.contracted_value > 0 THEN -- htp.p(''); -- ELSIF l_grid_disabled AND lr_grid_row.contracted_value > 0 THEN -- htp.p(''); -- ELSE -- -- No contracted value, display nothing -- htp.p('');--htp.p(''); -- END IF; -- ELSE -- htp.p(''); -- IF NOT l_grid_disabled AND lr_grid_row.contracted_value > 0 THEN -- htp.p(''); -- ELSIF l_grid_disabled AND lr_grid_row.contracted_value > 0 THEN -- htp.p(''); -- ELSE -- htp.p('');--htp.p(''); -- END IF; -- END IF; -- FETCH cur_grid INTO lr_grid_row; -- ELSE -- -- display a blank -- htp.p(''); -- IF custnepo.rowcount = 1 THEN -- lt_tot(griddetail.rownum).int_qty := 0; lt_tot(griddetail.rownum).con_qty := 0; -- END IF; -- END IF; -- END LOOP; --cate -- htp.p(''); -- END LOOP;--custnepo -- -- output total row -- htp.p(''); -- FOR i IN 1..lt_tot.COUNT LOOP -- htp.p(''); -- htp.p(''); htp.p(''); htp.p(''); -- END LOOP; -- htp.p(''); -- CLOSE cur_grid; -- htp.p('
'||iccvhead.name||'
'||caco_utilities.get_module_text(3595)||''||caco_utilities.get_module_text(2237)||''||caco_utilities.get_module_text(3802)||'
'); htp.p('
'); -- END IF; -- htp.p(''); -- lt_tot := lt_empty_tot; -- ELSIF p_action = c_delete THEN -- IF lr_interruption.gas_day_start > SYSDATE THEN -- l_success := delete_interruption ( p_int_id => p_int_id ); -- IF l_success THEN -- -- Journal the delete -- amfr_journal.log_transaction(p_operation_type => 'DELETE' ,p_operation_target => 'Interruption' ,p_old_values => name_value_tab(name_value_rec('Interruption Identifier',lr_interruption.int_id) ,name_value_rec('Name',lr_interruption.name) ,name_value_rec('Start Date',TO_CHAR(lr_interruption.gas_day_start, cout_system_configuration.get_configuration_item('G_DATE_FORMAT'))) ,name_value_rec('End Date',TO_CHAR(lr_interruption.gas_day_end, cout_system_configuration.get_configuration_item('G_DATE_FORMAT'))) ) ,p_new_values => amfr_journal.g_name_value_tab ); -- l_empty_substitution_list(1) := lr_interruption.name; l_success := display_success(3851, caco_utilities.get_module_text(3851), l_empty_substitution_list); -- Interruption deleted -- ELSE -- l_success := display_error(-20543); -- a problem was encountered when deleting the interruption -- END IF; -- ELSE -- l_success := display_error(-20544); -- Cannot delete interruption with a start date in the past -- END IF; -- htp.p('
'); -- END IF; -- ELSE -- g_boolean := caco_utilities.raise_error(-20100); -- WSGL.DisplayMessage( WSGL.MESS_ERROR , cg$errors.GetErrors , ''||' : '||caco_utilities.get_module_text(3800) , NULL ); -- END IF; -- htp.p('
'); -- caco_system.footer(TRUE); -- EXCEPTION WHEN OTHERS THEN htp.p(sqlerrm); END action; -- -- Load template -- PROCEDURE load_template ( p_int_id IN interruptions.int_id%TYPE DEFAULT NULL , p_intm_id IN interruption_templates.intm_id%TYPE DEFAULT NULL , p_action IN VARCHAR2 DEFAULT NULL ) IS -- lr_intm interruption_templates%ROWTYPE; -- BEGIN -- -- Security check -- IF NOT caco_security.security_check(g_package_name) THEN RETURN; END IF; -- -- Check Supplied Parameters -- IF (p_int_id IS NOT NULL) OR (p_int_id IS NOT NULL AND p_action IS NOT NULL AND p_intm_id IS NOT NULL) THEN -- IF p_action = caco_utilities.get_module_text(3852) THEN -- Load -- action ( p_action => 'template' , p_int_id => p_int_id , p_intm_id => p_intm_id ); -- ELSE -- -- Output standard page header -- page_head; -- htp.br; -- -- Secondary Title -- htp.header(nsize => 1 ,cheader => caco_utilities.get_module_text(p_text_number => 3807) ); -- IF p_action IS NOT NULL AND p_action = caco_utilities.get_module_text(838) THEN -- Delete -- BEGIN -- SELECT * INTO lr_intm FROM interruption_templates intm WHERE intm.intm_id = p_intm_id; -- EXCEPTION WHEN OTHERS THEN NULL; END; -- DELETE intm_conp_coca_vals itcv WHERE itcv.intm_id = p_intm_id; -- DELETE interruption_templates intm WHERE intm.intm_id = p_intm_id; -- g_boolean := display_success( 1 , caco_utilities.get_module_text(894)||lr_intm.name ); -- END IF; -- htp.p('
'); htp.para; htp.p(''); htp.p(''); htp.p(''); htp.p('
'||caco_utilities.get_module_text(2444)||':
'); htp.para; -- htp.p(''); htp.p(''); htp.p('#'); htp.p(''); -- htp.p('
'); -- END IF; -- ELSE -- -- Output standard page header -- page_head; -- htp.br; -- -- Secondary Title -- htp.header(nsize => 1 ,cheader => caco_utilities.get_module_text(p_text_number => 3807) ); -- g_boolean := caco_utilities.raise_error(-20100); -- WSGL.DisplayMessage( WSGL.MESS_ERROR , cg$errors.GetErrors , ''||' : '||caco_utilities.get_module_text(3800) , NULL ); -- END IF; -- caco_system.footer(TRUE); -- END load_template; -- BEGIN -- Initialization NULL; END efnow210$intz; /