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(' '); -- wsgl.openpagehead(g_title); -- caco_system.content_type; -- htp.p(''); htp.p(''); -- wsgl.closepagehead; wsgl.openpagebody(FALSE); htp.p(caco_system.menu); -- htp.p('

'||caco_utilities.get_module_text(2063)||'

'); -- View Commercial Comnfirmation Details -- OPEN c_conf; FETCH c_conf INTO l_conf_rec; CLOSE c_conf; -- htp.p(' '); -- Confirmation ID htp.p(' '); -- Customer Name htp.p(' '); -- Contract Number htp.p(' '); -- Nomination Identifier htp.p(' '); -- Confirmation Sent htp.p('
'||caco_utilities.get_module_text(2517)||'  '||l_conf_rec.conf_id||'
'||caco_utilities.get_module_text(1145)||'  '||l_conf_rec.customer_name||'
'||caco_utilities.get_module_text(2013)||'  '||l_conf_rec.contract_number||'
'||caco_utilities.get_module_text(2060)||'  '||NVL(l_conf_rec.nomi_identifier, caco_utilities.get_module_text(2037))||'
'||caco_utilities.get_module_text(2061)||'  '||TO_CHAR(l_conf_rec.confirmation_sent, cout_system_configuration.get_configuration_item('G_DATE_FORMAT')||' HH24:MI:SS')||'
'); -- -- We want a button to call the spreadsheet download routine htp.p('
'); -- IF l_conf_rec.confirmation_sent IS NOT NULL THEN -- htp.p(''); -- ELSE -- htp.p(''); -- END IF; -- -- htp.p('

'||caco_utilities.get_module_text(2065)||'

'); -- Confirmation Text -- -- Loop through all of the clob and display it in chunks...... -- Create a width limmited dive for putting it in htp.p('
');
    --
    -- 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('
'); -- -- Close the margin div htp.p('
'); -- -- Note at bottom of screen for utility -- htp.p('


'||REPLACE(caco_utilities.get_module_text(3854),'',''||caco_utilities.get_module_text(3853)||'')||''); -- -- Close centrecontent div htp.p('

'); -- -- Close outer div htp.p(''); -- 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$; /