cglist.asp

来自「创建和运行动态、交互的Web服务器应用程序」· ASP 代码 · 共 206 行

ASP
206
字号
<!--#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 caigoudan,action,shijian,cgdate,xiaoshoufangshi,gy,gyindex,i,bookid,bookname,bkcount,shichangjia,gyzk,rs2,total1,total2,total3,total4,czy,kfname,totalcount 
    action=request.QueryString("action")

select case action 
       case "list"
'//数据处理
shijian=now()
caigoudan="cg"&request("cgyear")&request("cgmonth")&request("cgday")&hour(shijian)&minute(shijian)&second(shijian)

  if request("cgyear")<>"" and request("cgmonth")<>"" and request("cgday")<>"" then

     if request("cgmonth")=2 and request("cgday")>28 then 
        t_cgday=28
     else
        t_cgday=request("cgday")
     end if

     cgdate=trim(request("cgyear"))&"-"&trim(request("cgmonth"))&"-"&t_cgday
  else
     cgdate=date()
  end if

  gy     = Session("mycg") 
  gyindex= session("cgindex")

 

  for i=1 to gyindex-1

      bookid       = gy(i,0)   
      bookname     = gy(i,1)
      bkcount      = gy(i,2)
      shichangjia  = gy(i,3)
      gyzk         = gy(i,4)
 
set rs2=server.CreateObject("adodb.recordset")
    rs2.open "select * from shop_cgaction",conn,1,3

rs2.addnew
rs2("gyid")     = gy(0,0)
rs2("bookid")   = bookid
rs2("caigoudan")= caigoudan
rs2("cgcount")  = bkcount
rs2("cgmy")     = shichangjia*bkcount
rs2("cgzk")     = gyzk
rs2("cgsy")     = shichangjia*bkcount*gyzk
rs2("cgdate")   = cgdate
rs2("kccount")  = bkcount
rs2("xiaoshoufangshi")=request("xiaoshoufangshi")
rs2("czy")      = request("cgadmin")
rs2("kqhao")    = request("cgkqhao")
rs2("kfname")   = request("cgkfname")
rs2("blnisrk")  = 0
rs2.update

set rs_bk=server.CreateObject("adodb.recordset")
    rs_bk.open "select * from shop_books where bookid="&bookid,conn,1,3
    rs_bk("sumcg")=rs_bk("sumcg")+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="&gy(0,0),conn,1,3
       rs_gy("sumqk")=rs_gy("sumqk")+(shichangjia*bkcount*gyzk)
       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 gyindex 
    for j=0 to 4
    gy(i,j)=""
    next
next

Session("mycg")=gy 
session("cgindex")=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_cgaction.cgcount,shop_cgaction.cgzk,shop_cgaction.cgmy,shop_cgaction.cgsy,shop_cgaction.caigoudan,shop_cgaction.czy,shop_cgaction.kqhao,shop_cgaction.kfname,shop_cgaction.cgdate,shop_cgaction.xiaoshoufangshi,shop_gongyi.gyname,shop_gongyi.lxr,shop_gongyi.gytel,shop_gongyi.dizhi FROM (shop_cgaction INNER JOIN shop_books ON shop_cgaction.bookid = shop_books.bookid) INNER JOIN shop_gongyi ON shop_cgaction.gyid = shop_gongyi.gyid where shop_cgaction.caigoudan='"&caigoudan&"' ",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("caigoudan")%></font></td>
             <td STYLE='PADDING-LEFT: 30px'>  库区号:<font color=#ff3300><%=rs("kqhao")%></font></td>
             <td STYLE='PADDING-LEFT: 30px'>下单日期:<font color=#ff3300><%=rs("cgdate")%></font></td>
             <%caigoudan=rs("caigoudan")%>
          </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>
          </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("cgcount")%></td>
             <td width="8%"  bgcolor="#ffffff" align="center"><%=formatnumber(rs("cgzk"))%></td>
            <%
              total1     = rs("shichangjia")*rs("cgcount")
              czy        = rs("czy")
              kfname     = rs("kfname")
     	      total2     = total1*rs("cgzk")
              totalcount = rs("cgcount")
             %> 
             <td width="12%" bgcolor="#ffffff" align="center"><%=formatnumber(rs("cgsy"),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="showgy.asp">继续采购</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="cglist.asp?action=delcgd&caigoudan=<%=caigoudan%>">删除此单</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="button" name="print_cg" class="bt3" value="打 印" onclick="javascript:window.print()">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
        </tr>
    </table>

   </tr>  
</table>
    
    <%case "delcgd"
           caigoudan=request.QueryString("caigoudan")
           conn.execute "delete from shop_cgaction where caigoudan='"&caigoudan&"' "
           response.Write "<script language=javascript>alert('订单删除成功!');window.location.reload('showgy.asp')</script>"
end select%>

</body>
</html>

⌨️ 快捷键说明

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