📄 customerbill.jsp
字号:
<%@ page contentType="text/html;charset=gb2312"%>
<%@page import="java.util.*"%>
<%@page import="java.io.*"%>
<%@page import="java.sql.*,java.lang.Double.*"%>
<%@include file="comm.jsp"%>
<html>
<SCRIPT language=javascript>
<!--
function datacheck()
{
if(frmInsert.Amount.value==""||isNaN(frmInsert.Amount.value))
{
window.alert("请输入汇款金额,且为数字");
document.frmUpdate.elements(3).focus();
return;
}
frmInsert.submit();
}
-->
</SCRIPT>
<body>
<div>
<table>
<tr>
<td width="236" align=center valign=top> <br>
<p ><a href=CustomerInfo.jsp?action=view>我的资料 </a></p>
<p>商品信息
<br> <a href="GoodsList.jsp?type=1">可用商品</a>
</p>
<p>我的购物车
<br> <a href="CartInfo.jsp?action=view&type=1">未提交订单</a>
<br> <a href="CartInfo.jsp?action=view&type=2">已提交订单</a>
<br> <a href="CartInfo.jsp?action=view&type=3">已发货订单</a>
</p>
<p>帐单管理
<br> <a href="CustomerBill.jsp?action=view&type=1">已汇款帐单</a>
<br> <a href="CustomerBill.jsp?action=view&type=2">已确认帐单</a>
</p>
</td>
<%
String CustomerID=(String)session.getValue("user");
action=request.getParameter("action");
String Type=request.getParameter("type");
int iType=Integer.parseInt(Type);
if(CustomerID==null)
{
%>
<jsp:forward page="CustomerLogin.htm"/>
<%
}
if(action.equals("insert"))
{
String Amount=request.getParameter("Amount");
String Descr=request.getParameter("Descr");
strSql="{call dbo.sp_InsertBill(?,?,?)}";
cstmt=conn.prepareCall(strSql);
cstmt.setString(1,CustomerID);
cstmt.setDouble(2,Double.parseDouble(Amount));
cstmt.setString(3,Descr);
cstmt.executeUpdate();
}
if(action.equals("del"))
{
String BillID=request.getParameter("BillID");
strSql="{call dbo.sp_DelBill(?)}";
cstmt=conn.prepareCall(strSql);
cstmt.setInt(1,Integer.parseInt(BillID));
cstmt.executeUpdate();
}
%>
<td align=center valign=top>
<p align=center>欢迎您:<%=CustomerID%></p>
<form method="POST" action="CustomerBill.jsp?action=insert&type=1" name="frmInsert">
<table width="580" >
<tr bgcolor="#E9E9D1">
<td align=center width="89"> </td>
<td align=center width="387">添加帐单</td>
</tr>
<tr>
<td width="89">汇款金额: </td>
<td width="287"><input type="text" name="Amount" size="10" > * </td>
</tr>
<tr bgcolor="#E9E9D1">
<td width="89">描 述: </td>
<td width="287"><input type="text" name="Descr" size="50" value=" "> </td>
</tr>
</table>
<table >
<p><button type="none" class="button" onclick="datacheck()">提交</button>
<input type="reset" value="全部重写" name="B2"></p>
</table>
</from>
<%
if(iType==1)
{
%>
<p align=left>已汇款帐单
<%
}
else if(iType==2)
{%>
<p align=left>已确认帐单
<%}
%>
<table>
<tr bgcolor=#E9E9D1>
<td width=70>帐单ID</td>
<td width=100>客户ID</td>
<td width=150>金额</td>
<td width=170>操作时间</td>
<td width=70></td>
</tr>
<%
//根据类型值获取订单信息
strSql="{call dbo.sp_GetBill(?,?)}";
cstmt=conn.prepareCall(strSql);
cstmt.setString(1,CustomerID);
cstmt.setInt(2,iType);
rs=cstmt.executeQuery();
while(rs.next())
{
%>
<tr bgcolor="#EAFfFff">
<td><%=rs.getInt(1)%></td>
<td><%=rs.getString(2)%></td>
<td><%=rs.getDouble(3)%></td>
<td><%=rs.getDate(4)%></td>
<%if(iType==1){%>
<td><a href="CustomerBill.jsp?action=del&BillID=<%=rs.getInt(1)%>&type=1">删除</a></td>
<%}%>
</tr>
<%}%>
</table>
</td>
<%
rs.close();
cstmt.close();
conn.close();
%>
</tr>
</table>
</div>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -