⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 spxs.asp

📁 《网上商品交易系统》 开发及测试环境 操作系统:Windows 2000 Server 后台数据库:SQL Server 2000 Web服务器:IIS 5.0  《网上商品交易系统》
💻 ASP
字号:
<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="../../Connections/sell.asp" -->
<!--#include file="../Fun_JS.asp" -->
<%'查询库存商品
set rsspname = Server.CreateObject("ADODB.Recordset")
sql_ID = "SELECT ID, spname FROM dbo.tab_kucun"
rsspname.open sql_ID,conn,1,3
%>
<%'查询销售表中最大的销售单号
set rsautono = Server.CreateObject("ADODB.Recordset")
sql_max = "SELECT MAX(ID) AS MAXID FROM dbo.tab_sell"
rsautono.open sql_max,conn,1,3
%>
<%
rsspname.movefirst
varname = rsspname("ID")
if (Request.Form("selectsp") <> "") then varname = Request.Form("selectsp")
set rs = Server.CreateObject("ADODB.Recordset")
sql_kc = "SELECT *  FROM dbo.tab_kucun  WHERE ID ='"&Replace(varname,"'","''")&_
"' ORDER BY id desc"
rs.open sql_kc,conn,1,3
%>
<%'查询客户信息
set rskhname = Server.CreateObject("ADODB.Recordset")
sql_kh = "SELECT ID, khname FROM dbo.tab_customer"
rskhname.open sql_kh,conn,1,3
%>
<html>
<head>
<title>网上商品交易系统——商品销售!</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<% 
Dim no,cno,mymonth,cmonth,cday
no=trim(rsautono("MAXID"))
if (month(date())<10) then
	cmonth="0"+Cstr(month(date()))
else
	cmonth=Cstr(month(date()))
end if
if (day(date())<10) then
	cday="0"+Cstr(day(date()))
else
	cday=Cstr(day(date()))
end if
select case len(int(Right(no,5)+1))
	case 1
		cno="0000"+Cstr(int(Right(no,5)+1))
	case 2
		cno="000"+Cstr(int(Right(no,5)+1))
	case 3
		cno="00"+Cstr(int(Right(no,5)+1))
	case 4
		cno="0"+Cstr(int(Right(no,5)+1))
	case 5
		cno=Cstr(int(Right(no,5)+1))
	case Else
		cno="00001"
end select
intno="XS"+Cstr(year(date()))+cmonth+cday+cno
session("autonum")=intno
%>
<script language="JavaScript">
function check()
{
  if (form1.sl.value==0)
    { alert("请输入数量!");form1.sl.focus();return;}
     str=form1.sl.value;
     if(isNaN(str))
          {alert("您输入的不是有效值(请输入0-9之间的数)!");form1.sl.focus();return;}
     str=form1.dj.value;
     if(isNaN(str))
          {alert("您输入的不是有效值(请输入0-9之间的数)!");form1.dj.focus();return;}
     str=form1.ss.value;
        if(isNaN(str))
          {alert("您输入的不是有效值(请输入0-9之间的数)!");form1.ss.focus();return;}
if (form1.czy.value=="")
	{alert("您的使用权限已过期,请重新登录!");window.parent.location.href='../login.asp';return;}
if (form1.jsr.value=="")
	{alert("请输入经手人姓名!");form1.jsr.focus();return;}
  if (CheckDate(form1.xsdate.value))
     {alert("请输入标准日期(如:2002/09/27或2002-09-27)");form1.xsdate.focus();return;}
	form1.je.value=form1.dj.value*form1.sl.value;
	form2.hxsph.value=form1.xsph.value;
	form2.hspname.value=form1.spname.value;
	form2.hkhname.value=form1.khname.value;
	form2.hjc.value=form1.jc.value;
	form2.hcd.value=form1.cd.value;
	form2.hgg.value=form1.gg.value;
	form2.hbz.value=form1.bz.value;
	form2.hsl.value=form1.sl.value;
	form2.hdw.value=form1.dw.value;
	form2.hdj.value=form1.dj.value;
	form2.hje.value=form1.je.value;
	form2.hys.value=form1.ys.value;
	form2.hss.value=form1.ss.value;
	form2.hws.value=form1.ws.value;
	form2.hczy.value=form1.czy.value;
	form2.hjsr.value=form1.jsr.value;
	form2.hxsdate.value=form1.xsdate.value;
	form2.hjsfs.value=form1.jsfs.value;
	form2.hid.value=form1.id.value;
if (form1.kcsl.value-form1.sl.value<0)
{if(confirm("库存数量不足,确定要销售吗?")){
	form2.submit();}
}
else
{
form2.submit();}
}
</script>
<Script language="Javascript">
function autoje(){
form1.je.value=form1.dj.value*form1.sl.value;
form1.ys.value=form1.je.value;
form1.ws.value=form1.ys.value-form1.ss.value;
if(form1.ss.value-form1.ys.value>0)
{alert("实收金额不应大于应收金额!");form1.ss.focus();return;}
}
</script>
<link href="../style.css" rel="stylesheet">
</head>
<body bgcolor="#FFFFFF" text="#000000" background="../../images/bg.gif">
<table width="590" border="0" cellspacing="-2" cellpadding="-2" height="27">
  <tr> 
    <td> 
      <h2 style="filter:glow(color=#ccccff,strength=5);height:1pt"align="center"><font size="2" color=#000099> 
        商品销售单</font></h2>
    </td>
  </tr>
</table>
<table width="590" border="0" cellspacing="-2" cellpadding="-2" height="211">
  <tr> 
    <td valign="top"> 
      <form name="form1" method="post" action="">
        <table width="470" align="center">
          <tr> 
            <td> 
              <select name="selectsp" onChange="form1.submit();">
                <option value="myempty" selected>请选择销售的商品名称:</option>
                <%While (NOT rsspname.EOF)%>
                <option value="<%=rsspname("ID")%>" ><%=rsspname("spname")%></option>
                <% rsspname.MoveNext()
				Wend %>
              </select>
              <font color="#00CCFF"> </font></td>
          </tr>
        </table>
        <table align="center" width="470">
          <tr valign="baseline"> 
            <td nowrap align="right" width="73"> 
              <div align="left">销售票号:</div>
            </td>
            <td colspan="3"><font color="#0099FF"><%=session("autonum")%> 
              <input type="hidden" name="xsph" value="<%=session("autonum")%>">
              <input type="hidden" name="id" value="<%=rs("id")%>">
              </font></td>
          </tr>
          <tr valign="baseline"> 
            <td nowrap align="right" width="73"> 
              <div align="left">商品名称:</div>
            </td>
            <td width="161"> <font color="#0099FF"> 
              <input type="hidden" name="spname" value="<%=rs("spname")%>">
              <%=rs("spname")%> </font></td>
            <td width="67">简  称:</td>
            <td width="149"><font color="#0099ff"><%=rs("jc")%></font> 
              <input type="hidden" name="jc" value="<%=rs("jc")%>">
            </td>
          </tr>
          <tr valign="baseline"> 
            <td nowrap align="right" width="73"> 
              <div align="left">产  地:</div>
            </td>
            <td width="161"><font color="#0099ff"><%=rs("cd")%></Font> 
              <input type="hidden" name="cd" value="<%=rs("cd")%>">
              <font color="#0099ff">&nbsp;</Font></td>
            <td width="67">规  格:</td>
            <td width="149"> 
              <input type="hidden" name="gg" value="<%=rs("gg")%>">
              <font color="#0099FF"><%=rs("gg")%></font></td>
          </tr>
          <tr valign="baseline"> 
            <td nowrap align="right" width="73"> 
              <div align="left">进  价:</div>
            </td>
            <td width="161"><font color="#0099FF"> <%=rs("dj")%></font> </td>
            <td width="67">包  装:</td>
            <td width="149"><font color="#0099ff"><%=rs("bz")%></font> 
              <input type="hidden" name="bz" value="<%=rs("bz")%>">
            </td>
          </tr>
          <tr valign="baseline"> 
            <td nowrap align="right" width="73" height="14"> 
              <div align="left">客户全称:</div>
            </td>
            <td colspan="3" height="14"> 
              <select name="khname">
                <%While (NOT rskhname.EOF)%>
                <option value="<%=rskhname("khname")%>" ><%=rskhname("khname")%></option>
                <% rskhname.MoveNext()
				Wend%>
              </select>
              <input type="hidden" name="kcsl" value="<%=rs("kcsl")%>">
            </td>
          </tr>
          <tr valign="baseline"> 
            <td nowrap align="right" width="73"> 
              <div align="left">单  价:</div>
            </td>
            <td width="161"> 
              <input type="text" name="dj" value="<%=rs("dj")%>" size="12" onblur="autoje()">
            </td>
            <td>未  收:</td>
            <td> 
              <input type="text" name="ws" size="12" value="0" disabled="yes">
            </td>
          </tr>
          <tr valign="baseline"> 
            <td nowrap align="right" width="73"> 
              <div align="left">数  量:</div>
            </td>
            <td width="161"> 
              <input type="text" name="sl" value="0" size="12" onblur="autoje()">
              <font color="#00CCFF"></font><font color="#0099ff">( <%=rs("dw")%>) </font><font color="#00CCFF"></font><font color="#00CCFF">*</font> 
              <input type="hidden" name="dw" value="<%=rs("dw")%>">
            </td>
            <td width="67">金  额: </td>
            <td width="149"> 
              <input type="text" name="je" value="0" size="12" disabled="yes">
            </td>
          </tr>
          <tr valign="baseline"> 
            <td nowrap align="right" width="73"> 
              <div align="left">应  收:</div>
            </td>
            <td width="161"> 
              <input type="text" name="ys" size="12" value="0" disabled=".t.">
            </td>
            <td width="67">实  收:</td>
            <td width="149"> 
              <input type="text" name="ss" size="12" value="0" onblur="autoje()">
              <font color="#00CCFF">*</font> </td>
          </tr>
          <tr valign="baseline"> 
            <td nowrap align="right" width="73"> 
              <div align="left">操作员:</div>
            </td>
            <td width="161"> 
              <input type="text" name="czy" value="<%=session("UserID")%>" size="12" readonly="yes">
              <font color="#00CCFF">*</font> </td>
            <td width="67">经手人:</td>
            <td width="149"> 
              <input type="text" name="jsr" size="12">
              <font color="#00CCFF">*</font> </td>
          </tr>
          <tr valign="baseline"> 
            <td nowrap align="right" width="73"> 
              <div align="left">销售日期:</div>
            </td>
            <td width="161"> 
              <input type="text" name="xsdate" value="<%=date()%>" size="12">
              <font color="#00CCFF">*</font> </td>
            <td width="67">结算方式:</td>
            <td width="149"> 
              <select name="jsfs">
                <option value="现金" selected>现金 </option>
                <option value="支票">支票 </option>
                <option value="挂帐">挂帐 </option>
                <option value="预付">预付 </option>
              </select>
              <font color="#00CCFF">*</font> </td>
          </tr>
          <tr valign="baseline"> 
            <td nowrap align="right" colspan="4"> 
              <div align="left"><font color="#00CCFF">注:带*号项为必填项。</font></div>
            </td>
          </tr>
        </table>
      </form>
      <table width="590" border="0" cellspacing="-2" cellpadding="-2">
        <tr> 
          <td> 
            <form name="form2" method="post" action="./xsaddok.asp">
              <div align="center"> 
                <input type="hidden" name="hxsph">
                <input type="hidden" name="hspname">
                <input type="hidden" name="hjc">
                <input type="hidden" name="hcd">
                <input type="hidden" name="hgg">
                <input type="hidden" name="hbz">
                <input type="hidden" name="hsl">
                <input type="hidden" name="hdw">
                <input type="hidden" name="hdj">
                <input type="hidden" name="hje">
                <input type="hidden" name="hczy">
                <input type="hidden" name="hjsr">
                <input type="hidden" name="hxsdate">
                <input type="hidden" name="hjsfs">
                <input type="hidden" name="hws">
                <input type="hidden" name="hys">
                <input type="hidden" name="hss">
                <input type="hidden" name="hkhname">
                <input type="button" name="Button" value="保存" onclick="check()">
                <input type="button" name="Button" value="重填" onclick="form1.reset();">
                <input type="hidden" name="hid">
              </div>
            </form>
          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -