4211 lines
162 KiB
Plaintext
4211 lines
162 KiB
Plaintext
CREATE OR REPLACE PACKAGE BODY efnow098$ IS
|
|
--
|
|
-- Private
|
|
--
|
|
g_cust_id customers.cust_id%TYPE;
|
|
g_cont_id contracts.cont_id%TYPE;
|
|
g_cont_num contracts.contract_number%TYPE;
|
|
g_cont_start_date contracts.valid_from%TYPE;
|
|
g_cont_end_date contracts.valid_until%TYPE;
|
|
g_active_time DATE := SYSDATE;
|
|
g_gas_day DATE := TRUNC(g_active_time-cout_system_configuration.get_configuration_item('GAS_DAY_OFFSET')/24);
|
|
--
|
|
g_int_category BOOLEAN := FALSE;
|
|
--
|
|
g_target_date DATE;
|
|
g_target_date_end DATE;
|
|
--
|
|
g_error_point VARCHAR2(10) := NULL;
|
|
--
|
|
FUNCTION is_number(l_val VARCHAR2) RETURN BOOLEAN IS
|
|
--
|
|
l_n NUMBER;
|
|
--
|
|
BEGIN
|
|
--
|
|
l_n := l_val;
|
|
--
|
|
RETURN true;
|
|
--
|
|
EXCEPTION
|
|
WHEN OTHERS THEN
|
|
RETURN false;
|
|
END;
|
|
|
|
PROCEDURE display_nnpcv_tab(p_nnpcv_tab IN gt_nnpcv_tab) IS
|
|
BEGIN
|
|
--
|
|
FOR i IN 1..p_nnpcv_tab.COUNT LOOP
|
|
--
|
|
caco_debug.putline('SP :'||i||
|
|
' nnpcv_id: '||p_nnpcv_tab(i).nnpcv_id||
|
|
' value: '||p_nnpcv_tab(i).value||
|
|
' gas_day: '||p_nnpcv_tab(i).gas_day||
|
|
' coca_id: '||p_nnpcv_tab(i).coca_id||
|
|
' nomi_id: '||p_nnpcv_tab(i).nomi_id||
|
|
' conp_id: '||p_nnpcv_tab(i).conp_id||
|
|
' created_by: '||p_nnpcv_tab(i).created_by||
|
|
' created_on: '||p_nnpcv_tab(i).created_on
|
|
);
|
|
--
|
|
END LOOP;
|
|
--
|
|
END display_nnpcv_tab;
|
|
--
|
|
PROCEDURE display_vc_arr(arr_name IN VARCHAR2,
|
|
arr IN owa_util.vc_arr) IS
|
|
BEGIN
|
|
--
|
|
IF arr.COUNT > 0 THEN
|
|
caco_debug.putline('---------------------------------------');
|
|
FOR i IN arr.FIRST..arr.LAST LOOP
|
|
caco_debug.putline(arr_name||': '||i||' = '||arr(i));
|
|
END LOOP;
|
|
caco_debug.putline('---------------------------------------');
|
|
END IF;
|
|
--
|
|
END display_vc_arr;
|
|
--
|
|
PROCEDURE get_cont_id ( p_cont_id IN contracts.cont_id%TYPE
|
|
) IS
|
|
--
|
|
BEGIN
|
|
--
|
|
BEGIN
|
|
--
|
|
SELECT cont.cont_id
|
|
,cont.contract_number
|
|
,cont.valid_from
|
|
,cont.valid_until
|
|
INTO g_cont_id
|
|
,g_cont_num
|
|
,g_cont_start_date
|
|
,g_cont_end_date
|
|
FROM contracts cont
|
|
WHERE cont.cont_id = p_cont_id
|
|
AND cont.status = 'O'
|
|
AND rownum < 2;
|
|
--
|
|
EXCEPTION
|
|
WHEN OTHERS THEN
|
|
--
|
|
g_cont_id := NULL;
|
|
g_cont_num := NULL;
|
|
--
|
|
END;
|
|
--
|
|
END get_cont_id;
|
|
--
|
|
FUNCTION get_cv ( p_conp_id IN NUMBER
|
|
) RETURN VARCHAR2 IS
|
|
--
|
|
CURSOR cu_cv IS
|
|
SELECT NVL(cnppv.value,0)
|
|
FROM cont_net_point_param_vals cnppv,
|
|
cont_network_points conp2,
|
|
contract_parameters copa,
|
|
parameters pars,
|
|
contracts cont
|
|
WHERE conp2.conp_id = p_conp_id
|
|
AND conp2.conp_id = cnppv.conp_id
|
|
AND copa.copa_id = cnppv.copa_id
|
|
AND cont.cont_id = g_cont_id
|
|
AND copa.cont_id = cont.cont_id
|
|
AND pars.pars_id = copa.pars_id
|
|
AND pars.code = 'par_futoertek';
|
|
--
|
|
l_cv NUMBER;
|
|
--
|
|
BEGIN
|
|
--
|
|
OPEN cu_cv;
|
|
FETCH cu_cv INTO l_cv;
|
|
IF cu_cv%NOTFOUND THEN
|
|
l_cv := 0;
|
|
END IF;
|
|
CLOSE cu_cv;
|
|
--
|
|
RETURN l_cv;
|
|
--
|
|
END get_cv;
|
|
--
|
|
PROCEDURE sort_nnpcv_array ( p_nnpcv_tab IN OUT gt_nnpcv_tab
|
|
, p_gas_days IN OUT owa_util.vc_arr
|
|
) IS
|
|
--
|
|
l_nnpcv_tab nnpcv_tab := nnpcv_tab();
|
|
--
|
|
BEGIN
|
|
--
|
|
-- Extend type to cover requirements
|
|
--
|
|
--
|
|
l_nnpcv_tab.EXTEND(p_nnpcv_tab.COUNT);
|
|
--
|
|
-- Convert index by table into type
|
|
--
|
|
FOR idx IN 1..p_nnpcv_tab.COUNT LOOP
|
|
--
|
|
l_nnpcv_tab(idx) := nnpcv_rec(nnpcv_id => p_nnpcv_tab(idx).nnpcv_id
|
|
,VALUE => p_nnpcv_tab(idx).value
|
|
,gas_day => TO_DATE(p_gas_days(CEIL(idx*(p_gas_days.COUNT/p_nnpcv_tab.COUNT))), cout_system_configuration.get_configuration_item('G_DATE_FORMAT'))
|
|
,coca_id => p_nnpcv_tab(idx).coca_id
|
|
,nomi_id => p_nnpcv_tab(idx).nomi_id
|
|
,conp_id => p_nnpcv_tab(idx).conp_id
|
|
,created_by => p_nnpcv_tab(idx).created_by
|
|
,created_on => p_nnpcv_tab(idx).created_on
|
|
);
|
|
--
|
|
END LOOP;
|
|
--
|
|
-- Now we have it in a type, sort it back into the array
|
|
--
|
|
FOR rec IN ( SELECT gas_day
|
|
,value
|
|
,conp_id
|
|
,coca_id
|
|
,rownum AS idx
|
|
FROM (SELECT sq1.gas_day
|
|
,sq1.value
|
|
,sq1.conp_id
|
|
,sq1.coca_id
|
|
FROM TABLE(CAST(l_nnpcv_tab AS nnpcv_tab)) sq1
|
|
,cont_network_points conp
|
|
,network_points nepo
|
|
,contract_categories coca
|
|
WHERE sq1.conp_id = conp.conp_id
|
|
AND conp.nepo_id = nepo.nepo_id
|
|
AND sq1.coca_id = coca.coca_id
|
|
ORDER BY nepo.code
|
|
,gas_day
|
|
,coca.display_sequence
|
|
)
|
|
) LOOP
|
|
--
|
|
p_nnpcv_tab(rec.idx).value := rec.value;
|
|
p_nnpcv_tab(rec.idx).conp_id := rec.conp_id;
|
|
p_nnpcv_tab(rec.idx).coca_id := rec.coca_id;
|
|
--
|
|
p_gas_days(CEIL(rec.idx*(p_gas_days.COUNT/p_nnpcv_tab.COUNT))) := TO_CHAR(rec.gas_day, cout_system_configuration.get_configuration_item('G_DATE_FORMAT'));
|
|
--
|
|
END LOOP;
|
|
--
|
|
-- Cleardown local variable
|
|
--
|
|
l_nnpcv_tab.delete;
|
|
--
|
|
END sort_nnpcv_array;
|
|
--
|
|
PROCEDURE page_head IS
|
|
BEGIN
|
|
--
|
|
htp.p(' <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">');
|
|
htp.p(' <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">');
|
|
--
|
|
wsgl.openpagehead(g_title);
|
|
wsgl.metatag;
|
|
htp.p(' <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2">' ||
|
|
chr(10));
|
|
htp.p(' <link rel=stylesheet HREF="caco_system.css?p_type=content" >' ||
|
|
chr(10));
|
|
htp.p(' <link rel="stylesheet" media="all" type="text/css" href="' ||
|
|
g_package_name || '.nomination_css" />' || chr(10));
|
|
--
|
|
htp.p(' <script type="text/javascript" src="' || g_package_name ||
|
|
'.noms_js"></script>');
|
|
--
|
|
htp.p(wsgjsl.openscript);
|
|
wsgjsl.output_invoke_cal_js(g_package_name
|
|
,'scrollbars=no,resizable=no,width=320,height=350');
|
|
htp.p(wsgjsl.closescript);
|
|
--
|
|
wsgl.closepagehead;
|
|
wsgl.openpagebody(FALSE);
|
|
htp.p(caco_system.menu);
|
|
--
|
|
htp.HEADER(nsize => 1
|
|
,cheader => g_title);
|
|
--
|
|
END page_head;
|
|
--
|
|
FUNCTION return_index ( p_search_var IN DATE
|
|
, p_array IN owa_util.vc_arr
|
|
) RETURN NUMBER IS
|
|
--
|
|
l_return NUMBER := 1;
|
|
--
|
|
BEGIN
|
|
--
|
|
FOR i IN 1..p_array.COUNT LOOP
|
|
--
|
|
IF TO_DATE(p_array(i), g_date_format) = p_search_var THEN
|
|
--
|
|
l_return := i;
|
|
EXIT;
|
|
--
|
|
END IF;
|
|
--
|
|
END LOOP;
|
|
--
|
|
RETURN l_return;
|
|
--
|
|
END return_index;
|
|
--
|
|
FUNCTION in_a_renom_window( p_gas_day IN DATE
|
|
, p_window_time IN DATE
|
|
) RETURN BOOLEAN IS
|
|
--
|
|
l_return BOOLEAN := FALSE;
|
|
--
|
|
BEGIN
|
|
--
|
|
FOR i IN ( SELECT NULL
|
|
FROM nomination_windows nw
|
|
,nom_window_contracts nwc
|
|
,contracts con
|
|
WHERE nw.nowi_id = nwc.nowi_id
|
|
AND nwc.cont_id = con.cont_id
|
|
AND con.cust_id = caco_utilities.get_cust_id
|
|
AND nw.gas_day = TRUNC(SYSDATE - cout_system_configuration.get_configuration_item('GAS_DAY_OFFSET')/24) + cout_system_configuration.get_configuration_item('GAS_DAY_OFFSET')/24
|
|
AND SYSDATE BETWEEN nw.window_start AND nw.window_end
|
|
) LOOP
|
|
--
|
|
l_return := TRUE;
|
|
--
|
|
EXIT;
|
|
--
|
|
END LOOP;
|
|
--
|
|
RETURN l_return;
|
|
--
|
|
END in_a_renom_window;
|
|
--
|
|
FUNCTION in_a_renom_window( p_gas_day IN DATE
|
|
, p_contract_id IN contracts.cont_id%TYPE
|
|
, p_window_time IN DATE
|
|
) RETURN BOOLEAN IS
|
|
--
|
|
l_return BOOLEAN := FALSE;
|
|
--
|
|
BEGIN
|
|
--
|
|
FOR i IN ( SELECT NULL
|
|
FROM nomination_windows nw
|
|
,nom_window_contracts nwc
|
|
,contracts con
|
|
WHERE nw.nowi_id = nwc.nowi_id
|
|
AND nwc.cont_id = con.cont_id
|
|
AND con.cust_id = caco_utilities.get_cust_id
|
|
AND nwc.cont_id = p_contract_id
|
|
AND nw.gas_day = TRUNC(SYSDATE - cout_system_configuration.get_configuration_item('GAS_DAY_OFFSET')/24) + cout_system_configuration.get_configuration_item('GAS_DAY_OFFSET')/24
|
|
AND SYSDATE BETWEEN nw.window_start AND nw.window_end
|
|
) LOOP
|
|
--
|
|
l_return := TRUE;
|
|
--
|
|
EXIT;
|
|
--
|
|
END LOOP;
|
|
--
|
|
RETURN l_return;
|
|
--
|
|
END in_a_renom_window;
|
|
--
|
|
FUNCTION check_cont_date ( p_cont_id IN contracts.cont_id%TYPE
|
|
, p_date IN DATE
|
|
, p_message OUT VARCHAR2
|
|
) RETURN BOOLEAN IS
|
|
--
|
|
l_return BOOLEAN := FALSE;
|
|
l_type VARCHAR2(100);
|
|
--
|
|
BEGIN
|
|
--
|
|
FOR i IN ( SELECT NULL
|
|
FROM contracts cont
|
|
WHERE cont.cont_id = p_cont_id
|
|
AND p_date BETWEEN cont.valid_from AND cont.valid_until ) LOOP
|
|
--
|
|
l_return := TRUE;
|
|
--
|
|
END LOOP;
|
|
--
|
|
IF NOT l_return THEN
|
|
--
|
|
caco_utilities.get_exception_message ( p_exception_number => -20512
|
|
, p_message => p_message
|
|
, p_exme_type => l_type
|
|
);
|
|
--
|
|
END IF;
|
|
--
|
|
RETURN l_return;
|
|
--
|
|
END check_cont_date;
|
|
--
|
|
FUNCTION check_gate_closure ( p_cont_id IN contracts.cont_id%TYPE
|
|
, p_date IN DATE
|
|
, p_message OUT VARCHAR2
|
|
) RETURN BOOLEAN IS
|
|
--
|
|
l_return BOOLEAN := TRUE;
|
|
l_type VARCHAR2(100);
|
|
l_sub_list caco_utilities.g_t_substitution_list;
|
|
l_deadline VARCHAR2(5) := NULL;
|
|
l_active_date DATE := NULL;
|
|
--
|
|
FUNCTION get_deadline ( p_cust_id IN customers.cust_id%TYPE ) RETURN VARCHAR2 IS
|
|
--
|
|
l_return VARCHAR2(5) := NULL;
|
|
--
|
|
BEGIN
|
|
--
|
|
SELECT cust.ind_deadline_for_nom_submit
|
|
INTO l_return
|
|
FROM customers cust
|
|
WHERE cust.cust_id = p_cust_id;
|
|
--
|
|
IF l_return IS NULL THEN
|
|
--
|
|
l_return := cout_system_configuration.get_configuration_item('G_SUBMISSION_DEADLINE');
|
|
--
|
|
END IF;
|
|
--
|
|
RETURN l_return;
|
|
--
|
|
END get_deadline;
|
|
--
|
|
BEGIN
|
|
--
|
|
IF (TRUNC(SYSDATE - cout_system_configuration.get_configuration_item('GAS_DAY_OFFSET')/24) + NVL(cout_system_configuration.get_configuration_item('G_NOM_DATE_OFFSET'),1)) = p_date THEN
|
|
--
|
|
-- We are looking at nominating for tomorrow, need to check gate closure
|
|
--
|
|
IF g_cust_id IS NULL THEN
|
|
IF p_cont_id IS NOT NULL THEN
|
|
SELECT cont.cust_id
|
|
INTO g_cust_id
|
|
FROM contracts cont
|
|
WHERE cont.cont_id = p_cont_id;
|
|
END IF;
|
|
END IF;
|
|
--
|
|
l_deadline := get_deadline(p_cust_id => g_cust_id);
|
|
--
|
|
IF l_deadline IS NOT NULL THEN
|
|
--
|
|
IF TO_NUMBER(RTRIM(SUBSTR(l_deadline,1,2),':')) < cout_system_configuration.get_configuration_item(p_parameter => 'GAS_DAY_OFFSET') THEN
|
|
--
|
|
-- Is tomorrow, add one to the date
|
|
--
|
|
l_active_date := TO_DATE(TO_CHAR(TRUNC(SYSDATE - cout_system_configuration.get_configuration_item('GAS_DAY_OFFSET')/24),'DD/MM/YYYY')||l_deadline, 'DD/MM/YYYYHH24:MI')+1;
|
|
--
|
|
ELSE
|
|
--
|
|
-- same calendar date, OK
|
|
--
|
|
l_active_date := TO_DATE(TO_CHAR(TRUNC(SYSDATE - cout_system_configuration.get_configuration_item('GAS_DAY_OFFSET')/24),'DD/MM/YYYY')||l_deadline, 'DD/MM/YYYYHH24:MI');
|
|
--
|
|
END IF;
|
|
--
|
|
-- Determined what the deadline is, now check it
|
|
--
|
|
IF SYSDATE > l_active_date THEN
|
|
--
|
|
l_sub_list(1) := TO_CHAR( p_date, g_date_format);
|
|
l_sub_list(2) := TO_CHAR( l_active_date, g_date_format || ' HH24:MI');
|
|
--
|
|
caco_utilities.get_exception_message ( p_exception_number => -20513 -- Cannot nominate for <p1> after <p2>.
|
|
, p_message => p_message
|
|
, p_exme_type => l_type
|
|
, p_substitution_list => l_sub_list
|
|
);
|
|
--
|
|
l_return := FALSE;
|
|
--
|
|
END IF; -- p_date > l_active_date
|
|
--
|
|
END IF; -- l_deadline not null
|
|
--
|
|
END IF; -- nominateing for tomorrow
|
|
--
|
|
-- Renom window check
|
|
--
|
|
IF (TRUNC(SYSDATE - cout_system_configuration.get_configuration_item('GAS_DAY_OFFSET')/24) + NVL(cout_system_configuration.get_configuration_item('G_NOM_DATE_OFFSET'),1) /* removed + cout_system_configuration.get_configuration_item('GAS_DAY_OFFSET')/24*/) > p_date THEN
|
|
--
|
|
-- Nominating for today, check for renom window for the contract
|
|
--
|
|
IF NOT in_a_renom_window( p_gas_day => NULL
|
|
, p_contract_id => p_cont_id
|
|
, p_window_time => NULL
|
|
) THEN
|
|
--
|
|
l_return := FALSE;
|
|
--
|
|
caco_utilities.get_exception_message ( p_exception_number => -20514 -- renomination window is not open
|
|
, p_message => p_message
|
|
, p_exme_type => l_type
|
|
);
|
|
--
|
|
END IF;
|
|
--
|
|
END IF;
|
|
--
|
|
RETURN l_return;
|
|
--
|
|
END check_gate_closure;
|
|
--
|
|
FUNCTION process_spreadsheet_to_arrays ( p_gtsp_id gtt_spreadsheet.spreadsheet_id%TYPE
|
|
, p_cont_id contracts.cont_id%TYPE
|
|
, p_nomi_tab IN OUT gt_nomi_tab
|
|
, p_nnpcv_tab IN OUT gt_nnpcv_tab
|
|
, p_error IN OUT VARCHAR2
|
|
) RETURN BOOLEAN IS
|
|
--
|
|
l_return BOOLEAN := FALSE;
|
|
--
|
|
lr_spte_row spreadsheet_templates%ROWTYPE;
|
|
--
|
|
l_x_a VARCHAR2(100);
|
|
l_y_a VARCHAR2(100);
|
|
--
|
|
l_x_a_start VARCHAR2(100);
|
|
--
|
|
l_cont_identifier contracts.contract_number%TYPE;
|
|
l_cont_id contracts.cont_id%TYPE;
|
|
l_gas_day VARCHAR2(100);
|
|
l_gas_day_to VARCHAR2(100);
|
|
l_field_value VARCHAR2(100);
|
|
--
|
|
l_start_date DATE;
|
|
l_end_date DATE;
|
|
l_exme_type VARCHAR2(10);
|
|
l_sub_list caco_utilities.g_t_substitution_list;
|
|
--
|
|
-- Variables addded for network point validation
|
|
--
|
|
l_nepo_x VARCHAR2(100);
|
|
l_nepo_y VARCHAR2(100);
|
|
l_nepo_code VARCHAR2(100);
|
|
l_nepo_y_start VARCHAR2(100);
|
|
l_nepo_rownum NUMBER := 0;
|
|
l_nepo_count NUMBER := 0;
|
|
--
|
|
-- Tags to search for
|
|
--
|
|
c_cont_placeholder CONSTANT VARCHAR2(100) := '{CONTRACT_ID}';
|
|
c_gday_placeholder CONSTANT VARCHAR2(100) := '{GAS_DAY}';
|
|
c_gday_placeholder2 CONSTANT VARCHAR2(100) := '{GAS_DAY_TO}';
|
|
c_nnpcv_placeholder CONSTANT VARCHAR2(100) := '{NOM_NET_POINT_CAT_VALS}';
|
|
c_nepo_code CONSTANT VARCHAR2(100) := '{NETWORK_POINT_CODE}';
|
|
c_cate_name CONSTANT VARCHAR2(100) := '{CAT_NAME}';
|
|
c_cate_units CONSTANT VARCHAR2(100) := '{CAT_UNITS}';
|
|
--
|
|
l_emo_contract VARCHAR2(1) := 'N';
|
|
l_conp_id cont_network_points.conp_id%TYPE;
|
|
--
|
|
PROCEDURE set_nom ( p_identifier IN VARCHAR2
|
|
, p_cont_id IN contracts.cont_id%TYPE ) IS
|
|
BEGIN
|
|
--
|
|
p_nomi_tab(1).status := 'A';
|
|
p_nomi_tab(1).cont_id := p_cont_id;
|
|
p_nomi_tab(1).identifier := p_identifier;
|
|
--
|
|
END set_nom;
|
|
--
|
|
PROCEDURE set_nnpcv ( p_value IN VARCHAR2
|
|
, p_gas_day IN DATE
|
|
, p_coca_id IN conf_net_point_cat_vals.coca_id%TYPE
|
|
, p_conp_id IN conf_net_point_cat_vals.conp_id%TYPE
|
|
) IS
|
|
--
|
|
l_nnpcv_idx NUMBER;
|
|
--
|
|
BEGIN
|
|
--
|
|
l_nnpcv_idx := NVL(p_nnpcv_tab.COUNT,0) + 1;
|
|
--
|
|
p_nnpcv_tab(l_nnpcv_idx).conp_id := p_conp_id;
|
|
p_nnpcv_tab(l_nnpcv_idx).coca_id := p_coca_id;
|
|
p_nnpcv_tab(l_nnpcv_idx).value := p_value;
|
|
p_nnpcv_tab(l_nnpcv_idx).gas_day := p_gas_day;
|
|
--
|
|
END set_nnpcv;
|
|
--
|
|
FUNCTION get_token_location ( p_token IN VARCHAR2
|
|
, p_spte_id IN spreadsheet_templates.spte_id%TYPE
|
|
, p_x_axis IN OUT spreadsheet_template_values.x_axis%TYPE
|
|
, p_y_axis IN OUT spreadsheet_template_values.y_axis%TYPE
|
|
) RETURN BOOLEAN IS
|
|
--
|
|
l_return BOOLEAN := FALSE;
|
|
--
|
|
BEGIN
|
|
--
|
|
-- Init grid locators
|
|
--
|
|
p_x_axis := NULL;
|
|
p_y_axis := NULL;
|
|
--
|
|
FOR i IN ( SELECT sptv.x_axis
|
|
,sptv.y_axis
|
|
FROM spreadsheet_template_values sptv
|
|
WHERE sptv.spte_id = p_spte_id
|
|
AND sptv.cell_value = p_token
|
|
) LOOP
|
|
--
|
|
p_x_axis := i.x_axis;
|
|
p_y_axis := i.y_axis;
|
|
--
|
|
l_return := TRUE;
|
|
EXIT;
|
|
--
|
|
END LOOP;
|
|
--
|
|
RETURN l_return;
|
|
--
|
|
END get_token_location;
|
|
--
|
|
FUNCTION get_spreadsheet_value ( p_gtsp_id IN gtt_spreadsheet.spreadsheet_id%TYPE
|
|
, p_x_axis IN spreadsheet_template_values.x_axis%TYPE
|
|
, p_y_axis IN spreadsheet_template_values.y_axis%TYPE
|
|
) RETURN VARCHAR2 IS
|
|
--
|
|
l_return VARCHAR2(100);
|
|
--
|
|
BEGIN
|
|
--
|
|
SELECT gtsp.cell_value
|
|
INTO l_return
|
|
FROM gtt_spreadsheet gtsp
|
|
WHERE gtsp.spreadsheet_id = p_gtsp_id
|
|
AND gtsp.x_axis = p_x_axis
|
|
AND gtsp.y_axis = p_y_axis - 1;
|
|
--
|
|
--caco_debug.putline(p_x_axis||':'||p_y_axis||':'||l_return);
|
|
--
|
|
RETURN l_return;
|
|
--
|
|
EXCEPTION
|
|
WHEN OTHERS THEN
|
|
RETURN null;
|
|
END get_spreadsheet_value;
|
|
--
|
|
FUNCTION max_ss_row ( p_gtsp_id IN gtt_spreadsheet.spreadsheet_id%TYPE ) RETURN NUMBER IS
|
|
--
|
|
l_return NUMBER := 0;
|
|
--
|
|
BEGIN
|
|
--
|
|
SELECT MAX(gtts.y_axis)
|
|
INTO l_return
|
|
FROM gtt_spreadsheet gtts
|
|
WHERE gtts.spreadsheet_id = p_gtsp_id;
|
|
--
|
|
RETURN l_return;
|
|
--
|
|
END;
|
|
--
|
|
BEGIN
|
|
--
|
|
-- Get the template details
|
|
--
|
|
g_error_point := 'P001';
|
|
--
|
|
-- Check if the contract is an entry mandatory offer contract
|
|
--
|
|
IF efno_contracts.emo_contract(p_cont_id) = 'Y' THEN
|
|
l_emo_contract := 'Y';
|
|
END IF;
|
|
--
|
|
SELECT spte.*
|
|
INTO lr_spte_row
|
|
FROM contracts cont
|
|
,spreadsheet_templates spte
|
|
WHERE spte.spte_id = cont.spte_id
|
|
AND spte.spte_type = 'NOST'
|
|
AND cont.cont_id = p_cont_id;
|
|
--
|
|
g_error_point := 'P002';
|
|
--
|
|
IF UPPER(lr_spte_row.name) IN (UPPER(g_spte_single),UPPER(g_spte_smulti)) THEN
|
|
--
|
|
-- Single gas day or Single-Multi Gas Day, find the location of useful stuff
|
|
--
|
|
g_error_point := 'P100';
|
|
--
|
|
IF get_token_location ( p_token => c_gday_placeholder
|
|
, p_spte_id => lr_spte_row.spte_id
|
|
, p_x_axis => l_x_a
|
|
, p_y_axis => l_y_a
|
|
) THEN
|
|
--
|
|
-- Token is present in the template, let's get the value
|
|
--
|
|
l_gas_day := get_spreadsheet_value ( p_gtsp_id => p_gtsp_id
|
|
, p_x_axis => l_x_a
|
|
, p_y_axis => l_y_a
|
|
);
|
|
--
|
|
IF l_gas_day IS NOT NULL THEN
|
|
--
|
|
BEGIN
|
|
--
|
|
l_start_date := TO_DATE( l_gas_day
|
|
, cout_system_configuration.get_configuration_item('G_DATE_FORMAT'));
|
|
--
|
|
EXCEPTION
|
|
--
|
|
WHEN OTHERS THEN
|
|
--
|
|
l_return := FALSE;
|
|
--
|
|
l_sub_list(1) := l_gas_day;
|
|
l_sub_list(2) := cout_system_configuration.get_configuration_item('G_DATE_FORMAT');
|
|
--
|
|
caco_utilities.get_exception_message(p_exception_number => -20104
|
|
,p_message => p_error
|
|
,p_exme_type => l_exme_type
|
|
,p_substitution_list => l_sub_list
|
|
,p_language => caco_utilities.get_syus_lang
|
|
);
|
|
--
|
|
RAISE;
|
|
--
|
|
END;
|
|
--
|
|
g_gas_days(1) := l_gas_day;
|
|
--
|
|
END IF;
|
|
--
|
|
END IF;
|
|
--
|
|
IF get_token_location ( p_token => c_cont_placeholder
|
|
, p_spte_id => lr_spte_row.spte_id
|
|
, p_x_axis => l_x_a
|
|
, p_y_axis => l_y_a
|
|
) THEN
|
|
--
|
|
--
|
|
-- Token is present in the template, let's get the value
|
|
--
|
|
l_cont_identifier := get_spreadsheet_value ( p_gtsp_id => p_gtsp_id
|
|
, p_x_axis => l_x_a
|
|
, p_y_axis => l_y_a
|
|
);
|
|
--
|
|
END IF;
|
|
--
|
|
IF get_token_location ( p_token => c_gday_placeholder2
|
|
, p_spte_id => lr_spte_row.spte_id
|
|
, p_x_axis => l_x_a
|
|
, p_y_axis => l_y_a
|
|
) THEN
|
|
--
|
|
-- Token is present in the template, let's get the value
|
|
--
|
|
g_error_point := 'P205';
|
|
g_target_date := TO_DATE(l_gas_day,g_date_format);
|
|
--
|
|
l_gas_day_to := get_spreadsheet_value ( p_gtsp_id => p_gtsp_id
|
|
, p_x_axis => l_x_a
|
|
, p_y_axis => l_y_a
|
|
);
|
|
--
|
|
IF l_gas_day_to IS NOT NULL THEN
|
|
--
|
|
BEGIN
|
|
--
|
|
l_end_date := TO_DATE( l_gas_day_to
|
|
, cout_system_configuration.get_configuration_item('G_DATE_FORMAT'));
|
|
--
|
|
EXCEPTION
|
|
--
|
|
WHEN OTHERS THEN
|
|
--
|
|
l_return := FALSE;
|
|
--
|
|
l_sub_list(1) := l_gas_day_to;
|
|
l_sub_list(2) := cout_system_configuration.get_configuration_item('G_DATE_FORMAT');
|
|
--
|
|
caco_utilities.get_exception_message(p_exception_number => -20104
|
|
,p_message => p_error
|
|
,p_exme_type => l_exme_type
|
|
,p_substitution_list => l_sub_list
|
|
,p_language => caco_utilities.get_syus_lang
|
|
);
|
|
--
|
|
RAISE;
|
|
--
|
|
END;
|
|
--
|
|
END IF;
|
|
--
|
|
g_target_date_end := to_date(l_gas_day_to,g_date_format);
|
|
--
|
|
FOR i IN 0..(g_target_date_end-g_target_date) + 1 LOOP
|
|
--
|
|
g_gas_days(i+1) := TO_CHAR(g_target_date+i,g_date_format);
|
|
--
|
|
END LOOP;
|
|
--
|
|
END IF;
|
|
--
|
|
-- We need to find out which contract this nomination is for.
|
|
-- EFT no longer want the contract name on the spreadsheet to determine this.
|
|
-- The spreadsheet upload needs to be more flexible and determine
|
|
-- the cont_id for itself.
|
|
--
|
|
FOR c IN ( SELECT cont.cont_id
|
|
FROM contracts cont
|
|
WHERE cont.cust_id = g_cust_id
|
|
AND l_start_date BETWEEN cont.valid_from AND cont.valid_until
|
|
AND ((l_end_date BETWEEN cont.valid_from AND cont.valid_until) OR
|
|
(l_end_date IS NULL))
|
|
AND cont.status = 'O'
|
|
AND rownum < 2 ) LOOP
|
|
--
|
|
l_cont_id := c.cont_id;
|
|
get_cont_id(l_cont_id);
|
|
--
|
|
END LOOP;
|
|
--
|
|
IF l_cont_id IS NULL THEN
|
|
caco_utilities.get_exception_message ( p_exception_number => -20512
|
|
, p_message => p_error
|
|
, p_exme_type => l_exme_type
|
|
, p_language => caco_utilities.get_syus_lang
|
|
);
|
|
END IF;
|
|
--
|
|
-- Find the token location
|
|
--
|
|
IF NOT get_token_location ( p_token => c_nepo_code
|
|
, p_spte_id => lr_spte_row.spte_id
|
|
, p_x_axis => l_nepo_x
|
|
, p_y_axis => l_nepo_y_start
|
|
) THEN
|
|
--
|
|
-- No point raising any errors if there aren't any network points in the template
|
|
--
|
|
NULL;
|
|
--
|
|
END IF;
|
|
--
|
|
-- Now on to the grid
|
|
--
|
|
IF get_token_location ( p_token => c_nnpcv_placeholder
|
|
, p_spte_id => lr_spte_row.spte_id
|
|
, p_x_axis => l_x_a_start
|
|
, p_y_axis => l_y_a
|
|
) THEN
|
|
--
|
|
-- Values start at the above location, for the moment assume that everything is in the right order
|
|
--
|
|
l_x_a := l_x_a_start;
|
|
l_nepo_y := l_nepo_y_start;
|
|
--
|
|
FOR conp IN ( SELECT nepo.name
|
|
,nepo.code
|
|
,conp.conp_id
|
|
,rownum AS sitenum
|
|
FROM cont_network_points conp
|
|
,network_points nepo
|
|
WHERE nepo.nepo_id = conp.nepo_id
|
|
AND conp.cont_id = g_cont_id
|
|
AND ((nepo.nepo_type = 'V' AND l_emo_contract = 'Y') OR
|
|
l_emo_contract = 'N')
|
|
ORDER BY nepo.code
|
|
) LOOP
|
|
--
|
|
-- Find nepo_code in the spreadsheet. Order does not matter.
|
|
--
|
|
LOOP
|
|
--
|
|
l_nepo_code := get_spreadsheet_value( p_gtsp_id => p_gtsp_id
|
|
, p_x_axis => l_nepo_x
|
|
, p_y_axis => l_nepo_y
|
|
);
|
|
--
|
|
IF l_nepo_code IS NULL THEN
|
|
--
|
|
l_return := FALSE;
|
|
p_error := caco_utilities.get_module_text(2519);
|
|
EXIT;
|
|
ELSIF l_nepo_code <> conp.code THEN
|
|
l_nepo_y := l_nepo_y + 1;
|
|
l_nepo_rownum := l_nepo_rownum + 1;
|
|
ELSE
|
|
-- l_nepo_code must equal conp.code
|
|
EXIT;
|
|
--
|
|
END IF;
|
|
END LOOP;
|
|
--
|
|
FOR conp_coca IN (SELECT coca.coca_id
|
|
FROM contract_categories coca
|
|
,categories cate
|
|
WHERE cate.cate_id = coca.cate_id
|
|
AND coca.cont_id = g_cont_id
|
|
ORDER BY coca.display_sequence ) LOOP
|
|
--
|
|
-- Look for the value in the spreadsheet
|
|
--
|
|
l_field_value := get_spreadsheet_value( p_gtsp_id => p_gtsp_id
|
|
, p_x_axis => l_x_a
|
|
, p_y_axis => l_y_a + l_nepo_rownum
|
|
);
|
|
--
|
|
IF INSTR(l_field_value,'.') > 0 THEN
|
|
--
|
|
l_field_value := RTRIM(RTRIM(l_field_value,'0'),'.');
|
|
--
|
|
END IF;
|
|
--
|
|
set_nnpcv ( p_value => caco_utilities.thousand_separated_to_num(l_field_value)
|
|
, p_gas_day => TO_DATE( g_gas_days(1)
|
|
, cout_system_configuration.get_configuration_item('G_DATE_FORMAT'))
|
|
, p_coca_id => conp_coca.coca_id
|
|
, p_conp_id => conp.conp_id
|
|
);
|
|
--
|
|
l_x_a := CHR(ASCII(l_x_a)+1);
|
|
--
|
|
END LOOP; -- categories
|
|
--
|
|
-- Increment network point count
|
|
--
|
|
l_nepo_count := l_nepo_count + 1;
|
|
--
|
|
-- Reset starting column
|
|
--
|
|
l_x_a := l_x_a_start;
|
|
--
|
|
-- Reset starting row
|
|
--
|
|
l_nepo_y := l_nepo_y_start;
|
|
--
|
|
-- Reset row number
|
|
--
|
|
l_nepo_rownum := 0;
|
|
--
|
|
END LOOP; -- network points
|
|
--
|
|
IF get_spreadsheet_value( p_gtsp_id => p_gtsp_id
|
|
, p_x_axis => l_x_a
|
|
, p_y_axis => l_y_a + l_nepo_count
|
|
) IS NOT NULL THEN
|
|
--
|
|
l_return := FALSE;
|
|
p_error := caco_utilities.get_module_text(2519);
|
|
--
|
|
END IF;
|
|
--
|
|
END IF;
|
|
--
|
|
IF l_cont_identifier <> g_cont_num
|
|
AND l_cont_identifier IS NOT NULL
|
|
THEN
|
|
p_error := REPLACE(REPLACE(caco_utilities.get_module_text(2519),'<P1>',g_cont_num),'<P2>',l_cont_identifier);
|
|
END IF; IF l_cont_identifier <> g_cont_num
|
|
AND l_cont_identifier IS NOT NULL
|
|
THEN
|
|
p_error := REPLACE(REPLACE(caco_utilities.get_module_text(3981),'<P1>',g_cont_num),'<P2>',l_cont_identifier);
|
|
END IF;
|
|
IF p_error IS NULL THEN
|
|
--
|
|
l_return := TRUE;
|
|
--
|
|
END IF;
|
|
--
|
|
ELSIF UPPER(lr_spte_row.name) = UPPER(g_spte_multi) THEN
|
|
--
|
|
-- Multiple gas day, find the location of useful stuff
|
|
--
|
|
g_error_point := 'P200';
|
|
--
|
|
IF get_token_location ( p_token => c_cont_placeholder
|
|
, p_spte_id => lr_spte_row.spte_id
|
|
, p_x_axis => l_x_a
|
|
, p_y_axis => l_y_a
|
|
) THEN
|
|
--
|
|
g_error_point := 'P201';
|
|
--
|
|
-- Token is present in the template, let's get the value
|
|
--
|
|
l_cont_identifier := get_spreadsheet_value ( p_gtsp_id => p_gtsp_id
|
|
, p_x_axis => l_x_a
|
|
, p_y_axis => l_y_a
|
|
);
|
|
--
|
|
g_error_point := 'P202';
|
|
--
|
|
IF l_cont_identifier IS NOT NULL THEN
|
|
g_error_point := 'P203';
|
|
--
|
|
FOR c IN ( SELECT cont.cont_id
|
|
FROM contracts cont
|
|
WHERE cont.contract_number = l_cont_identifier
|
|
AND cont.cust_id = g_cust_id ) LOOP
|
|
--
|
|
g_cont_id := c.cont_id;
|
|
--
|
|
END LOOP;
|
|
--
|
|
END IF;
|
|
--
|
|
END IF;
|
|
--
|
|
-- Multiple gas days - find the start
|
|
--
|
|
g_error_point := 'P204';
|
|
--
|
|
IF get_token_location ( p_token => c_gday_placeholder
|
|
, p_spte_id => lr_spte_row.spte_id
|
|
, p_x_axis => l_x_a
|
|
, p_y_axis => l_y_a
|
|
) THEN
|
|
--
|
|
-- Token is present in the template, let's get the value
|
|
--
|
|
g_target_date := NULL;
|
|
g_target_date_end := NULL;
|
|
--
|
|
FOR i IN 0..max_ss_row(p_gtsp_id) LOOP
|
|
--
|
|
g_error_point := 'P205'||l_x_a||TO_CHAR(l_y_a + i);
|
|
--
|
|
l_gas_day := get_spreadsheet_value ( p_gtsp_id => p_gtsp_id
|
|
, p_x_axis => l_x_a
|
|
, p_y_axis => l_y_a + i
|
|
);
|
|
--
|
|
IF l_gas_day IS NOT NULL THEN
|
|
--
|
|
BEGIN
|
|
--
|
|
l_start_date := TO_DATE( l_gas_day
|
|
, cout_system_configuration.get_configuration_item('G_DATE_FORMAT'));
|
|
--
|
|
EXCEPTION
|
|
--
|
|
WHEN OTHERS THEN
|
|
--
|
|
l_return := FALSE;
|
|
--
|
|
l_sub_list(1) := l_gas_day;
|
|
l_sub_list(2) := cout_system_configuration.get_configuration_item('G_DATE_FORMAT');
|
|
--
|
|
caco_utilities.get_exception_message(p_exception_number => -20104
|
|
,p_message => p_error
|
|
,p_exme_type => l_exme_type
|
|
,p_substitution_list => l_sub_list
|
|
,p_language => caco_utilities.get_syus_lang
|
|
);
|
|
--
|
|
RAISE;
|
|
--
|
|
END;
|
|
g_gas_days(i+1) := TO_CHAR(TO_DATE(l_gas_day, g_date_format),g_date_format);
|
|
--
|
|
g_target_date := LEAST(NVL(g_target_date, TO_DATE(g_gas_days(i+1), g_date_format)), TO_DATE(g_gas_days(i+1), g_date_format));
|
|
g_target_date_end := GREATEST(NVL(g_target_date_end, TO_DATE(g_gas_days(i+1), g_date_format)), TO_DATE(g_gas_days(i+1), g_date_format));
|
|
--
|
|
END IF;
|
|
--
|
|
END LOOP;
|
|
--
|
|
END IF;
|
|
--
|
|
-- Find the token location
|
|
--
|
|
IF NOT get_token_location ( p_token => c_nepo_code
|
|
, p_spte_id => lr_spte_row.spte_id
|
|
, p_x_axis => l_nepo_x
|
|
, p_y_axis => l_nepo_y
|
|
) THEN
|
|
--
|
|
-- No point raising any errors if there aren't any network points in the template
|
|
--
|
|
NULL;
|
|
--
|
|
END IF;
|
|
--
|
|
-- Now on to the grid
|
|
--
|
|
g_error_point := 'P206';
|
|
--
|
|
IF get_token_location ( p_token => c_nnpcv_placeholder
|
|
, p_spte_id => lr_spte_row.spte_id
|
|
, p_x_axis => l_x_a_start
|
|
, p_y_axis => l_y_a
|
|
) THEN
|
|
--
|
|
g_error_point := 'P208';
|
|
--
|
|
l_x_a := l_x_a_start;
|
|
--
|
|
FOR conp IN ( SELECT rownum AS sitenum
|
|
FROM cont_network_points conp
|
|
WHERE conp.cont_id = g_cont_id
|
|
) LOOP
|
|
--
|
|
FOR date_loop IN 1..(g_target_date_end-g_target_date)+1 LOOP
|
|
--
|
|
-- Check nepo_code (c_nepo_code) against the spreadsheet to ensure the sites are in the correct order
|
|
--
|
|
l_nepo_code := get_spreadsheet_value( p_gtsp_id => p_gtsp_id
|
|
, p_x_axis => l_nepo_x
|
|
, p_y_axis => l_nepo_y
|
|
);
|
|
--
|
|
l_conp_id := NULL;
|
|
--
|
|
FOR conp IN ( SELECT conp.conp_id
|
|
FROM cont_network_points conp
|
|
,network_points nepo
|
|
WHERE nepo.nepo_id = conp.nepo_id
|
|
AND conp.cont_id = g_cont_id
|
|
AND nepo.code = l_nepo_code
|
|
AND ((nepo.nepo_type = 'V' AND l_emo_contract = 'Y') OR
|
|
l_emo_contract = 'N')
|
|
) LOOP
|
|
--
|
|
l_conp_id := conp.conp_id;
|
|
--
|
|
END LOOP;
|
|
--
|
|
IF l_conp_id IS NULL
|
|
OR l_nepo_code IS NULL THEN
|
|
--
|
|
l_return := FALSE;
|
|
p_error := caco_utilities.get_module_text(2519);
|
|
--
|
|
END IF;
|
|
--
|
|
l_nepo_y := l_nepo_y + 1;
|
|
--
|
|
FOR conp_coca IN (SELECT coca.coca_id
|
|
FROM contract_categories coca
|
|
,categories cate
|
|
WHERE cate.cate_id = coca.cate_id
|
|
AND coca.cont_id = g_cont_id
|
|
ORDER BY coca.display_sequence ) LOOP
|
|
--
|
|
-- Look for the value in the spreadsheet
|
|
--
|
|
g_error_point := 'P209';
|
|
--
|
|
l_field_value := get_spreadsheet_value( p_gtsp_id => p_gtsp_id
|
|
, p_x_axis => l_x_a
|
|
, p_y_axis => l_y_a
|
|
);
|
|
--
|
|
g_error_point := 'P210';
|
|
--
|
|
IF INSTR(l_field_value,'.') > 0 THEN
|
|
--
|
|
l_field_value := RTRIM(RTRIM(l_field_value,'0'),'.');
|
|
--
|
|
END IF;
|
|
--
|
|
set_nnpcv ( p_value => caco_utilities.thousand_separated_to_num(l_field_value)
|
|
, p_gas_day => TO_DATE( g_gas_days(1)
|
|
, cout_system_configuration.get_configuration_item('G_DATE_FORMAT'))
|
|
, p_coca_id => conp_coca.coca_id
|
|
, p_conp_id => l_conp_id
|
|
);
|
|
--
|
|
g_error_point := 'P211';
|
|
--
|
|
l_x_a := CHR(ASCII(l_x_a)+1);
|
|
--
|
|
END LOOP; -- categories
|
|
--
|
|
-- Increment row number
|
|
--
|
|
l_y_a := TO_NUMBER(l_y_a) + 1;
|
|
--
|
|
-- Reset starting column
|
|
--
|
|
l_x_a := l_x_a_start;
|
|
--
|
|
END LOOP; -- dates
|
|
--
|
|
END LOOP; -- network points
|
|
--
|
|
IF get_spreadsheet_value( p_gtsp_id => p_gtsp_id
|
|
, p_x_axis => l_x_a
|
|
, p_y_axis => l_y_a
|
|
) IS NOT NULL THEN
|
|
--
|
|
l_return := FALSE;
|
|
p_error := caco_utilities.get_module_text(2519);
|
|
--
|
|
END IF;
|
|
--
|
|
g_error_point := 'P220';
|
|
--
|
|
END IF;
|
|
--
|
|
-- Sort the details in case they have been loaded in the wrong order - will aid detection of missing values
|
|
--
|
|
sort_nnpcv_array(p_nnpcv_tab
|
|
,g_gas_days);
|
|
--
|
|
--
|
|
--
|
|
IF p_error IS NULL THEN
|
|
--
|
|
l_return := TRUE;
|
|
--
|
|
END IF;
|
|
--
|
|
ELSIF UPPER(lr_spte_row.name) = UPPER(g_spte_hourly) THEN
|
|
--
|
|
NULL;
|
|
--
|
|
ELSE
|
|
--
|
|
-- Something else that we do not know about
|
|
--
|
|
p_error := caco_utilities.get_module_text(p_text_number => 2330); -- Unexpected Error
|
|
l_return := FALSE;
|
|
--
|
|
END IF;
|
|
--
|
|
RETURN l_return;
|
|
--
|
|
EXCEPTION
|
|
WHEN OTHERS THEN
|
|
--
|
|
cout_err.report_and_go(p_exception_message => sqlerrm||' : '||g_error_point);
|
|
--
|
|
p_error := NVL(p_error, caco_utilities.get_module_text(p_text_number => 2330)); -- Unexpected Error
|
|
l_return := FALSE;
|
|
--
|
|
RETURN l_return;
|
|
--
|
|
END process_spreadsheet_to_arrays;
|
|
--
|
|
FUNCTION display_message ( p_mess IN VARCHAR2
|
|
, p_type IN VARCHAR2
|
|
) RETURN VARCHAR2 IS
|
|
--
|
|
l_return VARCHAR2(200);
|
|
--
|
|
BEGIN
|
|
--
|
|
IF p_type = wsgl.mess_success THEN
|
|
--
|
|
l_return := htf.bold('<font color="008000" size=+2>'||htf.italic(wsgl.MsgGetText(121,WSGLM.DSP121_SUCCESS))||
|
|
'</font><br>'||p_mess);
|
|
--
|
|
ELSIF p_type = wsgl.mess_error THEN
|
|
--
|
|
l_return := htf.bold('<font color="ff4040" size=+2>'||htf.italic(wsgl.MsgGetText(122,WSGLM.DSP122_ERROR))||
|
|
'</font><br>'||p_mess);
|
|
--
|
|
END IF;
|
|
--
|
|
RETURN l_return;
|
|
--
|
|
END display_message;
|
|
--
|
|
FUNCTION send_nom_notification( p_cust_id IN customers.cust_id%TYPE
|
|
, p_nomi_identifier IN nominations.identifier%TYPE DEFAULT NULL
|
|
, p_gas_day_start IN DATE DEFAULT NULL
|
|
, p_gas_day_end IN DATE DEFAULT NULL
|
|
, p_timestamp IN DATE DEFAULT NULL
|
|
) RETURN VARCHAR2 IS
|
|
--
|
|
l_letter_content VARCHAR2(4000);
|
|
l_letter_subject VARCHAR2(4000);
|
|
--
|
|
BEGIN
|
|
--
|
|
g_error_point := 'S010';
|
|
--
|
|
FOR cust_rec IN ( SELECT cust.nom_conf_subject
|
|
,cust.nom_conf_content
|
|
FROM customers cust
|
|
WHERE cust.cust_id = p_cust_id
|
|
) LOOP
|
|
--
|
|
g_error_point := 'S020';
|
|
--
|
|
l_letter_content := cust_rec.nom_conf_content;
|
|
l_letter_subject := cust_rec.nom_conf_subject;
|
|
--
|
|
g_error_point := 'S030';
|
|
--
|
|
IF p_nomi_identifier IS NOT NULL THEN
|
|
--
|
|
l_letter_content := REPLACE(l_letter_content, '{NOMINATION_IDENTIFIER}', p_nomi_identifier);
|
|
l_letter_subject := REPLACE(l_letter_subject, '{NOMINATION_IDENTIFIER}', p_nomi_identifier);
|
|
--
|
|
END IF;
|
|
--
|
|
g_error_point := 'S040';
|
|
--
|
|
IF p_gas_day_start IS NOT NULL THEN
|
|
--
|
|
l_letter_content := REPLACE(l_letter_content, '{GAS_DAY_START}', TO_CHAR(p_gas_day_start, g_date_format));
|
|
l_letter_subject := REPLACE(l_letter_subject, '{GAS_DAY_START}', TO_CHAR(p_gas_day_start, g_date_format));
|
|
--
|
|
END IF;
|
|
--
|
|
g_error_point := 'S050';
|
|
--
|
|
IF p_gas_day_end IS NOT NULL THEN
|
|
--
|
|
l_letter_content := REPLACE(l_letter_content, '{GAS_DAY_END}', TO_CHAR(p_gas_day_end, g_date_format));
|
|
l_letter_subject := REPLACE(l_letter_subject, '{GAS_DAY_END}', TO_CHAR(p_gas_day_end, g_date_format));
|
|
--
|
|
END IF;
|
|
--
|
|
g_error_point := 'S060';
|
|
--
|
|
IF p_timestamp IS NOT NULL THEN
|
|
--
|
|
l_letter_content := REPLACE(l_letter_content, '{TIMESTAMP}', TO_CHAR(p_timestamp, g_date_format||' HH24:MI'));
|
|
l_letter_subject := REPLACE(l_letter_subject, '{TIMESTAMP}', TO_CHAR(p_timestamp, g_date_format||' HH24:MI'));
|
|
--
|
|
END IF;
|
|
--
|
|
g_error_point := 'S070';
|
|
--
|
|
efno_msgsubs.send_messages ( p_cust_id => p_cust_id
|
|
, p_suca_id => efno_msgsubs.get_suca_id( p_suca_group => gc_suca_msg_group_en
|
|
, p_suca_name => gc_suca_name_en
|
|
)
|
|
, p_email_content_en => l_letter_content
|
|
, p_email_subject_en => l_letter_subject
|
|
, p_sms_content_en => l_letter_subject
|
|
);
|
|
--
|
|
END LOOP;
|
|
--
|
|
g_error_point := 'S080';
|
|
--
|
|
RETURN l_letter_content;
|
|
--
|
|
END;
|
|
--
|
|
FUNCTION timestamp_nomi ( p_nomi_id IN nominations.nomi_id%TYPE
|
|
, p_nomi_details IN VARCHAR2
|
|
) RETURN DATE IS
|
|
--
|
|
l_timestamp DATE;
|
|
l_empty_blob BLOB;
|
|
l_message_blob BLOB;
|
|
--
|
|
BEGIN
|
|
--
|
|
l_message_blob := l_empty_blob;
|
|
--
|
|
l_message_blob := utl_raw.cast_to_raw(p_nomi_details);
|
|
--
|
|
l_timestamp := amfr_timestamp.timestamp_document( p_identifier => p_nomi_id
|
|
, p_doctype => amfr_timestamp.c_nomination
|
|
, p_file_for_hash => l_message_blob
|
|
);
|
|
--
|
|
efno_nominations.upd_nomi_timestamp( p_nomi_id => p_nomi_id
|
|
, p_timestamp => l_timestamp
|
|
);
|
|
--
|
|
l_message_blob := l_empty_blob;
|
|
--
|
|
RETURN l_timestamp;
|
|
--
|
|
END timestamp_nomi;
|
|
--
|
|
FUNCTION get_spte_name ( p_cont_id IN contracts.cont_id%TYPE ) RETURN VARCHAR2 IS
|
|
--
|
|
l_return VARCHAR(100);
|
|
--
|
|
BEGIN
|
|
--
|
|
IF p_cont_id IS NOT NULL THEN
|
|
--
|
|
SELECT UPPER(spte.name)
|
|
INTO l_return
|
|
FROM contracts cont
|
|
,spreadsheet_templates spte
|
|
WHERE spte.spte_id = cont.spte_id
|
|
AND spte.spte_type = 'NOST'
|
|
AND cont.cont_id = p_cont_id;
|
|
--
|
|
END IF;
|
|
--
|
|
RETURN l_return;
|
|
--
|
|
END get_spte_name;
|
|
--
|
|
FUNCTION get_receive_before_start( p_cont_id IN contracts.cont_id%TYPE ) RETURN NUMBER IS
|
|
--
|
|
l_return NUMBER;
|
|
--
|
|
BEGIN
|
|
--
|
|
SELECT receive_before_start
|
|
INTO l_return
|
|
FROM contracts
|
|
WHERE cont_id = p_cont_id;
|
|
--
|
|
RETURN l_return;
|
|
--
|
|
END get_receive_before_start;
|
|
--
|
|
FUNCTION get_matrix_val ( p_conp_id IN conf_net_point_cat_vals.conp_id%TYPE
|
|
, p_coca_id IN contract_categories.coca_id%TYPE
|
|
, p_iteration IN NUMBER
|
|
, p_mode IN NUMBER DEFAULT 0
|
|
) RETURN VARCHAR2 IS
|
|
--
|
|
l_return VARCHAR2(30) := '0';
|
|
l_iteration NUMBER := 0;
|
|
l_MJ_cate_name categories.name%TYPE;
|
|
l_m3_coca_id NUMBER;
|
|
l_cv NUMBER;
|
|
--
|
|
CURSOR cu_MJ_cate IS
|
|
SELECT cate.name
|
|
FROM categories cate,
|
|
contract_categories coca
|
|
WHERE coca.coca_id = p_coca_id
|
|
AND coca.cate_id = cate.cate_id
|
|
AND cate.units IN ('MJ/day','MJ/nap');
|
|
--
|
|
CURSOR cu_m3_coca (cp_cate_name categories.name%TYPE)IS
|
|
SELECT coca.coca_id
|
|
FROM categories cate,
|
|
contract_categories coca,
|
|
contracts cont
|
|
WHERE cate.name = cp_cate_name
|
|
AND cont.cont_id = g_cont_id
|
|
AND cont.cont_id = coca.cont_id
|
|
AND coca.cate_id = cate.cate_id
|
|
AND cate.units IN ('m3/day','m3/nap');
|
|
--
|
|
BEGIN
|
|
--
|
|
IF g_nnpcv_tab.COUNT > 0 THEN
|
|
--
|
|
-- Looks like we've comething to display, be it good or bad
|
|
--
|
|
FOR idx IN 1..g_nnpcv_tab.COUNT LOOP
|
|
--
|
|
IF g_nnpcv_tab(idx).conp_id = p_conp_id
|
|
AND g_nnpcv_tab(idx).coca_id = p_coca_id THEN
|
|
--
|
|
-- Found a match, but is it the right one
|
|
--
|
|
l_iteration := l_iteration + 1;
|
|
--
|
|
IF l_iteration = p_iteration THEN
|
|
IF g_nnpcv_tab(idx).value = 0 OR g_nnpcv_tab(idx).value IS NULL THEN
|
|
--
|
|
-- check to see if we are looking at a MJ/day energy value
|
|
--
|
|
OPEN cu_MJ_cate;
|
|
FETCH cu_MJ_cate INTO l_MJ_cate_name;
|
|
IF cu_MJ_cate%FOUND THEN
|
|
--
|
|
-- lets if there is a related volume category in the contract
|
|
--
|
|
OPEN cu_m3_coca(l_MJ_cate_name);
|
|
FETCH cu_m3_coca INTO l_m3_coca_id;
|
|
IF cu_m3_coca%FOUND THEN
|
|
--
|
|
-- lets get the cv value
|
|
--
|
|
l_cv := get_cv(p_conp_id);
|
|
IF l_cv > 0 THEN
|
|
--
|
|
-- lets get the volume value multiply by cv
|
|
--
|
|
l_return := caco_utilities.thousand_separated_to_num(get_matrix_val(p_conp_id,l_m3_coca_id,p_iteration)) * l_cv;
|
|
--
|
|
ELSE
|
|
l_return := g_nnpcv_tab(idx).value;
|
|
END IF;
|
|
ELSE
|
|
l_return := g_nnpcv_tab(idx).value;
|
|
END IF;
|
|
CLOSE cu_m3_coca;
|
|
ELSE
|
|
l_return := g_nnpcv_tab(idx).value;
|
|
END IF;
|
|
CLOSE cu_MJ_cate;
|
|
--
|
|
ELSE
|
|
l_return := g_nnpcv_tab(idx).value;
|
|
END IF;
|
|
EXIT;
|
|
--
|
|
END IF;
|
|
--
|
|
END IF;
|
|
--
|
|
END LOOP;
|
|
--
|
|
END IF;
|
|
--
|
|
RETURN caco_utilities.to_thousand_separated(l_return);
|
|
--
|
|
EXCEPTION
|
|
WHEN OTHERS THEN
|
|
--
|
|
cout_err.report_and_stop(p_exception_message => sqlerrm||' : efnow098$.get_matrix_val');
|
|
--
|
|
END get_matrix_val;
|
|
--
|
|
FUNCTION check_row_error ( p_row_number IN NUMBER
|
|
) RETURN VARCHAR2 IS
|
|
--
|
|
-- Function to check for the existance of a row error, and if present, return it
|
|
--
|
|
l_return VARCHAR2(1000) := NULL;
|
|
--
|
|
BEGIN
|
|
--
|
|
IF g_row_error.EXISTS(p_row_number) THEN
|
|
--
|
|
l_return := ' class="error" title='''||g_row_error(p_row_number)||'''';
|
|
--
|
|
END IF;
|
|
--
|
|
RETURN l_return;
|
|
--
|
|
END check_row_error;
|
|
--
|
|
FUNCTION check_cell_error ( p_conp_id IN conf_net_point_cat_vals.conp_id%TYPE
|
|
, p_coca_id IN contract_categories.coca_id%TYPE
|
|
, p_iteration IN NUMBER
|
|
) RETURN VARCHAR2 IS
|
|
--
|
|
-- Function to check for the existance of a row error, and if present, return it
|
|
--
|
|
l_return VARCHAR2(1000);
|
|
--
|
|
BEGIN
|
|
--
|
|
FOR i IN 1..g_cell_error.COUNT LOOP
|
|
--
|
|
-- Loop around all cell errors, should only be a few as an exception is raise soon after the error
|
|
--
|
|
IF p_conp_id = g_cell_error(i).conp_id
|
|
AND p_coca_id = g_cell_error(i).coca_id
|
|
AND p_iteration = g_cell_error(i).iteration THEN
|
|
--
|
|
-- Is a match, output the error
|
|
--
|
|
l_return := ' class="error" title='''||g_cell_error(i).message||'''';
|
|
--
|
|
END IF;
|
|
--
|
|
END LOOP;
|
|
--
|
|
IF l_return IS NULL THEN
|
|
--
|
|
-- See if I'm interrupted
|
|
--
|
|
IF efno_interruption.am_i_interrrupted ( p_conp_id => p_conp_id
|
|
, p_coca_id => p_coca_id
|
|
, p_gasday => (g_target_date + (p_iteration-1))
|
|
) THEN
|
|
--
|
|
l_return := ' class="interruption" title='''||caco_utilities.get_module_text(3809)||'''';
|
|
--
|
|
g_int_category := TRUE;
|
|
--
|
|
ELSE
|
|
--
|
|
l_return := ' class="r" ';
|
|
--
|
|
END IF;
|
|
--
|
|
END IF;
|
|
--
|
|
RETURN l_return;
|
|
--
|
|
END check_cell_error;
|
|
--
|
|
PROCEDURE display_nom_details ( p_type IN VARCHAR2 DEFAULT 'TABLE' ) IS
|
|
--
|
|
l_tab_head_1 VARCHAR2(4000);
|
|
l_tab_head_2 VARCHAR2(4000);
|
|
l_tab_line VARCHAR2(4000);
|
|
l_loop_counter NUMBER := 1;
|
|
l_gas_day DATE;
|
|
--
|
|
l_num_hours NUMBER;
|
|
l_cont_long_day BOOLEAN;
|
|
l_only_short_day BOOLEAN;
|
|
--
|
|
l_cv NUMBER;
|
|
l_MJ_coca_id NUMBER := 0;
|
|
--
|
|
CURSOR cu_MJ_cate (cp_m3name categories.name%TYPE)IS
|
|
SELECT coca.coca_id
|
|
FROM categories cate,
|
|
contracts cont,
|
|
contract_categories coca
|
|
WHERE cate.name = cp_m3name
|
|
AND cont.cont_id = g_cont_id
|
|
AND cont.cont_id = coca.cont_id
|
|
AND coca.cate_id = cate.cate_id
|
|
AND cate.units IN ('MJ/day','MJ/nap');
|
|
--
|
|
FUNCTION get_element ( p_array IN owa_util.vc_arr
|
|
, p_index IN NUMBER
|
|
) RETURN VARCHAR2 IS
|
|
--
|
|
l_return VARCHAR2(100) := NULL;
|
|
--
|
|
BEGIN
|
|
--
|
|
IF p_array.COUNT >= p_index THEN
|
|
--
|
|
l_return := p_array(p_index);
|
|
--
|
|
END IF;
|
|
--
|
|
RETURN l_return;
|
|
--
|
|
END get_element;
|
|
--
|
|
BEGIN
|
|
--
|
|
IF g_cont_id IS NOT NULL THEN
|
|
--
|
|
-- Contract is set, we can continue
|
|
--
|
|
-- set the g_target_date? **
|
|
--
|
|
g_target_date := NVL(TO_DATE(get_element(g_gas_days,1),g_date_format), g_target_date);
|
|
--
|
|
-- Sort out the start and end dates if looking at multi dates
|
|
--
|
|
IF get_spte_name(g_cont_id) IN (UPPER(g_spte_multi),UPPER(g_spte_smulti)) THEN
|
|
--
|
|
/* htp.p('**'||'g_cont_start_date: '||g_cont_start_date);
|
|
htp.p('<br>');
|
|
htp.p('**'||'g_cont_end_date: '||g_cont_end_date);
|
|
htp.p('<br>');
|
|
htp.p('**'||'g_target_date: '||g_target_date);
|
|
htp.p('<br>');
|
|
htp.p('**'||'g_target_date_end: '||g_target_date_end);
|
|
htp.p('<br>');*/
|
|
--
|
|
-- Check the start date against the contract start date - this will effect the number of days
|
|
--
|
|
IF g_target_date < g_cont_start_date OR g_target_date IS NULL THEN
|
|
--
|
|
-- Target date is less than the start of the contract...what to do?
|
|
--
|
|
g_target_date := g_cont_start_date;
|
|
--
|
|
END IF;
|
|
--
|
|
IF g_target_date > g_cont_end_date THEN
|
|
--
|
|
g_target_date := g_cont_end_date;
|
|
--
|
|
END IF;
|
|
--
|
|
IF g_target_date_end IS NULL THEN
|
|
--
|
|
g_target_date_end := g_target_date;
|
|
--
|
|
END IF;
|
|
--
|
|
IF g_target_date_end < g_target_date THEN
|
|
--
|
|
g_target_date_end := g_target_date;
|
|
--
|
|
END IF;
|
|
--
|
|
IF g_target_date_end > g_cont_end_date THEN -- g_target_date < TO_NUMBER(cout_system_configuration.get_configuration_item('G_MULTI_DAY_NOM_DAYS')) THEN
|
|
--
|
|
g_target_date_end := g_cont_end_date;
|
|
--
|
|
END IF;
|
|
--
|
|
IF g_target_date_end < g_cont_start_date THEN
|
|
--
|
|
g_target_date_end := g_cont_start_date;
|
|
--
|
|
END IF;
|
|
--
|
|
IF get_spte_name(g_cont_id) = UPPER(g_spte_multi) THEN
|
|
--
|
|
l_loop_counter := (g_target_date_end - g_target_date) +1;
|
|
--
|
|
END IF;
|
|
--
|
|
/* htp.p('----------------------------');
|
|
htp.p('<br>');
|
|
htp.p('**'||'g_target_date: '||g_target_date);
|
|
htp.p('<br>');
|
|
htp.p('**'||'g_target_date_end: '||g_target_date_end);
|
|
htp.p('<br>');
|
|
htp.p('**Loop:'||l_loop_counter);
|
|
htp.p('<br>');*/
|
|
--
|
|
END IF;
|
|
--
|
|
--
|
|
htp.p('<input type=hidden name="cont_id" value="'||g_cont_id||'">');
|
|
--
|
|
-- submit and verify buttons
|
|
--
|
|
htp.p('<input type="submit" name="action" value="'||caco_utilities.get_module_text(1149/*Verify*/)||'" >');
|
|
htp.p('<input type="submit" name="action" value="'||caco_utilities.get_module_text(840/*Insert*/)||'" >');
|
|
htp.p('<br>');
|
|
htp.p('<br>');
|
|
--
|
|
-- Header Table
|
|
--
|
|
htp.p('<table>');
|
|
--
|
|
htp.p('<tr>');
|
|
htp.p('<th scope="row">'||caco_utilities.get_module_text(1145)||'</th>');
|
|
htp.p('<td>'||caco_utilities.get_cust_name||'</td>');
|
|
htp.p('</tr>');
|
|
IF g_cont_num IS NOT NULL
|
|
THEN
|
|
htp.p('<tr>');
|
|
htp.p('<th scope="row">'||caco_utilities.get_module_text(3552)||'</th>');
|
|
htp.p('<td>'||g_cont_num||'</td>');
|
|
htp.p('</tr>');
|
|
END IF;
|
|
--
|
|
IF get_spte_name(g_cont_id) = UPPER(g_spte_single) THEN
|
|
--
|
|
htp.p('<tr><th scope="row">'||caco_utilities.get_module_text(1142)||'</th>'||
|
|
'<td>
|
|
<input id="gasday" name="gasday" class="inpdate" type="text" value="' ||
|
|
NVL(get_element(g_gas_days,1),TO_CHAR(g_target_date, g_date_format)) || '" onchange="this.form.submit();"/>
|
|
</td>
|
|
<td>');
|
|
--
|
|
htp.p(wsgjsl.calbutton(field_name => 'gasday',
|
|
p_calbut => htf.img(curl => caco_system.images_path ||
|
|
'lov.gif',
|
|
calign => 'TOP',
|
|
cattributes => 'ALT="List Values" WIDTH=18 HEIGHT=22 BORDER'),
|
|
p_form => 'forms[1]',
|
|
field_format => g_date_format,
|
|
p_field_prompt => caco_utilities.get_module_text(1142)));
|
|
--
|
|
htp.p('</td>
|
|
</tr>');
|
|
--
|
|
ELSIF get_spte_name(g_cont_id) IN (UPPER(g_spte_multi),UPPER(g_spte_smulti)) THEN
|
|
--
|
|
htp.p('<tr><th scope="row">'||caco_utilities.get_module_text(2484)||'</th>'||
|
|
'<td>
|
|
<input id="p_gasday_start" name="p_gasday_start" class="inpdate" type="text" value="' ||
|
|
NVL(get_element(g_gas_days,1),TO_CHAR(g_target_date, g_date_format)) || '" onchange="this.form.submit();">');
|
|
htp.p('</td>
|
|
<td>');
|
|
--
|
|
htp.p(wsgjsl.calbutton(field_name => 'p_gasday_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 => 'forms[1]',
|
|
field_format => g_date_format,
|
|
p_field_prompt => caco_utilities.get_module_text(1142)));
|
|
--
|
|
htp.p('</td></tr>');
|
|
--
|
|
htp.p('<tr><th scope="row">'||caco_utilities.get_module_text(2485)||'</th><td>
|
|
<input id="p_gasday_end" name="p_gasday_end" class="inpdate" type="text" value="' ||
|
|
TO_CHAR(g_target_date_end, g_date_format) || '" onchange="this.form.submit();">');
|
|
htp.p('</td><td>');
|
|
--
|
|
htp.p(wsgjsl.calbutton(field_name => 'p_gasday_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 => 'forms[1]',
|
|
field_format => g_date_format,
|
|
p_field_prompt => caco_utilities.get_module_text(1142)));
|
|
htp.p('</tr>');
|
|
--
|
|
END IF;
|
|
--
|
|
IF get_spte_name(g_cont_id) = UPPER(g_spte_smulti) THEN
|
|
--
|
|
htp.p('<input type=hidden name="gasday" value="">');
|
|
--
|
|
END IF;
|
|
--
|
|
htp.p('</table>');
|
|
--
|
|
htp.br;
|
|
--
|
|
-- Work out if we need to worry about the long and short days
|
|
--
|
|
l_only_short_day := FALSE;
|
|
l_cont_long_day := FALSE;
|
|
--
|
|
-- Check to see if the period we are looking at contains the long day, or only contains the short day
|
|
--
|
|
FOR i IN 1..l_loop_counter LOOP
|
|
--
|
|
IF cout_dates.hours_in_gas_day(g_target_date + (i-1)) = 25 THEN
|
|
l_cont_long_day := TRUE;
|
|
END IF;
|
|
--
|
|
END LOOP;
|
|
--
|
|
IF ( get_spte_name(g_cont_id) = UPPER(g_spte_single)
|
|
OR l_loop_counter = 1 )
|
|
AND cout_dates.hours_in_gas_day(g_target_date) = 23 THEN
|
|
--
|
|
l_only_short_day := TRUE;
|
|
--
|
|
END IF;
|
|
--
|
|
-- Data Table
|
|
--
|
|
htp.p('<table>');
|
|
--
|
|
FOR cate IN (SELECT coca.coca_id
|
|
,cate.code
|
|
,cate.name
|
|
,cate.units
|
|
,row_number() over (partition by cate.name order by coca.display_sequence) disp_head
|
|
,sq1.span
|
|
,cate.display_cond
|
|
FROM contract_categories coca
|
|
,categories cate
|
|
, (SELECT cate2.name
|
|
,count(*) as span
|
|
FROM contract_categories coca2
|
|
,categories cate2
|
|
WHERE coca2.cont_id = g_cont_id
|
|
AND coca2.cate_id = cate2.cate_id
|
|
GROUP BY cate2.name) sq1
|
|
WHERE cate.cate_id = coca.cate_id
|
|
AND coca.cont_id = g_cont_id
|
|
AND sq1.name = cate.name
|
|
ORDER BY coca.display_sequence ) LOOP
|
|
--
|
|
IF (cate.display_cond = 'LO' AND l_cont_long_day)
|
|
OR (cate.display_cond = 'SH' AND NOT l_only_short_day)
|
|
OR cate.display_cond = 'AL' THEN
|
|
--
|
|
IF cate.disp_head = 1 THEN
|
|
l_tab_head_1 := l_tab_head_1 || '<th scope="col" colspan="'||cate.span||'">'||cate.name||'</th>';
|
|
END IF;
|
|
--
|
|
l_tab_head_2 := l_tab_head_2 || '<input type=hidden name="coca" value="'||cate.coca_id||'"><th scope="col">'||cate.units||'</th>';
|
|
--
|
|
END IF;
|
|
--
|
|
END LOOP;
|
|
--
|
|
IF get_spte_name(g_cont_id) IN (UPPER(g_spte_single),UPPER(g_spte_smulti)) THEN
|
|
--
|
|
l_tab_head_1 := '<thead><tr><td colspan="2" class="nofill"></td>'||l_tab_head_1||'</tr></thead>';
|
|
l_tab_head_2 := '<thead><tr><th scope="row">'||caco_utilities.get_module_text(2113)||'</th><th scope="row">'||caco_utilities.get_module_text(2023)||'</th>'||l_tab_head_2||'</tr></thead>';
|
|
--
|
|
ELSIF get_spte_name(g_cont_id) = UPPER(g_spte_multi) THEN
|
|
--
|
|
l_tab_head_1 := '<thead><tr><td colspan="3" class="nofill"></td>'||l_tab_head_1||'</tr></thead>';
|
|
l_tab_head_2 := '<thead><tr><th scope="row">'||caco_utilities.get_module_text(2113)||'</th><th scope="row">'||caco_utilities.get_module_text(2023)||'</th><th scope="row">'||caco_utilities.get_module_text(1142)||'</th>'||l_tab_head_2||'</tr></thead>';
|
|
--
|
|
END IF;
|
|
--
|
|
htp.p(l_tab_head_1);
|
|
htp.p(l_tab_head_2);
|
|
--
|
|
FOR conp IN ( SELECT nepo.name
|
|
,nepo.code
|
|
,conp.conp_id
|
|
,rownum AS sitenum
|
|
FROM cont_network_points conp
|
|
,network_points nepo
|
|
WHERE nepo.nepo_id = conp.nepo_id
|
|
AND conp.cont_id = g_cont_id
|
|
AND ((nepo.nepo_type = 'V' AND efno_contracts.emo_contract(g_cont_id) = 'Y') OR
|
|
(nepo.nepo_type IN ('N','X') AND efno_contracts.emo_contract(g_cont_id) = 'N'))
|
|
--ORDER BY conp.display_sequence
|
|
ORDER BY nepo.code
|
|
) LOOP
|
|
--
|
|
htp.p('<input type=hidden name="conp" value="'||conp.conp_id||'">');
|
|
--
|
|
l_cv := get_cv(conp.conp_id);
|
|
--
|
|
htp.p('<input type=hidden id="'||conp.conp_id||'" name="cv" value="'||l_cv||'">');
|
|
--
|
|
FOR i IN 1..l_loop_counter LOOP
|
|
--
|
|
l_num_hours := cout_dates.hours_in_gas_day(g_target_date + (i-1));
|
|
--
|
|
IF get_spte_name(g_cont_id) IN (UPPER(g_spte_single),UPPER(g_spte_smulti)) THEN
|
|
--
|
|
l_tab_line := '<tbody><tr'||check_row_error(conp.sitenum*i)||'><th scope="row">'||conp.code||'</th><th scope="row">'||conp.name||'</th>';
|
|
--
|
|
ELSIF get_spte_name(g_cont_id) = UPPER(g_spte_multi) THEN
|
|
--
|
|
l_tab_line := '<tbody><tr'||check_row_error(((conp.sitenum-1)*l_loop_counter)+i)||'><th scope="row">'||conp.code||'</th><th scope="row">'||conp.name||'</th><td>'||'<input type=text name="gasday" class="inpdate" value='||NVL(get_element(g_gas_days,((conp.sitenum-1)*l_loop_counter)+i),TO_CHAR(g_target_date + (i-1), g_date_format))||'></td>';
|
|
--
|
|
ELSE
|
|
--
|
|
l_tab_line := '<tbody><tr'||check_row_error(((conp.sitenum-1)*l_loop_counter)+i)||'><th scope="row">'||conp.name||'</th><th scope="row">'||conp.code||'</th><td>'||'<input type=text name="gasday" class="inpdate" value='||NVL(get_element(g_gas_days,((conp.sitenum-1)*l_loop_counter)+i),TO_CHAR(g_target_date + (i-1), g_date_format))||'></td>';
|
|
--
|
|
END IF;
|
|
--
|
|
-- For all sites
|
|
--
|
|
FOR conp_coca IN (SELECT coca.coca_id
|
|
,cate.display_cond
|
|
,cate.units
|
|
,cate.name
|
|
FROM contract_categories coca
|
|
,categories cate
|
|
WHERE cate.cate_id = coca.cate_id
|
|
AND coca.cont_id = g_cont_id
|
|
ORDER BY coca.display_sequence ) LOOP
|
|
--
|
|
--htp.p('<input type=hidden name="id" value="'||conp.conp_id||':'||conp_coca.coca_id||'">');
|
|
--
|
|
l_MJ_coca_id := 0;
|
|
--
|
|
-- check to see if this is a m3/day volume category and we have a non-zero cv value
|
|
--
|
|
IF conp_coca.units IN ('m3/day','m3/nap') AND l_cv > 0 THEN
|
|
--
|
|
-- check to see if we have an equivalent energy category in the contract
|
|
--
|
|
OPEN cu_MJ_cate(conp_coca.name);
|
|
FETCH cu_MJ_cate INTO l_MJ_coca_id;
|
|
IF cu_MJ_cate%NOTFOUND THEN
|
|
l_MJ_coca_id := 0;
|
|
END IF;
|
|
CLOSE cu_MJ_cate;
|
|
--
|
|
END IF;
|
|
--
|
|
IF conp_coca.display_cond = 'AL' THEN
|
|
--
|
|
-- check to see if we need to put an onchange js call to calculate the energy
|
|
--
|
|
IF l_MJ_coca_id > 0 THEN
|
|
--
|
|
l_tab_line := l_tab_line || '<td>'||'<input type=text id="'||conp.conp_id||':'||conp_coca.coca_id||':'||i||'" name="val" value="'||get_matrix_val(conp.conp_id,conp_coca.coca_id,i)||'"'||check_cell_error(conp.conp_id,conp_coca.coca_id,i)||'onchange="calc_en(this.id,'||conp.conp_id||','||l_MJ_coca_id||','||i||');thousandSeparator(this.id,this.value)"></td>';
|
|
--
|
|
ELSE
|
|
--
|
|
l_tab_line := l_tab_line || '<td>'||'<input type=text id="'||conp.conp_id||':'||conp_coca.coca_id||':'||i||'" name="val" value="'||get_matrix_val(conp.conp_id,conp_coca.coca_id,i)||'"'||check_cell_error(conp.conp_id,conp_coca.coca_id,i)||'onchange="thousandSeparator(this.id,this.value)"></td>';
|
|
--
|
|
END IF;
|
|
--
|
|
ELSIF conp_coca.display_cond = 'SH' THEN
|
|
--
|
|
-- this is a short day category
|
|
--
|
|
IF l_num_hours = 23 THEN
|
|
--
|
|
IF l_only_short_day THEN
|
|
--
|
|
NULL;
|
|
--
|
|
ELSE
|
|
--
|
|
l_tab_line := l_tab_line || '<td>'||'<input type=hidden name="val" value="0">'||'<input type=text id="'||conp.conp_id||':'||conp_coca.coca_id||':'||i||'" name="val" value="'||get_matrix_val(conp.conp_id,conp_coca.coca_id,i)||'"'||check_cell_error(conp.conp_id,conp_coca.coca_id,i)||' disabled="disabled"></td>';
|
|
--
|
|
END IF;
|
|
--
|
|
ELSE
|
|
--
|
|
-- check to see if we need to put an onchange js call to calculate the energy
|
|
--
|
|
IF l_MJ_coca_id > 0 THEN
|
|
--
|
|
l_tab_line := l_tab_line || '<td>'||'<input type=text id="'||conp.conp_id||':'||conp_coca.coca_id||':'||i||'" name="val" value="'||get_matrix_val(conp.conp_id,conp_coca.coca_id,i)||'"'||check_cell_error(conp.conp_id,conp_coca.coca_id,i)||'onchange="calc_en(this.id,'||conp.conp_id||','||l_MJ_coca_id||','||i||');thousandSeparator(this.id,this.value)"></td>';
|
|
--
|
|
ELSE
|
|
--
|
|
l_tab_line := l_tab_line || '<td>'||'<input type=text id="'||conp.conp_id||':'||conp_coca.coca_id||':'||i||'" name="val" value="'||get_matrix_val(conp.conp_id,conp_coca.coca_id,i)||'"'||check_cell_error(conp.conp_id,conp_coca.coca_id,i)||'onchange="thousandSeparator(this.id,this.value)"></td>';
|
|
--
|
|
END IF;
|
|
--
|
|
END IF;
|
|
--
|
|
ELSIF conp_coca.display_cond = 'LO' THEN
|
|
--
|
|
-- this is a long day category
|
|
--
|
|
IF l_num_hours = '25' THEN
|
|
--
|
|
-- check to see if we need to put an onchange js call to calculate the energy
|
|
--
|
|
IF l_MJ_coca_id > 0 THEN
|
|
--
|
|
l_tab_line := l_tab_line || '<td>'||'<input type=text id="'||conp.conp_id||':'||conp_coca.coca_id||':'||i||'" name="val" value="'||get_matrix_val(conp.conp_id,conp_coca.coca_id,i)||'"'||check_cell_error(conp.conp_id,conp_coca.coca_id,i)||'onchange="calc_en(this.id,'||conp.conp_id||','||l_MJ_coca_id||','||i||');thousandSeparator(this.id,this.value)"></td>';
|
|
--
|
|
ELSE
|
|
--
|
|
l_tab_line := l_tab_line || '<td>'||'<input type=text id="'||conp.conp_id||':'||conp_coca.coca_id||':'||i||'" name="val" value="'||get_matrix_val(conp.conp_id,conp_coca.coca_id,i)||'"'||check_cell_error(conp.conp_id,conp_coca.coca_id,i)||'onchange="thousandSeparator(this.id,this.value)"></td>';
|
|
--
|
|
END IF;
|
|
--
|
|
ELSIF l_cont_long_day THEN
|
|
--
|
|
l_tab_line := l_tab_line || '<td>'||'<input type=hidden name="val" value="0">'||'<input type=text name="val" id="'||conp.conp_id||':'||conp_coca.coca_id||':'||i||'" value="'||get_matrix_val(conp.conp_id,conp_coca.coca_id,i)||'"'||check_cell_error(conp.conp_id,conp_coca.coca_id,i)||' disabled="disabled"></td>';
|
|
--
|
|
ELSE
|
|
--
|
|
NULL;
|
|
--
|
|
END IF;
|
|
--
|
|
END IF;
|
|
--
|
|
END LOOP;
|
|
--
|
|
l_tab_line := l_tab_line || '</tr>';
|
|
htp.p(l_tab_line);
|
|
--
|
|
END LOOP;
|
|
--
|
|
END LOOP;
|
|
--
|
|
htp.p('</table>');
|
|
--
|
|
ELSE
|
|
--
|
|
-- No contract identifier found - error!
|
|
--
|
|
wsgl.displaymessage(p_type => WSGL.MESS_ERROR
|
|
,p_mess => gc_no_cont_found
|
|
);
|
|
--
|
|
END IF;
|
|
--
|
|
--caco_debug.putline('display_nom_details END');
|
|
EXCEPTION
|
|
WHEN OTHERS THEN
|
|
--
|
|
cout_err.report_and_stop(p_exception_message => sqlerrm||' : efnow098$.display_nom_details');
|
|
--
|
|
END display_nom_details;
|
|
--
|
|
FUNCTION check_nomination ( p_nomination IN nominations.identifier%TYPE
|
|
, p_cust_id IN customers.cust_id%TYPE
|
|
) RETURN BOOLEAN IS
|
|
--
|
|
l_return BOOLEAN := FALSE;
|
|
--
|
|
BEGIN
|
|
--
|
|
FOR i IN ( SELECT noms.nomi_id
|
|
FROM nominations noms
|
|
,contracts cont
|
|
WHERE noms.identifier = p_nomination
|
|
AND noms.cont_id = cont.cont_id
|
|
AND cont.cust_id = p_cust_id ) LOOP
|
|
--
|
|
l_return := TRUE;
|
|
--
|
|
EXIT;
|
|
--
|
|
END LOOP;
|
|
--
|
|
RETURN l_return;
|
|
--
|
|
END;
|
|
--
|
|
PROCEDURE page_foot ( p_rb IN VARCHAR2
|
|
, p_contract IN VARCHAR2 DEFAULT NULL
|
|
, p_nomination IN VARCHAR2 DEFAULT NULL
|
|
, p_spreadsheet IN VARCHAR2 DEFAULT NULL
|
|
) IS
|
|
--
|
|
l_valid BOOLEAN := FALSE;
|
|
l_message VARCHAR2(1000) := NULL;
|
|
--
|
|
l_gtsp_id gtt_spreadsheet.spreadsheet_id%TYPE;
|
|
--
|
|
BEGIN
|
|
--
|
|
--caco_debug.putline('-----page_foot');
|
|
--
|
|
-- Build the matrix if the correct parameters have been passed
|
|
--
|
|
htp.p('<div id="nommatrix">');
|
|
--
|
|
IF ( p_rb = '1' AND p_contract IS NOT NULL)
|
|
OR ( p_rb = '2' AND p_nomination IS NOT NULL)
|
|
OR ( p_rb = '3' AND p_spreadsheet IS NOT NULL) THEN
|
|
--
|
|
-- Lets display the grid
|
|
--
|
|
IF p_rb = '2' THEN
|
|
--
|
|
-- Copying an existing nomination, check is valid for my user
|
|
--
|
|
l_valid := check_nomination ( p_nomination => p_nomination
|
|
, p_cust_id => g_cust_id
|
|
);
|
|
--
|
|
IF l_valid THEN
|
|
--
|
|
-- Appears to be valid, lets get the nomination
|
|
--
|
|
SELECT *
|
|
BULK COLLECT
|
|
INTO g_nomi_tab
|
|
FROM nominations noms
|
|
WHERE noms.identifier = p_nomination;
|
|
--
|
|
-- Now get the details
|
|
--
|
|
SELECT *
|
|
BULK COLLECT
|
|
INTO g_nnpcv_tab
|
|
FROM nom_net_point_cat_vals nnpcv
|
|
WHERE nnpcv.nomi_id = g_nomi_tab(1).nomi_id
|
|
ORDER BY nnpcv.gas_day
|
|
,efno_nominations.get_conp(nnpcv.conp_id, 'DISPLAY_SEQUENCE')
|
|
,efno_nominations.get_coca(nnpcv.coca_id, 'DISPLAY_SEQUENCE');
|
|
--
|
|
-- Set the target end date to the number of days in the nomination
|
|
--
|
|
g_target_date_end := g_target_date + (g_nnpcv_tab(g_nnpcv_tab.LAST).gas_day - g_nnpcv_tab(1).gas_day);
|
|
--
|
|
END IF;
|
|
--
|
|
END IF;
|
|
--
|
|
IF p_rb = '3' THEN
|
|
--
|
|
-- Uploading a spreadsheet, find the document
|
|
--
|
|
FOR i IN ( SELECT docu.docu_id
|
|
FROM documents docu
|
|
WHERE docu.name = p_spreadsheet ) LOOP
|
|
--
|
|
-- Decode the document using the java routines
|
|
--
|
|
BEGIN
|
|
--
|
|
l_gtsp_id := amfr_excel.j_readworkbook(p_docu_id => i.docu_id);
|
|
--
|
|
EXCEPTION
|
|
WHEN OTHERS THEN
|
|
--
|
|
l_valid := FALSE;
|
|
--
|
|
cout_err.report_and_go( p_exception_number => sqlcode
|
|
, p_exception_message => sqlerrm
|
|
);
|
|
--
|
|
l_valid := FALSE;
|
|
--
|
|
END;
|
|
--
|
|
IF l_gtsp_id IS NOT NULL AND l_gtsp_id != 0 THEN
|
|
--
|
|
-- Spreadheet appears to be OK, continue processing
|
|
--
|
|
caco_debug.putline('Read Spreadsheet gtsp: '||l_gtsp_id);
|
|
--
|
|
FOR i IN ( SELECT COUNT(*) AS gcnt
|
|
FROM gtt_spreadsheet gtts
|
|
WHERE gtts.spreadsheet_id = l_gtsp_id) LOOP
|
|
--
|
|
caco_debug.putline('Spreadsheet decoded to: '||i.gcnt||' cells.');
|
|
--
|
|
END LOOP;
|
|
--
|
|
IF NOT process_spreadsheet_to_arrays ( p_gtsp_id => l_gtsp_id
|
|
, p_cont_id => g_cont_id
|
|
, p_nomi_tab => g_nomi_tab
|
|
, p_nnpcv_tab => g_nnpcv_tab
|
|
, p_error => l_message
|
|
) THEN
|
|
--
|
|
l_valid := FALSE;
|
|
--
|
|
ELSE
|
|
--
|
|
l_valid := TRUE;
|
|
--
|
|
END IF;
|
|
--
|
|
ELSE
|
|
--
|
|
-- File doesn't appear to be in the correct format (that is, a spreadsheet)
|
|
--
|
|
l_valid := FALSE;
|
|
l_message := gc_invalid_file_format;
|
|
--
|
|
END IF;
|
|
--
|
|
END LOOP;
|
|
--
|
|
END IF;
|
|
--
|
|
IF p_rb = '1'
|
|
OR l_valid THEN
|
|
--
|
|
-- Build the form
|
|
--
|
|
htp.p('<form name="nom_grid" action="'||g_package_name||'.submit_nomination" method="post">');
|
|
--
|
|
htp.p('<br>');
|
|
--
|
|
-- Display the details
|
|
--
|
|
display_nom_details(p_type => 'TABLE');
|
|
--
|
|
htp.p('<br>');
|
|
--
|
|
-- submit and verify buttons
|
|
--
|
|
htp.p('<input type="submit" name="action" value="'||caco_utilities.get_module_text(1149/*Verify*/)||'" >');
|
|
htp.p('<input type="submit" name="action" value="'||caco_utilities.get_module_text(840/*Insert*/)||'" >');
|
|
--
|
|
htp.p('</form>');
|
|
--
|
|
ELSE
|
|
--
|
|
-- Must have invalid data - display any error
|
|
--
|
|
wsgl.displaymessage(p_type => WSGL.MESS_ERROR
|
|
,p_mess => l_message
|
|
);
|
|
--
|
|
END IF;
|
|
--
|
|
ELSE
|
|
--
|
|
-- Nothing to display - enter header details
|
|
--
|
|
htp.p(gc_missing_details);
|
|
--
|
|
END IF;
|
|
--
|
|
-- Close the nommatrix div
|
|
--
|
|
htp.p('</div>');
|
|
--
|
|
-- Interruption notes at footer of the page
|
|
--
|
|
IF g_int_category THEN
|
|
--
|
|
htp.br;
|
|
htp.p('<p><b>'||caco_utilities.get_module_text(3810)||'</b></p>');
|
|
--
|
|
END IF;
|
|
--
|
|
caco_system.footer(p_closebody => TRUE);
|
|
--
|
|
-- re-initialise the tables with empty tables in case they've been used
|
|
--
|
|
g_nomi_tab := g_empty_nomi_tab;
|
|
g_nnpcv_tab := g_empty_nnpcv_tab;
|
|
--
|
|
g_cell_error := g_empty_cell_error;
|
|
g_row_error := g_empty_row_error;
|
|
--
|
|
END page_foot;
|
|
--
|
|
FUNCTION pdecode ( p_decode_string IN VARCHAR2
|
|
) RETURN VARCHAR2 IS
|
|
--
|
|
l_return VARCHAR2(4000);
|
|
--
|
|
BEGIN
|
|
--
|
|
EXECUTE IMMEDIATE 'SELECT '||p_decode_string||' FROM DUAL' into l_return;
|
|
--
|
|
RETURN l_return;
|
|
--
|
|
EXCEPTION
|
|
WHEN OTHERS THEN
|
|
htp.p(sqlerrm||p_decode_string);
|
|
RETURN NULL;
|
|
END pdecode;
|
|
--
|
|
PROCEDURE get_cont_id ( p_cust_id IN customers.cust_id%TYPE
|
|
, p_contract_number IN contracts.contract_number%TYPE
|
|
) IS
|
|
--
|
|
BEGIN
|
|
--
|
|
BEGIN
|
|
--
|
|
SELECT cont.cont_id
|
|
,cont.contract_number
|
|
,cont.valid_from
|
|
,cont.valid_until
|
|
INTO g_cont_id
|
|
,g_cont_num
|
|
,g_cont_start_date
|
|
,g_cont_end_date
|
|
FROM contracts cont
|
|
WHERE cont.cust_id = p_cust_id
|
|
AND cont.status = 'O'
|
|
AND cont.contract_number = p_contract_number
|
|
AND rownum < 2;
|
|
--
|
|
EXCEPTION
|
|
WHEN OTHERS THEN
|
|
--
|
|
BEGIN
|
|
SELECT cont_id
|
|
,contract_number
|
|
,valid_from
|
|
,valid_until
|
|
INTO g_cont_id
|
|
,g_cont_num
|
|
,g_cont_start_date
|
|
,g_cont_end_date
|
|
FROM (SELECT cont.cont_id
|
|
,cont.contract_number
|
|
,cont.valid_from
|
|
,cont.valid_until
|
|
FROM contracts cont
|
|
WHERE cont.cust_id = p_cust_id
|
|
AND cont.status = 'O'
|
|
AND cont.contract_number = NVL(p_contract_number,cont.contract_number)
|
|
ORDER BY cont.valid_from
|
|
)
|
|
WHERE rownum < 2;
|
|
EXCEPTION
|
|
WHEN OTHERS THEN
|
|
--
|
|
--
|
|
g_cont_id := NULL;
|
|
g_cont_num := NULL;
|
|
END;
|
|
--
|
|
END;
|
|
--
|
|
END get_cont_id;
|
|
--
|
|
-- Public
|
|
--
|
|
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(g_package_name || '.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)
|
|
,NULL
|
|
,g_package_name
|
|
,'Close'
|
|
,TRUE
|
|
,'DD-MON-RRRR');
|
|
--
|
|
wsgl.output_calendar(z_field_name
|
|
,z_field_value
|
|
,z_field_format
|
|
,wsgl.msggettext(123
|
|
,wsglm.dsp128_cal_caption
|
|
,field_caption)
|
|
,NULL
|
|
,g_package_name
|
|
,'Close'
|
|
,FALSE
|
|
,'DD-MON-RRRR');
|
|
--
|
|
EXCEPTION
|
|
WHEN OTHERS THEN
|
|
wsgl.displaymessage(wsgl.mess_exception
|
|
,SQLERRM
|
|
,''
|
|
,NULL
|
|
,g_package_name || '.calendar');
|
|
END calendar;
|
|
--
|
|
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;
|
|
--
|
|
PROCEDURE output_format_cal_js(page_header IN VARCHAR2
|
|
,body_attributes IN VARCHAR2
|
|
,chosen_date IN VARCHAR2
|
|
,field_format IN VARCHAR2) IS
|
|
--
|
|
-- Copied from WSGL
|
|
--
|
|
the_date DATE := to_date(chosen_date
|
|
,'DD-MONTH-YYYY');
|
|
--
|
|
BEGIN
|
|
--
|
|
wsgl.openpagehead(page_header);
|
|
wsgl.closepagehead;
|
|
wsgl.openpagebody(FALSE
|
|
,p_attributes => body_attributes);
|
|
htp.p('<SCRIPT>');
|
|
htp.p('opener.dateField.value = "' ||
|
|
TO_CHAR(the_date
|
|
,field_format) || '";');
|
|
htp.p('opener.dateField.focus();');
|
|
htp.p('if(opener.dateField.onchange != null) { opener.dateField.onchange(); }');
|
|
htp.p('window.close();');
|
|
htp.p('</SCRIPT>');
|
|
wsgl.closepagebody;
|
|
--
|
|
END output_format_cal_js;
|
|
BEGIN
|
|
--
|
|
IF l_day = '0' THEN
|
|
l_day := '01';
|
|
END IF;
|
|
--
|
|
output_format_cal_js(wsgl.msggettext(123
|
|
,wsglm.dsp128_cal_caption
|
|
,field_caption)
|
|
,NULL
|
|
,l_day || '-' || MONTH || '-' || YEAR
|
|
,z_field_format);
|
|
--
|
|
END format_cal_date;
|
|
--
|
|
PROCEDURE noms_js IS
|
|
BEGIN
|
|
--
|
|
owa_util.mime_header('application/x-javascript'
|
|
,TRUE);
|
|
--
|
|
htp.p(' function showtr(trid)');
|
|
htp.p(' {');
|
|
htp.p(' obj = document.getElementsByTagName(''TR'');');
|
|
htp.p(' for (i=0; i<obj.length; i++)');
|
|
htp.p(' {');
|
|
htp.p(' if (obj[i].id == trid) {');
|
|
htp.p(' obj[i].checked = true;');
|
|
htp.p(' obj[i].style.display = '''';}');
|
|
htp.p(' }');
|
|
htp.p(' obj = document.getElementsByTagName("LABEL");');
|
|
htp.p(' for (i=0; i<obj.length; i++)');
|
|
htp.p(' {');
|
|
htp.p(' if (obj[i].id == trid+"i") ');
|
|
htp.p(' obj[i].className = ''selected'';');
|
|
htp.p(' }');
|
|
htp.p('}');
|
|
htp.p('function hidetr(trid)');
|
|
htp.p('{');
|
|
htp.p(' obj = document.getElementsByTagName(''TR'');');
|
|
htp.p(' for (i=0; i<obj.length; i++)');
|
|
htp.p(' {');
|
|
htp.p(' if (obj[i].id == trid)');
|
|
htp.p(' obj[i].style.display = ''none'';');
|
|
htp.p(' }');
|
|
htp.p(' obj = document.getElementsByTagName("LABEL");');
|
|
htp.p(' for (i=0; i<obj.length; i++)');
|
|
htp.p(' {');
|
|
htp.p(' if (obj[i].id == trid+"i") ');
|
|
htp.p(' obj[i].className = ''unselected'';');
|
|
htp.p(' }');
|
|
htp.p('}');
|
|
htp.p(WSGJSL.OpenEvent('nomination','LOV'));
|
|
htp.p(' var depStr = "";');
|
|
htp.p(' var modeStr = "";');
|
|
htp.p(' if (index == null)');
|
|
htp.p(' index = 0;');
|
|
htp.p(' var lovFra = "winLOV";');
|
|
htp.p(' var winpar = "height=400, width=500, scrollbars=yes, resizable=yes ";');
|
|
htp.p(' var filterprompt = "";'); --'||WSGL.MsgGetText(124,WSGLM.DSP124_LOV_ENTER_SEARCH,'Nomination')||'";');
|
|
htp.p(' var lovTitle = "'||replace('','"','\"')||'";');
|
|
htp.p(' window.current_lov_title = lovTitle;');
|
|
htp.p(' JSLOpenLOV( ctl, index, modeStr, "'||g_package_name||'.nomination_lov", depStr, lovFra, winpar, filterprompt );');
|
|
htp.p(wsgjsl.closeevent);
|
|
htp.p(wsgjsl.rtnopenlov);
|
|
htp.p('function removeSpaces(string)');
|
|
htp.p('{');
|
|
htp.p('return string.split('' '').join('''');');
|
|
htp.p('}');
|
|
htp.p('function calc_en(x,conp_id,coca_id,num)');
|
|
htp.p('{');
|
|
htp.p(' var y=removeSpaces(document.getElementById(x).value)');
|
|
htp.p(' var z=document.getElementById(conp_id).value');
|
|
htp.p(' var a=Math.round(z*y)');
|
|
htp.p(' b=a.toString()');
|
|
htp.p(' thousandSeparator(conp_id + '':'' + coca_id + '':'' + num,b)');
|
|
htp.p('}');
|
|
htp.p('function debug(message)');
|
|
htp.p('{');
|
|
htp.p(' alert(message)');
|
|
htp.p('}');
|
|
caco_utilities.thousand_separator_js;
|
|
--
|
|
END noms_js;
|
|
--
|
|
PROCEDURE nomination_css IS
|
|
BEGIN
|
|
--
|
|
owa_util.mime_header('text/css'
|
|
,TRUE);
|
|
--
|
|
htp.p(' .unselected {font-weight : lighter;
|
|
}
|
|
.selected {font-weight : bold;
|
|
}'||CHR(10));
|
|
--
|
|
htp.p('div#nommatrix input.r{ text-align:right; } ');
|
|
htp.p('div#nommatrix input.inpdate{ text-align:left; } ');
|
|
htp.p('div#nommatrix th { background-color : #D9D9D9;
|
|
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;
|
|
padding: 2px 5px 2px 5px; white-space: nowrap;}');
|
|
|
|
htp.p('div#nommatrix th[scope=row] { text-align:left; } ');
|
|
htp.p('div#nommatrix td {
|
|
border-left-width : 1px;
|
|
border-left-style : solid;
|
|
border-left-color : black;
|
|
border-right-width : 1px;
|
|
border-right-style : solid;
|
|
border-right-color : black;
|
|
border-top-width : 1px;
|
|
border-top-style : solid;
|
|
border-top-color : black;
|
|
border-bottom-width : 1px;
|
|
border-bottom-style : solid;
|
|
border-bottom-color : black;
|
|
}');
|
|
htp.p('* HTML #p_spreadsheet {height: 24px;}');
|
|
htp.p('div#nommatrix td.nofill {border-style: none;}');
|
|
htp.p('div#nommatrix input.error {text-align:right; color: red; }');
|
|
htp.p('div#nommatrix input.interruption {text-align:right; background-color: #ff9f98; filter:alpha(opacity=70); -moz-opacity:0.7; opacity: 0.7;}');
|
|
htp.p('div#nommatrix tr.error {color: red; background:transparent; filter:alpha(opacity=50); -moz-opacity:.50; opacity:.50;}');
|
|
|
|
--
|
|
END nomination_css;
|
|
--
|
|
PROCEDURE nom_header(p_contract IN VARCHAR2 DEFAULT NULL
|
|
,p_nomination IN VARCHAR2 DEFAULT NULL
|
|
,p_spreadsheet IN VARCHAR2 DEFAULT NULL
|
|
,p_rb IN VARCHAR2 DEFAULT 1
|
|
,p_error IN VARCHAR2 DEFAULT NULL
|
|
) IS
|
|
--
|
|
l_contract_details VARCHAR2(200);
|
|
l_cont_count INTEGER;
|
|
l_contract VARCHAR2(100);
|
|
--
|
|
CURSOR cur_cont IS
|
|
SELECT c.contract_number
|
|
, c.cont_id
|
|
, c.valid_from
|
|
, c.valid_until
|
|
FROM contracts c
|
|
WHERE c.cust_id = caco_utilities.get_cust_id
|
|
AND c.status = 'O'
|
|
AND c.valid_from < g_gas_day + c.receive_before_start
|
|
AND c.valid_until >= g_gas_day
|
|
ORDER BY c.valid_from;
|
|
--
|
|
BEGIN
|
|
--
|
|
--caco_debug.putline('-----nom_header');
|
|
--
|
|
get_cont_id ( p_contract_number => p_contract
|
|
, p_cust_id => g_cust_id );
|
|
--
|
|
/*caco_debug.putline('g_target_date: '||to_char(g_target_date,g_date_format));
|
|
caco_debug.putline('g_gas_day: '||to_char(g_gas_day,g_date_format));
|
|
caco_debug.putline('g_cust_id: '||g_cust_id);
|
|
caco_debug.putline('g_cont_start_date: '||to_char(g_cont_start_date,g_date_format));*/
|
|
--
|
|
IF NOT caco_security.security_check(p_package_name => g_package_name) THEN
|
|
--
|
|
NULL;
|
|
--
|
|
ELSE
|
|
--
|
|
-- Display the page head
|
|
--
|
|
page_head;
|
|
--
|
|
-- Security Check OK, now build the form
|
|
--
|
|
htp.p(' <form action="'||g_package_name||'.redisplay" method="post" id="header" name="header" enctype="multipart/form-data">');
|
|
htp.p(' <table border="0" cellpadding="2" cellspacing="1" >');
|
|
htp.p('<fieldset style="border:none">');
|
|
htp.p(' <tbody>');
|
|
|
|
htp.p(' <tr>');
|
|
htp.p(' <td>');
|
|
htp.p(' '||caco_utilities.get_module_text(2137)||': ');
|
|
--
|
|
-- Contract select list
|
|
--
|
|
htp.p('<select name="p_contract" id="p_contract" onchange="this.form.submit();">');
|
|
--
|
|
l_contract := p_contract;
|
|
IF l_contract IS NULL
|
|
THEN
|
|
|
|
l_cont_count := 0;
|
|
FOR i IN cur_cont
|
|
LOOP
|
|
l_cont_count := l_cont_count + 1;
|
|
l_contract := i.contract_number;
|
|
END LOOP;
|
|
--
|
|
IF l_cont_count > 1
|
|
THEN
|
|
l_contract := NULL;
|
|
END IF;
|
|
END IF;
|
|
--
|
|
--
|
|
IF l_contract IS NULL -- no contract passed in and > 1 contract
|
|
THEN
|
|
--
|
|
htp.p('<option value="" selected="selected" ></option>');
|
|
--
|
|
FOR i IN cur_cont
|
|
LOOP
|
|
--
|
|
htp.p('<option value="'||i.contract_number||'"'||'>'||i.contract_number||'</option>');
|
|
--
|
|
END LOOP;
|
|
--
|
|
ELSE -- contract passed in or just one contract
|
|
htp.p('<option value=""></option>');
|
|
--
|
|
FOR i IN cur_cont
|
|
LOOP
|
|
--
|
|
htp.p('<option value="'||i.contract_number||'"'||pdecode('decode('''||l_contract||''','''||i.contract_number||''',''selected="selected"'',NULL)')||'>'||i.contract_number||'</option>');
|
|
--
|
|
IF l_contract = i.contract_number THEN
|
|
--
|
|
-- Display some context information
|
|
--
|
|
l_contract_details := caco_utilities.get_module_text(2441)||': <input disabled value="'||TO_CHAR(i.valid_from, g_date_format)||'" style="width: 100px;"> '||caco_utilities.get_module_text(2440)||': <input disabled value="'||TO_CHAR(i.valid_until, g_date_format)||'" style="width: 100px;">';
|
|
--
|
|
g_cont_id := i.cont_id;
|
|
g_cont_num := i.contract_number;
|
|
g_cont_start_date := i.valid_from;
|
|
g_cont_end_date := i.valid_until;
|
|
--
|
|
END IF;
|
|
--
|
|
END LOOP;
|
|
END IF;
|
|
htp.p('</select>');
|
|
--
|
|
IF l_contract_details IS NOT NULL THEN
|
|
--
|
|
htp.p(l_contract_details);
|
|
l_contract_details := NULL;
|
|
--
|
|
END IF;
|
|
--
|
|
htp.p(' </td>');
|
|
htp.p(' </tr>');
|
|
|
|
IF l_contract IS NOT NULL
|
|
THEN
|
|
htp.p(' <tr>');
|
|
htp.p('<td colspan="2"><div><label for="rb1x" id="rb1i" class="'||pdecode('decode('''||p_rb||''',''1'',''selected'', ''unselected'')')||'"><input value="1" id="rb1x" name="p_rb" '||pdecode('decode('''||p_rb||''',''1'',''checked="checked"'', NULL)')||' type="radio" onclick="hidetr(''rb2'');hidetr(''rb3'');showtr(''rb1'');return true;">'||caco_utilities.get_module_text(2136)||'</label></div></td>');
|
|
htp.p(' </tr>');
|
|
htp.p(' <tr id="rb1" style="display: '||pdecode('decode('''||p_rb||''',''1'','''', ''none'')')||';">');
|
|
htp.p(' <td>');
|
|
htp.p(' </td>');
|
|
htp.p(' <td>');
|
|
htp.p(' </td>');
|
|
htp.p(' </tr>');
|
|
htp.p(' <tr>');
|
|
htp.p('<td colspan="2"><div><label for="rb2x" id="rb2i" class="'||pdecode('decode('''||p_rb||''',''2'',''selected'', ''unselected'')')||'"><input value="2" id="rb2x" name="p_rb" '||pdecode('decode('''||p_rb||''',''2'',''checked="checked"'', NULL)')||' type="radio" onclick="hidetr(''rb1'');hidetr(''rb3'');showtr(''rb2'');return true;">'||caco_utilities.get_module_text(2138)||'</label></div></td>');
|
|
htp.p(' </tr>');
|
|
htp.p(' <tr id="rb2" style="display: '||pdecode('decode('''||p_rb||''',''2'','''', ''none'')')||';">');
|
|
htp.p(' <td>');
|
|
htp.p(' '||caco_utilities.get_module_text(2140)||': <input name="P_nomination" size="10" maxlength="20" id="P_nomination" type="text" value="'||p_nomination||'" onchange="this.form.submit();">');
|
|
htp.p(wsgjsl.lovbutton('nomination'
|
|
,htf.img('/framework/images/lov.gif','TOP','List Values',NULL,'WIDTH=18 HEIGHT=22 BORDER=0')
|
|
,'header')
|
|
);
|
|
--
|
|
FOR i IN (SELECT 'Contract Number: <input disabled value="'||c.contract_number||'" style="width: 140px;"> '
|
|
|| 'Status: <input disabled value="'||caco_utilities.cgrefmeaning('STATUS',n.status)||'" style="width: 80px;"> '
|
|
|| 'Active From: <input disabled value="'||TO_CHAR(MIN(ncv.gas_day), g_date_format)||'" style="width: 80px;"> '
|
|
|| 'Active To: <input disabled value="'||TO_CHAR(MAX(ncv.gas_day),g_date_format)||'" style="width: 80px;"> ' AS nom_str
|
|
, c.contract_number
|
|
FROM nominations n
|
|
,contracts c
|
|
,nom_net_point_cat_vals ncv
|
|
WHERE n.cont_id = c.cont_id
|
|
AND c.cust_id = caco_utilities.get_cust_id
|
|
AND n.nomi_id = ncv.nomi_id
|
|
AND (n.IDENTIFIER = p_nomination)
|
|
GROUP BY n.IDENTIFIER
|
|
,c.contract_number
|
|
,caco_utilities.cgrefmeaning('STATUS'
|
|
,n.status)
|
|
) LOOP
|
|
--
|
|
htp.p(i.nom_str);
|
|
--
|
|
END LOOP;
|
|
--
|
|
htp.p(' </td>');
|
|
htp.p(' </tr>');
|
|
htp.p(' <tr>');
|
|
htp.p('<td colspan="2"><div><label for="rb3x" id="rb3i" class="'||pdecode('decode('''||p_rb||''',''3'',''selected'', ''unselected'')')||'"><input value="3" id="rb3x" name="p_rb" '||pdecode('decode('''||p_rb||''',''3'',''checked="checked"'', NULL)')||' type="radio" onclick="hidetr(''rb1'');hidetr(''rb2'');showtr(''rb3'');return true;">'||caco_utilities.get_module_text(2139)||'</label></div></td>');
|
|
htp.p(' </tr>');
|
|
htp.p(' <tr id="rb3" style="display: '||pdecode('decode('''||p_rb||''',''3'','''', ''none'')')||';">');
|
|
htp.p(' <td>');
|
|
htp.p(' '||caco_utilities.get_module_text(543)||' (.xls): <input name="p_spreadsheet" size="50" maxlength="200" id="p_spreadsheet" type="file" value="'||p_spreadsheet||'" accept="application/vnd.ms-excel">');
|
|
htp.formsubmit(cvalue => caco_utilities.get_module_text(1147));
|
|
htp.p(' </td>');
|
|
htp.p(' </tr>');
|
|
htp.p(' </tbody>');
|
|
END IF;
|
|
htp.p('</fieldset>');
|
|
htp.p(' </table>');
|
|
htp.p(' </form>');
|
|
htp.p(' <hr>');
|
|
--
|
|
-- Display any error or information messages
|
|
--
|
|
IF g_error_message IS NOT NULL THEN
|
|
--
|
|
htp.p('<span>'||g_error_message||'</span>');
|
|
--
|
|
END IF;
|
|
--
|
|
-- If appropriate, build the bottom of the screen
|
|
--
|
|
IF ( p_rb = 1 AND l_contract IS NOT NULL)
|
|
OR ( p_rb = 2 AND p_nomination IS NOT NULL)
|
|
OR ( p_rb = 3 AND p_spreadsheet IS NOT NULL) THEN
|
|
--
|
|
page_foot ( p_rb
|
|
, l_contract
|
|
, p_nomination
|
|
, p_spreadsheet
|
|
);
|
|
--
|
|
END IF;
|
|
--
|
|
END IF;
|
|
--
|
|
END nom_header;
|
|
--
|
|
PROCEDURE nomination_lov(z_filter IN VARCHAR2 DEFAULT NULL
|
|
,z_mode IN VARCHAR2 DEFAULT NULL
|
|
,z_caller_url IN VARCHAR2 DEFAULT NULL
|
|
,z_formrow IN NUMBER DEFAULT NULL
|
|
,z_long_list IN VARCHAR2 DEFAULT NULL
|
|
,z_issue_wait IN VARCHAR2 DEFAULT NULL
|
|
) IS
|
|
--
|
|
lb_first BOOLEAN := TRUE;
|
|
l_cust_id customers.cust_id%TYPE;
|
|
--
|
|
BEGIN
|
|
--
|
|
IF NOT caco_security.security_check(p_package_name => g_package_name) THEN
|
|
--
|
|
RETURN;
|
|
--
|
|
END IF;
|
|
htp.p('z_filter: '||'*'||z_filter||'*');
|
|
--
|
|
htp.p('<html>
|
|
<head>
|
|
<script>
|
|
if (opener.current_lov_title == "")
|
|
{
|
|
var winTitle = "Copy from Previous Nomination";
|
|
document.write("<title>" + winTitle + "</title>");
|
|
}
|
|
else
|
|
{
|
|
document.write("<title>" + opener.current_lov_title + "</title>");
|
|
}
|
|
</script>
|
|
|
|
<script>
|
|
function PassBack(p_nom_identifier) {
|
|
if (opener.LOVForm.name.search(/VForm$/) == -1) {
|
|
opener.LOVForm.P_nomination.focus();
|
|
opener.LOVForm.P_nomination.value = p_nom_identifier;
|
|
opener.document.header.submit();
|
|
}
|
|
close();
|
|
}
|
|
|
|
function Close_OnClick() {
|
|
close();
|
|
}
|
|
function Find_OnClick() {
|
|
document.forms[0].submit();
|
|
}
|
|
</script>
|
|
<link rel=stylesheet href="caco_system.css?p_type=lov" >
|
|
|
|
</head>
|
|
<body>
|
|
|
|
<script>
|
|
if (opener.current_lov_title == "")
|
|
{
|
|
var winTitle = "Nominations";
|
|
document.write("<H2><I>" + winTitle + "</I></H2>");
|
|
}
|
|
else
|
|
{
|
|
document.write("<H2><I>" + opener.current_lov_title + "</I></H2>");
|
|
}
|
|
</script>
|
|
<p>
|
|
');
|
|
|
|
htp.p('<FORM ACTION="efnow098$.nomination_lov" METHOD="POST">');
|
|
htp.p(' <P>');
|
|
htp.p('Search criterion for Identifier:');
|
|
htp.p('<P>');
|
|
htp.p('<INPUT TYPE="text" NAME="Z_FILTER" VALUE="%">');
|
|
htp.p('<input type="button" value="Find" onclick="Find_OnClick()">');
|
|
htp.p('<input type="button" value="Close" onclick="Close_OnClick()">');
|
|
htp.p('</FORM>');
|
|
htp.p(' <P>');
|
|
l_cust_id := caco_utilities.get_cust_id;
|
|
FOR f IN (SELECT *
|
|
FROM (SELECT n.IDENTIFIER
|
|
,c.contract_number
|
|
,wsgl.gettext(caco_utilities.cgrefmeaning('STATUS'
|
|
,n.status)) AS status
|
|
,TO_CHAR(MIN(ncv.gas_day)
|
|
,g_date_format) AS start_day
|
|
,TO_CHAR(MAX(ncv.gas_day)
|
|
,g_date_format) AS end_day
|
|
FROM nominations n
|
|
,contracts c
|
|
,nom_net_point_cat_vals ncv
|
|
WHERE c.cont_id IN (SELECT cont2.cont_id
|
|
FROM contracts cont2
|
|
CONNECT BY PRIOR cont2.prev_cont_id = cont2.cont_id
|
|
START WITH cont2.cont_id = g_cont_id)
|
|
AND c.cust_id = l_cust_id
|
|
AND n.cont_id = c.cont_id
|
|
AND n.nomi_id = ncv.nomi_id
|
|
AND (n.IDENTIFIER LIKE z_filter OR z_filter IS NULL)
|
|
GROUP BY n.IDENTIFIER
|
|
,c.contract_number
|
|
,caco_utilities.cgrefmeaning('STATUS'
|
|
,n.status)
|
|
ORDER BY MIN(ncv.gas_day) DESC
|
|
,2)
|
|
WHERE ROWNUM < 50) LOOP
|
|
--
|
|
IF lb_first THEN
|
|
--
|
|
-- Print table header - we have some data
|
|
--
|
|
htp.p('<table border>');
|
|
htp.p('<thead>');
|
|
htp.p('<tr><th align="left">Identifier</th><th align="left">Contract Number</th><th align="left">Status</th><th align="left">Start Date</th><th align="left">End Date</th></tr>');
|
|
htp.p('</thead>');
|
|
--
|
|
htp.p('<tbody>');
|
|
--
|
|
lb_first := FALSE;
|
|
--
|
|
END IF;
|
|
--
|
|
htp.p('<tr valign="top"><td align="left"><a href="javascript:PassBack(''' ||
|
|
f.IDENTIFIER || ''')">' || f.IDENTIFIER ||
|
|
'</a></td><td align="left">' || f.contract_number ||
|
|
'</td><td align="left">' || f.status ||
|
|
'</td><td align="left">' || f.start_day ||
|
|
'</td><td align="left">' || f.end_day || '</td></tr>');
|
|
--
|
|
END LOOP;
|
|
--
|
|
IF lb_first THEN
|
|
--
|
|
-- No rows returned, display no data found
|
|
--
|
|
htp.p(display_message ( p_mess => gc_no_data_found
|
|
, p_type => wsgl.mess_error
|
|
));
|
|
--
|
|
ELSE
|
|
--
|
|
-- Rows returned, close the table
|
|
--
|
|
htp.p('</tbody>');
|
|
htp.p('</table>');
|
|
--
|
|
END IF;
|
|
--
|
|
htp.p('<p></body></html>');
|
|
--
|
|
END nomination_lov;
|
|
--
|
|
PROCEDURE redisplay (p_contract IN VARCHAR2 DEFAULT NULL
|
|
,p_nomination IN VARCHAR2 DEFAULT NULL
|
|
,p_spreadsheet IN VARCHAR2 DEFAULT NULL
|
|
,p_rb IN VARCHAR2 DEFAULT 1
|
|
) IS
|
|
BEGIN
|
|
--
|
|
--caco_debug.putline('-----redisplay');
|
|
--
|
|
g_cont_num := p_contract;
|
|
--
|
|
nom_header(p_contract => p_contract
|
|
,p_nomination => p_nomination
|
|
,p_spreadsheet => p_spreadsheet
|
|
,p_rb => p_rb
|
|
);
|
|
--
|
|
END redisplay;
|
|
--
|
|
PROCEDURE submit_nomination ( val IN owa_util.vc_arr
|
|
, gasday IN owa_util.vc_arr
|
|
, coca IN owa_util.vc_arr
|
|
, conp IN owa_util.vc_arr
|
|
, cv IN owa_util.vc_arr
|
|
, cont_id IN contracts.cont_id%TYPE
|
|
, action IN VARCHAR2 DEFAULT NULL
|
|
, p_gasday_start IN VARCHAR2 DEFAULT NULL
|
|
, p_gasday_end IN VARCHAR2 DEFAULT NULL
|
|
) IS
|
|
--
|
|
-- Parameters are short intentionally
|
|
--
|
|
l_message VARCHAR2(1000);
|
|
l_mess_type VARCHAR2(1000);
|
|
l_sub_list caco_utilities.g_t_substitution_list;
|
|
--
|
|
e_ude EXCEPTION;
|
|
l_date DATE;
|
|
--
|
|
l_nomi_id nominations.nomi_id%TYPE;
|
|
--
|
|
lr_cell_error gr_cell_error;
|
|
--
|
|
l_nomi_details VARCHAR2(4000);
|
|
l_timestamp DATE;
|
|
l_letter VARCHAR2(4000);
|
|
--
|
|
l_c_nnpcv_tab efno_confirmations.nnpcv_tab;
|
|
l_rule_results BOOLEAN := TRUE;
|
|
--
|
|
l_cnp_count NUMBER;
|
|
--
|
|
l_idx NUMBER := NULL;
|
|
--
|
|
l_rcve_b4_start NUMBER := 0; -- Contract receive before start
|
|
--
|
|
l_multi_day_iter NUMBER := 7;
|
|
--
|
|
l_num_format VARCHAR2(50);
|
|
--
|
|
l_tot_perc_split NUMBER := 0;
|
|
--
|
|
-- dbms_lock values
|
|
--
|
|
l_noms_lock NUMBER;
|
|
l_noms_release NUMBER;
|
|
--
|
|
-- local variables for input array manipulation for multi day noms
|
|
l_val owa_util.vc_arr;
|
|
l_gasday owa_util.vc_arr;
|
|
l_gd DATE;
|
|
l_nom_days NUMBER := 0;
|
|
l_i NUMBER := 0;
|
|
l_r NUMBER := 0;
|
|
val_i NUMBER := 0;
|
|
val_r NUMBER := 0;
|
|
--
|
|
-- array to contain val array contents with no thousand separators
|
|
l_val_no_thou_sep owa_util.vc_arr;
|
|
--
|
|
l_loop_counter NUMBER := 1;
|
|
l_coca_id NUMBER;
|
|
--
|
|
CURSOR cu_coca(c_disp_cond IN categories.display_cond%TYPE) IS
|
|
SELECT coca.coca_id
|
|
FROM contract_categories coca
|
|
,categories cate
|
|
WHERE cate.cate_id = coca.cate_id
|
|
AND coca.cont_id = g_cont_id
|
|
AND cate.display_cond = c_disp_cond;
|
|
--
|
|
BEGIN
|
|
--
|
|
--caco_debug.putline('-----submit_nomination');
|
|
--
|
|
-- Security check
|
|
--
|
|
IF caco_security.security_check(p_package_name => g_package_name) THEN
|
|
--
|
|
-- Attempt to lock nominations table
|
|
caco_debug.putline('Entered default_values');
|
|
--
|
|
l_noms_lock := dbms_lock.request(id => 128
|
|
,lockmode => 6
|
|
,timeout => 180);
|
|
caco_debug.putline('default_values DBMS_LOCK id 128 request value l_noms_lock is ' ||
|
|
l_noms_lock);
|
|
--
|
|
IF l_noms_lock = 0 THEN
|
|
BEGIN
|
|
--
|
|
-- Set the initial error point
|
|
--
|
|
g_error_point := 'A005';
|
|
--
|
|
-- 02/12/09 SP Modification to multi-day nominations
|
|
-- Manipulate the input arrays for single-multi day nominations to simulate noms entered
|
|
-- for each day.
|
|
--
|
|
l_nom_days := (to_date(p_gasday_end,g_date_format) - to_date(p_gasday_start,g_date_format))+1;
|
|
--
|
|
/* caco_debug.putline('p_gasday_start: '||p_gasday_start);
|
|
caco_debug.putline('p_gasday_end: '||p_gasday_end);
|
|
caco_debug.putline('l_nom_days: '||l_nom_days);
|
|
display_vc_arr('val before',val);
|
|
display_vc_arr('gasday before',gasday);*/
|
|
--
|
|
-- remove thousand separators from val array
|
|
--
|
|
l_val_no_thou_sep := caco_utilities.thousand_separated_to_char(val);
|
|
--IF p_gasday_start IS NOT NULL AND p_gasday_end IS NOT NULL THEN
|
|
IF get_spte_name(cont_id) = UPPER(g_spte_smulti) THEN
|
|
FOR r IN 1..conp.count LOOP
|
|
l_gd := to_date(p_gasday_start,g_date_format);
|
|
--caco_debug.putline('l_gd1: '||l_gd);
|
|
FOR i IN 1..l_nom_days LOOP
|
|
-- enter values in the gasday array
|
|
--caco_debug.putline('l_gd: '||l_gd);
|
|
l_i := l_i + 1;
|
|
l_gasday(l_i) := to_char(l_gd,g_date_format);
|
|
l_gd := l_gd + 1;
|
|
END LOOP;
|
|
END LOOP;
|
|
--
|
|
IF l_val_no_thou_sep.COUNT > 0 THEN
|
|
FOR r IN 1..conp.COUNT LOOP
|
|
FOR i IN 1..l_nom_days LOOP
|
|
FOR y IN 1..coca.COUNT LOOP
|
|
val_r := val_i + y;
|
|
l_r := l_r + 1;
|
|
-- enter values in the values array
|
|
l_val(l_r) := l_val_no_thou_sep(val_r);
|
|
END LOOP;
|
|
END LOOP;
|
|
val_i := val_i + coca.COUNT;
|
|
END LOOP;
|
|
END IF;
|
|
ELSE
|
|
-- must be single day or multiple day nomination
|
|
l_val := l_val_no_thou_sep;
|
|
l_gasday := gasday;
|
|
END IF;
|
|
--
|
|
/* display_vc_arr('val after',l_val);
|
|
display_vc_arr('gasday after',l_gasday);*/
|
|
--
|
|
-- Anonymous block to handle exceptions
|
|
--
|
|
IF action IN (caco_utilities.get_module_text(1149/* Verify */), caco_utilities.get_module_text(840/* Insert */)) THEN
|
|
--
|
|
-- Nomination Identifier looks OK, set it globally
|
|
--
|
|
g_error_point := 'A015';
|
|
--
|
|
-- Now validate the details, set the global
|
|
--
|
|
g_error_point := 'A025';
|
|
--
|
|
g_gas_days := l_gasday;
|
|
--
|
|
-- Pre-populate the arrays based on screen values without any validation
|
|
-- so earlier validation failures do not 'wipe-out' screen values.
|
|
--
|
|
g_error_point := 'A035';
|
|
--
|
|
-- Check the number of categories and sites is in the same ballpark as the number of values supplied (multiplication factor)
|
|
--
|
|
IF MOD(l_val.COUNT,(conp.COUNT*coca.COUNT))=0 THEN
|
|
--
|
|
-- only proceed if balanced, otherwise, how would we know...
|
|
--
|
|
g_error_point := 'A036';
|
|
--
|
|
FOR i IN 1..l_val.COUNT LOOP
|
|
--
|
|
-- Pre-populate the variables in case of any errors
|
|
--
|
|
g_error_point := 'A037';
|
|
--
|
|
g_nnpcv_tab(i).conp_id := conp(TRUNC((i-1)/(coca.COUNT*(l_val.COUNT/(conp.COUNT*coca.COUNT))))+1);
|
|
g_error_point := 'A038';
|
|
g_nnpcv_tab(i).coca_id := coca(MOD((i-1),coca.COUNT)+1);
|
|
g_error_point := 'A039';
|
|
g_nnpcv_tab(i).value := l_val(i);
|
|
--
|
|
END LOOP;
|
|
--
|
|
END IF;
|
|
--
|
|
g_error_point := 'A045';
|
|
--
|
|
-- Verify the nomination
|
|
--
|
|
IF cont_id IS NOT NULL THEN
|
|
--
|
|
-- Ensure that we have a contract before proceeding
|
|
--
|
|
g_error_point := 'A095';
|
|
--
|
|
get_cont_id(p_cont_id => cont_id);
|
|
--
|
|
-- Get the "Receive Before Start" parameter for the contract
|
|
l_rcve_b4_start := get_receive_before_start(g_cont_id);
|
|
--
|
|
g_error_point := 'A115';
|
|
--
|
|
IF get_spte_name(g_cont_id) = UPPER(g_spte_single) THEN
|
|
--
|
|
-- Looking at a single gas day
|
|
--
|
|
IF g_gas_days(1) IS NULL THEN
|
|
--
|
|
l_sub_list(1) := caco_utilities.get_module_text(1142);
|
|
--
|
|
caco_utilities.get_exception_message(p_exception_number => -20506
|
|
,p_message => l_message
|
|
,p_exme_type => l_mess_type
|
|
,p_substitution_list => l_sub_list
|
|
,p_language => caco_utilities.get_syus_lang
|
|
);
|
|
--
|
|
g_error_point := 'A120';
|
|
--
|
|
RAISE e_ude;
|
|
--
|
|
END IF;
|
|
--
|
|
g_error_point := 'A125';
|
|
--
|
|
BEGIN
|
|
--
|
|
l_date := TO_DATE(g_gas_days(1), g_date_format);
|
|
--
|
|
EXCEPTION
|
|
--
|
|
WHEN OTHERS THEN
|
|
--
|
|
l_sub_list(1) := g_gas_days(1);
|
|
--
|
|
caco_utilities.get_exception_message(p_exception_number => -20102
|
|
,p_message => l_message
|
|
,p_exme_type => l_mess_type
|
|
,p_substitution_list => l_sub_list
|
|
,p_language => caco_utilities.get_syus_lang
|
|
);
|
|
--
|
|
g_error_point := 'A130';
|
|
--
|
|
RAISE e_ude;
|
|
--
|
|
END;
|
|
--
|
|
g_error_point := 'A135';
|
|
--
|
|
-- Established it is a valid date, but is it in the correct timeframe?
|
|
--
|
|
IF l_date < g_target_date -1 THEN
|
|
--
|
|
l_sub_list(1) := TO_CHAR(l_date, g_date_format);
|
|
l_sub_list(2) := TO_CHAR(g_target_date, g_date_format);
|
|
--
|
|
caco_utilities.get_exception_message(p_exception_number => -20509
|
|
,p_message => l_message
|
|
,p_exme_type => l_mess_type
|
|
,p_substitution_list => l_sub_list
|
|
,p_language => caco_utilities.get_syus_lang
|
|
);
|
|
--
|
|
g_error_point := 'A140';
|
|
--
|
|
RAISE e_ude;
|
|
--
|
|
END IF;
|
|
--
|
|
g_error_point := 'A145';
|
|
--
|
|
-- Check date against contract range
|
|
--
|
|
IF NOT check_cont_date ( p_cont_id => g_cont_id
|
|
, p_date => l_date
|
|
, p_message => l_message
|
|
) THEN
|
|
--
|
|
g_error_point := 'A150';
|
|
--
|
|
RAISE e_ude;
|
|
--
|
|
END IF;
|
|
--
|
|
-- Check the date against the "Receive Before Start" parameter
|
|
--
|
|
IF ( l_date - TRUNC(SYSDATE) ) > l_rcve_b4_start THEN
|
|
--
|
|
-- it is too early to nominate for this gas day.
|
|
caco_utilities.get_exception_message(p_exception_number => -20527
|
|
,p_message => l_message
|
|
,p_exme_type => l_mess_type
|
|
,p_substitution_list => l_sub_list
|
|
,p_language => caco_utilities.get_syus_lang
|
|
);
|
|
g_error_point := 'A152';
|
|
--
|
|
RAISE e_ude;
|
|
--
|
|
END IF;
|
|
--
|
|
g_error_point := 'A155';
|
|
--
|
|
-- Check the gate closure
|
|
--
|
|
IF NOT check_gate_closure ( p_cont_id => g_cont_id
|
|
, p_date => l_date
|
|
, p_message => l_message
|
|
) THEN
|
|
--
|
|
g_error_point := 'A160';
|
|
--
|
|
RAISE e_ude;
|
|
--
|
|
END IF;
|
|
--
|
|
g_error_point := 'A165';
|
|
--
|
|
ELSIF get_spte_name(g_cont_id) IN (UPPER(g_spte_multi),UPPER(g_spte_smulti)) THEN
|
|
--
|
|
-- Looking at multiple gas days
|
|
--
|
|
g_error_point := 'A167';
|
|
--
|
|
SELECT COUNT(*)
|
|
INTO l_cnp_count
|
|
FROM cont_network_points conp
|
|
,network_points nepo
|
|
WHERE conp.cont_id = g_cont_id
|
|
AND conp.nepo_id = nepo.nepo_id
|
|
AND ((nepo.nepo_type = 'V' AND efno_contracts.emo_contract(g_cont_id) = 'Y') OR
|
|
(nepo.nepo_type IN ('N','X') AND efno_contracts.emo_contract(g_cont_id) = 'N'));
|
|
--
|
|
g_target_date := TO_DATE(p_gasday_start, g_date_format);
|
|
g_target_date_end := TO_DATE(p_gasday_end, g_date_format);
|
|
--
|
|
IF g_target_date < g_cont_start_date THEN
|
|
--
|
|
-- Target date is less than the start of the contract...what to do?
|
|
--
|
|
l_multi_day_iter := l_multi_day_iter - MOD(7-(TO_CHAR(g_cont_start_date,'D')-g_day_at_start_of_week),7)+1;
|
|
--
|
|
g_target_date := g_cont_start_date;
|
|
--
|
|
END IF;
|
|
--
|
|
/* IF g_cont_end_date - g_target_date < TO_NUMBER(cout_system_configuration.get_configuration_item('G_MULTI_DAY_NOM_DAYS')) THEN
|
|
--
|
|
-- End of contract occurs during week, shorten the days displayed
|
|
--
|
|
l_multi_day_iter := l_multi_day_iter - (TO_NUMBER(cout_system_configuration.get_configuration_item('G_MULTI_DAY_NOM_DAYS')-(g_cont_end_date - g_target_date)))+1;
|
|
--
|
|
IF l_multi_day_iter < 0 THEN
|
|
--
|
|
l_multi_day_iter := 0;
|
|
--
|
|
END IF;
|
|
--
|
|
END IF; */
|
|
--
|
|
IF MOD(l_gasday.COUNT, l_cnp_count) <> 0 THEN
|
|
--
|
|
-- The same number of days should be specified for each network point
|
|
--
|
|
l_sub_list(1) := caco_utilities.get_module_text(1142);
|
|
--
|
|
caco_utilities.get_exception_message(p_exception_number => -20506
|
|
,p_message => l_message
|
|
,p_exme_type => l_mess_type
|
|
,p_substitution_list => l_sub_list
|
|
,p_language => caco_utilities.get_syus_lang
|
|
);
|
|
--
|
|
FOR i IN 1..(TO_NUMBER(l_multi_day_iter) * l_cnp_count) LOOP
|
|
--
|
|
g_row_error(i) := l_message;
|
|
--
|
|
END LOOP;
|
|
--
|
|
g_error_point := 'A170';
|
|
--
|
|
RAISE e_ude;
|
|
--
|
|
END IF;
|
|
--
|
|
g_error_point := 'A175';
|
|
--
|
|
FOR i IN 1..l_gasday.COUNT LOOP
|
|
--
|
|
-- Check each date is a valid date
|
|
--
|
|
BEGIN
|
|
--
|
|
l_date := TO_DATE(g_gas_days(i), g_date_format);
|
|
--
|
|
EXCEPTION
|
|
--
|
|
WHEN OTHERS THEN
|
|
--
|
|
l_sub_list(1) := g_gas_days(i);
|
|
--
|
|
caco_utilities.get_exception_message(p_exception_number => -20102
|
|
,p_message => l_message
|
|
,p_exme_type => l_mess_type
|
|
,p_substitution_list => l_sub_list
|
|
,p_language => caco_utilities.get_syus_lang
|
|
);
|
|
--
|
|
g_row_error(i) := l_message;
|
|
--
|
|
g_error_point := 'A180';
|
|
--
|
|
RAISE e_ude;
|
|
--
|
|
END;
|
|
--
|
|
g_error_point := 'A185';
|
|
--
|
|
-- Check date is in the future
|
|
--
|
|
IF l_date < g_target_date -1 THEN
|
|
--
|
|
l_sub_list(1) := TO_CHAR(l_date, g_date_format);
|
|
l_sub_list(2) := TO_CHAR(g_target_date+(i-1), g_date_format);
|
|
--
|
|
caco_utilities.get_exception_message(p_exception_number => -20509
|
|
,p_message => l_message
|
|
,p_exme_type => l_mess_type
|
|
,p_substitution_list => l_sub_list
|
|
,p_language => caco_utilities.get_syus_lang
|
|
);
|
|
g_row_error(i) := l_message;
|
|
--
|
|
g_error_point := 'A190';
|
|
--
|
|
RAISE e_ude;
|
|
--
|
|
END IF;
|
|
--
|
|
g_error_point := 'A195';
|
|
--
|
|
-- Check date against contract range
|
|
--
|
|
IF NOT check_cont_date ( p_cont_id => g_cont_id
|
|
, p_date => l_date
|
|
, p_message => l_message
|
|
) THEN
|
|
--
|
|
g_row_error(i) := l_message;
|
|
--
|
|
g_error_point := 'A200';
|
|
--
|
|
RAISE e_ude;
|
|
--
|
|
END IF;
|
|
--
|
|
g_error_point := 'A205';
|
|
--
|
|
-- Check the gate closure
|
|
--
|
|
IF NOT check_gate_closure ( p_cont_id => g_cont_id
|
|
, p_date => l_date
|
|
, p_message => l_message
|
|
) THEN
|
|
--
|
|
g_row_error(i) := l_message;
|
|
--
|
|
g_error_point := 'A210';
|
|
--
|
|
RAISE e_ude;
|
|
--
|
|
END IF;
|
|
--
|
|
g_error_point := 'A215';
|
|
--
|
|
-- Check date sequence
|
|
--
|
|
IF MOD(i-1, g_gas_days.COUNT/l_cnp_count) > 0 THEN
|
|
--
|
|
-- If we're not looking at the first date
|
|
--
|
|
IF TO_DATE(g_gas_days(i), g_date_format) -1 <> TO_DATE(g_gas_days(i-1), g_date_format) THEN
|
|
--
|
|
caco_utilities.get_exception_message(p_exception_number => -20510
|
|
,p_message => l_message
|
|
,p_exme_type => l_mess_type
|
|
,p_substitution_list => l_sub_list
|
|
,p_language => caco_utilities.get_syus_lang
|
|
);
|
|
g_row_error(i) := l_message;
|
|
--
|
|
g_error_point := 'A220';
|
|
--
|
|
RAISE e_ude;
|
|
--
|
|
END IF;
|
|
--
|
|
END IF;
|
|
--
|
|
-- Check the date against the "Receive Before Start" parameter
|
|
--
|
|
IF ( l_date - TRUNC(SYSDATE) ) > l_rcve_b4_start THEN
|
|
--
|
|
-- it is too early to nominate for this gas day.
|
|
caco_utilities.get_exception_message(p_exception_number => -20527
|
|
,p_message => l_message
|
|
,p_exme_type => l_mess_type
|
|
,p_substitution_list => l_sub_list
|
|
,p_language => caco_utilities.get_syus_lang
|
|
);
|
|
g_row_error(i) := l_message;
|
|
--
|
|
g_error_point := 'A222';
|
|
--
|
|
RAISE e_ude;
|
|
--
|
|
END IF;
|
|
--
|
|
--
|
|
g_error_point := 'A225';
|
|
--
|
|
END LOOP;
|
|
--
|
|
-- If a multi-day range contains a long/short day and the contract
|
|
-- has a long/short day category and the contract is using the single-multi day input format
|
|
-- then output an error/warning
|
|
l_loop_counter := (g_target_date_end - g_target_date) +1;
|
|
IF l_loop_counter > 1 AND get_spte_name(cont_id) = UPPER(g_spte_smulti) THEN
|
|
-- check for long day category
|
|
OPEN cu_coca('LO');
|
|
FETCH cu_coca INTO l_coca_id;
|
|
IF cu_coca%FOUND THEN
|
|
FOR i IN 1..l_loop_counter LOOP
|
|
--
|
|
-- check for long day
|
|
IF cout_dates.hours_in_gas_day(g_target_date + (i-1)) = 25 THEN
|
|
l_message := wsgl.msggettext(p_msgno => NULL
|
|
,p_dflttext => caco_utilities.get_module_text(3935)
|
|
,p_subst1 => to_char(g_target_date + (i-1),g_date_format));
|
|
--
|
|
g_error_message := display_message( p_type => WSGL.MESS_ERROR
|
|
, p_mess => l_message
|
|
);
|
|
RAISE e_ude;
|
|
END IF;
|
|
END LOOP;
|
|
END IF;
|
|
CLOSE cu_coca;
|
|
--
|
|
-- check for short day category
|
|
OPEN cu_coca('SH');
|
|
FETCH cu_coca INTO l_coca_id;
|
|
IF cu_coca%FOUND THEN
|
|
FOR i IN 1..l_loop_counter LOOP
|
|
--
|
|
-- check for short day
|
|
IF cout_dates.hours_in_gas_day(g_target_date + (i-1)) = 23 THEN
|
|
l_message := wsgl.msggettext(p_msgno => NULL
|
|
,p_dflttext => caco_utilities.get_module_text(3936)
|
|
,p_subst1 => to_char(g_target_date + (i-1),g_date_format));
|
|
--
|
|
g_error_message := display_message( p_type => WSGL.MESS_ERROR
|
|
, p_mess => l_message
|
|
);
|
|
RAISE e_ude;
|
|
END IF;
|
|
END LOOP;
|
|
END IF;
|
|
CLOSE cu_coca;
|
|
END IF;
|
|
ELSE
|
|
--
|
|
-- Looking at something else?
|
|
--
|
|
NULL;
|
|
--
|
|
END IF;
|
|
--
|
|
g_error_point := 'A227';
|
|
--
|
|
-- Dates look OK, move on to numbers
|
|
--
|
|
IF MOD(l_val.COUNT,(conp.COUNT*coca.COUNT))=0 THEN --id.COUNT = val.COUNT THEN
|
|
--
|
|
-- Now go through the values - this way we can redisplay any errors
|
|
--
|
|
FOR i IN 1..l_val.COUNT LOOP
|
|
--
|
|
IF l_val(i) IS NULL THEN
|
|
--
|
|
l_sub_list(1) := caco_utilities.get_module_text(2022);
|
|
--
|
|
caco_utilities.get_exception_message(p_exception_number => -20506
|
|
,p_message => l_message
|
|
,p_exme_type => l_mess_type
|
|
,p_substitution_list => l_sub_list
|
|
,p_language => caco_utilities.get_syus_lang
|
|
);
|
|
--
|
|
lr_cell_error.conp_id := g_nnpcv_tab(i).conp_id;
|
|
lr_cell_error.coca_id := g_nnpcv_tab(i).coca_id;
|
|
lr_cell_error.iteration := CEIL(i/(l_val.COUNT/l_gasday.COUNT));
|
|
lr_cell_error.message := l_message;
|
|
--
|
|
g_cell_error(NVL(g_cell_error.COUNT,0)+1) := lr_cell_error;
|
|
--
|
|
g_error_point := 'A230';
|
|
--
|
|
RAISE e_ude;
|
|
--
|
|
END IF;
|
|
--
|
|
g_error_point := 'A235';
|
|
--
|
|
BEGIN
|
|
--
|
|
-- Anon block to check for numeric conversion
|
|
--
|
|
g_nnpcv_tab(i).value := TO_NUMBER(REPLACE(l_val(i),',',''));
|
|
--
|
|
EXCEPTION
|
|
WHEN OTHERS THEN
|
|
--
|
|
caco_utilities.get_exception_message(p_exception_number => -20511
|
|
,p_message => l_message
|
|
,p_exme_type => l_mess_type
|
|
,p_substitution_list => l_sub_list
|
|
,p_language => caco_utilities.get_syus_lang
|
|
);
|
|
--
|
|
lr_cell_error.conp_id := g_nnpcv_tab(i).conp_id;
|
|
lr_cell_error.coca_id := g_nnpcv_tab(i).coca_id;
|
|
lr_cell_error.iteration := CEIL(i/(l_val.COUNT/l_gasday.COUNT));
|
|
lr_cell_error.message := l_message;
|
|
--
|
|
g_cell_error(NVL(g_cell_error.COUNT,0)+1) := lr_cell_error;
|
|
--
|
|
g_error_point := 'A240';
|
|
--
|
|
RAISE e_ude;
|
|
--
|
|
END;
|
|
--
|
|
-- Check number format
|
|
--
|
|
g_error_point := 'A241';
|
|
--
|
|
IF INSTR(TO_CHAR(g_nnpcv_tab(i).value),'.') > 0 THEN
|
|
--
|
|
-- Number entered has a decimal, lets check it's within range, lookup format
|
|
--
|
|
g_error_point := 'A242';
|
|
--
|
|
l_num_format := NULL;
|
|
--
|
|
SELECT c.number_format
|
|
INTO l_num_format
|
|
FROM categories c
|
|
,contract_categories cc
|
|
WHERE c.cate_id = cc.cate_id
|
|
AND cc.coca_id = g_nnpcv_tab(i).coca_id;
|
|
--
|
|
-- Now compare the number formats
|
|
--
|
|
IF (LENGTH(TO_CHAR(g_nnpcv_tab(i).value)) - INSTR(TO_CHAR(g_nnpcv_tab(i).value),'.')) > (LENGTH(l_num_format) - INSTR(l_num_format||'.','.')) THEN
|
|
--
|
|
-- Number of decimals in supplied format greater than number of decimals in format mask
|
|
--
|
|
g_error_point := 'A243';
|
|
--
|
|
l_message := display_message(p_type => WSGL.MESS_ERROR
|
|
,p_mess => NVL(l_message
|
|
,caco_utilities.get_module_text(p_text_number => 2240 )
|
|
)
|
|
);
|
|
l_message := caco_utilities.get_module_text(p_text_number => 2240 );
|
|
--
|
|
lr_cell_error.conp_id := g_nnpcv_tab(i).conp_id;
|
|
lr_cell_error.coca_id := g_nnpcv_tab(i).coca_id;
|
|
--lr_cell_error.iteration := CEIL(i/(val.COUNT/gasday.COUNT));
|
|
IF MOD(CEIL(i/(l_val.count/l_gasday.count)),(l_gasday.count/l_cnp_count)) = 0 THEN
|
|
--
|
|
-- MOD returns zero when I'd like # of gasdays
|
|
--
|
|
lr_cell_error.iteration := (l_gasday.count/l_cnp_count);
|
|
ELSE
|
|
--
|
|
-- otherwise, works OK
|
|
--
|
|
lr_cell_error.iteration := MOD(CEIL(i/(l_val.count/l_gasday.count)),(l_gasday.count/l_cnp_count));
|
|
END IF;
|
|
lr_cell_error.message := l_message;
|
|
--
|
|
g_cell_error(NVL(g_cell_error.COUNT,0)+1) := lr_cell_error;
|
|
--
|
|
RAISE e_ude;
|
|
--
|
|
END IF;
|
|
--
|
|
END IF;
|
|
--
|
|
g_error_point := 'A245';
|
|
--
|
|
-- Have validated gas days already
|
|
--
|
|
IF get_spte_name(g_cont_id) IN (UPPER(g_spte_multi),UPPER(g_spte_smulti)) THEN
|
|
--
|
|
g_nnpcv_tab(i).gas_day := TO_DATE(l_gasday(CEIL(i/(l_val.COUNT/l_gasday.COUNT))),g_date_format);
|
|
--
|
|
ELSE
|
|
--
|
|
g_nnpcv_tab(i).gas_day := TO_DATE(l_gasday(1), g_date_format);
|
|
--
|
|
END IF;
|
|
--
|
|
g_error_point := 'A246';
|
|
--
|
|
END LOOP;
|
|
--
|
|
IF get_spte_name(g_cont_id) IN (UPPER(g_spte_multi),UPPER(g_spte_smulti)) THEN
|
|
--
|
|
g_target_date_end := g_nnpcv_tab(g_nnpcv_tab.LAST).gas_day;
|
|
--
|
|
END IF;
|
|
--
|
|
g_error_point := 'A247';
|
|
--
|
|
ELSE
|
|
--
|
|
-- Identifiers and values not balanced
|
|
--
|
|
g_error_point := 'A248';
|
|
--
|
|
l_message := display_message(p_type => WSGL.MESS_ERROR
|
|
,p_mess => NVL(l_message
|
|
,caco_utilities.get_module_text(p_text_number => 2330 )
|
|
)
|
|
);
|
|
--
|
|
FOR i IN 1..TO_NUMBER(cout_system_configuration.get_configuration_item('G_MULTI_DAY_NOM_DAYS')) LOOP
|
|
--
|
|
g_row_error(i) := l_message;
|
|
--
|
|
END LOOP;
|
|
--
|
|
g_error_point := 'A250';
|
|
--
|
|
RAISE e_ude;
|
|
--
|
|
END IF;
|
|
--
|
|
g_error_point := 'A251';
|
|
--
|
|
ELSE
|
|
--
|
|
-- Null Contract, raise error
|
|
--
|
|
g_error_point := 'A255';
|
|
--
|
|
l_sub_list(1) := caco_utilities.get_module_text(2137);
|
|
--
|
|
caco_utilities.get_exception_message(p_exception_number => -20506
|
|
,p_message => l_message
|
|
,p_exme_type => l_mess_type
|
|
,p_substitution_list => l_sub_list
|
|
,p_language => caco_utilities.get_syus_lang
|
|
);
|
|
--
|
|
g_error_point := 'A260';
|
|
--
|
|
RAISE e_ude;
|
|
--
|
|
END IF;
|
|
--
|
|
g_error_point := 'A270';
|
|
--
|
|
-- Because rules are based on data in the nominations table, we need to insert it here...
|
|
--
|
|
DBMS_TRANSACTION.SAVEPOINT(g_cont_id);
|
|
--
|
|
-- Insert the nomination header
|
|
--
|
|
INSERT INTO nominations ( status
|
|
, identifier
|
|
, cont_id
|
|
)
|
|
VALUES ( 'A'
|
|
, 1
|
|
, g_cont_id
|
|
)
|
|
RETURNING nomi_id INTO l_nomi_id;
|
|
--
|
|
UPDATE nominations
|
|
SET identifier = l_nomi_id
|
|
WHERE nomi_id = l_nomi_id;
|
|
--
|
|
g_error_point := 'A280';
|
|
--
|
|
l_nomi_details := 'NOM:'||l_nomi_id||' ID:'||l_nomi_id||' CONT:'||g_cont_id||'DETAILS:';
|
|
--
|
|
-- check if it is an entry mandatory offer contract
|
|
IF efno_contracts.emo_contract(g_cont_id) = 'Y' THEN
|
|
--
|
|
OPEN c_tot_perc_split(g_cont_id);
|
|
FETCH c_tot_perc_split INTO l_tot_perc_split;
|
|
CLOSE c_tot_perc_split;
|
|
--
|
|
IF l_tot_perc_split = 0 THEN
|
|
IF caco_utilities.user_has_EFT_admin = 'Y' THEN
|
|
-- Percentage split contract parameters have not been set up correctly
|
|
l_message := caco_utilities.get_module_text(3917);
|
|
ELSE
|
|
-- A more customer friendly error message..
|
|
-- An error has occurred in validating this nomination. Please contact support.
|
|
l_message := caco_utilities.get_module_text(3923);
|
|
END IF;
|
|
g_error_point := 'A282';
|
|
RAISE e_ude;
|
|
END IF;
|
|
--
|
|
FOR nnpcv_idx IN g_nnpcv_tab.FIRST..g_nnpcv_tab.LAST LOOP
|
|
--
|
|
-- check that it is a virtual network point
|
|
IF efno_contracts.virtual_nepo(g_nnpcv_tab(nnpcv_idx).conp_id) THEN
|
|
-- insert a record for each non virtual network point assigned to the contract
|
|
-- using the virtual nepo nominated values and percentage split parameter
|
|
FOR i IN c_conp(g_cont_id) LOOP
|
|
--
|
|
INSERT INTO nom_net_point_cat_vals ( value
|
|
, gas_day
|
|
, coca_id
|
|
, nomi_id
|
|
, conp_id
|
|
)
|
|
VALUES ( ROUND((i.perc_split/l_tot_perc_split)*g_nnpcv_tab(nnpcv_idx).value)
|
|
, g_nnpcv_tab(nnpcv_idx).gas_day
|
|
, g_nnpcv_tab(nnpcv_idx).coca_id
|
|
, l_nomi_id
|
|
, i.conp_id
|
|
);
|
|
END LOOP;
|
|
ELSE
|
|
-- Nominations for Entry Manadatory Offer Contracts must be against a virtual network point
|
|
l_message := caco_utilities.get_module_text(3916);
|
|
g_error_point := 'A285';
|
|
RAISE e_ude;
|
|
END IF;
|
|
--
|
|
END LOOP;
|
|
--
|
|
END IF;
|
|
--
|
|
FOR nnpcv_idx IN g_nnpcv_tab.FIRST..g_nnpcv_tab.LAST LOOP
|
|
--
|
|
-- Would only use forall if it wasn't for pls-00436...
|
|
--
|
|
--
|
|
g_error_point := 'A290';
|
|
--
|
|
INSERT INTO nom_net_point_cat_vals ( value
|
|
, gas_day
|
|
, coca_id
|
|
, nomi_id
|
|
, conp_id
|
|
)
|
|
VALUES ( g_nnpcv_tab(nnpcv_idx).value
|
|
, g_nnpcv_tab(nnpcv_idx).gas_day
|
|
, g_nnpcv_tab(nnpcv_idx).coca_id
|
|
, l_nomi_id
|
|
, g_nnpcv_tab(nnpcv_idx).conp_id
|
|
);
|
|
--
|
|
l_nomi_details := SUBSTR(l_nomi_details||' Day:'||g_nnpcv_tab(nnpcv_idx).gas_day||' Cat:'||g_nnpcv_tab(nnpcv_idx).coca_id||' Net:'||g_nnpcv_tab(nnpcv_idx).conp_id||' Val:'||g_nnpcv_tab(nnpcv_idx).value
|
|
,1
|
|
,4000
|
|
);
|
|
--
|
|
END LOOP;
|
|
--
|
|
--
|
|
g_error_point := 'A300';
|
|
--
|
|
-- Now enact the rules
|
|
--
|
|
l_rule_results := efno_nominations.rule_loops( l_nomi_id
|
|
, g_cont_id
|
|
, l_message
|
|
, l_c_nnpcv_tab
|
|
);
|
|
--
|
|
g_error_point := 'A310';
|
|
--
|
|
-- Check the status of the rules
|
|
--
|
|
IF l_rule_results THEN
|
|
--
|
|
g_error_point := 'A320';
|
|
--
|
|
-- questionable results
|
|
--
|
|
IF l_message IS NULL THEN
|
|
--
|
|
l_message := caco_utilities.get_module_text(2270);
|
|
--
|
|
END IF;
|
|
--
|
|
l_idx := l_c_nnpcv_tab.FIRST;
|
|
--
|
|
g_error_point := 'A330';
|
|
--
|
|
FOR i IN 1..l_c_nnpcv_tab.COUNT LOOP
|
|
--
|
|
g_error_point := 'A331';
|
|
--
|
|
IF l_c_nnpcv_tab(l_idx).in_error THEN
|
|
--
|
|
g_error_point := 'A332';
|
|
--
|
|
lr_cell_error.conp_id := l_c_nnpcv_tab(l_idx).conp_id;
|
|
lr_cell_error.coca_id := l_c_nnpcv_tab(l_idx).coca_id;
|
|
lr_cell_error.iteration := return_index(l_c_nnpcv_tab(l_idx).gas_day, l_gasday);
|
|
lr_cell_error.message := l_message;
|
|
--
|
|
-- Now add to the end of the stack
|
|
--
|
|
g_cell_error(NVL(g_cell_error.COUNT,0)+1) := lr_cell_error;
|
|
--
|
|
END IF;
|
|
--
|
|
l_idx := l_c_nnpcv_tab.NEXT(l_idx);
|
|
--
|
|
END LOOP;
|
|
--
|
|
-- Raise as an error
|
|
--
|
|
g_error_point := 'A350';
|
|
--
|
|
RAISE e_ude;
|
|
--
|
|
END IF;
|
|
--
|
|
-- Now determine what we should be doing, be it verify or insert
|
|
--
|
|
IF action = caco_utilities.get_module_text(1149/*Verify*/) THEN
|
|
--
|
|
g_error_point := 'A360';
|
|
--
|
|
-- We do not want to save it, rollback.
|
|
--
|
|
DBMS_TRANSACTION.ROLLBACK_SAVEPOINT(g_cont_id);
|
|
--
|
|
l_message := caco_utilities.get_module_text( p_text_number => 2341 );
|
|
--
|
|
g_error_message := display_message( p_type => WSGL.MESS_SUCCESS
|
|
, p_mess => l_message
|
|
);
|
|
--
|
|
END IF;
|
|
--
|
|
IF action IN (caco_utilities.get_module_text(840/* Insert */)) THEN
|
|
--
|
|
g_error_point := 'A370';
|
|
--
|
|
-- Update existing nominations to inactive
|
|
--
|
|
l_idx := g_nnpcv_tab.COUNT; -- not sure why we can't imbed this in the SQL below, but we can't
|
|
--
|
|
UPDATE nominations nomi
|
|
SET nomi.status = 'I'
|
|
WHERE nomi.cont_id = g_cont_id
|
|
AND nomi.nomi_id <> l_nomi_id
|
|
AND EXISTS ( SELECT NULL
|
|
FROM nom_net_point_cat_vals nnpcv
|
|
WHERE nnpcv.nomi_id = nomi.nomi_id
|
|
AND nnpcv.gas_day BETWEEN g_nnpcv_tab(1).gas_day AND g_nnpcv_tab(l_idx).gas_day
|
|
)
|
|
AND NOT EXISTS ( SELECT NULL
|
|
FROM nom_net_point_cat_vals nnpcv
|
|
WHERE nnpcv.nomi_id = nomi.nomi_id
|
|
AND nnpcv.gas_day NOT BETWEEN g_nnpcv_tab(1).gas_day AND g_nnpcv_tab(l_idx).gas_day
|
|
);
|
|
|
|
--
|
|
g_error_point := 'A371';
|
|
--
|
|
-- Timestamp
|
|
--
|
|
l_timestamp := timestamp_nomi ( p_nomi_id => l_nomi_id
|
|
, p_nomi_details => l_nomi_details
|
|
);
|
|
--
|
|
g_error_point := 'A372';
|
|
--
|
|
-- Notification
|
|
--
|
|
l_letter := send_nom_notification ( p_cust_id => g_cust_id
|
|
, p_nomi_identifier => l_nomi_id
|
|
, p_gas_day_start => g_nnpcv_tab(1).gas_day
|
|
, p_gas_day_end => g_nnpcv_tab(g_nnpcv_tab.COUNT).gas_day
|
|
, p_timestamp => l_timestamp
|
|
);
|
|
--
|
|
g_error_point := 'A373';
|
|
--
|
|
-- Create confimation
|
|
--
|
|
INSERT INTO confirmations ( confirmation_type
|
|
, confirmation_sent
|
|
, confirmation
|
|
, nomi_id
|
|
, confirmation_text
|
|
, approved
|
|
)
|
|
VALUES ( 'NO'
|
|
, l_timestamp
|
|
, NULL -- will add later
|
|
, l_nomi_id
|
|
, l_letter
|
|
, 'Y'
|
|
);
|
|
--
|
|
g_error_point := 'A374';
|
|
--
|
|
-- Save Spreadsheet
|
|
--
|
|
IF NVL(cout_system_configuration.get_configuration_item('G_SAVE_NOM_TEMPLATE'),'Y') = 'Y' THEN
|
|
--
|
|
amfr_excel.get_template(p_id => g_cont_id
|
|
,p_type => amfr_excel.gc_nomination
|
|
,p_nomi_conf_id => l_nomi_id
|
|
,p_mode => 'INSERT'
|
|
);
|
|
--
|
|
END IF;
|
|
--
|
|
g_error_point := 'A375';
|
|
--
|
|
l_message := caco_utilities.get_module_text( p_text_number => 2342 );
|
|
--
|
|
g_error_message := display_message( p_type => WSGL.MESS_SUCCESS
|
|
, p_mess => l_message
|
|
);
|
|
--
|
|
END IF;
|
|
--
|
|
ELSE
|
|
--
|
|
-- We must be changing the date, keep existing data
|
|
--
|
|
get_cont_id(cont_id);
|
|
--
|
|
g_error_point := 'A376';
|
|
--
|
|
IF l_gasday.COUNT > 0 THEN
|
|
--
|
|
g_target_date := TO_DATE(l_gasday(1),g_date_format);
|
|
--
|
|
END IF;
|
|
--
|
|
IF p_gasday_start IS NOT NULL THEN
|
|
--
|
|
g_target_date := TO_DATE(p_gasday_start,g_date_format);
|
|
--
|
|
END IF;
|
|
--
|
|
g_target_date_end := GREATEST(GREATEST(TO_DATE(NVL(p_gasday_end, g_target_date),g_date_format), g_target_date),(TO_DATE(p_gasday_start,g_date_format) + (TO_DATE(l_gasday(l_gasday.COUNT), g_date_format)-TO_DATE(l_gasday(1),g_date_format))));
|
|
--
|
|
g_error_point := 'A377';
|
|
--
|
|
FOR i IN 1..l_val.COUNT LOOP
|
|
--
|
|
g_nnpcv_tab(i).value := l_val(i);
|
|
g_nnpcv_tab(i).gas_day := TO_DATE(l_gasday(CEIL(i/(l_val.count/l_gasday.count))),g_date_format);
|
|
--
|
|
IF MOD(i,coca.COUNT) = 0 THEN
|
|
g_nnpcv_tab(i).coca_id := coca(coca.COUNT);
|
|
ELSE
|
|
g_nnpcv_tab(i).coca_id := coca(MOD(i,coca.COUNT));
|
|
END IF;
|
|
--
|
|
g_nnpcv_tab(i).conp_id := conp(CEIL(CEIL(i/coca.COUNT)/((TO_DATE(l_gasday(l_gasday.COUNT), g_date_format)+1)-TO_DATE(l_gasday(1),g_date_format))));
|
|
--
|
|
END LOOP;
|
|
--
|
|
g_target_date_end := TO_DATE(p_gasday_end, g_date_format);
|
|
--
|
|
--display_nnpcv_tab(g_nnpcv_tab);
|
|
--
|
|
-- If a multi-day range contains a long/short day and the contract
|
|
-- has a long/short day category and the contract is using the single-multi day input format
|
|
-- then output an error/warning
|
|
l_loop_counter := (g_target_date_end - g_target_date) +1;
|
|
IF l_loop_counter > 1 AND get_spte_name(cont_id) = UPPER(g_spte_smulti) THEN
|
|
-- check for long day category
|
|
OPEN cu_coca('LO');
|
|
FETCH cu_coca INTO l_coca_id;
|
|
IF cu_coca%FOUND THEN
|
|
FOR i IN 1..l_loop_counter LOOP
|
|
--
|
|
-- check for long day
|
|
IF cout_dates.hours_in_gas_day(g_target_date + (i-1)) = 25 THEN
|
|
l_message := wsgl.msggettext(p_msgno => NULL
|
|
,p_dflttext => caco_utilities.get_module_text(3935)
|
|
,p_subst1 => to_char(g_target_date + (i-1),g_date_format));
|
|
--
|
|
g_error_message := display_message( p_type => WSGL.MESS_ERROR
|
|
, p_mess => l_message
|
|
);
|
|
EXIT;
|
|
END IF;
|
|
END LOOP;
|
|
END IF;
|
|
CLOSE cu_coca;
|
|
--
|
|
-- check for short day category
|
|
OPEN cu_coca('SH');
|
|
FETCH cu_coca INTO l_coca_id;
|
|
IF cu_coca%FOUND THEN
|
|
FOR i IN 1..l_loop_counter LOOP
|
|
--
|
|
-- check for short day
|
|
IF cout_dates.hours_in_gas_day(g_target_date + (i-1)) = 23 THEN
|
|
l_message := wsgl.msggettext(p_msgno => NULL
|
|
,p_dflttext => caco_utilities.get_module_text(3936)
|
|
,p_subst1 => to_char(g_target_date + (i-1),g_date_format));
|
|
--
|
|
g_error_message := display_message( p_type => WSGL.MESS_ERROR
|
|
, p_mess => l_message
|
|
);
|
|
EXIT;
|
|
END IF;
|
|
END LOOP;
|
|
END IF;
|
|
CLOSE cu_coca;
|
|
END IF;
|
|
--
|
|
END IF;
|
|
--
|
|
EXCEPTION
|
|
WHEN OTHERS THEN
|
|
--
|
|
-- Rollback the transaction just in case...
|
|
--
|
|
BEGIN
|
|
DBMS_TRANSACTION.ROLLBACK_SAVEPOINT(g_cont_id);
|
|
EXCEPTION
|
|
WHEN OTHERS THEN
|
|
NULL;
|
|
END;
|
|
--
|
|
g_error_message := display_message(p_type => WSGL.MESS_ERROR
|
|
,p_mess => NVL(l_message
|
|
,caco_utilities.get_module_text(p_text_number => 2330 )
|
|
)
|
|
);
|
|
--
|
|
cout_err.report_and_go(p_exception_number => sqlcode
|
|
,p_exception_message => g_error_point||' : '||sqlerrm
|
|
);
|
|
--
|
|
END;
|
|
--
|
|
-- release lock on nominations table
|
|
--
|
|
l_noms_release := dbms_lock.release(id => 128);
|
|
caco_debug.putline('default_values DBMS_LOCK id 128 release value l_noms_release is ' ||
|
|
l_noms_release);
|
|
END IF;
|
|
--
|
|
-- Now verified, let us rebuild the screen
|
|
--
|
|
redisplay ( p_contract => g_cont_num
|
|
);
|
|
--
|
|
END IF; -- security check
|
|
--
|
|
END submit_nomination;
|
|
--
|
|
PROCEDURE startup IS
|
|
BEGIN
|
|
--
|
|
-- Startup the screen with the contract for the target date
|
|
--
|
|
-- nom_header( p_contract => g_cont_num );
|
|
--caco_debug.putline('-----startup');
|
|
--
|
|
nom_header( p_contract => NULL );
|
|
--
|
|
END startup;
|
|
--
|
|
FUNCTION get_exception_message( p_exception_number IN NUMBER ) RETURN VARCHAR2 IS
|
|
--
|
|
l_return VARCHAR2(1000);
|
|
l_type VARCHAR2(1000);
|
|
--
|
|
BEGIN
|
|
--
|
|
caco_utilities.get_exception_message(p_exception_number => p_exception_number
|
|
,p_message => l_return
|
|
,p_exme_type => l_type
|
|
);
|
|
--
|
|
RETURN l_return;
|
|
--
|
|
END get_exception_message;
|
|
--
|
|
/**
|
|
-- FUNCTION about
|
|
-- Returns the version number and VSS header for this package
|
|
--
|
|
-- %return The version number and VSS header for this package
|
|
*/
|
|
FUNCTION about RETURN VARCHAR2 IS
|
|
BEGIN
|
|
RETURN(g_package_name || chr(10) || g_revision || chr(10) || g_header);
|
|
END about;
|
|
--
|
|
BEGIN
|
|
--
|
|
-- Initialisation
|
|
--
|
|
--caco_debug.putline('-----Initialisation');
|
|
--
|
|
gc_no_data_found := get_exception_message(-20521);
|
|
gc_missing_details := get_exception_message(-20516);
|
|
gc_invalid_file_format := get_exception_message(-20517);
|
|
gc_no_cont_found := get_exception_message(-20518);
|
|
gc_nom_id_null := get_exception_message(-20519);
|
|
gc_dup_nom_identifier := get_exception_message(-20520);
|
|
--
|
|
g_day_at_start_of_week := cout_system_configuration.get_configuration_item('G_DAY_AT_START_OF_WEEK');
|
|
--
|
|
IF g_cust_id IS NULL THEN
|
|
--
|
|
g_cust_id := caco_utilities.get_cust_id;
|
|
--
|
|
END IF;
|
|
--
|
|
IF g_cust_id IS NOT NULL THEN
|
|
--
|
|
get_cont_id ( p_contract_number => g_cont_num
|
|
, p_cust_id => g_cust_id );
|
|
--
|
|
IF in_a_renom_window(p_gas_day => g_gas_day
|
|
,p_window_time => g_active_time) THEN
|
|
--
|
|
-- In a renomination window
|
|
--
|
|
g_target_date := g_gas_day;
|
|
--
|
|
ELSE
|
|
--
|
|
-- Not in renom window, default to gasday + offset
|
|
--
|
|
g_target_date := g_gas_day + NVL(cout_system_configuration.get_configuration_item('G_NOM_DATE_OFFSET'),1);
|
|
--
|
|
END IF;
|
|
--
|
|
g_target_date := GREATEST(g_target_date, g_cont_start_date);
|
|
g_target_date_end := g_target_date;
|
|
--
|
|
/*caco_debug.putline('g_target_date: '||to_char(g_target_date,g_date_format));
|
|
caco_debug.putline('g_gas_day: '||to_char(g_gas_day,g_date_format));
|
|
caco_debug.putline('g_cust_id: '||g_cust_id);
|
|
caco_debug.putline('g_cont_start_date: '||to_char(g_cont_start_date,g_date_format));*/
|
|
--
|
|
END IF;
|
|
--
|
|
END efnow098$;
|
|
/
|