QRCodeViewIframe.jsp
6.16 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
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ page import="weaver.general.Util" %>
<%@page import="com.weaver.formmodel.util.StringHelper" %>
<%@ page import="weaver.formmode.virtualform.VirtualFormHandler" %>
<jsp:useBean id="rs" class="weaver.conn.RecordSet" scope="page" />
<jsp:useBean id="RecordSet" class="weaver.conn.RecordSet" scope="page" />
<jsp:useBean id="FormModeTransMethod" class="weaver.formmode.search.FormModeTransMethod" scope="page"/>
<%@ include file="/systeminfo/init_wev8.jsp" %>
<%@ include file="/formmode/pub_detach.jsp"%>
<html>
<%
//获取modeid
String modeid = request.getParameter("modeId");
String formid = request.getParameter("formId");
String customid = request.getParameter("customid");
String billids = request.getParameter("billid");
String qrCodeDesc = "";
String width = "";
String height = "";
float levelspacing = 0;
float verticalspacing = 0;
int numberrows = 0;
int numbercols = 0;
rs.executeSql("select * from ModeQRCode where modeid="+StringHelper.empty2Null(modeid));
if (rs.next()) {
qrCodeDesc = rs.getString("qrCodeDesc");
width = Util.null2String(rs.getString("width"));
height = Util.null2String(rs.getString("height"));
levelspacing = Util.getFloatValue(rs.getString("levelspacing"),0);
verticalspacing = Util.getFloatValue(rs.getString("verticalspacing"),0);
numberrows = Util.getIntValue(rs.getString("numberrows"),0);
numbercols = Util.getIntValue(rs.getString("numbercols"),0);
}
boolean isVirtualForm = VirtualFormHandler.isVirtualForm(formid);
String vdatasource = "";
String vprimarykey = "";
if(isVirtualForm){
Map<String,Object> vFormInfo = VirtualFormHandler.getVFormInfo(formid);
vdatasource = Util.null2String(vFormInfo.get("vdatasource"));
vprimarykey = Util.null2String(vFormInfo.get("vprimarykey")); //虚拟表单主键列名称
}
qrCodeDesc = Util.toScreenToEdit(qrCodeDesc,user.getLanguage()).trim();
qrCodeDesc = FormModeTransMethod.getDefaultSqlToName(user,qrCodeDesc);
String qrCodeDescT = qrCodeDesc;
String tablename = "";
String sqlStr = "select tablename from workflow_bill where id="+StringHelper.empty2Null(formid);
RecordSet.executeSql(sqlStr);
if (RecordSet.next()) {
tablename = Util.null2String(RecordSet.getString("tablename"));
}
if(isVirtualForm){
tablename = VirtualFormHandler.getRealFromName(tablename);
}
String elSpacingStyle = "";
if(levelspacing > 0){
elSpacingStyle += "margin-right:" + levelspacing + "cm;";
}
if(verticalspacing > 0){
elSpacingStyle += "margin-bottom:" + verticalspacing + "cm;";
}
String splitLineDiv = "<div class='splitLine'></div>";
String pageBreakDiv = "<div class='pageBreak'></div>";
%>
<head>
<style>
body{
text-align:center;
}
table{
border-spacing:0px;
}
.elBaseClass{
display:inline-block;
}
.elSpacingClass{
<%=elSpacingStyle%>
}
.splitLine{
height:0px;
}
.pageBreak{
page-break-after: always;
}
</style>
</head>
<%@ include file="/systeminfo/RightClickMenuConent_wev8.jsp" %>
<%
RCMenu += "{"+SystemEnv.getHtmlLabelName(257,user.getLanguage())+",javascript:doPrint(),_self} " ;//打印
RCMenuHeight += RCMenuHeightStep;
%>
<%@ include file="/systeminfo/RightClickMenu_wev8.jsp" %>
<body>
<div style="display:inline-block;text-align:left;">
<%
int rows = 0;
int cols = 0;
int totalSize = billids.split(",").length;
for (int i = 0 ; i < totalSize ; i++) {
qrCodeDesc = qrCodeDescT;
String billid = billids.split(",")[i];
if ("".equals(billid)) continue;
String requestid = "0";
String datesql ="select * from "+tablename +" where id='"+billid+"'";
if(isVirtualForm){
RecordSet.executeSql(datesql,vdatasource);
}else{
RecordSet.executeSql(datesql);
}
if(RecordSet.next()){
requestid = RecordSet.getString("requestId");
qrCodeDesc = Util.replaceString2(qrCodeDesc, "\\$requestId\\$", requestid);
RecordSet RecordSetfield = new RecordSet();
String fieldsql = "select * from workflow_billfield where billid="+StringHelper.empty2Null(formid)+" and (detailtable ='' or detailtable is null)";
RecordSetfield.executeSql(fieldsql);
while(RecordSetfield.next()){
int fieldid = RecordSetfield.getInt("id");
String fieldhtype = RecordSetfield.getString("fieldhtmltype");
String type = RecordSetfield.getString("type");
String fielddbtype = RecordSetfield.getString("fielddbtype");
String fieldname = RecordSetfield.getString("fieldname");
int viewtype = RecordSetfield.getInt("viewtype");
if(("2".equals(fieldhtype)&&"2".equals(type))||"".equals(Util.match(qrCodeDesc, "\\$"+fieldname+"\\$", false))){
continue;
}
String fieldvalue = RecordSet.getString(fieldname);
String paraTwo = (isVirtualForm?vprimarykey:"id") + "+" + fieldid + "+" + fieldhtype + "+" + type + "+" + user.getLanguage() + "+" + "1" + "+" + fielddbtype + "+" + "+" + modeid + "+" +
formid + "+" + viewtype + "+" + "3" + "+" + customid + "+fromsearchlist";
String showname = FormModeTransMethod.getOthersNoTitle(fieldvalue, paraTwo);
qrCodeDesc = Util.replaceString2(qrCodeDesc, "\\$"+fieldname+"\\$", showname);
qrCodeDesc = Util.replaceString2(qrCodeDesc, "\\$billid\\$", billid);
qrCodeDesc = Util.replaceString2(qrCodeDesc, "\\$modeid\\$", modeid);
qrCodeDesc = Util.replaceString2(qrCodeDesc, "\\$formid\\$", formid);
}
}
qrCodeDesc = qrCodeDesc.replaceAll("#QRCodeImg#","<img alt='' style='vertical-align:top;' width="+width+" height="+height+" src='/weaver/weaver.formmode.servelt.QRcodeBuildAction?modeid="+modeid+"&formid="+formid+"&billid="+billid+"&customid="+customid+"'>");
%>
<div class="elBaseClass elSpacingClass"><%=qrCodeDesc%></div>
<%
cols++;
if(numberrows == 0){
if(numbercols == 0){
out.print(splitLineDiv);
}else if(cols%numbercols == 0){
out.print(splitLineDiv);
cols = 0;
}
}else{
if(numbercols == 0){
out.print(splitLineDiv);
rows++;
}else if(cols%numbercols == 0){
out.print(splitLineDiv);
cols = 0;
rows++;
if(rows%numberrows == 0){
out.print("</div>");
if(i < totalSize-1){
out.print(pageBreakDiv);
out.print("<div style='display:inline-block;text-align:left;'>");
}
}
}
}
%>
<%
}
%>
</div>
</body>
<script type="text/javascript">
function doPrint() {
hideRightClickMenu();
window.print();
}
</script>
</html>