create or replace package body efnow240$int is function BuildSQL( P_UI_STATUS in varchar2 default null, P_UI_QUERY_DATE in varchar2 default null, U_UI_QUERY_DATE in varchar2 default null, P_UI_CATE_NAME in varchar2 default null, P_UI_NEPO_CODE in varchar2 default null, P_UI_CUST_NAME in varchar2 default null, P_UI_CONTRACT_NUMBER in varchar2 default null, Z_QUERY_BY_KEY in boolean default false, Z_ROW_ID in ROWID default null, Z_BIND_ROW_ID in boolean default false) return boolean; procedure OpenZoneSql ( I_CURSOR OUT integer ); procedure AssignZoneRow( I_CURSOR IN integer ); function PreQuery( P_UI_STATUS in varchar2 default null, P_UI_QUERY_DATE in varchar2 default null, U_UI_QUERY_DATE in varchar2 default null, P_UI_CATE_NAME in varchar2 default null, P_UI_NEPO_CODE in varchar2 default null, P_UI_CUST_NAME in varchar2 default null, P_UI_CONTRACT_NUMBER in varchar2 default null) return boolean; function PostQuery(Z_POST_DML in boolean, Z_UPDATE_ROW in out boolean) return boolean; QF_BODY_ATTRIBUTES constant varchar2(500) := ''; QF_QUERY_BUT_CAPTION constant varchar2(100) := WSGL.MsgGetText(3,WSGLM.CAP003_QF_FIND); QF_CLEAR_BUT_CAPTION constant varchar2(100) := WSGL.MsgGetText(4,WSGLM.CAP004_QF_CLEAR); QF_QUERY_BUT_ACTION constant varchar2(10) := 'QUERY'; QF_CLEAR_BUT_ACTION constant varchar2(10) := 'CLEAR'; QF_NUMBER_OF_COLUMNS constant number(4) := 1; VF_BODY_ATTRIBUTES constant varchar2(500) := ''; IF_BODY_ATTRIBUTES constant varchar2(500) := ''; RL_BODY_ATTRIBUTES constant varchar2(500) := ''; RL_NEXT_BUT_CAPTION constant varchar2(100) := WSGL.MsgGetText(11,WSGLM.CAP011_RL_NEXT); RL_PREV_BUT_CAPTION constant varchar2(100) := WSGL.MsgGetText(12,WSGLM.CAP012_RL_PREVIOUS); RL_FIRST_BUT_CAPTION constant varchar2(100) := WSGL.MsgGetText(13,WSGLM.CAP013_RL_FIRST); RL_LAST_BUT_CAPTION constant varchar2(100) := WSGL.MsgGetText(14,WSGLM.CAP014_RL_LAST); RL_COUNT_BUT_CAPTION constant varchar2(100) := WSGL.MsgGetText(15,WSGLM.CAP015_RL_COUNT); RL_REQUERY_BUT_CAPTION constant varchar2(100) := WSGL.MsgGetText(16,WSGLM.CAP016_RL_REQUERY); RL_QUERY_BUT_CAPTION constant varchar2(100) := WSGL.MsgGetText(24,WSGLM.CAP024_RL_QUERY); RL_QUERY_BUT_ACTION constant varchar2(10) := 'QUERY'; RL_NEXT_BUT_ACTION constant varchar2(10) := 'NEXT'; RL_PREV_BUT_ACTION constant varchar2(10) := 'PREV'; RL_FIRST_BUT_ACTION constant varchar2(10) := 'FIRST'; RL_LAST_BUT_ACTION constant varchar2(10) := 'LAST'; RL_COUNT_BUT_ACTION constant varchar2(10) := 'COUNT'; RL_REQUERY_BUT_ACTION constant varchar2(10) := 'REQUERY'; RL_RECORD_SET_SIZE constant number(4) := 0; RL_TOTAL_COUNT_REQD constant boolean := FALSE; RL_NUMBER_OF_COLUMNS constant number(4) := 1; LOV_BODY_ATTRIBUTES constant varchar2(500) := ''; LOV_FIND_BUT_CAPTION constant varchar2(100) := WSGL.MsgGetText(17,WSGLM.CAP017_LOV_FIND); LOV_CLOSE_BUT_CAPTION constant varchar2(100) := WSGL.MsgGetText(18,WSGLM.CAP018_LOV_CLOSE); LOV_FIND_BUT_ACTION constant varchar2(10) := 'FIND'; LOV_CLOSE_BUT_ACTION constant varchar2(10) := 'CLOSE'; LOV_BUTTON_TEXT constant varchar2(100) := htf.img('/framework/images/lov.gif','TOP','List Values',NULL,'WIDTH=18 HEIGHT=22 BORDER=0'); LOV_FRAME constant varchar2(20) := null; CAL_BUTTON_TEXT constant varchar2(100) := htf.img('/framework/images/lov.gif','TOP','List Values',NULL,'WIDTH=18 HEIGHT=22 BORDER=0'); CAL_CLOSE_BUT_CAPTION constant varchar2(100) := WSGL.MsgGetText(18,WSGLM.CAP025_CAL_CLOSE); CAL_BODY_ATTRIBUTES constant varchar2(500) := ''; TF_BODY_ATTRIBUTES constant varchar2(500) := ''; DEF_BODY_ATTRIBUTES constant varchar2(500) := ''; type FORM_REC is record (GAS_YEAR varchar2(24) ,CUSTOMER_NAME varchar2(600) ,CONTRACT_NUMBER varchar2(180) ,CATEGORY_NAME varchar2(900) ,NETWORK_POINT varchar2(420) ,NO_OF_INTERRUPTIONS varchar2(40) ,ACCUMULATED_TIME varchar2(40) ,UI_STATUS varchar2(32760) ,UI_ORDER_BY varchar2(24000) ,UI_QUERY_DATE varchar2(40) ,UI_CATE_NAME varchar2(32760) ,UI_NEPO_CODE varchar2(32760) ,UI_CUST_NAME varchar2(32760) ,UI_CONTRACT_NUMBER varchar2(32760) ); FORM_VAL FORM_REC; PROCESSING_VIEW boolean := false; ZONE_SQL varchar2(32767) := null; ZONE_CHECKSUM varchar2(10); REF_COMPONENT WSGOC.COMPONENT_REF; R_GAS_YEAR WSGOC.ITEM_REF; R_CUSTOMER_NAME WSGOC.ITEM_REF; R_CONTRACT_NUMBER WSGOC.ITEM_REF; R_CATEGORY_NAME WSGOC.ITEM_REF; R_NETWORK_POINT WSGOC.ITEM_REF; R_NO_OF_INTERRUPTIONS WSGOC.ITEM_REF; R_ACCUMULATED_TIME WSGOC.ITEM_REF; R_UI_STATUS WSGOC.ITEM_REF; R_UI_ORDER_BY WSGOC.ITEM_REF; R_UI_QUERY_DATE WSGOC.ITEM_REF; R_UI_CATE_NAME WSGOC.ITEM_REF; R_UI_NEPO_CODE WSGOC.ITEM_REF; R_UI_CUST_NAME WSGOC.ITEM_REF; R_UI_CONTRACT_NUMBER WSGOC.ITEM_REF; -------------------------------------------------------------------------------- -- Name: efnow240$int.PreQuery -- -- Description: Provides place holder for code to be run prior to a query -- for the 'INT' module component (#View Interruptions#2504#). -- -- Parameters: None -- -- Returns: True If success -- False Otherwise -- -------------------------------------------------------------------------------- function PreQuery( P_UI_STATUS in varchar2, P_UI_QUERY_DATE in varchar2, U_UI_QUERY_DATE in varchar2, P_UI_CATE_NAME in varchar2, P_UI_NEPO_CODE in varchar2, P_UI_CUST_NAME in varchar2, P_UI_CONTRACT_NUMBER in varchar2) return boolean is L_RET_VAL boolean := TRUE; begin -- populate_table -- -- DECLARE CURSOR c_cate IS SELECT cate_id FROM categories WHERE name = p_ui_cate_name; CURSOR c_nepo IS SELECT nepo_id FROM network_points WHERE code = p_ui_nepo_code; CURSOR c_cust IS SELECT cust_id FROM customers WHERE name = p_ui_cust_name; CURSOR c_cont IS SELECT cont_id FROM contracts WHERE contract_number = p_ui_contract_number; l_cate_id NUMBER; l_nepo_id NUMBER; l_cust_id NUMBER; l_cont_id NUMBER; BEGIN OPEN c_cate; FETCH c_cate INTO l_cate_id; CLOSE c_cate; OPEN c_nepo; FETCH c_nepo INTO l_nepo_id; CLOSE c_nepo; OPEN c_cust; FETCH c_cust INTO l_cust_id; CLOSE c_cust; OPEN c_cont; FETCH c_cont INTO l_cont_id; CLOSE c_cont; populate_gtt_interruptions (p_gas_day_start => to_date(p_ui_query_date,cout_system_configuration.get_configuration_item('G_DATE_FORMAT')) ,p_gas_day_end => to_date(u_ui_query_date,cout_system_configuration.get_configuration_item('G_DATE_FORMAT')) ,p_cate_id => l_cate_id ,p_nepo_id => l_nepo_id ,p_cust_id => l_cust_id ,p_cont_id => l_cont_id ,p_status => p_ui_status ); END; return L_RET_VAL; exception when others then WSGL.DisplayMessage(WSGL.MESS_EXCEPTION, SQLERRM, ''||' : '||'#View Interruptions#2504#', DEF_BODY_ATTRIBUTES, 'efnow240$int.PreQuery'); return FALSE; end; PROCEDURE populate_gtt_interruptions (p_gas_day_start IN DATE, p_gas_day_end IN DATE, p_cate_id IN NUMBER, p_nepo_id IN NUMBER, p_cust_id IN NUMBER, p_cont_id IN NUMBER, p_status IN VARCHAR2) IS -- populate_gtt_interruptions -- -- -- CURSOR c_int IS SELECT TO_CHAR(int.gas_day_start,'YYYY') + DECODE(SIGN(TO_NUMBER(TO_CHAR(int.gas_day_start,'MM'))-7),-1,0,0,0,1) gas_year, cust.name customer_name, cont.contract_number contract_number, cate.name category_name, nepo.code||' '||nepo.name network_point, COUNT(DISTINCT(int.int_id)) no_of_interruptions, SUM((int.gas_day_end - int.gas_day_start)+1) accumulated_time FROM interruptions int, int_conp_coca_vals iccp, customers cust, cont_network_points conp, network_points nepo, contract_categories coca, categories cate, contracts cont WHERE int.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 conp.cont_id = cont.cont_id AND cont.cust_id = cust.cust_id AND (cust.cust_id = p_cust_id OR p_cust_id IS NULL) AND (cont.cont_id = p_cont_id OR p_cont_id IS NULL) AND (int.gas_day_start >= p_gas_day_start OR p_gas_day_start IS NULL) AND (int.gas_day_end <= p_gas_day_end OR p_gas_day_end IS NULL) AND (nepo.nepo_id = p_nepo_id OR p_nepo_id IS NULL) AND (cate.cate_id = p_cate_id OR p_cate_id IS NULL) AND (cont.status = DECODE(NVL(p_status,'A'),'A',cont.status,p_status)) AND iccp.send_to_customer = 'Y' GROUP BY cust.name,cont.contract_number,cate.name,nepo.code||' '||nepo.name, TO_CHAR(int.gas_day_start,'YYYY') + DECODE(SIGN(TO_NUMBER(TO_CHAR(int.gas_day_start,'MM'))-7),-1,0,0,0,1); -- BEGIN -- FOR r IN c_int LOOP -- BEGIN -- INSERT INTO gtt_interruptions ( gas_year , customer_name , contract_number , category_name , network_point , no_of_interruptions , accumulated_time ) VALUES ( r.gas_year , r.customer_name , r.contract_number , r.category_name , r.network_point , r.no_of_interruptions , r.accumulated_time ); -- EXCEPTION WHEN others THEN caco_debug.putline('an unexpected error has occured: '||sqlerrm(sqlcode)); -- EXIT; -- END; -- END LOOP; -- END populate_gtt_interruptions; -------------------------------------------------------------------------------- -- Name: efnow240$int.CUST_LOV_LOV -- -- Description: This procedure displays the 'CUST_LOV' LOV -- -------------------------------------------------------------------------------- procedure CUST_LOV_LOV( Z_FILTER in varchar2, Z_MODE in varchar2, Z_CALLER_URL in varchar2, Z_FORMROW in number, Z_LONG_LIST in varchar2, Z_ISSUE_WAIT in varchar2) is L_SEARCH_STRING varchar2(1000); L_ABORT boolean := FALSE; L_INVALID_DEPENDENT boolean := FALSE; L_ANY boolean := FALSE; L_BODY_ATTRIBUTES VarChar2 (1000) := LOV_BODY_ATTRIBUTES; L_SUCCESS boolean := TRUE ; begin if not caco_security.security_check('efnow240$int') then return; end if; WSGL.RegisterURL('efnow240$int.CUST_LOV_LOV'); WSGL.AddURLParam('Z_FILTER', Z_FILTER); WSGL.AddURLParam('Z_MODE', Z_MODE); WSGL.AddURLParam('Z_CALLER_URL', Z_CALLER_URL); WSGL.AddURLParam('Z_FORMROW', Z_FORMROW); if WSGL.NotLowerCase then return; end if; WSGL.OpenPageHead; WSGL.METATag; htp.p(' '); if Z_ISSUE_WAIT is not null then htp.p (''); L_BODY_ATTRIBUTES := L_BODY_ATTRIBUTES || ' OnLoad="RefreshMe()"'; else if Z_FORMROW = -1 then htp.p(''); end if; efnow240$.TemplateHeader(TRUE,7); WSGL.ClosePageHead; WSGL.OpenPageBody(FALSE, p_attributes=>L_BODY_ATTRIBUTES); htp.p(' '); if Z_ISSUE_WAIT is not null then htp.p(WSGL.MsgGetText(127,WSGLM.DSP127_LOV_PLEASE_WAIT)); WSGL.ClosePageBody; return; end if; htp.formOpen(lower('efnow240$int.CUST_LOV_LOV')); WSGL.HiddenField('Z_CALLER_URL', Z_CALLER_URL); WSGL.HiddenField('Z_MODE', Z_MODE); SaveState; WSGL.HiddenField('Z_FORMROW',Z_FORMROW); L_SEARCH_STRING := rtrim(Z_FILTER); if L_SEARCH_STRING is not null then if ((instr(Z_FILTER,'%') = 0) and (instr(Z_FILTER,'_') = 0)) then L_SEARCH_STRING := L_SEARCH_STRING || '%'; end if; else L_SEARCH_STRING := '%'; end if; htp.para; htp.p(WSGL.MsgGetText(19,WSGLM.CAP019_LOV_FILTER_CAPTION,'Name')); htp.para; htp.formText('Z_FILTER', cvalue=>L_SEARCH_STRING); htp.p(''); if LOV_FRAME is null then htp.p(''); end if; htp.formClose; if L_INVALID_DEPENDENT then WSGL.DisplayMessage(WSGL.MESS_ERROR, cg$errors.GetErrors, '', LOV_BODY_ATTRIBUTES); end if; if Z_LONG_LIST is not null then if not L_ABORT and L_SEARCH_STRING is null then htp.p(WSGL.MsgGetText(124,WSGLM.DSP124_LOV_ENTER_SEARCH)); L_ABORT := TRUE; end if; end if; if not L_ABORT then WSGL.LayoutOpen(WSGL.LAYOUT_TABLE, TRUE); WSGL.LayoutRowStart; WSGL.LayoutHeader(1, 'LEFT', 'Name'); WSGL.LayoutRowEnd; declare l_uu varchar2(100); l_ul varchar2(100); l_lu varchar2(100); l_ll varchar2(100); l_retval number; cursor c_lov ( z_mode in varchar2 , z_filter in varchar2 , z_uu in varchar2 , z_ul in varchar2 , z_lu in varchar2 , z_ll in varchar2 ) is SELECT CUST.CUST_ID CUST_ID, CUST.NAME NAME FROM CUSTOMERS CUST WHERE (CUST.NAME like z_uu||'%' or CUST.NAME like z_ul||'%' or CUST.NAME like z_lu||'%' or CUST.NAME like z_ll||'%') and upper(CUST.NAME) like upper(z_filter) ORDER BY NAME ; begin l_retval := WSGL.SearchComponents(L_SEARCH_STRING,l_uu,l_ul,l_lu,l_ll); for c1rec in c_lov(Z_MODE, L_SEARCH_STRING,l_uu,l_ul,l_lu,l_ll) loop WSGL.LayoutRowStart('TOP'); WSGL.LayoutData(''||WSGL.EscapeItem(c1rec.NAME)||''); WSGL.LayoutRowEnd; l_any := true; end loop; WSGL.LayoutClose; if not l_any then htp.p(WSGL.MsgGetText(224,WSGLM.MSG224_LOV_NO_ROWS)); end if; end; end if; htp.p(''); WSGL.ClosePageBody; exception when others then WSGL.DisplayMessage(WSGL.MESS_EXCEPTION, SQLERRM, '', LOV_BODY_ATTRIBUTES, 'efnow240$int.CUST_LOV_LOV'); end; -------------------------------------------------------------------------------- -- Name: efnow240$int.NEPO_LOV_LOV -- -- Description: This procedure displays the 'NEPO_LOV' LOV -- -------------------------------------------------------------------------------- procedure NEPO_LOV_LOV( Z_FILTER in varchar2, Z_MODE in varchar2, Z_CALLER_URL in varchar2, Z_FORMROW in number, Z_LONG_LIST in varchar2, Z_ISSUE_WAIT in varchar2) is L_SEARCH_STRING varchar2(1000); L_ABORT boolean := FALSE; L_INVALID_DEPENDENT boolean := FALSE; L_ANY boolean := FALSE; L_BODY_ATTRIBUTES VarChar2 (1000) := LOV_BODY_ATTRIBUTES; L_SUCCESS boolean := TRUE ; begin if not caco_security.security_check('efnow240$int') then return; end if; WSGL.RegisterURL('efnow240$int.NEPO_LOV_LOV'); WSGL.AddURLParam('Z_FILTER', Z_FILTER); WSGL.AddURLParam('Z_MODE', Z_MODE); WSGL.AddURLParam('Z_CALLER_URL', Z_CALLER_URL); WSGL.AddURLParam('Z_FORMROW', Z_FORMROW); if WSGL.NotLowerCase then return; end if; WSGL.OpenPageHead; WSGL.METATag; htp.p(' '); if Z_ISSUE_WAIT is not null then htp.p (''); L_BODY_ATTRIBUTES := L_BODY_ATTRIBUTES || ' OnLoad="RefreshMe()"'; else if Z_FORMROW = -1 then htp.p(''); end if; efnow240$.TemplateHeader(TRUE,7); WSGL.ClosePageHead; WSGL.OpenPageBody(FALSE, p_attributes=>L_BODY_ATTRIBUTES); htp.p(' '); if Z_ISSUE_WAIT is not null then htp.p(WSGL.MsgGetText(127,WSGLM.DSP127_LOV_PLEASE_WAIT)); WSGL.ClosePageBody; return; end if; htp.formOpen(lower('efnow240$int.NEPO_LOV_LOV')); WSGL.HiddenField('Z_CALLER_URL', Z_CALLER_URL); WSGL.HiddenField('Z_MODE', Z_MODE); SaveState; WSGL.HiddenField('Z_FORMROW',Z_FORMROW); L_SEARCH_STRING := rtrim(Z_FILTER); if L_SEARCH_STRING is not null then if ((instr(Z_FILTER,'%') = 0) and (instr(Z_FILTER,'_') = 0)) then L_SEARCH_STRING := L_SEARCH_STRING || '%'; end if; else L_SEARCH_STRING := '%'; end if; htp.para; htp.p(WSGL.MsgGetText(19,WSGLM.CAP019_LOV_FILTER_CAPTION,'Code')); htp.para; htp.formText('Z_FILTER', cvalue=>L_SEARCH_STRING); htp.p(''); if LOV_FRAME is null then htp.p(''); end if; htp.formClose; if L_INVALID_DEPENDENT then WSGL.DisplayMessage(WSGL.MESS_ERROR, cg$errors.GetErrors, '', LOV_BODY_ATTRIBUTES); end if; if Z_LONG_LIST is not null then if not L_ABORT and L_SEARCH_STRING is null then htp.p(WSGL.MsgGetText(124,WSGLM.DSP124_LOV_ENTER_SEARCH)); L_ABORT := TRUE; end if; end if; if not L_ABORT then WSGL.LayoutOpen(WSGL.LAYOUT_TABLE, TRUE); WSGL.LayoutRowStart; WSGL.LayoutHeader(1, 'LEFT', 'Code'); WSGL.LayoutRowEnd; declare l_uu varchar2(100); l_ul varchar2(100); l_lu varchar2(100); l_ll varchar2(100); l_retval number; cursor c_lov ( z_mode in varchar2 , z_filter in varchar2 , z_uu in varchar2 , z_ul in varchar2 , z_lu in varchar2 , z_ll in varchar2 ) is SELECT NEPO.CODE CODE, NEPO.NEPO_ID NEPO_ID FROM NETWORK_POINTS NEPO WHERE (NEPO.CODE like z_uu||'%' or NEPO.CODE like z_ul||'%' or NEPO.CODE like z_lu||'%' or NEPO.CODE like z_ll||'%') and upper(NEPO.CODE) like upper(z_filter) ; begin l_retval := WSGL.SearchComponents(L_SEARCH_STRING,l_uu,l_ul,l_lu,l_ll); for c1rec in c_lov(Z_MODE, L_SEARCH_STRING,l_uu,l_ul,l_lu,l_ll) loop WSGL.LayoutRowStart('TOP'); WSGL.LayoutData(''||WSGL.EscapeItem(c1rec.CODE)||''); WSGL.LayoutRowEnd; l_any := true; end loop; WSGL.LayoutClose; if not l_any then htp.p(WSGL.MsgGetText(224,WSGLM.MSG224_LOV_NO_ROWS)); end if; end; end if; htp.p(''); WSGL.ClosePageBody; exception when others then WSGL.DisplayMessage(WSGL.MESS_EXCEPTION, SQLERRM, '', LOV_BODY_ATTRIBUTES, 'efnow240$int.NEPO_LOV_LOV'); end; -------------------------------------------------------------------------------- -- Name: efnow240$int.CONT_LOV_LOV -- -- Description: This procedure displays the 'CONT_LOV' LOV -- -------------------------------------------------------------------------------- procedure CONT_LOV_LOV( Z_FILTER in varchar2, Z_MODE in varchar2, Z_CALLER_URL in varchar2, P_UI_STATUS in varchar2, P_UI_CUST_NAME in varchar2, Z_FORMROW in number, Z_LONG_LIST in varchar2, Z_ISSUE_WAIT in varchar2) is L_SEARCH_STRING varchar2(1000); L_ABORT boolean := FALSE; L_INVALID_DEPENDENT boolean := FALSE; L_ANY boolean := FALSE; L_BODY_ATTRIBUTES VarChar2 (1000) := LOV_BODY_ATTRIBUTES; L_SUCCESS boolean := TRUE ; begin if not caco_security.security_check('efnow240$int') then return; end if; WSGL.RegisterURL('efnow240$int.CONT_LOV_LOV'); WSGL.AddURLParam('Z_FILTER', Z_FILTER); WSGL.AddURLParam('Z_MODE', Z_MODE); WSGL.AddURLParam('Z_CALLER_URL', Z_CALLER_URL); WSGL.AddURLParam('P_UI_STATUS', P_UI_STATUS); WSGL.AddURLParam('P_UI_CUST_NAME', P_UI_CUST_NAME); WSGL.AddURLParam('Z_FORMROW', Z_FORMROW); if WSGL.NotLowerCase then return; end if; WSGL.OpenPageHead; WSGL.METATag; htp.p(' '); if Z_ISSUE_WAIT is not null then htp.p (''); L_BODY_ATTRIBUTES := L_BODY_ATTRIBUTES || ' OnLoad="RefreshMe()"'; else if Z_FORMROW = -1 then htp.p(''); end if; efnow240$.TemplateHeader(TRUE,7); WSGL.ClosePageHead; WSGL.OpenPageBody(FALSE, p_attributes=>L_BODY_ATTRIBUTES); htp.p(' '); if Z_ISSUE_WAIT is not null then htp.p(WSGL.MsgGetText(127,WSGLM.DSP127_LOV_PLEASE_WAIT)); WSGL.ClosePageBody; return; end if; htp.formOpen(lower('efnow240$int.CONT_LOV_LOV')); WSGL.HiddenField('Z_CALLER_URL', Z_CALLER_URL); WSGL.HiddenField('Z_MODE', Z_MODE); SaveState; WSGL.HiddenField('P_UI_STATUS', P_UI_STATUS); WSGL.HiddenField('P_UI_CUST_NAME', P_UI_CUST_NAME); WSGL.HiddenField('Z_FORMROW',Z_FORMROW); L_SEARCH_STRING := rtrim(Z_FILTER); if L_SEARCH_STRING is not null then if ((instr(Z_FILTER,'%') = 0) and (instr(Z_FILTER,'_') = 0)) then L_SEARCH_STRING := L_SEARCH_STRING || '%'; end if; else L_SEARCH_STRING := '%'; end if; htp.para; htp.p(WSGL.MsgGetText(19,WSGLM.CAP019_LOV_FILTER_CAPTION,'Contract Number')); htp.para; htp.formText('Z_FILTER', cvalue=>L_SEARCH_STRING); htp.p(''); if LOV_FRAME is null then htp.p(''); end if; htp.formClose; if Z_MODE = 'Q' then NBT_VAL.UI_STATUS := P_UI_STATUS; NBT_VAL.UI_CUST_NAME := P_UI_CUST_NAME; end if; if L_INVALID_DEPENDENT then WSGL.DisplayMessage(WSGL.MESS_ERROR, cg$errors.GetErrors, '', LOV_BODY_ATTRIBUTES); end if; if Z_LONG_LIST is not null then if not L_ABORT and L_SEARCH_STRING is null then htp.p(WSGL.MsgGetText(124,WSGLM.DSP124_LOV_ENTER_SEARCH)); L_ABORT := TRUE; end if; end if; if not L_ABORT then WSGL.LayoutOpen(WSGL.LAYOUT_TABLE, TRUE); WSGL.LayoutRowStart; WSGL.LayoutHeader(1, 'LEFT', 'Contract Number'); WSGL.LayoutRowEnd; declare l_uu varchar2(100); l_ul varchar2(100); l_lu varchar2(100); l_ll varchar2(100); l_retval number; cursor c_lov ( z_mode in varchar2 , z_filter in varchar2 , z_uu in varchar2 , z_ul in varchar2 , z_lu in varchar2 , z_ll in varchar2 ) is SELECT CONT.CONTRACT_NUMBER CONTRACT_NUMBER, CONT.CONT_ID CONT_ID FROM CONTRACTS CONT WHERE /* CG$LOVI_WC_START CONT_LOV 1 */ ((cont.status = DECODE(NVL(efnow240$int.NBT_VAL.UI_STATUS,'A'),'A',cont.status,efnow240$int.NBT_VAL.UI_STATUS)) AND (EXISTS (SELECT 1 FROM customers cu WHERE cu.name = efnow240$int.NBT_VAL.UI_CUST_NAME AND cu.cust_id = cont.cust_id AND efnow240$int.NBT_VAL.UI_CUST_NAME IS NOT NULL UNION SELECT 1 FROM dual WHERE efnow240$int.NBT_VAL.UI_CUST_NAME IS NULL))) /* CG$LOVI_WC_END CONT_LOV 1 */ AND (CONT.CONTRACT_NUMBER like z_uu||'%' or CONT.CONTRACT_NUMBER like z_ul||'%' or CONT.CONTRACT_NUMBER like z_lu||'%' or CONT.CONTRACT_NUMBER like z_ll||'%') and upper(CONT.CONTRACT_NUMBER) like upper(z_filter) ORDER BY CONTRACT_NUMBER ; begin l_retval := WSGL.SearchComponents(L_SEARCH_STRING,l_uu,l_ul,l_lu,l_ll); for c1rec in c_lov(Z_MODE, L_SEARCH_STRING,l_uu,l_ul,l_lu,l_ll) loop WSGL.LayoutRowStart('TOP'); WSGL.LayoutData(''||WSGL.EscapeItem(c1rec.CONTRACT_NUMBER)||''); WSGL.LayoutRowEnd; l_any := true; end loop; WSGL.LayoutClose; if not l_any then htp.p(WSGL.MsgGetText(224,WSGLM.MSG224_LOV_NO_ROWS)); end if; end; end if; htp.p(''); WSGL.ClosePageBody; exception when others then WSGL.DisplayMessage(WSGL.MESS_EXCEPTION, SQLERRM, '', LOV_BODY_ATTRIBUTES, 'efnow240$int.CONT_LOV_LOV'); end; -------------------------------------------------------------------------------- -- Name: efnow240$int.CATE_LOV_LOV -- -- Description: This procedure displays the 'CATE_LOV' LOV -- -------------------------------------------------------------------------------- procedure CATE_LOV_LOV( Z_FILTER in varchar2, Z_MODE in varchar2, Z_CALLER_URL in varchar2, Z_FORMROW in number, Z_LONG_LIST in varchar2, Z_ISSUE_WAIT in varchar2) is L_SEARCH_STRING varchar2(1000); L_ABORT boolean := FALSE; L_INVALID_DEPENDENT boolean := FALSE; L_ANY boolean := FALSE; L_BODY_ATTRIBUTES VarChar2 (1000) := LOV_BODY_ATTRIBUTES; L_SUCCESS boolean := TRUE ; begin if not caco_security.security_check('efnow240$int') then return; end if; WSGL.RegisterURL('efnow240$int.CATE_LOV_LOV'); WSGL.AddURLParam('Z_FILTER', Z_FILTER); WSGL.AddURLParam('Z_MODE', Z_MODE); WSGL.AddURLParam('Z_CALLER_URL', Z_CALLER_URL); WSGL.AddURLParam('Z_FORMROW', Z_FORMROW); if WSGL.NotLowerCase then return; end if; WSGL.OpenPageHead; WSGL.METATag; htp.p(' '); if Z_ISSUE_WAIT is not null then htp.p (''); L_BODY_ATTRIBUTES := L_BODY_ATTRIBUTES || ' OnLoad="RefreshMe()"'; else if Z_FORMROW = -1 then htp.p(''); end if; efnow240$.TemplateHeader(TRUE,7); WSGL.ClosePageHead; WSGL.OpenPageBody(FALSE, p_attributes=>L_BODY_ATTRIBUTES); htp.p(' '); if Z_ISSUE_WAIT is not null then htp.p(WSGL.MsgGetText(127,WSGLM.DSP127_LOV_PLEASE_WAIT)); WSGL.ClosePageBody; return; end if; htp.formOpen(lower('efnow240$int.CATE_LOV_LOV')); WSGL.HiddenField('Z_CALLER_URL', Z_CALLER_URL); WSGL.HiddenField('Z_MODE', Z_MODE); SaveState; WSGL.HiddenField('Z_FORMROW',Z_FORMROW); L_SEARCH_STRING := rtrim(Z_FILTER); if L_SEARCH_STRING is not null then if ((instr(Z_FILTER,'%') = 0) and (instr(Z_FILTER,'_') = 0)) then L_SEARCH_STRING := L_SEARCH_STRING || '%'; end if; else L_SEARCH_STRING := '%'; end if; htp.para; htp.p(WSGL.MsgGetText(19,WSGLM.CAP019_LOV_FILTER_CAPTION,'Name')); htp.para; htp.formText('Z_FILTER', cvalue=>L_SEARCH_STRING); htp.p(''); if LOV_FRAME is null then htp.p(''); end if; htp.formClose; if L_INVALID_DEPENDENT then WSGL.DisplayMessage(WSGL.MESS_ERROR, cg$errors.GetErrors, '', LOV_BODY_ATTRIBUTES); end if; if Z_LONG_LIST is not null then if not L_ABORT and L_SEARCH_STRING is null then htp.p(WSGL.MsgGetText(124,WSGLM.DSP124_LOV_ENTER_SEARCH)); L_ABORT := TRUE; end if; end if; if not L_ABORT then WSGL.LayoutOpen(WSGL.LAYOUT_TABLE, TRUE); WSGL.LayoutRowStart; WSGL.LayoutHeader(1, 'LEFT', 'Name'); WSGL.LayoutRowEnd; declare l_uu varchar2(100); l_ul varchar2(100); l_lu varchar2(100); l_ll varchar2(100); l_retval number; cursor c_lov ( z_mode in varchar2 , z_filter in varchar2 , z_uu in varchar2 , z_ul in varchar2 , z_lu in varchar2 , z_ll in varchar2 ) is SELECT CATE.NAME NAME FROM CATEGORIES CATE WHERE (CATE.NAME like z_uu||'%' or CATE.NAME like z_ul||'%' or CATE.NAME like z_lu||'%' or CATE.NAME like z_ll||'%') and upper(CATE.NAME) like upper(z_filter) ; begin l_retval := WSGL.SearchComponents(L_SEARCH_STRING,l_uu,l_ul,l_lu,l_ll); for c1rec in c_lov(Z_MODE, L_SEARCH_STRING,l_uu,l_ul,l_lu,l_ll) loop WSGL.LayoutRowStart('TOP'); WSGL.LayoutData(''||WSGL.EscapeItem(c1rec.NAME)||''); WSGL.LayoutRowEnd; l_any := true; end loop; WSGL.LayoutClose; if not l_any then htp.p(WSGL.MsgGetText(224,WSGLM.MSG224_LOV_NO_ROWS)); end if; end; end if; htp.p(''); WSGL.ClosePageBody; exception when others then WSGL.DisplayMessage(WSGL.MESS_EXCEPTION, SQLERRM, '', LOV_BODY_ATTRIBUTES, 'efnow240$int.CATE_LOV_LOV'); end; -------------------------------------------------------------------------------- -- Name: efnow240$int.InitialiseDomain -- -- Description: Initialises the Domain Record for the given Column Usage -- -- Parameters: P_ALIAS The alias of the column usage -- -------------------------------------------------------------------------------- procedure InitialiseDomain(P_ALIAS in varchar2) is begin if not caco_security.security_check('efnow240$int') then return; end if; if P_ALIAS = 'UI_STATUS' and not D_UI_STATUS.Initialised then D_UI_STATUS.ColAlias := 'UI_STATUS'; D_UI_STATUS.ControlType := WSGL.DV_LIST; D_UI_STATUS.DispWidth := 10; D_UI_STATUS.DispHeight := 1; D_UI_STATUS.MaxWidth := 32760; D_UI_STATUS.UseMeanings := True; D_UI_STATUS.ColOptional := False; D_UI_STATUS.Vals(1) := 'C'; D_UI_STATUS.Meanings(1) := 'Closed'; D_UI_STATUS.Abbreviations(1) := ''; D_UI_STATUS.Vals(2) := 'O'; D_UI_STATUS.Meanings(2) := 'Open'; D_UI_STATUS.Abbreviations(2) := ''; D_UI_STATUS.Vals(3) := 'A'; D_UI_STATUS.Meanings(3) := 'All'; D_UI_STATUS.Abbreviations(3) := ''; D_UI_STATUS.NumOfVV := 3; D_UI_STATUS.Initialised := True; end if; exception when others then WSGL.DisplayMessage(WSGL.MESS_EXCEPTION, SQLERRM, ''||' : '||'#View Interruptions#2504#', DEF_BODY_ATTRIBUTES, 'efnow240$int.InitialseDomain'); end; -------------------------------------------------------------------------------- -- Name: efnow240$int.calendar -- -- Description: -- -- Parameters: -- -------------------------------------------------------------------------------- procedure calendar ( Z_FIELD_NAME in varchar2, Z_CALLER_URL in varchar2, Z_FIELD_VALUE in varchar2 default null, Z_FIELD_FORMAT in varchar2 default null, Z_FIELD_PROMPT in varchar2 default null ) is Field_Caption Varchar2 (2000); begin if Z_FIELD_PROMPT is null then Field_Caption := initcap (replace (substr (Z_FIELD_NAME, 3, length (Z_FIELD_NAME) - 2), '_', ' ')); else Field_Caption := initcap (replace (Z_FIELD_PROMPT, '_', ' ')); end if; WSGL.RegisterURL('efnow240$int.calendar'); WSGL.AddURLParam('Z_FIELD_NAME', Z_FIELD_NAME); WSGL.AddURLParam('Z_CALLER_URL', Z_CALLER_URL); if WSGL.NotLowerCase then return; end if; WSGL.Output_Calendar ( Z_FIELD_NAME, Z_FIELD_VALUE, Z_FIELD_FORMAT, WSGL.MsgGetText(123,WSGLM.DSP128_CAL_CAPTION, Field_Caption), CAL_BODY_ATTRIBUTES, 'efnow240$int', CAL_CLOSE_BUT_CAPTION, True, 'DD-MON-RRRR' ); efnow240$.TemplateHeader(TRUE,7); WSGL.Output_Calendar ( Z_FIELD_NAME, Z_FIELD_VALUE, Z_FIELD_FORMAT, WSGL.MsgGetText(123,WSGLM.DSP128_CAL_CAPTION, Field_Caption), CAL_BODY_ATTRIBUTES, 'efnow240$int', CAL_CLOSE_BUT_CAPTION, False, 'DD-MON-RRRR' ); exception when others then WSGL.DisplayMessage(WSGL.MESS_EXCEPTION, SQLERRM, '', CAL_BODY_ATTRIBUTES, 'efnow240$int.calendar'); end calendar; -------------------------------------------------------------------------------- -- Name: efnow240$int.format_cal_date -- -- Description: Converts the chosen date into the correct format using the format mask assigned -- to the field that the calendar was popped up for -- -------------------------------------------------------------------------------- procedure format_cal_date ( Z_FIELD_NAME in Varchar2, Z_FIELD_FORMAT in varchar2, day in varchar2, month in varchar2, year in varchar2 ) is Field_Caption Varchar2 (2000) := initcap (replace (substr (Z_FIELD_NAME, 3, length (Z_FIELD_NAME) - 2), '_', ' ')); l_day varchar2(15) := day; begin if l_day = '0' then l_day := '01'; end if; WSGL.Output_Format_Cal_JS ( WSGL.MsgGetText(123,WSGLM.DSP128_CAL_CAPTION, Field_Caption), CAL_BODY_ATTRIBUTES, l_day || '-' || month || '-' || year, Z_FIELD_FORMAT ); end format_cal_date; -------------------------------------------------------------------------------- -- Name: efnow240$int.Startup -- -- Description: Entry point for the 'INT' module -- component (#View Interruptions#2504#). -- -- Parameters: -- -------------------------------------------------------------------------------- procedure Startup( Z_DIRECT_CALL in boolean, Z_CHK in varchar2, Z_FORM in varchar2) is l_Foundform boolean := FALSE; l_fs_text varchar2(32767) := '' ; begin if not caco_security.security_check('efnow240$int') then return; end if; WSGL.RegisterURL('efnow240$int.startup'); WSGL.AddURLParam('Z_CHK', Z_CHK); WSGL.StoreURLLink(1, '#View Interruptions#2504#'); -- Either no frames are being used or the query form is on a -- separate page. if Z_FORM is not null then null; -- Work out which form is required, and check if that is possible if Z_FORM = 'QUERY' then FormQuery( Z_DIRECT_CALL=>TRUE); l_Foundform := TRUE; end if; if Z_FORM = 'LIST' then QueryList( Z_DIRECT_CALL=>TRUE); l_Foundform := TRUE; end if; end if; if l_Foundform = FALSE then FormQuery( Z_DIRECT_CALL=>TRUE); end if; exception when others then WSGL.DisplayMessage(WSGL.MESS_EXCEPTION, SQLERRM, ''||' : '||'#View Interruptions#2504#', DEF_BODY_ATTRIBUTES, 'efnow240$int.Startup'); end; -------------------------------------------------------------------------------- -- Name: efnow240$int.ActionQuery -- -- Description: Called when a Query form is subitted to action the query request. -- -- Parameters: -- -------------------------------------------------------------------------------- procedure ActionQuery( P_UI_STATUS in varchar2, P_UI_QUERY_DATE in varchar2, U_UI_QUERY_DATE in varchar2, P_UI_CATE_NAME in varchar2, P_UI_NEPO_CODE in varchar2, P_UI_CUST_NAME in varchar2, P_UI_CONTRACT_NUMBER in varchar2, Z_DIRECT_CALL in boolean default false, Z_ACTION in varchar2, Z_CHK in varchar2 ) is L_CHK varchar2(10) := Z_CHK; L_BUTCHK varchar2(100):= null; l_dummy_bool boolean := false; begin if not caco_security.security_check('efnow240$int') then return; end if; if not Z_DIRECT_CALL then null; end if; l_dummy_bool := RestoreState ( Z_CURR_DEPTH => 0 , Z_MAX_DEPTH => 99 , Z_RESTORE_OWN_ROW => false ); QueryList( P_UI_STATUS, P_UI_QUERY_DATE, U_UI_QUERY_DATE, P_UI_CATE_NAME, P_UI_NEPO_CODE, P_UI_CUST_NAME, P_UI_CONTRACT_NUMBER, Z_START=>null, Z_ACTION=>L_BUTCHK, Z_DIRECT_CALL=>TRUE); exception when others then WSGL.DisplayMessage(WSGL.MESS_EXCEPTION, SQLERRM, ''||' : '||'#View Interruptions#2504#', DEF_BODY_ATTRIBUTES, 'efnow240$int.ActionQuery'); end; -------------------------------------------------------------------------------- -- Name: efnow240$int.QueryHits -- -- Description: Returns the number or rows which matches the given search -- criteria (if any). -- -- Parameters: -- -------------------------------------------------------------------------------- function QueryHits( P_UI_STATUS in varchar2, P_UI_QUERY_DATE in varchar2, U_UI_QUERY_DATE in varchar2, P_UI_CATE_NAME in varchar2, P_UI_NEPO_CODE in varchar2, P_UI_CUST_NAME in varchar2, P_UI_CONTRACT_NUMBER in varchar2) return number is I_QUERY varchar2(32767) := ''; I_CURSOR integer; I_VOID integer; I_FROM_POS integer := 0; I_COUNT number(10); begin if not caco_security.security_check('efnow240$int') then return -1; end if; if not BuildSQL(P_UI_STATUS, P_UI_QUERY_DATE, U_UI_QUERY_DATE, P_UI_CATE_NAME, P_UI_NEPO_CODE, P_UI_CUST_NAME, P_UI_CONTRACT_NUMBER) then return -1; end if; if not PreQuery(P_UI_STATUS, P_UI_QUERY_DATE, U_UI_QUERY_DATE, P_UI_CATE_NAME, P_UI_NEPO_CODE, P_UI_CUST_NAME, P_UI_CONTRACT_NUMBER) then WSGL.DisplayMessage(WSGL.MESS_ERROR, cg$errors.GetErrors, ''||' : '||'#View Interruptions#2504#', DEF_BODY_ATTRIBUTES); return -1; end if; I_FROM_POS := instr(upper(ZONE_SQL), ' FROM '); if I_FROM_POS = 0 then return -1; end if; I_QUERY := 'SELECT count(*)' || substr(ZONE_SQL, I_FROM_POS); I_CURSOR := dbms_sql.open_cursor; dbms_sql.parse(I_CURSOR, I_QUERY, dbms_sql.v7); dbms_sql.define_column(I_CURSOR, 1, I_COUNT); I_VOID := dbms_sql.execute(I_CURSOR); I_VOID := dbms_sql.fetch_rows(I_CURSOR); dbms_sql.column_value(I_CURSOR, 1, I_COUNT); dbms_sql.close_cursor(I_CURSOR); return I_COUNT; exception when others then WSGL.DisplayMessage(WSGL.MESS_EXCEPTION, SQLERRM, ''||' : '||'#View Interruptions#2504#', DEF_BODY_ATTRIBUTES, 'efnow240$int.QueryHits'); return -1; end; -------------------------------------------------------------------------------- -- Name: efnow240$int.BuildSQL -- -- Description: Builds the SQL for the 'INT' module component (#View Interruptions#2504#). -- This incorporates all query criteria and Foreign key columns. -- -- Parameters: -- -------------------------------------------------------------------------------- function BuildSQL( P_UI_STATUS in varchar2, P_UI_QUERY_DATE in varchar2, U_UI_QUERY_DATE in varchar2, P_UI_CATE_NAME in varchar2, P_UI_NEPO_CODE in varchar2, P_UI_CUST_NAME in varchar2, P_UI_CONTRACT_NUMBER in varchar2, Z_QUERY_BY_KEY in boolean default false, Z_ROW_ID in ROWID default null, Z_BIND_ROW_ID in boolean default false) return boolean is I_WHERE varchar2(32767); row_idx integer; begin InitialiseDomain('UI_STATUS'); -- Build up the Where clause if Z_QUERY_BY_KEY then I_WHERE := 'WHERE GAS_YEAR = ''' || replace(CURR_VAL.GAS_YEAR, '''','''''') || ''' AND CUSTOMER_NAME = ''' || replace(CURR_VAL.CUSTOMER_NAME, '''','''''') || ''' AND CONTRACT_NUMBER = ''' || replace(CURR_VAL.CONTRACT_NUMBER, '''','''''') || ''' AND CATEGORY_NAME = ''' || replace(CURR_VAL.CATEGORY_NAME, '''','''''') || ''' AND NETWORK_POINT = ''' || replace(CURR_VAL.NETWORK_POINT, '''','''''') || ''' '; elsif Z_ROW_ID is not null then I_WHERE := 'WHERE CG$ROW_ID = ''' || rowidtochar( Z_ROW_ID ) || ''''; elsif Z_BIND_ROW_ID then I_WHERE := 'WHERE CG$ROW_ID = :b_row_id'; else null; end if; ZONE_SQL := 'SELECT GAS_YEAR, CUSTOMER_NAME, CONTRACT_NUMBER, CATEGORY_NAME, NETWORK_POINT, NO_OF_INTERRUPTIONS, ACCUMULATED_TIME, UI_ORDER_BY FROM ( SELECT GTT_INTERRUPTIONS.GAS_YEAR GAS_YEAR, GTT_INTERRUPTIONS.CUSTOMER_NAME CUSTOMER_NAME, GTT_INTERRUPTIONS.CONTRACT_NUMBER CONTRACT_NUMBER, GTT_INTERRUPTIONS.CATEGORY_NAME CATEGORY_NAME, GTT_INTERRUPTIONS.NETWORK_POINT NETWORK_POINT, GTT_INTERRUPTIONS.NO_OF_INTERRUPTIONS NO_OF_INTERRUPTIONS, GTT_INTERRUPTIONS.ACCUMULATED_TIME ACCUMULATED_TIME, UPPER(GTT_INTERRUPTIONS.CATEGORY_NAME) UI_ORDER_BY FROM GTT_INTERRUPTIONS GTT_INTERRUPTIONS ) '; ZONE_SQL := ZONE_SQL || I_WHERE; ZONE_SQL := ZONE_SQL || ' ORDER BY GAS_YEAR Desc , CUSTOMER_NAME, UI_ORDER_BY'; return true; exception when others then WSGL.DisplayMessage(WSGL.MESS_EXCEPTION, SQLERRM, ''||' : '||'#View Interruptions#2504#', DEF_BODY_ATTRIBUTES, 'efnow240$int.BuildSQL'); return false; end; -------------------------------------------------------------------------------- -- Name: efnow240$int.OpenZoneSql -- -- Description: Open's the cursor for the zone SQL of -- 'INT' module component (#View Interruptions#2504#). -- -- Parameters: -- -------------------------------------------------------------------------------- procedure OpenZoneSql ( I_CURSOR OUT integer ) is begin I_CURSOR := dbms_sql.open_cursor; dbms_sql.parse(I_CURSOR, ZONE_SQL, dbms_sql.v7); dbms_sql.define_column(I_CURSOR, 1, CURR_VAL.GAS_YEAR, 4); dbms_sql.define_column(I_CURSOR, 2, CURR_VAL.CUSTOMER_NAME, 100); dbms_sql.define_column(I_CURSOR, 3, CURR_VAL.CONTRACT_NUMBER, 30); dbms_sql.define_column(I_CURSOR, 4, CURR_VAL.CATEGORY_NAME, 150); dbms_sql.define_column(I_CURSOR, 5, CURR_VAL.NETWORK_POINT, 70); dbms_sql.define_column(I_CURSOR, 6, CURR_VAL.NO_OF_INTERRUPTIONS); dbms_sql.define_column(I_CURSOR, 7, CURR_VAL.ACCUMULATED_TIME); dbms_sql.define_column(I_CURSOR, 8, NBT_VAL.UI_ORDER_BY, 4000); exception when others then WSGL.DisplayMessage(WSGL.MESS_EXCEPTION, SQLERRM, ''||' : '||'#View Interruptions#2504#', '', 'efnow240$int.OpenZoneSql'); raise; end; -------------------------------------------------------------------------------- -- Name: efnow240$int.AssignZoneRow -- -- Description: Assign's a row of data and calculates the check sum from the -- zone SQL of 'INT' module component (#View Interruptions#2504#). -- -- Parameters: -- -------------------------------------------------------------------------------- procedure AssignZoneRow ( I_CURSOR IN integer ) is begin dbms_sql.column_value(I_CURSOR, 1, CURR_VAL.GAS_YEAR); dbms_sql.column_value(I_CURSOR, 2, CURR_VAL.CUSTOMER_NAME); dbms_sql.column_value(I_CURSOR, 3, CURR_VAL.CONTRACT_NUMBER); dbms_sql.column_value(I_CURSOR, 4, CURR_VAL.CATEGORY_NAME); dbms_sql.column_value(I_CURSOR, 5, CURR_VAL.NETWORK_POINT); dbms_sql.column_value(I_CURSOR, 6, CURR_VAL.NO_OF_INTERRUPTIONS); dbms_sql.column_value(I_CURSOR, 7, CURR_VAL.ACCUMULATED_TIME); dbms_sql.column_value(I_CURSOR, 8, NBT_VAL.UI_ORDER_BY); ZONE_CHECKSUM := to_char(WSGL.Checksum ( '' || CURR_VAL.GAS_YEAR || CURR_VAL.CUSTOMER_NAME || CURR_VAL.CONTRACT_NUMBER || CURR_VAL.CATEGORY_NAME || CURR_VAL.NETWORK_POINT ) ); exception when others then WSGL.DisplayMessage(WSGL.MESS_EXCEPTION, SQLERRM, ''||' : '||'#View Interruptions#2504#', '', 'efnow240$int.AssignZoneRow'); raise; end; -------------------------------------------------------------------------------- -- Name: efnow240$int.FormQuery -- -- Description: This procedure builds an HTML form for entry of query criteria. -- The criteria entered are to restrict the query of the 'INT' -- module component (#View Interruptions#2504#). -- -- Parameters: -- -------------------------------------------------------------------------------- procedure FormQuery( Z_DIRECT_CALL in boolean, Z_CHK in varchar2) is L_SUCCESS boolean := TRUE; begin if not caco_security.security_check('efnow240$int') then return; end if; if not Z_DIRECT_CALL then null; end if; L_SUCCESS := RestoreState ( Z_CURR_DEPTH => 0 , Z_MAX_DEPTH => 99 , Z_RESTORE_OWN_ROW => false ); WSGL.OpenPageHead(''||' : '||'#View Interruptions#2504#'); WSGL.METATag; efnow240$.TemplateHeader(TRUE,1); WSGL.ClosePageHead; WSGL.OpenPageBody(FALSE, p_attributes=>QF_BODY_ATTRIBUTES || 'onLoad="return INT_OnLoad()"'); efnow240$js$int.CreateQueryJavaScript(LOV_FRAME,QF_BODY_ATTRIBUTES); LoadCache ( Z_CURR_DEPTH => 0 , Z_MAX_DEPTH => 2 , Z_OWN_ROW_VALUES => false , Z_CONTEXT_FOR => REF_COMPONENT ); htp.p(caco_system.menu); efnow240$.FirstPage(Z_DIRECT_CALL => TRUE ); WSGMC_OUTPUT2.Before(REF_COMPONENT,2); htp.p(WSGL.MsgGetText(116,WSGLM.DSP116_ENTER_QRY_CAPTION,'#View Interruptions#2504#')); htp.para; WSGL.ResetForMultipleForms ; htp.formOpen(curl => 'efnow240$int.actionquery', cattributes => 'NAME="efnow240$int$QForm"'); SaveState; WSGL.LayoutOpen(WSGL.LAYOUT_TABLE); WSGL.LayoutRowStart; for i in 1..QF_NUMBER_OF_COLUMNS loop WSGL.LayoutHeader(23, 'LEFT', NULL); WSGL.LayoutHeader(30, 'LEFT', NULL); end loop; WSGL.LayoutRowEnd; WSGL.LayoutRowStart('TOP'); WSGL.LayoutData(htf.bold('#Status#2114#:')); InitialiseDomain('UI_STATUS'); WSGL.LayoutData(WSGL.BuildDVControl(D_UI_STATUS, WSGL.CTL_QUERY)); WSGL.LayoutRowEnd; WSGL.LayoutRowStart('TOP'); WSGL.LayoutData(htf.bold('#Gas Day#1142#:')); WSGL.LayoutData(WSGL.BuildQueryControl('UI_QUERY_DATE', '11', TRUE, p_maxlength=>'40' , p_cal_but_text => CAL_BUTTON_TEXT , p_cal_date_format => 'DD-MON-RRRR' , p_cal_prompt => '#Gas Day#1142#' , p_form=>'efnow240$int$QForm')); WSGL.LayoutRowEnd; WSGL.LayoutRowStart('TOP'); WSGL.LayoutData(htf.bold('#Category#3842#:')); WSGL.LayoutData(WSGL.BuildQueryControl('UI_CATE_NAME', '30', FALSE, p_maxlength=>'32760') || ' ' || WSGJSL.LOVButton('UI_CATE_NAME',LOV_BUTTON_TEXT,'efnow240$int$QForm')); WSGL.LayoutRowEnd; WSGL.LayoutRowStart('TOP'); WSGL.LayoutData(htf.bold('#Network Point#2023#:')); WSGL.LayoutData(WSGL.BuildQueryControl('UI_NEPO_CODE', '30', FALSE, p_maxlength=>'32760') || ' ' || WSGJSL.LOVButton('UI_NEPO_CODE',LOV_BUTTON_TEXT,'efnow240$int$QForm')); WSGL.LayoutRowEnd; WSGL.LayoutRowStart('TOP'); WSGL.LayoutData(htf.bold('#Customer#1047#:')); WSGL.LayoutData(WSGL.BuildQueryControl('UI_CUST_NAME', '30', FALSE, p_maxlength=>'32760') || ' ' || WSGJSL.LOVButton('UI_CUST_NAME',LOV_BUTTON_TEXT,'efnow240$int$QForm')); WSGL.LayoutRowEnd; WSGL.LayoutRowStart('TOP'); WSGL.LayoutData(htf.bold('#Contract Number#2013#:')); WSGL.LayoutData(WSGL.BuildQueryControl('UI_CONTRACT_NUMBER', '30', FALSE, p_maxlength=>'32760') || ' ' || WSGJSL.LOVButton('UI_CONTRACT_NUMBER',LOV_BUTTON_TEXT,'efnow240$int$QForm')); WSGL.LayoutRowEnd; WSGL.LayoutClose; WSGL.SubmitButton('Z_ACTION', htf.escape_sc(QF_QUERY_BUT_CAPTION), 'btnQFQ', 'this.form.Z_ACTION.value=\''' || QF_QUERY_BUT_ACTION || '\'''); htp.formReset(htf.escape_sc(QF_CLEAR_BUT_CAPTION), 'ID="'||htf.escape_sc(QF_CLEAR_BUT_CAPTION)||'"'); WSGL.HiddenField('Z_CHK', to_char(WSGL.Checksum (''))); htp.formClose; WSGMC_OUTPUT2.After(REF_COMPONENT,2); htp.p(caco_system.footer); WSGL.ClosePageBody; exception when others then WSGL.DisplayMessage(WSGL.MESS_EXCEPTION, SQLERRM, ''||' : '||'#View Interruptions#2504#', QF_BODY_ATTRIBUTES, 'efnow240$int.FormQuery'); WSGL.ClosePageBody; end; -------------------------------------------------------------------------------- -- Name: efnow240$int.QueryList -- -- Description: This procedure builds the Record list for the 'INT' -- module component (#View Interruptions#2504#). -- -- The Record List displays context information for records which -- match the specified query criteria. -- Sets of records are displayed (0 records at a time) -- with Next/Previous buttons to get other record sets. -- -- Parameters: P_UI_STATUS - #Status#2114# -- P_UI_QUERY_DATE - #Gas Day#1142# -- U_UI_QUERY_DATE - #Gas Day#1142# (upper bound) -- P_UI_CATE_NAME - #Category#3842# -- P_UI_NEPO_CODE - #Network Point#2023# -- P_UI_CUST_NAME - #Customer#1047# -- P_UI_CONTRACT_NUMBER - #Contract Number#2013# -- Z_START - First record to display -- Z_ACTION - Next or Previous set -- -------------------------------------------------------------------------------- procedure QueryList( P_UI_STATUS in varchar2, P_UI_QUERY_DATE in varchar2, U_UI_QUERY_DATE in varchar2, P_UI_CATE_NAME in varchar2, P_UI_NEPO_CODE in varchar2, P_UI_CUST_NAME in varchar2, P_UI_CONTRACT_NUMBER in varchar2, Z_START in varchar2, Z_ACTION in varchar2, Z_DIRECT_CALL in boolean, Z_CHK in varchar2 ) is I_VF_FRAME varchar2(20) := null; I_WHERE varchar2(2000) := ''; I_CURSOR integer; I_VOID integer; I_ROWS_FETCHED integer := 0; I_TOTAL_ROWS integer := 0; I_START number(38) := to_number(Z_START); I_COUNT number(10) := 0; I_OF_TOTAL_TEXT varchar2(200) := ''; I_NEXT_BUT boolean; I_PREV_BUT boolean; I_COL_COUNT integer; I_SUCCESS boolean := true; l_row integer := 0; l_id varchar2(35) := null; -- Reset break group? RSIG_YEAR boolean := true; -- Reset break group? RSIG_CUST boolean := true; -- Reset break group? RSIG_OTHERS boolean := true; I_LAST_BASE CURR_VAL%TYPE; I_LAST_NBT NBT_REC; begin if not caco_security.security_check('efnow240$int') then return; end if; WSGL.RegisterURL('efnow240$int.querylist'); WSGL.AddURLParam('P_UI_STATUS', P_UI_STATUS); WSGL.AddURLParam('P_UI_QUERY_DATE', P_UI_QUERY_DATE); WSGL.AddURLParam('U_UI_QUERY_DATE', U_UI_QUERY_DATE); WSGL.AddURLParam('P_UI_CATE_NAME', P_UI_CATE_NAME); WSGL.AddURLParam('P_UI_NEPO_CODE', P_UI_NEPO_CODE); WSGL.AddURLParam('P_UI_CUST_NAME', P_UI_CUST_NAME); WSGL.AddURLParam('P_UI_CONTRACT_NUMBER', P_UI_CONTRACT_NUMBER); WSGL.AddURLParam('Z_START', Z_START); WSGL.AddURLParam('Z_ACTION', Z_ACTION); WSGL.AddURLParam('Z_CHK', Z_CHK); if (not Z_DIRECT_CALL) then null; end if; if (Z_ACTION = RL_QUERY_BUT_ACTION) or (Z_ACTION = RL_QUERY_BUT_CAPTION) then FormQuery( Z_DIRECT_CALL=>TRUE); return; end if; -- Set up any master context values that may be required I_SUCCESS := RestoreState ( Z_CURR_DEPTH => 0 , Z_MAX_DEPTH => 99 , Z_RESTORE_OWN_ROW => false ); WSGL.OpenPageHead(''||' : '||'#View Interruptions#2504#'); WSGL.METATag; efnow240$.TemplateHeader(TRUE,6); WSGL.ClosePageHead; WSGL.OpenPageBody(FALSE, p_attributes=>RL_BODY_ATTRIBUTES); efnow240$js$int.CreateListJavaScript(RL_BODY_ATTRIBUTES); LoadCache ( Z_CURR_DEPTH => 0 , Z_MAX_DEPTH => 2 , Z_OWN_ROW_VALUES => false , Z_CONTEXT_FOR => REF_COMPONENT ); htp.p(caco_system.menu); WSGMC_OUTPUT2.Before(REF_COMPONENT,2); if (Z_ACTION = RL_LAST_BUT_ACTION) or (Z_ACTION = RL_LAST_BUT_CAPTION) or (Z_ACTION = RL_COUNT_BUT_ACTION) or (Z_ACTION = RL_COUNT_BUT_CAPTION) or (RL_TOTAL_COUNT_REQD) then I_COUNT := QueryHits( P_UI_STATUS, P_UI_QUERY_DATE, U_UI_QUERY_DATE, P_UI_CATE_NAME, P_UI_NEPO_CODE, P_UI_CUST_NAME, P_UI_CONTRACT_NUMBER); if I_COUNT = -1 then WSGL.ClosePageBody; return; end if; end if; if (Z_ACTION = RL_COUNT_BUT_ACTION) or (Z_ACTION = RL_COUNT_BUT_CAPTION) or RL_TOTAL_COUNT_REQD then I_OF_TOTAL_TEXT := ' '||WSGL.MsgGetText(111,WSGLM.DSP111_OF_TOTAL, to_char(I_COUNT)); end if; I_START := 1; I_PREV_BUT := TRUE; I_NEXT_BUT := FALSE; if I_START = 1 or Z_ACTION IS NULL then I_PREV_BUT := FALSE; end if; if nvl(Z_ACTION, 'X') != 'DONTQUERY' then if ZONE_SQL IS NULL then if not BuildSQL( P_UI_STATUS, P_UI_QUERY_DATE, U_UI_QUERY_DATE, P_UI_CATE_NAME, P_UI_NEPO_CODE, P_UI_CUST_NAME, P_UI_CONTRACT_NUMBER) then WSGL.ClosePageBody; return; end if; end if; if not PreQuery( P_UI_STATUS, P_UI_QUERY_DATE, U_UI_QUERY_DATE, P_UI_CATE_NAME, P_UI_NEPO_CODE, P_UI_CUST_NAME, P_UI_CONTRACT_NUMBER) then WSGL.DisplayMessage(WSGL.MESS_ERROR, cg$errors.GetErrors, ''||' : '||'#View Interruptions#2504#', RL_BODY_ATTRIBUTES); return; end if; OpenZoneSql( I_CURSOR ); I_VOID := dbms_sql.execute(I_CURSOR); I_ROWS_FETCHED := dbms_sql.fetch_rows(I_CURSOR); else I_ROWS_FETCHED := 0; end if; I_TOTAL_ROWS := I_ROWS_FETCHED; if I_ROWS_FETCHED != 0 then WSGL.LayoutOpen(WSGL.LAYOUT_TABLE, P_BORDER=>TRUE); WSGL.LayoutRowStart(p_attrs=>'class = cgrlheaderrow'); for i in 1..RL_NUMBER_OF_COLUMNS loop WSGL.LayoutHeader(4, 'LEFT', '#Gas Year#3840#','GAS_YEAR'); WSGL.LayoutHeader(100, 'LEFT', '#Customer Name#1145#','CUSTOMER_NAME'); WSGL.LayoutHeader(30, 'LEFT', '#Contract Number#2013#','CONTRACT_NUMBER'); WSGL.LayoutHeader(150, 'LEFT', '#Category Name#3839#','CATEGORY_NAME'); WSGL.LayoutHeader(70, 'LEFT', '#Network Point#2023#','NETWORK_POINT'); WSGL.LayoutHeader(8, 'RIGHT', '#No Of Interruptions#3841#','NO_OF_INTERRUPTIONS'); WSGL.LayoutHeader(8, 'RIGHT', '#Accumulated Time#2506#','ACCUMULATED_TIME'); end loop; WSGL.LayoutRowEnd; while I_ROWS_FETCHED <> 0 loop if I_TOTAL_ROWS >= I_START then AssignZoneRow(I_CURSOR); if (CURR_VAL.GAS_YEAR != I_LAST_BASE.GAS_YEAR or (CURR_VAL.GAS_YEAR is null and I_LAST_BASE.GAS_YEAR is not null) or (CURR_VAL.GAS_YEAR is not null and I_LAST_BASE.GAS_YEAR is null) ) then RSIG_YEAR := true; else RSIG_YEAR := false; end if; if (CURR_VAL.CUSTOMER_NAME != I_LAST_BASE.CUSTOMER_NAME or (CURR_VAL.CUSTOMER_NAME is null and I_LAST_BASE.CUSTOMER_NAME is not null) or (CURR_VAL.CUSTOMER_NAME is not null and I_LAST_BASE.CUSTOMER_NAME is null) ) or (CURR_VAL.CONTRACT_NUMBER != I_LAST_BASE.CONTRACT_NUMBER or (CURR_VAL.CONTRACT_NUMBER is null and I_LAST_BASE.CONTRACT_NUMBER is not null) or (CURR_VAL.CONTRACT_NUMBER is not null and I_LAST_BASE.CONTRACT_NUMBER is null) ) then RSIG_CUST := true; else RSIG_CUST := false; end if; if RSIG_YEAR then RSIG_CUST := true; end if; if (NBT_VAL.UI_STATUS != I_LAST_NBT.UI_STATUS or (NBT_VAL.UI_STATUS is null and I_LAST_NBT.UI_STATUS is not null) or (NBT_VAL.UI_STATUS is not null and I_LAST_NBT.UI_STATUS is null) ) or (NBT_VAL.UI_ORDER_BY != I_LAST_NBT.UI_ORDER_BY or (NBT_VAL.UI_ORDER_BY is null and I_LAST_NBT.UI_ORDER_BY is not null) or (NBT_VAL.UI_ORDER_BY is not null and I_LAST_NBT.UI_ORDER_BY is null) ) or (NBT_VAL.UI_QUERY_DATE != I_LAST_NBT.UI_QUERY_DATE or (NBT_VAL.UI_QUERY_DATE is null and I_LAST_NBT.UI_QUERY_DATE is not null) or (NBT_VAL.UI_QUERY_DATE is not null and I_LAST_NBT.UI_QUERY_DATE is null) ) or (NBT_VAL.UI_CATE_NAME != I_LAST_NBT.UI_CATE_NAME or (NBT_VAL.UI_CATE_NAME is null and I_LAST_NBT.UI_CATE_NAME is not null) or (NBT_VAL.UI_CATE_NAME is not null and I_LAST_NBT.UI_CATE_NAME is null) ) or (NBT_VAL.UI_NEPO_CODE != I_LAST_NBT.UI_NEPO_CODE or (NBT_VAL.UI_NEPO_CODE is null and I_LAST_NBT.UI_NEPO_CODE is not null) or (NBT_VAL.UI_NEPO_CODE is not null and I_LAST_NBT.UI_NEPO_CODE is null) ) or (NBT_VAL.UI_CUST_NAME != I_LAST_NBT.UI_CUST_NAME or (NBT_VAL.UI_CUST_NAME is null and I_LAST_NBT.UI_CUST_NAME is not null) or (NBT_VAL.UI_CUST_NAME is not null and I_LAST_NBT.UI_CUST_NAME is null) ) or (NBT_VAL.UI_CONTRACT_NUMBER != I_LAST_NBT.UI_CONTRACT_NUMBER or (NBT_VAL.UI_CONTRACT_NUMBER is null and I_LAST_NBT.UI_CONTRACT_NUMBER is not null) or (NBT_VAL.UI_CONTRACT_NUMBER is not null and I_LAST_NBT.UI_CONTRACT_NUMBER is null) ) or (CURR_VAL.CATEGORY_NAME != I_LAST_BASE.CATEGORY_NAME or (CURR_VAL.CATEGORY_NAME is null and I_LAST_BASE.CATEGORY_NAME is not null) or (CURR_VAL.CATEGORY_NAME is not null and I_LAST_BASE.CATEGORY_NAME is null) ) or (CURR_VAL.NETWORK_POINT != I_LAST_BASE.NETWORK_POINT or (CURR_VAL.NETWORK_POINT is null and I_LAST_BASE.NETWORK_POINT is not null) or (CURR_VAL.NETWORK_POINT is not null and I_LAST_BASE.NETWORK_POINT is null) ) or (CURR_VAL.NO_OF_INTERRUPTIONS != I_LAST_BASE.NO_OF_INTERRUPTIONS or (CURR_VAL.NO_OF_INTERRUPTIONS is null and I_LAST_BASE.NO_OF_INTERRUPTIONS is not null) or (CURR_VAL.NO_OF_INTERRUPTIONS is not null and I_LAST_BASE.NO_OF_INTERRUPTIONS is null) ) or (CURR_VAL.ACCUMULATED_TIME != I_LAST_BASE.ACCUMULATED_TIME or (CURR_VAL.ACCUMULATED_TIME is null and I_LAST_BASE.ACCUMULATED_TIME is not null) or (CURR_VAL.ACCUMULATED_TIME is not null and I_LAST_BASE.ACCUMULATED_TIME is null) ) then RSIG_OTHERS := true; else RSIG_OTHERS := false; end if; if RSIG_CUST then RSIG_OTHERS := true; end if; I_LAST_BASE.GAS_YEAR := CURR_VAL.GAS_YEAR; I_LAST_BASE.CUSTOMER_NAME := CURR_VAL.CUSTOMER_NAME; I_LAST_BASE.CONTRACT_NUMBER := CURR_VAL.CONTRACT_NUMBER; I_LAST_NBT.UI_STATUS := NBT_VAL.UI_STATUS; I_LAST_NBT.UI_ORDER_BY := NBT_VAL.UI_ORDER_BY; I_LAST_NBT.UI_QUERY_DATE := NBT_VAL.UI_QUERY_DATE; I_LAST_NBT.UI_CATE_NAME := NBT_VAL.UI_CATE_NAME; I_LAST_NBT.UI_NEPO_CODE := NBT_VAL.UI_NEPO_CODE; I_LAST_NBT.UI_CUST_NAME := NBT_VAL.UI_CUST_NAME; I_LAST_NBT.UI_CONTRACT_NUMBER := NBT_VAL.UI_CONTRACT_NUMBER; I_LAST_BASE.CATEGORY_NAME := CURR_VAL.CATEGORY_NAME; I_LAST_BASE.NETWORK_POINT := CURR_VAL.NETWORK_POINT; I_LAST_BASE.NO_OF_INTERRUPTIONS := CURR_VAL.NO_OF_INTERRUPTIONS; I_LAST_BASE.ACCUMULATED_TIME := CURR_VAL.ACCUMULATED_TIME; l_row := l_row + 1; WSGL.LayoutRowStart('TOP', p_attrs=>'class = cgrldatarow'); l_id := 'GAS_YEAR' || l_row; if RSIG_YEAR and CURR_VAL.GAS_YEAR is not null then WSGL.LayoutData(p_text=>replace(WSGL.EscapeItem(CURR_VAL.GAS_YEAR), ' ', '
'), p_id=>l_id); else WSGL.LayoutData(p_text=>' ', p_id=>l_id); end if; l_id := 'CUSTOMER_NAME' || l_row; if RSIG_CUST and CURR_VAL.CUSTOMER_NAME is not null then WSGL.LayoutData(p_text=>replace(WSGL.EscapeItem(CURR_VAL.CUSTOMER_NAME), ' ', '
'), p_id=>l_id); else WSGL.LayoutData(p_text=>' ', p_id=>l_id); end if; l_id := 'CONTRACT_NUMBER' || l_row; if RSIG_CUST and CURR_VAL.CONTRACT_NUMBER is not null then WSGL.LayoutData(p_text=>replace(WSGL.EscapeItem(CURR_VAL.CONTRACT_NUMBER), ' ', '
'), p_id=>l_id); else WSGL.LayoutData(p_text=>' ', p_id=>l_id); end if; l_id := 'CATEGORY_NAME' || l_row; if RSIG_OTHERS and CURR_VAL.CATEGORY_NAME is not null then WSGL.LayoutData(p_text=>replace(WSGL.EscapeItem(CURR_VAL.CATEGORY_NAME), ' ', '
'), p_id=>l_id); else WSGL.LayoutData(p_text=>' ', p_id=>l_id); end if; l_id := 'NETWORK_POINT' || l_row; if RSIG_OTHERS and CURR_VAL.NETWORK_POINT is not null then WSGL.LayoutData(p_text=>replace(WSGL.EscapeItem(CURR_VAL.NETWORK_POINT), ' ', '
'), p_id=>l_id); else WSGL.LayoutData(p_text=>' ', p_id=>l_id); end if; l_id := 'NO_OF_INTERRUPTIONS' || l_row; if RSIG_OTHERS and CURR_VAL.NO_OF_INTERRUPTIONS is not null then WSGL.LayoutData(p_text=>WSGL.EscapeItem(CURR_VAL.NO_OF_INTERRUPTIONS), p_id=>l_id); else WSGL.LayoutData(p_text=>' ', p_id=>l_id); end if; l_id := 'ACCUMULATED_TIME' || l_row; if RSIG_OTHERS and CURR_VAL.ACCUMULATED_TIME is not null then WSGL.LayoutData(p_text=>WSGL.EscapeItem(CURR_VAL.ACCUMULATED_TIME), p_id=>l_id); else WSGL.LayoutData(p_text=>' ', p_id=>l_id); end if; WSGL.LayoutRowEnd; I_ROWS_FETCHED := dbms_sql.fetch_rows(I_CURSOR); else I_ROWS_FETCHED := dbms_sql.fetch_rows(I_CURSOR); end if; I_TOTAL_ROWS := I_TOTAL_ROWS + I_ROWS_FETCHED; end loop; WSGL.LayoutClose; if I_START = I_TOTAL_ROWS then htp.p(WSGL.MsgGetText(109,WSGLM.DSP109_RECORD, to_char(I_TOTAL_ROWS))||I_OF_TOTAL_TEXT); else htp.p(WSGL.MsgGetText(110,WSGLM.DSP110_RECORDS_N_M, to_char(I_START), to_char(I_TOTAL_ROWS))|| I_OF_TOTAL_TEXT); end if; htp.para; else htp.p(WSGL.MsgGetText(112,WSGLM.DSP112_NO_RECORDS)); end if; if nvl(Z_ACTION, 'X') != 'DONTQUERY' then dbms_sql.close_cursor(I_CURSOR); end if; WSGL.ResetForMultipleForms ; htp.formOpen(curl => 'efnow240$int.querylist', cattributes => 'NAME="efnow240$int$LForm"'); SaveState; WSGL.HiddenField('P_UI_STATUS', P_UI_STATUS); WSGL.HiddenField('P_UI_QUERY_DATE', P_UI_QUERY_DATE); WSGL.HiddenField('U_UI_QUERY_DATE', U_UI_QUERY_DATE); WSGL.HiddenField('P_UI_CATE_NAME', P_UI_CATE_NAME); WSGL.HiddenField('P_UI_NEPO_CODE', P_UI_NEPO_CODE); WSGL.HiddenField('P_UI_CUST_NAME', P_UI_CUST_NAME); WSGL.HiddenField('P_UI_CONTRACT_NUMBER', P_UI_CONTRACT_NUMBER); WSGL.HiddenField('Z_START', to_char(I_START)); htp.p (''); WSGL.RecordListButton(I_PREV_BUT, 'Z_ACTION', htf.escape_sc(RL_FIRST_BUT_CAPTION), WSGL.MsgGetText(213,WSGLM.MSG213_AT_FIRST), FALSE, 'onClick="this.form.Z_ACTION.value=\''' || RL_FIRST_BUT_ACTION || '\''"'); WSGL.RecordListButton(I_PREV_BUT, 'Z_ACTION', htf.escape_sc(RL_PREV_BUT_CAPTION), WSGL.MsgGetText(213,WSGLM.MSG213_AT_FIRST), FALSE, 'onClick="this.form.Z_ACTION.value=\''' || RL_PREV_BUT_ACTION || '\''"'); WSGL.RecordListButton(I_NEXT_BUT,'Z_ACTION', htf.escape_sc(RL_NEXT_BUT_CAPTION), WSGL.MsgGetText(214,WSGLM.MSG214_AT_LAST), FALSE, 'onClick="this.form.Z_ACTION.value=\''' || RL_NEXT_BUT_ACTION || '\''"'); WSGL.RecordListButton(I_NEXT_BUT,'Z_ACTION', htf.escape_sc(RL_LAST_BUT_CAPTION), WSGL.MsgGetText(214,WSGLM.MSG214_AT_LAST), FALSE, 'onClick="this.form.Z_ACTION.value=\''' || RL_LAST_BUT_ACTION || '\''"'); WSGL.RecordListButton(TRUE, 'Z_ACTION', htf.escape_sc(RL_REQUERY_BUT_CAPTION),p_dojs=>FALSE, buttonJS => 'onClick="this.form.Z_ACTION.value=\''' || RL_REQUERY_BUT_ACTION || '\''"'); WSGL.RecordListButton(TRUE, 'Z_ACTION', htf.escape_sc(RL_COUNT_BUT_CAPTION),p_dojs=>FALSE, buttonJS => 'onClick="this.form.Z_ACTION.value=\''' || RL_COUNT_BUT_ACTION || '\''"'); htp.para; WSGL.RecordListButton(TRUE, 'Z_ACTION', htf.escape_sc(RL_QUERY_BUT_CAPTION),p_dojs=>FALSE, buttonJS => 'onClick="this.form.Z_ACTION.value=\''' || RL_QUERY_BUT_ACTION || '\''"'); WSGL.HiddenField('Z_CHK', to_char(WSGL.Checksum(''))); htp.formClose; WSGL.ReturnLinks('0.1', WSGL.MENU_LONG, p_target=>'_top'); WSGL.NavLinks; WSGMC_OUTPUT2.After(REF_COMPONENT,2); htp.p(caco_system.footer); WSGL.ClosePageBody; exception when others then WSGL.DisplayMessage(WSGL.MESS_EXCEPTION, SQLERRM, ''||' : '||'#View Interruptions#2504#', RL_BODY_ATTRIBUTES, 'efnow240$int.QueryList'); WSGL.ClosePageBody; end; -------------------------------------------------------------------------------- -- Name: efnow240$int.RestoreState -- -- Description: Restore the data state and optional meta data for the -- 'INT' module component (#View Interruptions#2504#). -- -- Parameters: -- -------------------------------------------------------------------------------- function RestoreState ( Z_CURR_DEPTH in number , Z_MAX_DEPTH in number , Z_RESTORE_OWN_ROW in boolean ) return boolean is I_REMAINING_DEPTH integer; I_CURSOR integer; I_VOID integer; I_ROWS_FETCHED integer; I_FETCH_ERROR boolean := FALSE; I_SUCCESS boolean := TRUE; begin if Z_RESTORE_OWN_ROW then if ( CURR_VAL.GAS_YEAR is null or CURR_VAL.CUSTOMER_NAME is null or CURR_VAL.CONTRACT_NUMBER is null or CURR_VAL.CATEGORY_NAME is null or CURR_VAL.NETWORK_POINT is null ) then return FALSE; end if; end if; if ( Z_RESTORE_OWN_ROW ) then -- Use the CURR_VAL fields for UID to get the other values if not BuildSQL( Z_QUERY_BY_KEY => true ) then return FALSE; end if; OpenZoneSql(I_CURSOR); I_VOID := dbms_sql.execute(I_CURSOR); I_ROWS_FETCHED := dbms_sql.fetch_rows(I_CURSOR); if I_ROWS_FETCHED = 0 then I_FETCH_ERROR := TRUE; else AssignZoneRow(I_CURSOR); I_ROWS_FETCHED := dbms_sql.fetch_rows(I_CURSOR); if I_ROWS_FETCHED != 0 then I_FETCH_ERROR := TRUE; end if; end if; dbms_sql.close_cursor(I_CURSOR); if I_FETCH_ERROR then return FALSE; end if; end if; return TRUE; exception when others then WSGL.DisplayMessage(WSGL.MESS_EXCEPTION, SQLERRM, ''||' : '||'#View Interruptions#2504#', '', 'efnow240$int.RestoreState'); raise; return FALSE; end; -------------------------------------------------------------------------------- -- Name: efnow240$int.SaveState -- -- Description: Saves the data state for the 'INT' module component (#View Interruptions#2504#). -- -- Parameters: -- -------------------------------------------------------------------------------- procedure SaveState is begin null; exception when others then WSGL.DisplayMessage(WSGL.MESS_EXCEPTION, SQLERRM, ''||' : '||'#View Interruptions#2504#', '', 'efnow240$int.SaveState'); raise; end; -------------------------------------------------------------------------------- -- Name: efnow240$int.GetRef -- -- Description: Returns a handle to the component object -- -- Parameters: -- -------------------------------------------------------------------------------- function GetRef return WSGOC.COMPONENT_REF is begin return ref_Component; end; -------------------------------------------------------------------------------- -- Name: efnow240$int.LoadCache -- -- Description: Populate the object cache with -- 'INT' module component (#View Interruptions#2504#). -- -------------------------------------------------------------------------------- procedure LoadCache ( Z_CURR_DEPTH in number , Z_MAX_DEPTH in number , Z_OWN_ROW_VALUES in boolean , Z_CONTEXT_FOR in WSGOC.COMPONENT_REF , Z_BRANCH in WSGOC.BRANCH_REF ) is I_VF_FRAME varchar2(20) := null; begin -- Is cache already loaded if not WSGOC.Is_Null(ref_Component) then return; end if; InitialiseDomain('UI_STATUS'); ref_Component := WSGOC.Component ( pModule => efnow240$.GetRef , pBranch => Z_BRANCH , pContext_For=> Z_CONTEXT_FOR , pName => 'INT' , pTitle => '#View Interruptions#2504#' , pSystemImagePath=> '/images/' ); r_GAS_YEAR := WSGOC.Item ( pName => 'GAS_YEAR' , pPrompt => '#Gas Year#3840#' , pIsContext=> true ); r_CUSTOMER_NAME := WSGOC.Item ( pName => 'CUSTOMER_NAME' , pPrompt => '#Customer Name#1145#' , pIsContext=> true ); r_CONTRACT_NUMBER := WSGOC.Item ( pName => 'CONTRACT_NUMBER' , pPrompt => '#Contract Number#2013#' , pIsContext=> true ); r_CATEGORY_NAME := WSGOC.Item ( pName => 'CATEGORY_NAME' , pPrompt => '#Category Name#3839#' , pIsContext=> true ); r_NETWORK_POINT := WSGOC.Item ( pName => 'NETWORK_POINT' , pPrompt => '#Network Point#2023#' , pIsContext=> true ); r_NO_OF_INTERRUPTIONS := WSGOC.Item ( pName => 'NO_OF_INTERRUPTIONS' , pPrompt => '#No Of Interruptions#3841#' , pIsContext=> true ); r_ACCUMULATED_TIME := WSGOC.Item ( pName => 'ACCUMULATED_TIME' , pPrompt => '#Accumulated Time#2506#' , pIsContext=> true ); r_UI_STATUS := WSGOC.Item ( pName => 'UI_STATUS' , pPrompt => '#Status#2114#' ); r_UI_ORDER_BY := WSGOC.Item ( pName => 'UI_ORDER_BY' , pPrompt => '' ); r_UI_QUERY_DATE := WSGOC.Item ( pName => 'UI_QUERY_DATE' , pPrompt => '#Gas Day#1142#' ); r_UI_CATE_NAME := WSGOC.Item ( pName => 'UI_CATE_NAME' , pPrompt => '#Category#3842#' ); r_UI_NEPO_CODE := WSGOC.Item ( pName => 'UI_NEPO_CODE' , pPrompt => '#Network Point#2023#' ); r_UI_CUST_NAME := WSGOC.Item ( pName => 'UI_CUST_NAME' , pPrompt => '#Customer#1047#' ); r_UI_CONTRACT_NUMBER := WSGOC.Item ( pName => 'UI_CONTRACT_NUMBER' , pPrompt => '#Contract Number#2013#' ); WSGOC.Add_Items(ref_Component, r_GAS_YEAR); WSGOC.Add_Items(ref_Component, r_CUSTOMER_NAME); WSGOC.Add_Items(ref_Component, r_CONTRACT_NUMBER); WSGOC.Add_Items(ref_Component, r_CATEGORY_NAME); WSGOC.Add_Items(ref_Component, r_NETWORK_POINT); WSGOC.Add_Items(ref_Component, r_NO_OF_INTERRUPTIONS); WSGOC.Add_Items(ref_Component, r_ACCUMULATED_TIME); WSGOC.Add_Items(ref_Component, r_UI_STATUS); WSGOC.Add_Items(ref_Component, r_UI_ORDER_BY); WSGOC.Add_Items(ref_Component, r_UI_QUERY_DATE); WSGOC.Add_Items(ref_Component, r_UI_CATE_NAME); WSGOC.Add_Items(ref_Component, r_UI_NEPO_CODE); WSGOC.Add_Items(ref_Component, r_UI_CUST_NAME); WSGOC.Add_Items(ref_Component, r_UI_CONTRACT_NUMBER); if ( Z_OWN_ROW_VALUES ) then -- Set the display value for each item -- ( As would be displayed on the Record List ) WSGOC.Set_Value( r_GAS_YEAR, replace(WSGL.EscapeItem(CURR_VAL.GAS_YEAR), ' ', '
') ); WSGOC.Set_Value( r_CUSTOMER_NAME, replace(WSGL.EscapeItem(CURR_VAL.CUSTOMER_NAME), ' ', '
') ); WSGOC.Set_Value( r_CONTRACT_NUMBER, replace(WSGL.EscapeItem(CURR_VAL.CONTRACT_NUMBER), ' ', '
') ); WSGOC.Set_Value( r_CATEGORY_NAME, replace(WSGL.EscapeItem(CURR_VAL.CATEGORY_NAME), ' ', '
') ); WSGOC.Set_Value( r_NETWORK_POINT, replace(WSGL.EscapeItem(CURR_VAL.NETWORK_POINT), ' ', '
') ); WSGOC.Set_Value( r_NO_OF_INTERRUPTIONS, WSGL.EscapeItem(CURR_VAL.NO_OF_INTERRUPTIONS) ); WSGOC.Set_Value( r_ACCUMULATED_TIME, WSGL.EscapeItem(CURR_VAL.ACCUMULATED_TIME) ); WSGOC.Set_Value( r_UI_ORDER_BY, replace(WSGL.EscapeItem(NBT_VAL.UI_ORDER_BY), ' ', '
') ); end if; exception when others then WSGL.DisplayMessage(WSGL.MESS_EXCEPTION, SQLERRM, ''||' : '||'#View Interruptions#2504#', '', 'efnow240$int.LoadCache'); raise; end; -------------------------------------------------------------------------------- -- Name: efnow240$int.PostQuery -- -- Description: Provides place holder for code to be run after a query -- for the 'INT' module component (#View Interruptions#2504#). -- -- Parameters: Z_POST_DML Flag indicating if Query after insert or update -- Z_UPDATE_ROW Can be set to mark that row as modified when a -- multirow form is displayed, causing it to be -- updated when the form is submitted. -- -- Returns: True If success -- False Otherwise -- -------------------------------------------------------------------------------- function PostQuery(Z_POST_DML in boolean, Z_UPDATE_ROW in out boolean) return boolean is L_RET_VAL boolean := TRUE; begin return L_RET_VAL; exception when others then WSGL.DisplayMessage(WSGL.MESS_EXCEPTION, SQLERRM, ''||' : '||'#View Interruptions#2504#', DEF_BODY_ATTRIBUTES, 'efnow240$int.PostQuery'); return FALSE; end; end; /