searchDetailedField.jsp
13.1 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
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
<!DOCTYPE html>
<%@ page import="weaver.general.Util" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ include file="/systeminfo/init_wev8.jsp" %>
<%@ taglib uri="/WEB-INF/weaver.tld" prefix="wea"%>
<jsp:useBean id="RecordSet" class="weaver.conn.RecordSet" scope="page" />
<jsp:useBean id="rs" class="weaver.conn.RecordSet" scope="page" />
<HTML><HEAD>
<link REL=stylesheet type=text/css HREF="/css/Weaver_wev8.css">
<script type="text/javascript">
var parentWin = null;
var dialog = null;
try{
parentWin = parent.parent.getParentWindow(parent);
dialog = parent.parent.getDialog(parent);
}catch(e){}
</script>
</HEAD>
<%
String wfid = Util.null2String(request.getParameter("wfid"));
String formid = Util.null2String(request.getParameter("billid"));
String fieldname = Util.null2String(request.getParameter("fieldname"));
int tabletype = Util.getIntValue(Util.null2String(request.getParameter("tabletype")),0);
String sqlwhere = Util.null2String(request.getParameter("sqlwhere"));
boolean hasSqlwhere = false;
if("".equals(sqlwhere) && !"".equals(wfid)){
hasSqlwhere = false;
}else{
hasSqlwhere = true;
}
%>
<BODY>
<div class="zDialog_div_content">
<%@ include file="/systeminfo/RightClickMenuConent_wev8.jsp" %>
<%
if(hasSqlwhere == false){
RCMenu += "{"+SystemEnv.getHtmlLabelName(197,user.getLanguage())+",javascript:onSubmit(),_self} " ;
RCMenuHeight += RCMenuHeightStep ;
}
RCMenu += "{"+SystemEnv.getHtmlLabelName(201,user.getLanguage())+",javascript:onClose(),_self} " ;
RCMenuHeight += RCMenuHeightStep ;
RCMenu += "{"+SystemEnv.getHtmlLabelName(311,user.getLanguage())+",javascript:onClear(),_self} " ;
RCMenuHeight += RCMenuHeightStep ;
%>
<%@ include file="/systeminfo/RightClickMenu_wev8.jsp" %>
<FORM NAME=SearchForm STYLE="margin-bottom:0" action="searchDetailedField.jsp" method=post>
<input type="hidden" id="wfid" name="wfid" value="<%=wfid%>">
<wea:layout>
<wea:group context="" attributes="{'groupDisplay':'none'}">
<%if(hasSqlwhere == false){%>
<wea:item><%=SystemEnv.getHtmlLabelName(685,user.getLanguage())%></wea:item>
<wea:item><input name=fieldname class="InputStyle" value='<%=fieldname%>'></wea:item>
<wea:item><%=SystemEnv.getHtmlLabelName(26734, user.getLanguage())%></wea:item>
<wea:item>
<select id="tabletype" name="tabletype">
<option value=0 <%if(tabletype==0){%>selected<%}%>></option>
<option value=1 <%if(tabletype==1){%>selected<%}%>><%=SystemEnv.getHtmlLabelName(21778,user.getLanguage())%></option>
<option value=2 <%if(tabletype==2){%>selected<%}%>><%=SystemEnv.getHtmlLabelName(19325,user.getLanguage())%></option>
</select>
</wea:item>
<%}%>
<wea:item attributes="{'isTableList':'true'}">
<TABLE ID=BrowseTable class="ListStyle" cellspacing="0" width="100%">
<TR class=header>
<TH width=50%><%=SystemEnv.getHtmlLabelName(685,user.getLanguage())%></TH>
<TH width=50%><%=SystemEnv.getHtmlLabelName(26734, user.getLanguage())%></TH>
</TR>
<%
int i=0;
String sql = "";
String isbill = "";
if(hasSqlwhere == false){
RecordSet.executeSql("select formid,isbill from workflow_base where id="+wfid);
if(RecordSet.next()){
formid = RecordSet.getString("formid");
isbill = RecordSet.getString("isbill");
}
if(isbill.equals("0")){//表单
sql = "select a.fieldid, b.fieldlable, a.isdetail, a.fieldorder, '' as description, a.groupid as optionkey from workflow_formfield a, workflow_fieldlable b "+
" where a.formid=b.formid and a.fieldid=b.fieldid and a.formid="+formid+" and b.langurageid = "+user.getLanguage();
if(tabletype==1) sql += " and a.isdetail is null ";
if(tabletype==2) sql += " and a.isdetail=1 ";
if(!fieldname.equals("")) sql += " and b.fieldlable like '%"+fieldname+"%' ";
if(RecordSet.getDBType().equals("oracle")){
sql += " order by a.isdetail desc,optionkey asc,a.fieldorder asc ";
}else{
sql += " order by a.isdetail,optionkey,a.fieldorder ";
}
}else if(isbill.equals("1")){//单据
sql = "select id as fieldid,fieldlabel,viewtype as isdetail,dsporder as fieldorder, '' as description, detailtable as optionkey from workflow_billfield where billid="+formid;
if(tabletype==1) sql += " and viewtype=0";
if(tabletype==2) sql += " and viewtype=1";
sql += " order by viewtype,optionkey,dsporder";
}
}else{
isbill = Util.null2o(request.getParameter("isbill"));
int isdetail = Util.getIntValue(request.getParameter("isdetail"), 0);
if("1".equals(isbill)){
if(isdetail == 0){
sql = "select id as fieldid, fieldlabel, 0 as isdetail, 0 as fieldorder, '' as description, '' as optionkey from workflow_billfield where viewtype=1 and fieldhtmltype=1 and (type=2 or type=3 or type=4 or type=5) and billid="+formid;
}else{
sql = "select id as fieldid, fieldlabel, 1 as isdetail, 0 as fieldorder, '' as description, '' as optionkey from workflow_billfield where viewtype=1 and fieldhtmltype=1 and (type=2 or type=3 or type=4 or type=5) and billid="+formid;
}
}else{
if(isdetail == 0){
sql = "select id as fieldid, fieldname as fieldlable, 0 as isdetail, 0 as fieldorder, description, '' as optionkey from workflow_formdict "+sqlwhere;
}else{
sql = "select id as fieldid, fieldname as fieldlable, 1 as isdetail, 0 as fieldorder, description, '' as optionkey from workflow_formdictdetail "+sqlwhere;
}
}
sql += " order by id";
}
String mainOption = "";
String optionsql = "";
Hashtable detailOption = new Hashtable();
if(hasSqlwhere == false){
if(isbill.equals("0")){//表单主字段
optionsql = "select a.fieldid, b.fieldlable, a.isdetail, a.fieldorder from workflow_formfield a, workflow_fieldlable b "+
" where a.isdetail is null and a.formid=b.formid and a.fieldid=b.fieldid and a.formid="+formid+" and b.langurageid = "+user.getLanguage();
if(RecordSet.getDBType().equals("oracle")){
optionsql += " order by a.isdetail desc,a.fieldorder asc ";
}else{
optionsql += " order by a.isdetail,a.fieldorder ";
}
}else if(isbill.equals("1")){//单据主字段
optionsql = "select id,fieldlabel,viewtype,dsporder from workflow_billfield where viewtype=0 and billid="+formid;
optionsql += " order by viewtype,dsporder";
}
rs.executeSql(optionsql);
while(rs.next()){
String tempfieldname = "";
if(isbill.equals("0")) tempfieldname = rs.getString("fieldlable");
if(isbill.equals("1")) tempfieldname = SystemEnv.getHtmlLabelName(rs.getInt("fieldlabel"), user.getLanguage());
mainOption += "<,option value="+rs.getString(1)+">"+tempfieldname+"</option,>";
}
if(isbill.equals("0")){
ArrayList detaigroupidlist = new ArrayList();
optionsql = "select distinct groupid from workflow_formfield where formid="+formid;
rs.executeSql(optionsql);
while(rs.next()){
String tempgroupid = Util.null2String(rs.getString("groupid"));
if(tempgroupid.equals("")) continue;
detaigroupidlist.add(tempgroupid);
}
for(int j=0;j<detaigroupidlist.size();j++){
String tempgroupid = (String)detaigroupidlist.get(j);
if(tempgroupid.equals("")) continue;
optionsql = "select a.fieldid, b.fieldlable, a.isdetail, a.fieldorder from workflow_formfield a, workflow_fieldlable b "+
" where a.isdetail=1 and a.formid=b.formid and a.fieldid=b.fieldid and a.formid="+formid+" and b.langurageid = "+user.getLanguage()+" and groupid="+tempgroupid;
if(rs.getDBType().equals("oracle")){
optionsql += " order by a.isdetail desc,a.fieldorder asc ";
}else{
optionsql += " order by a.isdetail,a.fieldorder ";
}
rs.executeSql(optionsql);
String wfDetailFieldsOptions = "";
while(rs.next()){
String tempfieldname = rs.getString("fieldlable");
wfDetailFieldsOptions += "<,option value="+rs.getString(1)+">"+tempfieldname+"</option,>";
}
detailOption.put(tempgroupid,wfDetailFieldsOptions);
}
}else{
ArrayList detailtablelist = new ArrayList();
optionsql = "select distinct detailtable from workflow_billfield where billid="+formid;
rs.executeSql(optionsql);
while(rs.next()){
String tempdetailtable = Util.null2String(rs.getString("detailtable"));
if(tempdetailtable.equals("")) continue;
detailtablelist.add(tempdetailtable);
}
for(int j=0;j<detailtablelist.size();j++){
String tempdetailtable = Util.null2String((String)detailtablelist.get(j));
if(tempdetailtable.equals("")) continue;
optionsql = "select id,fieldlabel,viewtype,dsporder from workflow_billfield where viewtype=1 and billid="+formid+" and detailtable='"+tempdetailtable+"'";
optionsql += " order by viewtype,dsporder";
rs.executeSql(optionsql);
String wfDetailFieldsOptions = "";
while(rs.next()){
String tempfieldname = SystemEnv.getHtmlLabelName(rs.getInt("fieldlabel"), user.getLanguage());
wfDetailFieldsOptions += "<,option value="+rs.getString(1)+">"+tempfieldname+"</option,>";
}
detailOption.put(tempdetailtable,wfDetailFieldsOptions);
}
}
}
//out.println("sql:"+sql);
RecordSet.execute(sql);
while(RecordSet.next()){
String fieldlablename = "";
if(isbill.equals("1")){//单据无法将字段名称作为查询条件,在这里进行处理
fieldlablename = SystemEnv.getHtmlLabelName(RecordSet.getInt("fieldlabel"),user.getLanguage());
if(!fieldname.equals("")&&fieldlablename.indexOf(fieldname)<0) continue;
}else{
fieldlablename = Util.null2String(RecordSet.getString("fieldlable"));
}
String description_tmp = Util.null2String(RecordSet.getString("description")).trim();
if(!"".equals(description_tmp)){
fieldlablename = description_tmp;
}
int id_tmp = Util.getIntValue(RecordSet.getString("fieldid"), 0);
String tempoption = ","+mainOption;
String isdetail = Util.null2String(RecordSet.getString("isdetail"));
if(isdetail.equals("1")){
String optionkey = Util.null2String(RecordSet.getString("optionkey"));
if(!optionkey.equals("")) tempoption = ","+(String)detailOption.get(optionkey);
}
tempoption += ",";
if(i==0){
i=1;
%>
<TR class=DataLight>
<%
}else{
i=0;
%>
<TR class=DataDark>
<%
}
%>
<TD style="display:none"><%=RecordSet.getString("fieldid")%></TD>
<TD>
<%=fieldlablename%>
</TD>
<TD>
<%if(RecordSet.getString("isdetail").equals("1")){
out.print(SystemEnv.getHtmlLabelName(19325,user.getLanguage()));
}else{
out.print(SystemEnv.getHtmlLabelName(21778,user.getLanguage()));
}
%>
</TD>
<TD style="display:none"><%if(isdetail.equals("1")){%>1<%}else{%>0<%}%></TD>
<TD style="display:none"><%=tempoption%></TD>
</TR>
<%}%>
</TABLE>
</wea:item>
</wea:group>
</wea:layout>
</FORM>
</div>
<div id="zDialog_div_bottom" class="zDialog_div_bottom">
<wea:layout needImportDefaultJsAndCss="false">
<wea:group context="" attributes="{\"groupDisplay\":\"none\"}">
<wea:item type="toolbar">
<input type="button" accessKey=2 id=btnclear value="<%="2-"+SystemEnv.getHtmlLabelName(311,user.getLanguage())%>" id="zd_btn_submit" class="zd_btn_submit" onclick="submitClear();">
<input type="button" accessKey=T id=btncancel value="<%="T-"+SystemEnv.getHtmlLabelName(201,user.getLanguage())%>" id="zd_btn_cancle" class="zd_btn_cancle" onclick="onClose();">
</wea:item>
</wea:group>
</wea:layout>
<script type="text/javascript">
jQuery(document).ready(function(){
resizeDialog(document);
});
</script>
</div>
</BODY>
<script language="javascript">
jQuery(document).ready(function(){
//alert(jQuery("#BrowseTable").find("tr").length)
jQuery("#BrowseTable").find("tr[class^='Data'][class!='DataHeader']").bind("click",function(){
/* var returnjson = {
id:$($(this).children()[0]).text(),
name:$($(this).children()[1]).text(),
fieldtype:$($(this).children()[3]).text(),
options:$($(this).children()[4]).text()
};
*/
var strid = $($(this).children()[0]).text();
var strName = $($(this).children()[1]).text();
if(dialog){
//dialog.callback(returnjson);
parentWin.assignment(strid,strName);
dialog.close();
}else{
window.parent.returnValue = returnjson;
window.parent.close();
}
});
jQuery("#BrowseTable").find("tr[class^='Data'][class!='DataHeader']").bind("mouseover",function(){
$(this).addClass("Selected")
})
jQuery("#BrowseTable").find("tr").bind("mouseout",function(){
$(this).removeClass("Selected")
})
})
function submitClear()
{
var returnjson = {id:"",name:"",fieldtype:"",options:""};
if(dialog){
dialog.callback(returnjson);
}else{
window.parent.parent.returnValue = returnjson;
window.parent.parent.close();
}
}
function onClear()
{
submitClear() ;
}
function onSubmit()
{
SearchForm.submit();
}
function onClose()
{
if(dialog){
dialog.close();
}else{
window.parent.parent.close() ;
}
}
</script>
</HTML>