首页 > 代码库 > 利用HTP工具包开发报表
利用HTP工具包开发报表
利用这种方式的优点是不需要跑请求就可以打印报表
工具包中常用程序说明
htp.print
语法 htp.print (cbuf | dbuf | nbuf);作用 generates a line in an HTML document.
参数 cbuf in varchar2 or
dbuf in dateor
nbuf in number
Generates Generates a line in an HTML document based on the value passed to it.
Alias for htp.print
Structure Tags 结构标记
The following tags are used to identify the major parts of an HTML
document.
Note: Although this section shows hypertext procedures (HTP), all of
them are also available as hypertext functions (HTF).
语法 htp.htmlOpen;
作用 Prints a tag that indicates the beginning of an HTML document
ERP REPORT
参数 none
Generates <HTML>
htp.htmlClose
语法 htp.htmlClose;
作用 Prints a tag that indicates the end of an HTML document
参数 none
Generates </HTML>
语法 htp.headOpen;
作用 Prints a tag that indicates the beginning of the HTML document head
参数 none
Generates <HEAD>
语法 htp.headClose;
作用 Prints a tag that indicates the end of the HTML document head
参数 none
Generates </HEAD>
语法 htp.bodyOpen (cbackground, cattributes);
作用 Prints the tag that identifies the beginning of the body of an HTML document, and
allows you to specify an image as the background of the document
参数 cbackground in varchar2 DEFAULT NULL
cattributes in varchar2 DEFAULT NULL
Generates <BODY background="cbackground" cattributes>
Note: If cbackground and cattributes are NULL, this tag generates <BODY>.
ERP REPORT
Example htp.bodyOpen (‘/img/background.gif‘); This line produces:<BODY
background="background.gif">
语法 htp.bodyClose;
作用 Defines the end of the HTML document body
参数 none
Generates </BODY>
Generates <TITLE>ctitle</TITLE><Hnsize
ALIGN="calign" NOWRAP CLEAR="cclear"
cattributes>ctitle</Hnsize>
Note that htp.htitle produces non-standard
HTML. However, most Web Browsers accept
it. To produce standard HTML, the <TITLE>
tag must be in the HEAD section of the page,
and the level heading tag (<H
n>) must be in the BODY section. For example:
htp.headOpen; htp.title(...);
htp.headClose; htp.bodyOpen; htp.header
(1,...)); ...
Table Tags 表格标记
The Table tags allow the user to insert tables and manipulate the size
and columns of the table in a document.
Note: All the hypertext procedures (HTP) shown in this section are also
available as hypertext functions (HTF).
语法 htp.tableOpen (cborder, calign, cnowrap, cclear, cattributes);
作用 Prints an HTML tag that begins an HTML table.
参数 cborder in varchar2 DEFAULT NULL
calign in varchar2 DEFAULT NULL
cnowrap in varchar2 DEFAULT NULL
cclear in varchar2 DEFAULT NULL
cattributes in varchar2 DEFAULT NULL;
Generates <TABLE BORDER NOWRAP ALIGN="calign" CLEAR="cclear" cattributes>
Note: The BORDER attribute is only determined by whether cborder is null
or not null.
ERP REPORT
语法 htp.tableClose;
作用 Prints an HTML tag that ends an HTML table.
参数 none
Generates </TABLE>
语法 htp.tableRowOpen (calign, cvalign,cdp, cnowrap, cattributes);
作用 Prints an HTML tag that inserts a row tag into a table.
参数 calign in varchar2 DEFAULT NULL
cvalign in varchar2 DEFAULT NULL
cdp in varchar2 DEFAULT NULL
cnowrap in varchar2 DEFAULT NULL
cattributes in varchar2 DEFAULT NULL
Generates <TR ALIGN="calign" VALIGN="cvalign" DP="cdp" NOWRAP catttributes>
语法 htp.tableRowClose;
作用 Prints an HTML tag that ends a row in a table.
参数 none
Generates </TR>
语法 htp.tableData (cvalue, calign, cdp, cnowrap, cattributes);
作用 Prints an HTML tag that inserts data into the rows and columns of a selected table.
参数 cvalue in varchar2 DEFAULT NULL
calign in varchar2 DEFAULT NULL
cdp in varchar2 DEFAULT NULL
cnowrap in varchar2 DEFAULT NULL
cattributes in varchar2 DEFAULT NULL
Generates <TD ALIGN="calign" DP="cdp" ROWSPAN="crowspan" COLSPAN="ccolspan" NOWRAP
ERP REPORT
cattributes>cvalue</TD>
包里面别的程序和用法可以查
http://www.lnu.edu.cn/book/oracleweb/ows402.htm
一个例子
<span style="font-size:18px;">PROCEDURE CUXTS001( p_header_id IN VARCHAR2 default null, p_org_id IN VARCHAR2 default null ) AS ---declare the data source ------Report page parameters v_row_num NUMBER; v_first_flag NUMBER := 0; -----标志 x_count NUMBER; -------总行数 v_page_rows NUMBER := 1; ------定义每张报表的line数量 v_page_count NUMBER; v_page_width NUMBER := 800; v_font_size NUMBER := 2; v_page_num NUMBER := 1; v_line_count NUMBER := 0; v_jes NUMBER := 0; v_dis_no NUMBER := 0; max_line NUMBER := 7; ---------------------------------------------------- t_qty NUMBER := 0; t_amount NUMBER := 0; x_org_name VARCHAR2 (100); x_sum_count_no NUMBER := 0; ----采购题头 CURSOR c_header IS SELECT pha.segment1 po_num, pha.po_header_id, pha.type_lookup_code, pha.agent_id, pha.comments, ppf.full_name full_name, pha.creation_date, ERP REPORT pv.vendor_id, SUBSTR (pv.vendor_name, 1, 38) vendor_name FROM po_headers_all pha, po_vendors pv, per_people_f ppf WHERE pha.vendor_id = pv.vendor_id AND pha.agent_id = ppf.person_id AND pha.org_id = TO_NUMBER (p_org_id) AND pha.po_header_id = p_header_id; ----行信息 CURSOR c_line (x_header_id NUMBER) IS SELECT pda.destination_subinventory, pll.quantity, pla.line_num, pla.unit_meas_lookup_code, pla.unit_price, pla.item_description item_desc, pll.quantity * pla.unit_price amount, pla.po_header_id, pll.shipment_num, msi.segment1 item, pll.need_by_date need_by, pll.ship_to_organization_id, pll.promised_date, pll.note_to_receiver, ood.organization_code FROM po_lines_all pla, po_distributions_all pda, po_line_locations_all pll, mtl_system_items_b msi, financials_system_params_all fsp, org_organization_definitions ood WHERE pla.po_line_id = pda.po_line_id AND pll.line_location_id = pda.line_location_id AND (pll.closed_code = 'OPEN' OR pll.closed_code IS NULL) AND pla.item_id = msi.inventory_item_id(+) AND pla.po_header_id = x_header_id AND NVL (msi.organization_id, fsp.inventory_organization_id) = fsp.inventory_organization_id ERP REPORT AND fsp.org_id = p_org_id AND pll.ship_to_organization_id = ood.organization_id(+) ; BEGIN fnd_client_info.set_org_context(p_org_id); HTP.htmlopen; HTP.p ('<head>'); HTP.p ('<STYLE>'); HTP.p (' P { page-break-before: always }'); HTP.p ('</STYLE>'); HTP.p ('</head>'); HTP.bodyopen; FOR lc_h IN c_header LOOP ---title2 HTP.tableopen ( cattributes=> 'cellspacing=0 cellpadding=15 border=0 width=' || v_page_width || ' bgcolor="#000000"' ); HTP.tablerowopen (cattributes => 'bgcolor="#ffffff"'); HTP.tabledata ( cvalue=http://www.mamicode.com/> '
开发好后注册程序:
路径:系统管理员->安全性->WEB PL/SQL
然后在需要的地方调用就可以直接打印出报表
DECLARE v_command VARCHAR2 (200); v_org_id NUMBER := fnd_profile.VALUE ('ORG_ID'); BEGIN v_command := fnd_profile.VALUE ('APPS_WEB_AGENT'); v_command := v_command || '/CUXTS001?p_header_id=' || :submit.header_id; v_command := v_command || '&p_org_id=' || TO_CHAR (v_org_id); web.show_document (v_command, '_blank'); END;
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。