forked from maxliaops/Java_Web_Examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathemiction.jsp
More file actions
188 lines (186 loc) · 8.36 KB
/
emiction.jsp
File metadata and controls
188 lines (186 loc) · 8.36 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
<%@ page contentType="text/html; charset=gb2312" %>
<%@ page import="java.util.*"%>
<%@ page import="java.sql.*"%>
<%@ page import="java.text.SimpleDateFormat"%>
<%@ page import="electric.dbs.*"%>
<%@ page import="java.sql.ResultSet"%>
<%@ page import="electric.electricUtils.ParamUtils"%>
<%@ page import="electric.electricUtils.DbConnectionManager"%>
<%
String Ayear = ParamUtils.getEscapeHTMLParameter(request, "Ayear","2000");
String Amonth = ParamUtils.getEscapeHTMLParameter(request, "Amonth","01");
String Aday = ParamUtils.getEscapeHTMLParameter(request, "Aday","01");
String Byear = ParamUtils.getEscapeHTMLParameter(request, "Byear","2000");
String Bmonth = ParamUtils.getEscapeHTMLParameter(request, "Bmonth","01");
String Bday = ParamUtils.getEscapeHTMLParameter(request, "Bday","01");
String Atime=Ayear+Amonth+Aday;
String Btime=Byear+Bmonth+Bday;
int Proid = ParamUtils.getIntParameter(request, "Proid",-1);
String sql="";
if(Proid==-1){
sql=" SELECT SUM(PRONUMBER)AS PRONUMBER,SHOPID FROM SELL WHERE PTIME BETWEEN '"+Atime+"' AND '" +Btime+"' GROUP BY SHOPID ORDER BY PRONUMBER DESC";
}else{
sql=" SELECT SUM(PRONUMBER)AS PRONUMBER,SHOPID FROM SELL WHERE PTIME BETWEEN '"+Atime+"' AND '" +Btime+"' AND PRODUCTID=" + Proid + " GROUP BY SHOPID ORDER BY PRONUMBER DESC";
}
int i=0;
shop pt=(shop)session.getAttribute("USERPO");
if(pt==null){
response.sendRedirect("login.jsp");
}
%>
<html>
<head>
<title>销售排行</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="style.css" rel="stylesheet">
</head>
<body>
<table width="777" height="172" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><table width="777" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><img src="Images/tiring-room/tiring-room_01.gif" width="777" height="125"></td>
</tr>
<tr>
<td height="47" valign="top" background="Images/tiring-room/tiring-room_02.gif"><jsp:include page="H_navigation.jsp"/></td>
</tr>
</table></td>
</tr>
</table>
<table width="777" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="44" height="380" valign="top"><img src="Images/tiring-room/tiring-room_03.gif" width="44" height="248"></td>
<td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="68" colspan="2" background="Images/tiring-room/h_sort.gif"> </td>
</tr>
<tr>
<td width="4%"> </td>
<td width="96%">
<table width="100%" border="0" cellspacing="-2" cellpadding="-2" height="30">
<tr>
<td width="87%">
<form method="POST" action="emiction.jsp" name="form1">
<table border="0" width="100%">
<tr>
<td width="52%" align="center">售货日期
<select size="1" name="Ayear">
<%for(i=2000;i<2015;i++){
out.print("<option value="+i+">"+i+"</option>");}%>
</select>
年
<select size="1" name="Amonth">
<%String a;
for(i=1;i<13;i++){
if(i<10){a="0"+String.valueOf(i);}else{a=String.valueOf(i);}
out.print("<option value="+a+">"+a+"</option>");
}%>
</select>
月
<select size="1" name="Aday">
<%for(i=1;i<32;i++){
a="";
if(i<10){a="0"+String.valueOf(i);}else{a=String.valueOf(i);}
out.print("<option value="+a+">"+a+"</option>");}%>
</select>
日</td>
<td width="48%">至
<select size="1" name="Byear">
<%for(i=2000;i<2015;i++){out.print("<option value="+i+">"+i+"</option>");}%>
</select>
年
<select size="1" name="Bmonth">
<%
for(i=1;i<13;i++){
a="";
if(i<10){a="0"+String.valueOf(i);}else{a=String.valueOf(i);}
out.print("<option value="+a+">"+a+"</option>");}%>
</select>
月
<select size="1" name="Bday">
<%
for(i=1;i<32;i++){
a="";
if(i<10){a="0"+String.valueOf(i);}else{a=String.valueOf(i);}
out.print("<option value="+a+">"+a+"</option>");}%>
</select>日</td>
</tr>
<tr>
<td width="52%" align="center">请选择商品
<select size="1" name="Proid">
<%out.print("<option value=-1>所有商品</option>");%>
<%
waredb waredb=new waredb();
Collection col=waredb.select(5000,1);
if (col == null || col.isEmpty()) {
out.println("无记录");
} else {
Iterator itl = col.iterator();
while (itl.hasNext()) {
ware b3 = (ware) itl.next();
out.print("<option value="+b3.getId()+">"+b3.getPname()+"</option>");
}}%>
</select>
</td>
<td width="48%"><input name="B1" type="submit" class="btn_grey" value="查询"></td>
</tr>
</table>
</form>
<tr>
<td width="52%" align="center"> <%=Atime.substring(0,4)%>.<%=Atime.substring(4,6)%>.<%=Atime.substring(6,8)%>--<%=Btime.substring(0,4)%>.<%=Btime.substring(4,6)%>.<%=Btime.substring(6,8)%>
<%
if(Proid==-1)
{
out.print("所有商品");
}
else
{
Dbware dbware=new Dbware(Proid);
out.print(dbware.getPname());
}
%>
</td>
</tr>
</table>
<table width="90%" height="74" border="1" cellpadding="0" cellspacing="0"
bordercolor="#FFFFFF" bordercolorlight="#FFFFFF" bordercolordark="#82664F" align="center">
<td width="126" height="20" align="center"> 排名</td>
<td width="122" height="20" align="center"> 销售总量</td>
<td height="20" width="135" align="center"> 连锁店</td>
<%
ResultSet rs=null;
Connection con = null;
PreparedStatement pstmt = null;
try {
con = DbConnectionManager.getConnection();
pstmt = con.prepareStatement(sql);
rs = pstmt.executeQuery();
}
catch (SQLException sqle) {
System.err.println("错误位置: Dbchfph-" + sqle);
sqle.printStackTrace();
}
int j=0;
while(rs.next())
{
j=j+1;
%>
<tr>
<td height="20" align="center" width="126">第<%=j%>名</td>
<td height="20" align="center" width="122"><%=rs.getInt(1)%></td>
<td height="20" align="center" width="135">
<%int userid=rs.getInt(2);
Dbshop dbshop=new Dbshop(userid);
out.print(dbshop.getShopname());%></td>
</tr>
<%}%>
</table>
</td>
</tr>
</table></td>
<td width="35" valign="top"><img src="Images/tiring-room/tiring-room_05.gif" width="35" height="248"></td>
</tr>
</table>
<jsp:include page="copyright.htm"/>
</body>
</html>