ireport报表制作, 通过节点产品类型来判断,当该节点审核通过之后,报表相对应的字段出显示审核意见及签名

Posted DSHORE

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ireport报表制作, 通过节点产品类型来判断,当该节点审核通过之后,报表相对应的字段出显示审核意见及签名相关的知识,希望对你有一定的参考价值。

1、代码①  (与本内容相关代码:7~36)           以下类似 $P{P_XXXX} :均为页面端的传入参数

 1 select so.sale_order_no as sale_order_no,
 2 (SELECT company_name from CUSTOMER where company_code = so.CUSTOMER_NO) as CUSTOMER_NAME,
 3 so.out_order_no as out_order_no,
 4 so.required_date,
 5 (select sysdate from dual) as system_date,
 6 so.quality_note as quality_note,
 7 (select \'同意\' from dual WHERE substr(2,1,1) < substr(wf_node_code,1,1) AND so.pro_type = \'01\') as audit_opinion1,  -- substr(2,1,1),从2开始,而不是从1开始;是因为审核到2节点了,但,还没审核通过。(以下7~36行代码 相同)
 8 (select \'同意\' from dual WHERE SUBSTR(3,1,1) < SUBSTR(wf_node_code,1,1) AND so.pro_type = \'01\') as audit_opinion2,
 9 (select \'同意\' from dual WHERE SUBSTR(4,1,1) < SUBSTR(wf_node_code,1,1) AND so.pro_type = \'01\') as audit_opinion3,
10 (select \'同意\' from dual WHERE SUBSTR(5,1,1) < SUBSTR(wf_node_code,1,1) AND so.pro_type = \'01\') as audit_opinion4,
11 (select \'同意\' from dual WHERE SUBSTR(6,1,1) < SUBSTR(wf_node_code,1,1) AND so.pro_type = \'01\') as audit_opinion5,
12 (select \'同意\' from dual WHERE SUBSTR(7,1,1) < SUBSTR(wf_node_code,1,1) AND so.pro_type = \'01\') as audit_opinion6,
13 (SELECT p.person_name FROM personnel p WHERE p.person_code = 
14           (SELECT distinct au.person_code FROM APPLICATION_USERS au WHERE au.username =
15           (SELECT distinct w.role_code FROM Work_Flow_Role w WHERE w.wf_code = \'000180\' 
16           AND SUBSTR(2,1,1) < SUBSTR(so.wf_node_code,1,1) AND w.node_code = DECODE(pro_type,\'01\',22,\'03\',2,\'04\',23) AND w.role_code <> \'test2\'))) as signature1,
17 (SELECT p.person_name FROM personnel p WHERE p.person_code = 
18           (SELECT distinct au.person_code FROM APPLICATION_USERS au WHERE au.username =         
19           (SELECT distinct w.role_code FROM Work_Flow_Role w WHERE w.wf_code = \'000180\' 
20           AND SUBSTR(3,1,1) < SUBSTR(so.wf_node_code,1,1) AND w.node_code = DECODE(pro_type,\'01\',3) AND w.role_code <> \'test2\'))) as signature2,
21 (SELECT p.person_name FROM personnel p WHERE p.person_code = 
22           (SELECT distinct au.person_code FROM APPLICATION_USERS au WHERE au.username =          
23           (SELECT distinct w.role_code FROM Work_Flow_Role w WHERE w.wf_code = \'000180\' 
24           AND SUBSTR(4,1,1) < SUBSTR(so.wf_node_code,1,1) AND w.node_code = DECODE(pro_type,\'01\',41) AND w.role_code <> \'test2\'))) as signature3,
25 (SELECT p.person_name FROM personnel p WHERE p.person_code = 
26           (SELECT distinct au.person_code FROM APPLICATION_USERS au WHERE au.username =          
27           (SELECT distinct w.role_code FROM Work_Flow_Role w WHERE w.wf_code = \'000180\' 
28           AND SUBSTR(5,1,1) < SUBSTR(so.wf_node_code,1,1) AND w.node_code = DECODE(pro_type,\'01\',5) AND w.role_code <> \'test2\'))) as signature4,
29 (SELECT p.person_name FROM personnel p WHERE p.person_code = 
30           (SELECT distinct au.person_code FROM APPLICATION_USERS au WHERE au.username =           
31           (SELECT distinct w.role_code FROM Work_Flow_Role w WHERE w.wf_code = \'000180\' 
32           AND SUBSTR(6,1,1) < SUBSTR(so.wf_node_code,1,1) AND w.node_code = DECODE(pro_type,\'01\',6) AND w.role_code <> \'test2\'))) as signature5,
33 (SELECT p.person_name FROM personnel p WHERE p.person_code = 
34           (SELECT distinct au.person_code FROM APPLICATION_USERS au WHERE au.username =           
35           (SELECT distinct w.role_code FROM Work_Flow_Role w WHERE w.wf_code = \'000180\' 
36           AND SUBSTR(7,1,1) < SUBSTR(so.wf_node_code,1,1) AND w.node_code = DECODE(pro_type,\'01\',7) AND w.role_code <> \'test2\'))) as signature6
37 
38 from sale_order so
39 where so.sale_order_no = $P{P_SALE_ORDER_NO}   -- $P{P_SALE_ORDER_NO} :需要传入的参数(订单号)

 

2、代码② (与本内容相关的代码:7~46)

 1 select so.sale_order_no as sale_order_no,
 2 (SELECT company_name from CUSTOMER where company_code = so.CUSTOMER_NO) as CUSTOMER_NAME,
 3 so.out_order_no as out_order_no,
 4 so.required_date,
 5 (select sysdate from dual) as system_date,
 6 so.quality_note as quality_note,
 7 (SELECT CASE WHEN audit_opinion = \' \' THEN \'同意\' ELSE audit_opinion END FROM 
 8 (SELECT ocl.audit_opinion FROM Order_Check_List ocl WHERE ocl.order_no = $P{P_SALE_ORDER_NO} AND ocl.wf_node_code = \'22\' AND ocl.wf_code = \'000180\' AND 
 9 (SELECT \'1\' FROM sale_order so WHERE so.sale_order_no = $P{P_SALE_ORDER_NO} AND so.wf_node_code IN (\'32\',\'41\',\'5\',\'6\',\'7\',\'99\')) IS NOT NULL ORDER BY check_date desc)
10 WHERE ROWNUM = 1) as audit_opinion1,
11 (SELECT CASE WHEN audit_opinion = \' \' THEN \'同意\' ELSE audit_opinion END FROM 
12 (SELECT ocl.audit_opinion FROM Order_Check_List ocl WHERE ocl.order_no = $P{P_SALE_ORDER_NO} AND ocl.wf_node_code = \'41\' AND ocl.wf_code = \'000180\' AND 
13 (SELECT \'1\' FROM sale_order so WHERE so.sale_order_no = $P{P_SALE_ORDER_NO} AND so.wf_node_code IN (\'5\',\'6\',\'7\',\'99\')) IS NOT NULL ORDER BY check_date desc)
14 WHERE ROWNUM = 1) as audit_opinion2,
15 (SELECT CASE WHEN audit_opinion = \' \' THEN \'同意\' ELSE audit_opinion END FROM 
16 (SELECT ocl.audit_opinion FROM Order_Check_List ocl WHERE ocl.order_no = $P{P_SALE_ORDER_NO} AND ocl.wf_node_code = \'5\' AND ocl.wf_code = \'000180\' AND 
17 (SELECT \'1\' FROM sale_order so WHERE so.sale_order_no = $P{P_SALE_ORDER_NO} AND so.wf_node_code IN (\'6\',\'7\',\'99\')) IS NOT NULL ORDER BY check_date desc)
18 WHERE ROWNUM = 1) as audit_opinion3,
19 (SELECT CASE WHEN audit_opinion = \' \' THEN \'同意\' ELSE audit_opinion END FROM 
20 (SELECT ocl.audit_opinion FROM Order_Check_List ocl WHERE ocl.order_no = $P{P_SALE_ORDER_NO} AND ocl.wf_node_code = \'6\' AND ocl.wf_code = \'000180\' AND 
21 (SELECT \'1\' FROM sale_order so WHERE so.sale_order_no = $P{P_SALE_ORDER_NO} AND so.wf_node_code IN (\'7\',\'99\')) IS NOT NULL ORDER BY check_date desc)
22 WHERE ROWNUM = 1) as audit_opinion4,
23 (SELECT CASE WHEN audit_opinion = \' \' THEN \'同意\' ELSE audit_opinion END FROM 
24 (SELECT ocl.audit_opinion FROM Order_Check_List ocl WHERE ocl.order_no = $P{P_SALE_ORDER_NO} AND ocl.wf_node_code = \'7\' AND ocl.wf_code = \'000180\' AND 
25 (SELECT \'1\' FROM sale_order so WHERE so.sale_order_no = $P{P_SALE_ORDER_NO} AND so.wf_node_code = \'99\') IS NOT NULL ORDER BY check_date desc)
26 WHERE ROWNUM = 1) as audit_opinion5,
27 (SELECT p.person_name FROM personnel p WHERE p.person_code = 
28           (SELECT distinct au.person_code FROM APPLICATION_USERS au WHERE au.username =
29           (SELECT distinct w.role_code FROM Work_Flow_Role w WHERE w.wf_code = \'000180\' 
30           AND SUBSTR(2,1,1) < SUBSTR(so.wf_node_code,1,1) AND w.node_code = DECODE(pro_type,\'02\',22) AND w.role_code <> \'test2\'))) as signature1,
31 (SELECT p.person_name FROM personnel p WHERE p.person_code = 
32           (SELECT distinct au.person_code FROM APPLICATION_USERS au WHERE au.username =          
33           (SELECT distinct w.role_code FROM Work_Flow_Role w WHERE w.wf_code = \'000180\' 
34           AND SUBSTR(4,1,1) < SUBSTR(so.wf_node_code,1,1) AND w.node_code = DECODE(pro_type,\'02\',41) AND w.role_code <> \'test2\'))) as signature2,
35 (SELECT p.person_name FROM personnel p WHERE p.person_code = 
36           (SELECT distinct au.person_code FROM APPLICATION_USERS au WHERE au.username =          
37           (SELECT distinct w.role_code FROM Work_Flow_Role w WHERE w.wf_code = \'000180\' 
38           AND SUBSTR(5,1,1) < SUBSTR(so.wf_node_code,1,1) AND w.node_code = DECODE(pro_type,\'02\',5) AND w.role_code <> \'test2\'))) as signature3,
39 (SELECT p.person_name FROM personnel p WHERE p.person_code = 
40           (SELECT distinct au.person_code FROM APPLICATION_USERS au WHERE au.username =           
41           (SELECT distinct w.role_code FROM Work_Flow_Role w WHERE w.wf_code = \'000180\' 
42           AND SUBSTR(6,1,1) < SUBSTR(so.wf_node_code,1,1) AND w.node_code = DECODE(pro_type,\'02\',6) AND w.role_code <> \'test2\'))) as signature4,
43 (SELECT p.person_name FROM personnel p WHERE p.person_code = 
44           (SELECT distinct au.person_code FROM APPLICATION_USERS au WHERE au.username =           
45           (SELECT distinct w.role_code FROM Work_Flow_Role w WHERE w.wf_code = \'000180\' 
46           AND SUBSTR(7,1,1) < SUBSTR(so.wf_node_code,1,1) AND w.node_code = DECODE(pro_type,\'02\',7) AND w.role_code <> \'test2\'))) as signature5
47 
48 from sale_order so
49 where so.sale_order_no = $P{P_SALE_ORDER_NO}  -- $P{P_SALE_ORDER_NO} :需要传入的参数(订单号)

代码②与代码①的区别:

1、代码①的结果如下图所示,只要是审核通过,审核意见处显示“同意,签名处显示审核人的名字。

2代码②的结果是:只要是审核通过,如果审核人填了审核意见,那么审核意见处显示“所填的内容”,否则显示“同意”,签名处显示审核人的名字。

 

3、代码① 图示

代码① 最终效果图

 

 代码 最终效果图

 

 

小结:只要是对应的部门审核通过了,那么“审核意见”和“签名/时间”这两栏 都同时显示;没有审核通过的部门,都是空白。

 

 

 

 

 

附录:(11~25行 为重要代码)       类似 $P{P_XXXX} :均为页面端的传入参数

该代码的作用:按照where(15行)后面的条件,输入那些条件,就打印出 适合哪些条件的内容

 时间格式:(大小写不区分,唯一不同,在时分秒的分处),24指:时间为24小时制。

  1、mysql:YYYY-MM-DD HH24:MM:SS      例:2017-12-18 15:10:30

  2、Oracle:YYYY-MM-DD HH24:MI:SS

或  (我常用的写法)

      3、MySQL:yyyy-MM-dd HH24:mm:ss    

      4、Oracle: yyyy-MM-dd HH24:mi:ss

 1 SELECT 
 2 (select person_name from personnel where person_code = mlm.eq_responser) AS eq_responser,
 3 (SELECT company_name from COMPANY  WHERE company_code = mlm.insert_orgid) AS insert_orgid,
 4 mld.finished_roll_qty AS finished_roll_qty,
 5 mld.actual_time AS actual_time,
 6 mld.start_time AS start_date,
 7 mld.end_time AS end_date,
 8 NVL(WORK_DATE,WORK_DATE) AS WORK_DATE,
 9 NVL(manufacture_no,manufacture_no) AS manufacture_no,
10 (select material_name from material where material_code = mld.product_code) AS material_name,
11 (SELECT NVL(ARTS_DESC, ARTS_DESC) FROM EQUIPMENT_POWER_CONSUMPTION WHERE ARTS_NO = (SELECT ARTS_NO FROM MANUFACTURE_ROADMAP 
12                                                                                                    WHERE MANUFACTURE_NO = MLD.MANUFACTURE_NO AND SERIAL = MLD.MAN_SERIAL_NO)) AS MAN_SERIAL_NAME
13 
14 FROM manufacture_log_master mlm,manufacture_log_detail mld
15 WHERE mlm.log_no = mld.log_no 
16  AND mlm.eq_responser = NVL($P{P_EQ_RESPONSER},eq_responser)
17  AND TO_CHAR(WORK_DATE,\'ireport 如何实现固定行、动态列的报表?

iReport+JasperReport1.iReport与JasperReport基础

iReport 生成pdf分页问题

打印信息,通过.jasper工具将集合输出到PDF文件 然后利用打印机打印文件

ireport5.1.0和jasperreports5.1.1怎么集成

IReport实践指南