|
|
发表于 2007/5/8 15:18:50
|
显示全部楼层
plsql写报表的好处是很多的 比用report修改格式方面也要容易得多 。我上传一个格式的存储,大家要用的话可以参考以下采用xx存储格式化输出报表:
v_base_line NUMBER := 0;
BEGIN
xx.print_title(fnd_global.org_name,3000);
xx.out('<table cellSpacing=0 width="3000" bgColor=#000000 border=0>');
xx.out('<tr bgColor=#ffffff>');
xx.out('<td class="ce" colspan=2>销售统计报表</td>');
xx.out('</tr>');
xx.out('<tr bgColor=#ffffff>');
xx.out('<td class="ce" colspan=2>========================</td>');
xx.out('</tr>');
xx.out('<tr bgColor=#ffffff >');
xx.out('<td width=10% class="lf">发运日期从:'||substr(p_date_from,1,4)||'/'||substr(p_date_from,5,2)||'/'||substr(p_date_from,7,2)||'</td>');
xx.out('<td width=90% class="lf">到:'||substr(p_date_to,1,4)||'/'||substr(p_date_to,5,2)||'/'||substr(p_date_to,7,2)||'</td>');
xx.out('</tr>');
xx.out('</table>');
xx.out('<table border=1 cellSpacing=0 width="3000" bgColor=#000000 borderColorLight=#000000 borderColorDark=#ffffff >');
IF p_style = 'Y' THEN
xx.out('<tr bgColor=#ffffff>');
xx.out('<td width=2% class="ce">状态</td>');
xx.out('<td width=4% class="ce">状态分解</td>');
xx.out('<td width=2% class="ce">性质</td>');
xx.out('</tr>');
FOR c_1 IN c_order LOOP
IF c_1.region = '行业' THEN
v_base_line := get_base_line(c_1.item_id);
ELSIF c_1.region = '区域' THEN
v_base_line := get_terr_base_line(c_1.item_id);
END IF;
xx.out('<td class="lf">'||c_1.status||'</td>');
xx.out('<td class="lf">'||c_1.step_status||'</td>');
xx.out('<td class="lf">'||c_1.region||'</td>');
xx.out('</tr>');
v_base_line := 0;
END LOOP;
END IF;
xx.out('</table>');
xx.print_footer;
以下为xx存储:
CREATE OR REPLACE PACKAGE BODY xx AS
PROCEDURE print_title(p_title VARCHAR2,p_page_width NUMBER) IS
BEGIN
fnd_file.put_line(fnd_file.output,'<html>');
fnd_file.put_line(fnd_file.output,'<head>');
fnd_file.put_line(fnd_file.output,'<title>'||p_title||'</title>');
fnd_file.put_line(fnd_file.output,'<META http-equiv=Content-Type content="text/html; charset=gb2312">');
fnd_file.put_line(fnd_file.output,'<STYLE>P {');
fnd_file.put_line(fnd_file.output,'PAGE-BREAK-BEFORE: always');
fnd_file.put_line(fnd_file.output,'}');
fnd_file.put_line(fnd_file.output,'</STYLE>');
fnd_file.put_line(fnd_file.output,'<style type= text/css >');
fnd_file.put_line(fnd_file.output,'td,p,li,input,select {font-size:12px;}');
fnd_file.put_line(fnd_file.output,'td.FormYellowTd{');
fnd_file.put_line(fnd_file.output,'background-color :#8Be3fF;}');
fnd_file.put_line(fnd_file.output,'td.rt{text-align: right;}');
fnd_file.put_line(fnd_file.output,'td.lf{text-align: left;}');
fnd_file.put_line(fnd_file.output,'td.ce{text-align: center;}');
fnd_file.put_line(fnd_file.output,'</style>');
fnd_file.put_line(fnd_file.output,'</head>');
fnd_file.put_line(fnd_file.output,'<body>');
fnd_file.put_line(fnd_file.output,'<table cellSpacing=0 width='||p_page_width||' bgColor=#000000 border=0>');
fnd_file.put_line(fnd_file.output,'<tr width=100% bgColor=#ffffff >');
fnd_file.put_line(fnd_file.output,'<td align=middle><font size=3><STRONG>'||p_title||'</STRONG></font></td>');
fnd_file.put_line(fnd_file.output,'</tr>');
fnd_file.put_line(fnd_file.output,'</table>');
fnd_file.put_line(fnd_file.output,'<br>');
fnd_file.put_line(fnd_file.output,'<br>');
END print_title;
PROCEDURE print_title(p_title VARCHAR2) IS
BEGIN
fnd_file.put_line(fnd_file.output,'<html>');
fnd_file.put_line(fnd_file.output,'<head>');
fnd_file.put_line(fnd_file.output,'<title>'||p_title||'</title>');
fnd_file.put_line(fnd_file.output,'<META http-equiv=Content-Type content="text/html; charset=gb2312">');
fnd_file.put_line(fnd_file.output,'<STYLE>P {');
fnd_file.put_line(fnd_file.output,'PAGE-BREAK-BEFORE: always');
fnd_file.put_line(fnd_file.output,'}');
fnd_file.put_line(fnd_file.output,'</STYLE>');
fnd_file.put_line(fnd_file.output,'<style type= text/css >');
fnd_file.put_line(fnd_file.output,'td,p,li,input,select {font-size:12px;}');
fnd_file.put_line(fnd_file.output,'td.FormYellowTd{');
fnd_file.put_line(fnd_file.output,'background-color :#8Be3fF;}');
fnd_file.put_line(fnd_file.output,'td.rt{text-align: right;}');
fnd_file.put_line(fnd_file.output,'td.lf{text-align: left;}');
fnd_file.put_line(fnd_file.output,'td.ce{text-align: center;}');
fnd_file.put_line(fnd_file.output,'</style>');
fnd_file.put_line(fnd_file.output,'</head>');
fnd_file.put_line(fnd_file.output,'<body>');
END print_title;
PROCEDURE print_footer IS
BEGIN
fnd_file.put_line(fnd_file.output,'</body>');
fnd_file.put_line(fnd_file.output,'</html>');
END print_footer;
PROCEDURE out(p_out VARCHAR2) IS
BEGIN
fnd_file.put_line(fnd_file.output,p_out);
-- <td class="lf" > </td>
-- <td class="rt" ></td>
-- <td class="ce" > </td>
END out;
PROCEDURE log(p_log VARCHAR2) IS
BEGIN
fnd_file.put_line(fnd_file.log,p_log);
END log;
PROCEDURE print_title_htp(p_title VARCHAR2) IS
BEGIN
htp.p('<html>');
htp.p('<head>');
htp.p('<title>'||p_title||'</title>');
htp.p('<META http-equiv=Content-Type content="text/html; charset=gb2312">');
htp.p('<STYLE>P {');
htp.p('PAGE-BREAK-BEFORE: always');
htp.p('}');
htp.p('</STYLE>');
htp.p('<style type= text/css >');
htp.p('td,p,li,input,select {font-size:12px;}');
htp.p('td.FormYellowTd{');
htp.p('background-color :#8Be3fF;}');
htp.p('td.rt{text-align: right;}');
htp.p('td.lf{text-align: left;}');
htp.p('td.ce{text-align: center;}');
htp.p('</style>');
htp.p('</head>');
htp.p('<body>');
END print_title_htp;
PROCEDURE print_footer_htp IS
BEGIN
htp.p('</body>');
htp.p('</html>');
END print_footer_htp;
PROCEDURE out_htp(p_out VARCHAR2) IS
BEGIN
htp.p(p_out);
-- <td class="lf" > </td>
-- <td class="rt" > </td>
-- <td class="ce" > </td>
END out_htp;
END xx; |
|