-
CREATE OR REPLACE PACKAGE xxfin_xml_print_pub IS
-
/*================================================================*
-
-- Description:
-
-- XML 报表打印通用程序
-
--
-
-- Reference:
-
-- 参考文档
-
-- Modification History:
-
-- Date Author Description
-
-- ------------ ----------------- ---------------------------------------
-
--
-
-- 2014-2-24 rojian Created
-
*================================================================*/
-
FUNCTION get_string_xml(p_string IN VARCHAR2) RETURN VARCHAR2;
-
-
PROCEDURE write_raw_data
-
(
-
p_in_chr_item IN VARCHAR2
-
,p_in_chr_value IN VARCHAR2
-
);
-
-
PROCEDURE write_str_data
-
(
-
p_in_chr_item IN VARCHAR2
-
,p_in_chr_value IN VARCHAR2
-
);
-
-
PROCEDURE write_num_data
-
(
-
p_in_chr_item IN VARCHAR2
-
,p_in_num_value IN NUMBER
-
);
-
-
PROCEDURE write_money_data
-
(
-
p_in_chr_item IN VARCHAR2
-
,p_in_num_value IN NUMBER
-
);
-
-
PROCEDURE write_date_data
-
(
-
p_in_chr_item IN VARCHAR2
-
,p_in_date_value IN DATE
-
);
-
-
PROCEDURE write_pecent_data
-
(
-
p_in_chr_item IN VARCHAR2
-
,p_in_num_value IN NUMBER
-
);
-
-
PROCEDURE print_head;
-
PROCEDURE print_end;
-
PROCEDURE print_data(p_data varchar2);
-
END xxfin_xml_print_pub;
-
/
-
CREATE OR REPLACE PACKAGE BODY xxfin_xml_print_pub IS
-
-
/*================================================================*
-
-- Description:
-
-- XML 报表打印通用程序
-
--
-
-- Reference:
-
-- 参考文档
-
-- Modification History:
-
-- Date Author Description
-
-- ------------ ----------------- ---------------------------------------
-
--
-
-- 2014-2-24 rojian Created
-
*================================================================*/
-
FUNCTION get_string_xml(p_string IN VARCHAR2) RETURN VARCHAR2 IS
-
l_temp VARCHAR2(30000);
-
BEGIN
-
l_temp := p_string;
-
l_temp := REPLACE(l_temp, '&', '&');
-
l_temp := REPLACE(l_temp, '<', '<');
-
l_temp := REPLACE(l_temp, '>', '>');
-
l_temp := REPLACE(l_temp, '‘', ''');
-
l_temp := REPLACE(l_temp, '’', ''');
-
l_temp := REPLACE(l_temp, '“', '"');
-
l_temp := REPLACE(l_temp, '”', '"');
-
RETURN l_temp;
-
END get_string_xml;
-
-
PROCEDURE write_raw_data
-
(
-
p_in_chr_item IN VARCHAR2
-
,p_in_chr_value IN VARCHAR2
-
) IS
-
v_line VARCHAR2(4000);
-
BEGIN
-
v_line := '<' || p_in_chr_item || '> || p_in_chr_value || ']]>' || p_in_chr_item || '>';
-
fnd_file.put_line(fnd_file.output, v_line);
-
--dbms_output.put_line(v_line);
-
END write_raw_data;
-
-
PROCEDURE write_str_data
-
(
-
p_in_chr_item IN VARCHAR2
-
,p_in_chr_value IN VARCHAR2
-
) IS
-
v_line VARCHAR2(4000);
-
BEGIN
-
v_line := '<' || p_in_chr_item || '>' || get_string_xml(p_in_chr_value) || '' || p_in_chr_item || '>';
-
fnd_file.put_line(fnd_file.output, v_line);
-
--dbms_output.put_line(v_line);
-
END write_str_data;
-
-
PROCEDURE write_num_data
-
(
-
p_in_chr_item IN VARCHAR2
-
,p_in_num_value IN NUMBER
-
) IS
-
v_line VARCHAR2(4000);
-
BEGIN
-
v_line := '<' || p_in_chr_item || '>' || ROUND(p_in_num_value, 6) || '' || p_in_chr_item || '>';
-
fnd_file.put_line(fnd_file.output, v_line);
-
--dbms_output.put_line(v_line);
-
END write_num_data;
-
-
PROCEDURE write_money_data
-
(
-
p_in_chr_item IN VARCHAR2
-
,p_in_num_value IN NUMBER
-
) IS
-
v_line VARCHAR2(4000);
-
BEGIN
-
v_line := '<' || p_in_chr_item || '>' || TO_CHAR(p_in_num_value, 'FM999,999,999,999,999,999,999,999,999.00') || '' ||
-
p_in_chr_item || '>';
-
fnd_file.put_line(fnd_file.output, v_line);
-
--dbms_output.put_line(v_line);
-
END write_money_data;
-
-
PROCEDURE write_date_data
-
(
-
p_in_chr_item IN VARCHAR2
-
,p_in_date_value IN DATE
-
) IS
-
v_line VARCHAR2(255);
-
BEGIN
-
v_line := '<' || p_in_chr_item || '>' || TO_CHAR(p_in_date_value, 'YYYY-MM-DD') || '' || p_in_chr_item || '>';
-
-
fnd_file.put_line(fnd_file.output, v_line);
-
--dbms_output.put_line(v_line);
-
END write_date_data;
-
-
PROCEDURE write_pecent_data
-
(
-
p_in_chr_item IN VARCHAR2
-
,p_in_num_value IN NUMBER
-
) IS
-
v_line VARCHAR2(4000);
-
BEGIN
-
v_line := '<' || p_in_chr_item || '>' || p_in_num_value * 100 || '%' || p_in_chr_item || '>';
-
fnd_file.put_line(fnd_file.output, v_line);
-
--dbms_output.put_line(v_line);
-
END write_pecent_data;
-
-
PROCEDURE print_head IS
-
BEGIN
-
fnd_file.put_line(fnd_file.output, '');
-
fnd_file.put_line(fnd_file.output, '');
-
END;
-
-
PROCEDURE print_end IS
-
BEGIN
-
fnd_file.put_line(fnd_file.output, '');
-
END;
-
-
PROCEDURE print_data(p_data varchar2) IS
-
BEGIN
-
fnd_file.put_line(fnd_file.output, get_string_xml(p_data));
-
END print_data;
-
END xxfin_xml_print_pub;
-
/
FUNCTION get_string_xml(p_string IN VARCHAR2) RETURN VARCHAR2;这个函数是处理XML中出现特殊字符写的函数。