CustomQueryTypeSearch.jsp
9.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ page import="weaver.general.Util" %>
<%@ page import="weaver.conn.*" %>
<%@ page import="java.util.*,java.sql.Timestamp" %>
<%@ page import="weaver.systeminfo.menuconfig.LeftMenuInfoHandler" %>
<%@ page import="weaver.systeminfo.menuconfig.LeftMenuInfo" %>
<%@page import="weaver.workflow.workflow.WorkflowVersion"%>
<%@ include file="/systeminfo/init_wev8.jsp" %>
<jsp:useBean id="WorkTypeComInfo" class="weaver.workflow.workflow.WorkTypeComInfo" scope="page"/>
<jsp:useBean id="WorkflowComInfo" class="weaver.workflow.workflow.WorkflowComInfo" scope="page"/>
<jsp:useBean id="ResourceComInfo" class="weaver.hrm.resource.ResourceComInfo" scope="page"/>
<jsp:useBean id="RecordSet" class="weaver.conn.RecordSet" scope="page" />
<jsp:useBean id="rs" class="weaver.conn.RecordSet" scope="page" />
<HTML><HEAD>
<LINK href="/css/Weaver_wev8.css" type=text/css rel=STYLESHEET>
</head>
<%
String imagefilename = "/images/hdDOC_wev8.gif";
String titlename = SystemEnv.getHtmlLabelName(197,user.getLanguage())+":"+SystemEnv.getHtmlLabelName(20773,user.getLanguage());
String needfav ="1";
String needhelp ="";
int userid=user.getUID();
String logintype = user.getLogintype();
int usertype = 0;
if(logintype.equals("2"))
usertype = 1;
boolean issimple = Util.null2String(request.getParameter("issimple")).equals("false")?false:true;
%>
<body>
<%@ include file="/systeminfo/TopTitle_wev8.jsp" %>
<%@ include file="/systeminfo/RightClickMenuConent_wev8.jsp" %>
<%
RCMenu += "{" + SystemEnv.getHtmlLabelName(23803, user.getLanguage()) + ",/workflow/search/CustomSearch.jsp?issimple="+issimple+",_self} ";
RCMenuHeight += RCMenuHeightStep;
%>
<%@ include file="/systeminfo/RightClickMenu_wev8.jsp" %>
<form name=subform method=post>
<%
ArrayList CustomQueryTypeids = new ArrayList();
ArrayList CustomQueryTypenames = new ArrayList();
ArrayList CustomQuerys = new ArrayList();
ArrayList Customids = new ArrayList();
ArrayList Customnames = new ArrayList();
String temptypeid="";
String temptypename="";
String typeid="";
String typename="";
String sql = "";
String tempbillworkflowids="";
String tempfromworkflowids="";
RecordSet.execute("select * from workflow_custom ");
while(RecordSet.next()){
String isbill = Util.null2String(RecordSet.getString("isbill"));
String formID = Util.null2String(RecordSet.getString("formid"));
String tempworkflowids = Util.null2String(RecordSet.getString("workflowids"));
if (tempworkflowids.trim().equals("")) {
rs.executeSql("select id from workflow_base where (isvalid='1' or isvalid='3') and formid=" + formID + " and isbill='" + isbill + "'");
while (rs.next()) {
if (tempworkflowids.trim().equals("")) {
tempworkflowids = rs.getString("id");
} else {
tempworkflowids += "," + rs.getString("id");
}
}
}
if (!tempworkflowids.trim().equals("")) {
if (isbill.equals("1")) {
if (tempbillworkflowids.trim().equals("")) {
tempbillworkflowids = tempworkflowids;
} else {
tempbillworkflowids += "," + tempworkflowids;
}
} else {
if (tempfromworkflowids.trim().equals("")) {
tempfromworkflowids = tempworkflowids;
} else {
tempfromworkflowids += "," + tempworkflowids;
}
}
}
}
String tempwfids="";
if(!tempbillworkflowids.equals("")){
RecordSet.executeSql("select distinct a.workflowid from workflow_createdoc a,workflow_billfield b where (b.viewtype is null or b.viewtype !='1') and a.flowdocfield=b.id and a.status='1' and a.workflowid in("+ WorkflowVersion.getAllVersionStringByWFIDs(tempbillworkflowids) +")");
while(RecordSet.next()){
String tmpworkflowid=RecordSet.getString("workflowid");
if(tempwfids.equals("")){
tempwfids=tmpworkflowid;
}else{
tempwfids+=","+tmpworkflowid;
}
}
}
if(!tempfromworkflowids.equals("")){
RecordSet.executeSql("select distinct c.workflowid from workflow_createdoc c,workflow_formfield a ,workflow_formdict b where a.fieldid=b.id and (a.isdetail is null or a.isdetail !='1') and c.flowdocfield=a.fieldid and c.status='1' and c.workflowid in("+WorkflowVersion.getAllVersionStringByWFIDs(tempfromworkflowids)+")");
while(RecordSet.next()){
String tmpworkflowid=RecordSet.getString("workflowid");
if(tempwfids.equals("")){
tempwfids=tmpworkflowid;
}else{
tempwfids+=","+tmpworkflowid;
}
}
}
if(!tempwfids.equals("")){
sql="select distinct b.id as typeid,b.typename,a.customname,a.id from workflow_custom a,workflow_customQuerytype b,(select formid,isbill,id from workflow_base where (isvalid='1' or isvalid='3') and formid in (select formid from workflow_custom where isbill=workflow_base.isbill) and (id in("+tempwfids+") or exists (select 1 from workflow_currentoperator where workflow_currentoperator.workflowid=workflow_base.id and userid="+userid+" and usertype='"+usertype+"')))c";
}else{
sql="select distinct b.id as typeid,b.typename,a.customname,a.id from workflow_custom a,workflow_customQuerytype b,(select formid,isbill,id from workflow_base where (isvalid='1' or isvalid='3') and formid in (select formid from workflow_custom where isbill=workflow_base.isbill) and exists (select 1 from workflow_currentoperator where workflow_currentoperator.workflowid=workflow_base.id and userid="+userid+" and usertype='"+usertype+"'))c";
}
if(RecordSet.getDBType().equals("oracle")){
sql+=" where a.querytypeid=b.id and a.formid=c.formid and a.isbill=c.isbill and (','||a.workflowids||',' like '%,'||to_char(c.id)||',%' or a.workflowids is null) order by b.id,a.id";
}else if(RecordSet.getDBType().equals("mysql")){
sql+=" where a.querytypeid=b.id and a.formid=c.formid and a.isbill=c.isbill and concat(',',a.workflowids,',') like concat('%,',c.id,',%') or a.workflowids is null) order by b.id,a.id";
}else{
sql+=" where a.querytypeid=b.id and a.formid=c.formid and a.isbill=c.isbill and (','+convert(varchar,a.workflowids)+',' like '%,'+convert(varchar,c.id)+',%' or convert(varchar,a.workflowids)='' or a.workflowids is null) order by b.id,a.id";
}
RecordSet.executeSql(sql);
while(RecordSet.next()){
typeid=Util.null2String(RecordSet.getString("typeid"));
typename=Util.null2String(RecordSet.getString("typename"));
if(!temptypeid.equals("")&&!temptypeid.equals(typeid)){
CustomQueryTypeids.add(temptypeid);
CustomQueryTypenames.add(temptypename);
ArrayList Customs = new ArrayList();
Customs.add(Customids.clone());
Customs.add(Customnames.clone());
CustomQuerys.add(Customs);
Customids.clear();
Customnames.clear();
}
temptypeid=typeid;
temptypename=typename;
Customids.add(RecordSet.getString("id"));
Customnames.add(Util.null2String(RecordSet.getString("customname")));
}
if(!typeid.equals("")){
CustomQueryTypeids.add(typeid);
CustomQueryTypenames.add(typename);
ArrayList Customs = new ArrayList();
Customs.add(Customids.clone());
Customs.add(Customnames.clone());
CustomQuerys.add(Customs);
}
int wftypetotal=CustomQueryTypeids.size();
int rownum=(wftypetotal+2)/3;
%>
<table width=100% height=100% border="0" cellspacing="0" cellpadding="0">
<colgroup>
<col width="10">
<col width="">
<col width="10">
<tr>
<td height="10" colspan="3"></td>
</tr>
<tr>
<td ></td>
<td valign="top">
<TABLE class=Shadow>
<tr>
<td valign="top">
<table class="ViewForm">
<tr class=field>
<td width="30%" align=left valign=top>
<%
int i=0;
int needtd=rownum;
for(int k=0;k<CustomQueryTypeids.size();k++){
String wftypename=(String)CustomQueryTypenames.get(k);
ArrayList wfCustomQuerys=(ArrayList)CustomQuerys.get(k);
%>
<table class="ViewForm">
<tr>
<td>
<%
needtd--;
if(wfCustomQuerys!=null&&wfCustomQuerys.size()==2){
ArrayList wfcustomids=(ArrayList)wfCustomQuerys.get(0);
ArrayList wfcustomnames=(ArrayList)wfCustomQuerys.get(1);
if(wfcustomids!=null&&wfcustomids.size()>0){
%>
<ul><li><b><%=Util.toScreen(wftypename,user.getLanguage())%></b>
<%
for(int m=0;m<wfcustomids.size();m++){
String wfname=(String)wfcustomnames.get(m);
String wfcustomid = (String)wfcustomids.get(m);
%>
<ul><li><a href="javascript:onSearchCustom(<%=wfcustomid%>);">
<%=Util.toScreen(wfname,user.getLanguage())%></a></ul></li>
<%
}
}
}
%>
</ul></li></td></tr>
</table>
<%
if(needtd<=0){
needtd=rownum;
%>
</td><td width="30%" align=left valign=top>
<%
}
}
%>
</td>
</tr>
</table>
</td>
</tr>
</TABLE>
</td>
<td></td>
</tr>
<tr>
<td height="10" colspan="3"></td>
</tr>
</table>
</form>
<script language=javascript>
function onSearchCustom(customid){
document.subform.action="WFCustomSearchBySimple.jsp?searchtype=querytype&customid="+customid+"&issimple=<%=issimple%>";
document.subform.submit();
}
</script>
</body>
</html>