store.asp
上传用户:apresys
上传日期:2021-03-30
资源大小:813k
文件大小:19k
源码类别:

WEB源码(ASP,PHP,...)

开发平台:

DOS

  1. <!--#include file="conn.asp"-->
  2. <!--#include file="checkuser.asp"-->
  3. <html>
  4. <head>
  5. <title>∷汽车4S店配件仓储管理系统:.</title>
  6. <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
  7. <link href="css/main.css" rel="stylesheet" type="text/css">
  8. <SCRIPT language=JavaScript src="css/User_Info_Modify.js"></SCRIPT>
  9. <style type="text/css">
  10. <!--
  11. td {  font-family: "宋体"; font-size: 9pt}
  12. body {  font-family: "宋体"; font-size: 9pt}
  13. select {  font-family: "宋体"; font-size: 9pt}
  14. A {text-decoration: none; color: #336699; font-family: "宋体"; font-size: 9pt}
  15. A:hover {text-decoration: underline; color: #FF0000; font-family: "宋体"; font-size: 9pt} 
  16. -->
  17. </style>
  18. <SCRIPT LANGUAGE=javascript>
  19. <!--
  20. function Juge(powersearch)
  21. {
  22. if (powersearch.pinming.value == "")
  23. {
  24. alert("名称不能为空!");
  25. powersearch.pinming.focus();
  26. return (false);
  27. }
  28. }
  29. function SelectAll() {
  30. for (var i=0;i<document.selform.selBigClass.length;i++) {
  31. var e=document.selform.selBigClass[i];
  32. e.checked=!e.checked;
  33. }
  34. }
  35. //-->
  36. </script>
  37. <script>
  38.   var po_ca_show = new Array();
  39.   var po_ca_value = new Array();
  40.   var po_detail_show = new Array();
  41.   var po_detail_value = new Array();
  42.   var funtype1;
  43. //Modified by Ryan Gao 2006-03-30 16:01:09
  44. <%
  45. i=0
  46. set rs1=server.createobject("adodb.recordset")
  47. rs1.open "select * from class",conn,1,1
  48. if not rs1.eof then   
  49. do while not rs1.eof
  50. j=0
  51. %>
  52. po_ca_show[<%=i%>] = '<%=rs1("classnumber")%>';
  53. po_ca_value[<%=i%>] = '<%=rs1("classnumber")%>';
  54. po_detail_show[<%=i%>] = new Array();
  55. po_detail_value[<%=i%>] = new Array();
  56. <%
  57. classnumber=rs1("classnumber")
  58. set rs2=server.createobject("adodb.recordset")
  59. rs2.open "select * from Material where class='"&classnumber&"' order by pinming",conn,1,1
  60. if not rs2.eof then   
  61. do while not rs2.eof
  62. %>
  63. po_detail_show[<%=i%>][<%=j%>] = '<%=rs2("pinming")%>-<%=rs2("guige")%>';
  64. po_detail_value[<%=i%>][<%=j%>] = '<%=rs2("pinming")%>';
  65. <%
  66. rs2.movenext
  67. j=j+1
  68. loop
  69. else
  70. %>
  71. po_detail_show[<%=i%>][<%=j%>] = '此类暂无配件';
  72. po_detail_value[<%=i%>][<%=j%>] = '';
  73. <%
  74. end if
  75. rs2.close
  76. set rs2=nothing
  77. %>
  78. <%
  79. rs1.movenext
  80. i=i+1
  81. loop
  82. end if
  83. rs1.close
  84. set rs1=nothing
  85. %>
  86. </script>
  87. <script Language="JavaScript">
  88. var psid="";
  89. function DoLoad(form,funtypev){
  90.         var n;
  91.         var i,j,k;
  92.         var num;
  93.         num= GetObjID('funtype[]');
  94.         num1= GetObjID('pinming');
  95.         if (!funtypev)
  96.            return;
  97.         k=0;
  98.         for (i=0;i<po_ca_show.length;i++) {
  99.          for(j = 0; j < po_detail_value[i].length; j++){
  100.                 if(funtypev.indexOf(po_detail_value[i][j])!=-1) {
  101.                     NewOptionName = new Option(po_detail_show[i][j], po_detail_value[i][j]);
  102.                     form.elements[num].options[k] = NewOptionName;
  103.                     k++;
  104.                     }
  105.          }
  106.         }
  107. }
  108. function Do_po_Change(form){
  109.         var num,n, i, m;
  110.         num= GetObjID('d_position1');
  111.         m = document.powersearch.elements[num].selectedIndex-1;
  112.         n = document.powersearch.elements[num + 1].length;
  113.         for(i = n - 1; i >= 0; i--)
  114.                 document.powersearch.elements[num + 1].options[i] = null;
  115.         if (m>=0) {
  116.         for(i = 0; i < po_detail_show[m].length; i++){
  117.                 NewOptionName = new Option(po_detail_show[m][i], po_detail_value[m][i]);
  118.                 document.powersearch.elements[num + 1].options[i] = NewOptionName;
  119.         }
  120.         document.powersearch.elements[num + 1].options[0].selected = true;
  121.         }
  122. }
  123. function InsertItem(ObjID, Location)
  124. {
  125. len=document.powersearch.elements[ObjID].length;
  126. for (counter=len; counter>Location; counter--)
  127. {
  128. Value = document.powersearch.elements[ObjID].options[counter-1].value;
  129. Text2Insert  = document.powersearch.elements[ObjID].options[counter-1].text;
  130. document.powersearch.elements[ObjID].options[counter] = new Option(trimPrefixIndent(Text2Insert), Value);
  131. }
  132. }
  133. function GetLocation(ObjID, Value)
  134. {
  135.   total=document.powersearch.elements[ObjID].length;
  136.   for (pp=0; pp<total; pp++)
  137.      if (document.powersearch.elements[ObjID].options[pp].text == "---"+Value+"---")
  138.      { return (pp);
  139.        break;
  140.      }
  141.   return (-1);
  142. }
  143. function GetObjID(ObjName)
  144. {
  145.   for (var ObjID=0; ObjID < window.powersearch.elements.length; ObjID++)
  146.     if ( window.powersearch.elements[ObjID].name == ObjName )
  147.     {  return(ObjID);
  148.        break;
  149.     }
  150.   return(-1);
  151. }
  152. </script>
  153. </HEAD>
  154. <BODY topMargin=0 rightMargin=0 leftMargin=0>       
  155. <!--#include file="top.asp"-->
  156. <%
  157.   select case request("action")
  158.   case "add"
  159.        call SaveAdd()
  160.   case "modify"
  161.        call SaveModify()
  162.   case "del"
  163.        call delCate()
  164.   case "edit"
  165.        isEdit=True
  166.        call myform(isEdit)
  167.   case else
  168.        isEdit=False
  169.        call myform(isEdit) 
  170.   end select
  171.   
  172. sub SaveAdd   
  173. set rs=server.createobject("adodb.recordset") 
  174. sql="select * from store"
  175. rs.open sql,conn,1,3
  176. rs.addnew
  177. rs("class") = trim(request.Form("d_position1"))
  178. rs("guige") = trim(request.Form("guige"))
  179. rs("pinming") = trim(request.Form("pinming"))
  180. rs("Unit") = trim(request.Form("Unit"))
  181. rs("price") = request.Form("price")
  182. rs("number") = request.Form("number")
  183. rs.update
  184. response.Write "<script language=javascript>alert('添加成功!');</script>"
  185. response.write "<meta http-equiv=""refresh"" content=""0;url=store.asp"">"
  186. response.end
  187. rs.close
  188. set rs=nothing
  189. end sub
  190.  
  191. sub SaveModify   
  192. set rs=server.createobject("adodb.recordset") 
  193. sql="select * from store where id="&request.Form("id")
  194. rs.open sql,conn,1,3
  195. rs("class") = trim(request.Form("d_position1"))
  196. rs("guige") = trim(request.Form("guige"))
  197. rs("pinming") = trim(request.Form("pinming"))
  198. rs("Unit") = trim(request.Form("Unit"))
  199. rs("price") = request.Form("price")
  200. rs("number") = request.Form("number")
  201. rs.update
  202. response.Write "<script language=javascript>alert('修改成功!');</script>"
  203. response.write "<meta http-equiv=""refresh"" content=""0;url=store.asp"">"
  204. response.end
  205. rs.close
  206. set rs=nothing
  207. end sub   
  208.  
  209.   sub delCate()
  210.         conn.execute("delete from store where id in ("&Request.Form("selBigClass")&")")
  211. response.Write "<script language=javascript>alert('删除成功!');</script>"
  212. response.write "<meta http-equiv=""refresh"" content=""0;url=store.asp"">"
  213. response.end
  214.   end sub
  215.   %> <% sub myform(isEdit) %>    
  216. <TABLE width=98% align=center border="1" cellspacing="0" bordercolor="#D6D3CE">
  217.   <TBODY> 
  218.   <TR> 
  219.     <td align="center" valign="top"> <%if oskey="supper" or oskey="admin" then%>
  220. <fieldset style="width:98%"><legend>
  221. <%
  222.     
  223.    if isedit then
  224.    set rs=server.createobject("adodb.recordset")
  225.    rs.open "select * from store where id=" & request("id"),conn,1,1
  226.        response.write "编辑库存信息"
  227.    else
  228.        response.write "添加库存信息"
  229.    end if %></legend>
  230.         <table width="100%" border="0" cellpadding="0" cellspacing="0" bordercolor="#D4D0C8">
  231.           <tr class="but"> 
  232.             <td width="20%" height="18" align="center" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'">类 别</td>
  233. <td width="25%" height="18" align="center" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'">配件名称</td>
  234. <td width="15%" height="18" align="center" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'">车 型</td>
  235. <td width="10%" height="18" align="center" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'">单 位</td>
  236. <td width="10%" height="18" align="center" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'">单 价</td>
  237. <td width="20%" height="18" align="center"  class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'"> 库存数量</td>
  238.           </tr>
  239.   <form name="powersearch" method="post" action="store.asp" onSubmit="return Juge(this)" >
  240.   <tr> <input type="Hidden" name="action" value='<% If isedit then%>modify<% Else %>add<% End If %>'> 
  241.   <% If isedit then%><input type="Hidden" name="id" value="<%=rs("id")%>"> <% End If %>
  242.             <td height="18" align="center">
  243. <select name='d_position1' onchange='Do_po_Change(this);' valign=top style='width:90'>
  244. <% if isedit then%>
  245. <option selected="selected"><%=rs("class")%></option>
  246. <%else%>
  247. <option selected value='0000'>请选择类别</option>
  248. <%end if%>
  249. <%
  250. set rs1=server.createobject("adodb.recordset")
  251.    rs1.open "select * from class",conn,1,1
  252.    if not rs1.eof then
  253.    do while not rs1.eof
  254. %>
  255. <option value="<%=rs1("classnumber")%>"><%=rs1("classnumber")%></option>
  256. <%
  257. rs1.movenext
  258. loop
  259. end if
  260. rs1.close
  261. set rs1=nothing
  262. %></select></td>
  263.             <td align="center">
  264. <select name='pinming' size=1 style='width:150'>
  265. <% if isedit then%>
  266. <option selected="selected" value="<%=rs("pinming")%>"><%=rs("pinming")%></option>
  267. <%else%>
  268. <option>--请选择--</option>
  269. <%end if%>
  270. </select></td>
  271. <td align="center"><input name="guige" type="text"  size="20" value='<% if isedit then
  272.                                                          response.write rs("guige")
  273.   end if %>'></td>
  274. <td align="center">
  275. <select name="Unit" size="1">
  276. <option <% if isedit then
  277. if rs("Unit")="个" then
  278. %> selected="selected"<%end if%><%end if%>>个</option>
  279. <option <% if isedit then
  280. if rs("Unit")="台" then
  281. %> selected="selected"<%end if%><%end if%>>台</option>
  282. <option <% if isedit then
  283. if rs("Unit")="套" then
  284. %> selected="selected"<%end if%><%end if%>>套</option>
  285. <option <% if isedit then
  286. if rs("Unit")="把" then
  287. %> selected="selected"<%end if%><%end if%>>把</option>
  288. <option <% if isedit then
  289. if rs("Unit")="件" then
  290. %> selected="selected"<%end if%><%end if%>>件</option>
  291. <option <% if isedit then
  292. if rs("Unit")="瓶" then
  293. %> selected="selected"<%end if%><%end if%>>瓶</option>
  294. <option <% if isedit then
  295. if rs("Unit")="桶" then
  296. %> selected="selected"<%end if%><%end if%>>桶</option>
  297. <option <% if isedit then
  298. if rs("Unit")="盒" then
  299. %> selected="selected"<%end if%><%end if%>>盒</option>
  300. <option <% if isedit then
  301. if rs("Unit")="张" then
  302. %> selected="selected"<%end if%><%end if%>>张</option>
  303. </select>
  304. </td>
  305. <td align="center"><input name="price" type="text"  size="10" value='<% if isedit then
  306.                                                          response.write rs("price")
  307.   end if %>'></td>
  308. <td align="center"><input name="number" type="text"  size="10" value='<% if isedit then
  309.                                                          response.write rs("number")
  310.   end if %>'></td>
  311.           </tr>
  312.    <tr>
  313. <td colspan="8" align="center"><input type="submit" value="<% if isedit then
  314.                                                          response.write "编辑"
  315.  else
  316.  response.write "添加"
  317.   end if %>"> </td>
  318.           </tr></form>
  319.   
  320.            </table>
  321.         </fieldset><%end if%>
  322.       <TABLE cellSpacing=1 cellPadding=0 width="100%" border=0 >
  323.         <TR>
  324.           <TD height="25" align="center">库 存 配 件 列 表</TD>
  325.               </TR>
  326.             </TABLE>
  327. <form action="store.asp" method="post" name="selform" >
  328.   <table width="100%"  border="1" cellpadding="0" cellspacing="0" bordercolor="#D4D0C8" align="center">
  329.     <tr> 
  330.       
  331.       <td width="100%" align="center" valign="top">
  332.   <fieldset style="width:95%">
  333.         <table width="100%" border="0" cellpadding="0" cellspacing="0" bordercolor="#D4D0C8">
  334.           <tr class="but"> 
  335. <td width="20%" height="18" align="center" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'">类 别</td>
  336. <td width="25%" height="18" align="center" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'">配件名称</td>
  337. <td width="15%" height="18" align="center" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'">车 型</td>
  338. <td width="10%" height="18" align="center" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'">单 位</td>
  339. <td width="10%" height="18" align="center" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'">单 价</td>
  340. <td width="15%" height="18" align="center"  class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'"> 库存数量</td>
  341.             <td width="5%" height="18" align="center" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'">操 作</td>
  342.           </tr>
  343.  <%
  344. PageShowSize = 10            '每页显示多少个页
  345. MyPageSize   = 20          '每页显示多少条
  346. If Not IsNumeric(Request("page")) Or IsEmpty(Request("page")) Or Request("page") <=0 Then
  347. MyPage=1
  348. Else
  349. MyPage=Int(Abs(Request("page")))
  350. End if
  351. set rs=server.CreateObject("ADODB.RecordSet")
  352. search=request("search")
  353. if search<>"" then 
  354. class1=request("class")
  355. keyword=request("keyword")
  356. rs.Source="select* from Store where class like '%"&class1&"%' and pinming like '%"&keyword&"%' order by -id"
  357. else
  358. rs.Source="select* from Store order by -id"
  359. end if
  360. rs.Open rs.Source,conn,1,1
  361. if not rs.EOF then
  362. rs.PageSize     = MyPageSize
  363. MaxPages         = rs.PageCount
  364. rs.absolutepage = MyPage
  365. total            = rs.RecordCount
  366. for i=1 to rs.PageSize
  367. if not rs.EOF then
  368. %>
  369. <tr >
  370. <td height="18" align="center" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'"><%=rs("class")%><%if rs("class")="" then%>&nbsp;<%end if%></td>
  371. <td height="18"  class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'">&nbsp;<a href="Store.Asp?id=<%=rs("ID")%>&action=edit"><%=rs("pinming")%></a></td>
  372. <td height="18" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'">&nbsp;<%=rs("guige")%></td>
  373. <td height="18" align="center" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'"><%=rs("Unit")%><%if rs("Unit")="" then%>&nbsp;<%end if%></td>
  374. <td height="18" align="center" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'"><%=rs("price")%><%if rs("price")="" then%>&nbsp;<%end if%></td>
  375. <td height="18" align="center" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'"><%=rs("number")%><%if rs("number")<cdbl(baojing_num(rs("Material_id"))) then%><font color="#FF0000">!</font><%end if%> </td>
  376. <td height="18" align="center" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'"><input name="selBigClass" type="checkbox" id="selBigClass" value="<%=rs("ID")%>"></td>
  377. </tr>
  378. <%
  379. rs.MoveNext
  380. end if
  381. next
  382. end if
  383. %>
  384. <tr><td align="right" colspan="10" height="22">
  385. 共 <%=total%> 条,当前第 <%=Mypage%>/<%=Maxpages%> 
  386.             页,每页 <%=MyPageSize%> 条 
  387.             <%
  388. if search<>"" then
  389. url="Store.asp?class="&class1&"&keyword="&keyword&"&search=search&"
  390. else
  391.             url="Store.asp?"
  392. end if
  393. PageNextSize=int((MyPage-1)/PageShowSize)+1
  394. Pagetpage=int((total-1)/rs.PageSize)+1
  395. if PageNextSize >1 then
  396. PagePrev=PageShowSize*(PageNextSize-1)
  397. Response.write "<a class=black href='" & Url & "page=" & PagePrev & "' title='上" & PageShowSize & "页'>上一翻页</a> "
  398. Response.write "<a class=black href='" & Url & "page=1' title='第1页'>页首</a> "
  399. end if
  400. if MyPage-1 > 0 then
  401. Prev_Page = MyPage - 1
  402. Response.write "<a class=black href='" & Url & "page=" & Prev_Page & "' title='第" & Prev_Page & "页'>上一页</a> "
  403. end if
  404. if Maxpages>=PageNextSize*PageShowSize then
  405. PageSizeShow = PageShowSize
  406. Else
  407. PageSizeShow = Maxpages-PageShowSize*(PageNextSize-1)
  408. End if
  409. If PageSizeShow < 1 Then PageSizeShow = 1
  410. for PageCounterSize=1 to PageSizeShow
  411. PageLink = (PageCounterSize+PageNextSize*PageShowSize)-PageShowSize
  412. if PageLink <> MyPage Then
  413. Response.write "<a class=black href='" & Url & "page=" & PageLink & "'>[" & PageLink & "]</a> "
  414. else
  415. Response.Write "<B>["& PageLink &"]</B> "
  416. end if
  417. If PageLink = MaxPages Then Exit for
  418. Next
  419. if Mypage+1 <=Pagetpage  then
  420. Next_Page = MyPage + 1
  421. Response.write "<a class=black href='" & Url & "page=" & Next_Page & "' title='第" & Next_Page & "页'>下一页</A>"
  422. end if
  423. if MaxPages > PageShowSize*PageNextSize then
  424. PageNext = PageShowSize * PageNextSize + 1
  425. Response.write " <A class=black href='" & Url & "page=" & Pagetpage & "' title='第"& Pagetpage &"页'>页尾</A>"
  426. Response.write " <a class=black href='" & Url & "page=" & PageNext & "' title='下" & PageShowSize & "页'>下一翻页</a>"
  427. End if
  428. rs.Close
  429. set rs=nothing
  430. %>&nbsp;&nbsp;&nbsp;&nbsp;<%if oskey="supper" or oskey="admin" then%>
  431.         <input type="checkbox" name="checkbox" value="checkbox" onClick="javascript:SelectAll()"> 选择/反选
  432.               <input onClick="{if(confirm('此操作将删除该信息!nn确定要执行此项操作吗?')){this.document.selform.submit();return true;}return false;}" type=submit value=删除 name=action2> 
  433.               <input type="Hidden" name="action" value='del'><%end if%></td></tr>
  434.         </table>
  435. </fieldset>
  436.   
  437. </td>
  438.     </tr>
  439.     <tr> 
  440.       <td height="50" colspan="3" align="center">
  441.         
  442.         </td>
  443.     </tr>
  444.   </table>
  445. </form>
  446. <br>
  447. <fieldset style="width:80%"><legend>库存搜索</legend>
  448.         <table width="90%" border="0" cellpadding="0" cellspacing="0" bordercolor="#D4D0C8">
  449.          
  450.   <form name="search" method="post" action="store.asp">
  451.   <tr><input name="search" type="hidden" value="search">
  452.             <td height="18" align="center" width="20%">
  453. <select name="class" size="1">
  454. <option value="">所有分类</option>
  455. <%
  456.        set rs2=server.createobject("adodb.recordset")
  457.    rs2.open "select * from class",conn,1,1
  458.    if not rs2.eof then
  459.    do while not rs2.eof
  460.    classnumber=rs2("classnumber")
  461.    %>
  462.    <option value="<%=rs2("classnumber")%>"><%=rs2("classnumber")%></option>
  463. <%
  464. rs2.movenext
  465. loop
  466. end if
  467. rs2.close
  468. set rs2=nothing
  469. %></select></td>
  470.             <td align="center" width="65%">配件名称关键字: <input name="keyword" type="text"  size="25"> 关键字为空则搜索所有</td>
  471.                       
  472. <td align="center" width="15%" ><input type="submit"  value="查 找"> </td>
  473.           </tr></form>
  474.   
  475.            </table>
  476.         </fieldset>
  477. </TD>
  478.               </TR>
  479.           </table>
  480.           
  481.       <table width="100%" border="0" cellspacing="0" cellpadding="4">
  482.       
  483.       </table>
  484.   </TBODY>
  485. </TABLE>
  486. <%end sub%>
  487. <P>
  488. <TABLE cellSpacing=0 cellPadding=0 width="100%" align=center border=0>
  489.   <TBODY>
  490.   <TR vAlign=center>
  491.     <TD align=middle width="100%"><!--#include file="footer.htm"--></TD>
  492.   </TR></TBODY></TABLE></P></BODY></HTML>