334 lines
9.6 KiB
Plaintext
334 lines
9.6 KiB
Plaintext
CREATE OR REPLACE PACKAGE BODY efnow099$ IS
|
|
|
|
c_bin_mime CONSTANT VARCHAR2(100) := 'application/octet-stream';
|
|
|
|
PROCEDURE conf_css
|
|
IS
|
|
BEGIN
|
|
htp.p('
|
|
h2 {
|
|
color : #FF3030;
|
|
}
|
|
|
|
.confTR {
|
|
height : 20px;
|
|
}
|
|
|
|
#confTextDiv {
|
|
width : 95%;
|
|
white-space : pre;
|
|
overflow-x : scroll;
|
|
border : 1px solid;
|
|
margin-left : 5px;
|
|
margin-right : 5px;
|
|
padding : 5px;
|
|
}
|
|
');
|
|
END conf_css;
|
|
|
|
FUNCTION check_customer_conf ( p_cust_id customers.cust_id%TYPE
|
|
, p_conf_id confirmations.conf_id%TYPE
|
|
) RETURN BOOLEAN IS
|
|
--
|
|
l_return BOOLEAN := TRUE;
|
|
l_count NUMBER := NULL;
|
|
--
|
|
BEGIN
|
|
--
|
|
SELECT count(*)
|
|
INTO l_count
|
|
FROM confirmations conf
|
|
,contracts cont
|
|
WHERE conf.conf_id = p_conf_id
|
|
AND conf.cont_id = cont.cont_id
|
|
AND cont.cust_id = p_cust_id;
|
|
--
|
|
IF l_count < 1 THEN
|
|
--
|
|
l_return := FALSE;
|
|
--
|
|
END IF;
|
|
--
|
|
RETURN l_return;
|
|
--
|
|
END check_customer_conf;
|
|
|
|
PROCEDURE startup( p_conf_id IN NUMBER
|
|
, p_approved IN VARCHAR2 DEFAULT 'Y' )
|
|
IS
|
|
-- Cursor to grab most of the confirmation details required
|
|
CURSOR c_conf IS
|
|
SELECT cust.name customer_name
|
|
, cont.contract_number contract_number
|
|
, nomi.identifier nomi_identifier
|
|
, conf.confirmation_sent confirmation_sent
|
|
, conf.conf_id
|
|
FROM confirmations conf
|
|
, nominations nomi
|
|
, contracts cont
|
|
, customers cust
|
|
WHERE cust.cust_id = cont.cust_id
|
|
AND cont.cont_id = conf.cont_id (+)
|
|
AND nomi.nomi_id (+)= conf.nomi_id
|
|
AND conf.conf_id = p_conf_id
|
|
AND NVL(conf.approved,'N') = p_approved;
|
|
--
|
|
l_conf_rec c_conf%ROWTYPE;
|
|
--
|
|
l_conf_text_clob CLOB;
|
|
l_conf_text_temp VARCHAR2(4000);
|
|
l_text_pos NUMBER := 1;
|
|
l_text_length NUMBER := 0;
|
|
--
|
|
l_success BOOLEAN := TRUE;
|
|
--
|
|
BEGIN
|
|
--
|
|
g_package_name := 'efnow120$';
|
|
--
|
|
IF NOT caco_security.security_check(p_package_name => g_package_name) THEN
|
|
--
|
|
RETURN;
|
|
--
|
|
END IF;
|
|
--
|
|
g_package_name := 'efnow099$';
|
|
--
|
|
htp.p(' <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">');
|
|
--
|
|
wsgl.openpagehead(g_title);
|
|
--
|
|
caco_system.content_type;
|
|
--
|
|
htp.p('<link rel=stylesheet HREF="caco_system.css?p_type=content" >');
|
|
htp.p('<link rel="stylesheet" media="all" type="text/css" href="'||g_package_name||'.conf_css" />');
|
|
--
|
|
wsgl.closepagehead;
|
|
wsgl.openpagebody(FALSE);
|
|
htp.p(caco_system.menu);
|
|
--
|
|
htp.p('
|
|
<div style="margin:15px;">
|
|
<div>
|
|
<h2>'||caco_utilities.get_module_text(2063)||'</h2>'); -- View Commercial Comnfirmation Details
|
|
--
|
|
OPEN c_conf;
|
|
FETCH c_conf INTO l_conf_rec;
|
|
CLOSE c_conf;
|
|
--
|
|
htp.p('
|
|
<table>
|
|
<tr class="confTR">
|
|
<td><b>'||caco_utilities.get_module_text(2517)||' </b></td>'); -- Confirmation ID
|
|
htp.p(' <td>'||l_conf_rec.conf_id||'</td>
|
|
</tr>
|
|
<tr class="confTR">
|
|
<td><b>'||caco_utilities.get_module_text(1145)||' </b></td>'); -- Customer Name
|
|
htp.p(' <td>'||l_conf_rec.customer_name||'</td>
|
|
</tr>
|
|
<tr class="confTR">
|
|
<td><b>'||caco_utilities.get_module_text(2013)||' </b></td>'); -- Contract Number
|
|
htp.p(' <td>'||l_conf_rec.contract_number||'</td>
|
|
</tr>
|
|
<tr class="confTR">
|
|
<td><b>'||caco_utilities.get_module_text(2060)||' </b></td>'); -- Nomination Identifier
|
|
htp.p(' <td>'||NVL(l_conf_rec.nomi_identifier, caco_utilities.get_module_text(2037))||'</td>
|
|
</tr>
|
|
<tr class="confTR">
|
|
<td><b>'||caco_utilities.get_module_text(2061)||' </b></td>'); -- Confirmation Sent
|
|
htp.p(' <td>'||TO_CHAR(l_conf_rec.confirmation_sent, cout_system_configuration.get_configuration_item('G_DATE_FORMAT')||' HH24:MI:SS')||'</td>
|
|
</tr>
|
|
</table>');
|
|
--
|
|
-- We want a button to call the spreadsheet download routine
|
|
htp.p('<br /><input type="button" value="'||caco_utilities.get_module_text(2072) -- Confirmation
|
|
||'" onclick="window.location = ''efnow099$.get_conf?p_conf_id='||l_conf_rec.conf_id||'''" />');
|
|
--
|
|
IF l_conf_rec.confirmation_sent IS NOT NULL THEN
|
|
--
|
|
htp.p('<input type="button" value="'||caco_utilities.get_module_text(1152) -- Timestamp
|
|
||'" onclick="window.location = ''efnow099$.get_time?p_conf_id='||l_conf_rec.conf_id||'''" />');
|
|
--
|
|
ELSE
|
|
--
|
|
htp.p('<input type="button" disabled value="'||caco_utilities.get_module_text(1152) -- Timestamp
|
|
||'" />');
|
|
--
|
|
END IF;
|
|
--
|
|
--
|
|
htp.p('<p><b>'||caco_utilities.get_module_text(2065)||'</b></p>'); -- Confirmation Text
|
|
--
|
|
-- Loop through all of the clob and display it in chunks......
|
|
-- Create a width limmited dive for putting it in
|
|
htp.p('<div id="confTextDiv"><pre>');
|
|
--
|
|
-- Get the CLOB
|
|
BEGIN
|
|
SELECT confirmation_text
|
|
INTO l_conf_text_clob
|
|
FROM confirmations
|
|
WHERE conf_id = p_conf_id;
|
|
EXCEPTION
|
|
WHEN others THEN
|
|
l_success := FALSE;
|
|
END;
|
|
--
|
|
IF l_success THEN
|
|
-- Get the length of the Confirmation text CLOB
|
|
l_text_length := DBMS_LOB.GETLENGTH(l_conf_text_clob);
|
|
--
|
|
-- Loop through the clob in chunks of 4000
|
|
WHILE l_text_pos <= l_text_length LOOP
|
|
--
|
|
l_conf_text_temp := DBMS_LOB.SUBSTR( l_conf_text_clob, 4000, l_text_pos );
|
|
--
|
|
htp.p( l_conf_text_temp );
|
|
--
|
|
l_text_pos := l_text_pos + 4000;
|
|
--
|
|
END LOOP;
|
|
--
|
|
ELSE
|
|
-- error - display a message?
|
|
htp.p(caco_utilities.get_module_text(2258)); -- Error reading confirmation text. Please contact support
|
|
--
|
|
END IF;
|
|
-- Close confText
|
|
htp.p('</pre></div>');
|
|
--
|
|
-- Close the margin div
|
|
htp.p('</div>');
|
|
--
|
|
-- Note at bottom of screen for utility
|
|
--
|
|
htp.p('<p><br><b><span>'||REPLACE(caco_utilities.get_module_text(3854),'<p1>','<a href="efnow099$.get_utility">'||caco_utilities.get_module_text(3853)||'</a>')||'</b></span>');
|
|
--
|
|
-- Close centrecontent div
|
|
htp.p('</div>');
|
|
--
|
|
-- Close outer div
|
|
htp.p('</div>');
|
|
--
|
|
wsgl.closepagebody;
|
|
--
|
|
--
|
|
END startup;
|
|
|
|
|
|
PROCEDURE get_conf ( p_conf_id IN confirmations.conf_id%TYPE ) IS
|
|
BEGIN
|
|
--
|
|
g_package_name := 'efnow120$';
|
|
--
|
|
IF NOT caco_security.security_check(p_package_name => g_package_name) THEN
|
|
--
|
|
RETURN;
|
|
--
|
|
END IF;
|
|
--
|
|
amfr_excel.download(p_conf_id => p_conf_id);
|
|
--
|
|
END get_conf;
|
|
|
|
PROCEDURE get_time ( p_conf_id IN confirmations.conf_id%TYPE ) IS
|
|
--
|
|
l_document_contents BLOB;
|
|
l_doti_id document_timestamps.doti_id%TYPE;
|
|
--
|
|
BEGIN
|
|
--
|
|
g_package_name := 'efnow120$';
|
|
--
|
|
IF NOT caco_security.security_check(p_package_name => g_package_name) THEN
|
|
--
|
|
RETURN;
|
|
--
|
|
END IF;
|
|
--
|
|
-- IF NOT check_customer_conf ( p_cust_id => caco_utilities.get_cust_id
|
|
-- , p_conf_id => p_conf_id
|
|
-- ) THEN
|
|
--
|
|
-- caco_security.show_no_access;
|
|
-- RETURN;
|
|
--
|
|
-- END IF;
|
|
--
|
|
-- Get the document out of the table ready for direct transmission
|
|
--
|
|
BEGIN
|
|
--
|
|
SELECT dt.timestamp_response
|
|
,dt.doti_id
|
|
INTO l_document_contents
|
|
,l_doti_id
|
|
FROM document_timestamps dt
|
|
WHERE dt.doc_identifier = p_conf_id
|
|
AND dt.doc_type = 'C';
|
|
--
|
|
EXCEPTION
|
|
WHEN OTHERS THEN
|
|
--
|
|
NULL;
|
|
--
|
|
END;
|
|
--
|
|
owa_util.mime_header(c_bin_mime, FALSE);
|
|
htp.p('Content-Length: '||dbms_lob.getlength(l_document_contents));
|
|
htp.p('Content-Disposition: attachment; filename='||caco_utilities.get_module_text(1152)||'_'||NVL(l_doti_id, TO_NUMBER(TO_CHAR(SYSDATE, 'J')))||'.bin');
|
|
owa_util.http_header_close;
|
|
--
|
|
IF l_document_contents IS NOT NULL THEN
|
|
wpg_docload.download_file(l_document_contents);
|
|
END IF;
|
|
--
|
|
END get_time;
|
|
|
|
PROCEDURE get_utility IS
|
|
--
|
|
l_utility BLOB;
|
|
l_filename VARCHAR2(256);
|
|
--
|
|
BEGIN
|
|
--
|
|
g_package_name := 'efnow120$';
|
|
--
|
|
IF NOT caco_security.security_check(p_package_name => g_package_name) THEN
|
|
--
|
|
RETURN;
|
|
--
|
|
END IF;
|
|
--
|
|
BEGIN
|
|
--
|
|
SELECT doc.blob_content
|
|
,doc.name
|
|
INTO l_utility
|
|
,l_filename
|
|
FROM documents doc
|
|
WHERE doc.docu_id = cout_system_configuration.get_configuration_item('G_TIMESTAMP_UTILITY_DOCU_ID');
|
|
--
|
|
EXCEPTION
|
|
WHEN OTHERS THEN
|
|
NULL;
|
|
END;
|
|
--
|
|
owa_util.mime_header(c_bin_mime, FALSE);
|
|
htp.p('Content-Length: '||dbms_lob.getlength(l_utility));
|
|
htp.p('Content-Disposition: attachment; filename='||l_filename);
|
|
owa_util.http_header_close;
|
|
--
|
|
IF l_utility IS NOT NULL THEN
|
|
wpg_docload.download_file(l_utility);
|
|
END IF;
|
|
--
|
|
END get_utility;
|
|
|
|
BEGIN
|
|
-- Initialization
|
|
NULL;
|
|
--
|
|
END efnow099$;
|
|
/
|