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

📄 tslist.asp

📁 创建和运行动态、交互的Web服务器应用程序
💻 ASP
字号:
<!--#include file="conn.asp"-->
<html>
<head>
<title><%=webname%>--图书退书单</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="../images/css2.css" rel="stylesheet" type="text/css">
</head>
<body>
<%
dim tishudan,action,shijian,tsdate,ts,tsindex,i,bookid,bookname,bkcount,shichangjia,tszk,rs2,total1,total2,total3,total4,czy,kfname,totalcount,t_tcount,t_gtcount 

'//数据处理
shijian=now()
tishudan="ts"&request("tsyear")&request("tsmonth")&request("tsday")&hour(shijian)&minute(shijian)&second(shijian)

  if request("tsyear")<>"" and request("tsmonth")<>"" and request("tsday")<>"" then
     tsdate=trim(request("tsyear"))&"-"&trim(request("tsmonth"))&"-"&trim(request("tsday"))
  else
     tsdate=date()
  end if

  ts     = Session("myts") 
  tsindex= session("tsindex")

  for i=1 to tsindex-1

      bookid   = ts(i,0)   
      bookname = ts(i,1)
      bkcount  = ts(i,2)
      shichangjia  = ts(i,3)
      tszk         = ts(i,4)

set rs2=server.CreateObject("adodb.recordset")
    rs2.open "select * from shop_tsaction",conn,1,3

rs2.addnew
rs2("gyid")      = ts(0,0)
rs2("bookid")    = bookid
rs2("tishudan")  = tishudan
rs2("tscount")   = bkcount
rs2("tsmy")      = shichangjia*bkcount
rs2("tszk")      = tszk
rs2("tssy")      = shichangjia*bkcount*tszk
rs2("tsdate")    = tsdate
rs2("xiaoshoufangshi")=request("xiaoshoufangshi")
rs2("czy")      = request("tsadmin")
rs2("kqhao")    = request("tskqhao")
rs2("kfname")   = request("tskfname")
rs2("blnisrk")  = 0
rs2.update

'//按笔冲减采数 
set rs_cg=server.CreateObject("adodb.recordset")
    rs_cg.open "select * from shop_cgaction where gyid=" &ts(0,0)& "and bookid=" &bookid& " and kccount>0 ",conn,1,3

    '//获取退书数
    t_tcount=cint(bkcount)
 
    do while not rs_cg.eof

       '//退书数大于单笔库存数
       if t_tcount>rs_cg("kccount") then

          '//单笔退书数等于库存数
          rs_cg("tscount")=rs_cg("tscount")+rs_cg("kccount")
          t_gtcount=rs_cg("kccount")
          rs_cg("kccount")=rs_cg("cgcount")-rs_cg("xscount")-rs_cg("tscount")

       '//退书数小于单笔数
       else

          '//单笔退书数等于退书数
          rs_cg("tscount")=rs_cg("tscount")+t_tcount
          t_gtcount=t_tcount
          rs_cg("kccount")=rs_cg("cgcount")-rs_cg("xscount")-rs_cg("tscount")

       end if

       '//分解退书数
       t_tcount=t_tcount-t_gtcount

       if t_tcount<0 then t_tcount=0
       if t_tcount=0 then exit do

    rs_cg.movenext
    loop

    rs_cg.update  
   
'//更新图书品种的数据
set rs_bk=server.CreateObject("adodb.recordset")
    rs_bk.open "select * from shop_books where bookid="&bookid,conn,1,3

    rs_bk("sumts")=rs_bk("sumts")+bkcount
    rs_bk("sumkc")=rs_bk("sumcg")-rs_bk("sumxs")-rs_bk("sumts")
    rs_bk.update

'//如果是代销,更新供应商的数据
if request("xiaoshoufangshi")=2 then

   set rs_gy=server.CreateObject("adodb.recordset")
       rs_gy.open "select * from shop_gongyi where gyid="&ts(0,0),conn,1,3
       rs_gy("sumtsk")=rs_gy("sumtsk")+(shichangjia*bkcount*tszk)
       rs_gy("sumsq")=rs_gy("sumqk")-rs_gy("sumhk")-rs_gy("sumtsk")
       rs_gy.update

end if

conn.execute "delete from shop_cgaction where bookid=0"
conn.execute "delete from shop_cgaction where cgsy=0" 
 
next

for i=0 to tsindex 
    for j=0 to 4
    ts(i,j)=""
    next
next

Session("myts")=ts 
session("tsindex")=0

set rs2=nothing
set rs_bk=nothing

'//显示退书单
set rs=server.CreateObject("adodb.recordset")
    rs.open "select shop_books.bookid,shop_books.bookname,shop_books.isbn,shop_books.shichangjia,shop_tsaction.tscount,shop_tsaction.tszk,shop_tsaction.tsmy,shop_tsaction.tssy,shop_tsaction.tishudan,shop_tsaction.czy,shop_tsaction.kqhao,shop_tsaction.kfname,shop_tsaction.tsdate,shop_gongyi.gyname,shop_gongyi.lxr,shop_gongyi.gytel,shop_gongyi.dizhi,shop_gongyi.xiaoshoufangshi FROM (shop_tsaction INNER JOIN shop_books ON shop_tsaction.bookid = shop_books.bookid) INNER JOIN shop_gongyi ON shop_tsaction.gyid = shop_gongyi.gyid where shop_tsaction.tishudan='"&tishudan&"' ",conn,1,1
%>

<table width="90%" height="450" border="0"  cellpadding="0" cellspacing="0">
   <tr><td><br>
       <table width="98%" border="0" align="center" cellpadding="0" cellspacing="2">
          <tr><td height=10></td></tr> 
          <tr>
             <td align="center" colspan="3"><font color=blue size=3><b><%=webname%>图书退书单</b></font></td>
          </tr>
          <tr><td colspan=3 align="center"><hr noshade color=#cccccc size=1></td></tr>
          <tr> 
             <td STYLE='PADDING-LEFT: 30px'>退书单号:<font color=#ff3300><%=rs("tishudan")%></font></td>
             <td STYLE='PADDING-LEFT: 30px'>  库区号:<font color=#ff3300><%=rs("kqhao")%></font></td>
             <td STYLE='PADDING-LEFT: 30px'>退书日期:<font color=#ff3300><%=rs("tsdate")%></font></td>
             <%tishudan=rs("tishudan")%>
          </tr>
          <tr> 
             <td STYLE='PADDING-LEFT: 30px'>供应商名:<font color=#ff3300><%=rs("gyname")%></font></td>
             <td STYLE='PADDING-LEFT: 30px'>  联系人:<font color=#ff3300><%=rs("lxr")%></font></td>
             <td STYLE='PADDING-LEFT: 30px'>电话号码:<font color=#ff3300><%=rs("gytel")%></font></td>
          </tr>
          <tr>
             <td STYLE='PADDING-LEFT: 30px' colspan="2">详细地址:<font color=#ff3300><%=rs("dizhi")%></font></td>
             <td STYLE='PADDING-LEFT: 30px'>销售方式:<font color=#ff3300>
             <%if rs("xiaoshoufangshi")=1 then
                  response.write"经销"
               else
                  response.write"代销"
               end if%></font></td></font></td>
          </tr>
          <tr><td height=10></td></tr> 
          </tr> 
       </table>

       <table width="98%" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#cccccc">
          <tr>
             <td width="25%" bgcolor="#ece9d8" align="center">书号</td>
             <td width="37%" bgcolor="#ece9d8" align="center">书名</td>
             <td width="8%"  bgcolor="#ece9d8" align="center">定价</td>
             <td width="10%" bgcolor="#ece9d8" align="center">数量</td>
             <td width="8%"  bgcolor="#ece9d8" align="center">折扣</td>
             <td width="12%" bgcolor="#ece9d8" align="center">实洋</td>
          </tr>
          <%do while not rs.eof%> 
          <tr>
             <td width="25%" bgcolor="#ffffff" align="center"><%=rs("isbn")%></td>
             <td width="37%" bgcolor="#ffffff" align="center"><%=rs("bookname")%></td>
             <td width="8%"  bgcolor="#ffffff" align="center"><%=formatnumber(rs("shichangjia"))%></td>
             <td width="10%" bgcolor="#ffffff" align="center"><%=rs("tscount")%></td>
             <td width="8%"  bgcolor="#ffffff" align="center"><%=formatnumber(rs("tszk"))%></td>
            <%
              total1     = rs("shichangjia")*rs("tscount")
              czy        = rs("czy")
              kfname     = rs("kfname")
     	      total2     = total1*rs("tszk")
              totalcount = rs("tscount")
             %> 
             <td width="12%" bgcolor="#ffffff" align="center"><%=formatnumber(rs("tssy"),2)%></td>
         </tr> 
            <%total0=total0+total1
              total3=total3+total2
              total4=total4+totalcount
          rs.movenext
             loop
          rs.close%>
          <tr> 
             <td bgcolor="#ffffff" STYLE='PADDING-LEFT: 100px' colspan="9" height=40>   总数量&nbsp;<font color="#FF0000"><%=total4%>                </font>&nbsp;册&nbsp;&nbsp;&nbsp;&nbsp; 
                                                                                      总计码洋&nbsp;<font color="#FF0000"><%=formatnumber(total0,2)%></font>&nbsp;元&nbsp;&nbsp;&nbsp;&nbsp;
                                                                                      总计实洋&nbsp;<font color="#FF0000"><%=formatnumber(total3,2)%></font>&nbsp;元</td>
          </tr>
      </table>

      <table width="98%" border="0" align="center" cellpadding="0" cellspacing="2">
         <tr><td height=10></td></tr> 
         <tr>
            <td align="right">操作人员:&nbsp;</td>
            <td width="15%"><font color="#FF0000"><%=czy%></font></td>
            <td align="right">采购经理:</td>
            <td width="15%"></td>
            <td align="right">库房管理员:</td>
            <td width="15%"></td>
         </tr>
         <tr>
            <td align="right">库房地址:&nbsp;</td>
            <td colspan=4><font color="#FF0000"><%=kfname%></font></td>
         </tr>
         <tr>
            <td colspan=6 align="center"><hr noshade color=#cccccc size=1></td>
        </tr>
        <tr>
           <td  colspan=6 align="right"><a href="showts.asp">继续退书</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="button" name="print_ts" class="bt3" value="打 印" onclick="javascript:window.print()">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
        </tr>
   </body>
</html>

⌨️ 快捷键说明

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