sub SaveAdd
class1=request.Form("d_position1")
  
pinming=request.Form("pinming")
names=Split(pinming,"|")
pinming=names(0)
guige=names(1)
unit=names(2)
set rs1=server.createobject("adodb.recordset") 
if guige="" then
sql1="select * from yuanliao_store where pinming='"&pinming&"'"
else
sql1="select * from yuanliao_store where pinming='"&pinming&"' and guige='"&guige&"'"
end if
rs1.open sql1,conn,1,3
if not rs1.eof and not rs1.bof then
rs1("number")=rs1("number")+request.Form("use_num")
else
rs1.addnew
rs1("class") = trim(request.Form("d_position1"))
rs1("Unit") = unit
rs1("guige") = guige
rs1("pinming") = pinming
rs1("number")=request.Form("use_num")
end if
rs1.update
rs1.close
set rs1=nothing
set rs=server.createobject("adodb.recordset") 
sql="select * from yuanliao_in_store"
rs.open sql,conn,1,3
rs.addnew
rs("class") = trim(request.Form("d_position1"))
rs("guige") = guige
rs("pinming") = pinming
rs("uptime") = request.Form("uptime")
rs("Unit") = unit
rs("Supplier") = trim(request.Form("Supplier"))
rs("use_num") = request.Form("use_num")
rs("ghfph") = request.Form("ghfph")
rs("caigou") = request.Form("caigou")
rs("cgjcsqdh") = request.Form("cgjcsqdh")
rs("cgddh") = request.Form("cgddh")
rs("sltzdh") = request.Form("sltzdh")
rs("jincbh") = request.Form("jincbh")
rs("shencs") = request.Form("shencs")
rs("wuliaobm") = request.Form("wuliaobm")
rs("pihao") = request.Form("pihao")
rs("beizhu") = trim(request.Form("beizhu"))
rs("content") = trim(request.Form("content"))
rs.update
response.Write "<script language=javascript>alert('入库成功!');</script>"
response.write "<meta http-equiv=""refresh"" content=""0;url=yuanliao_in_store.asp"">"
response.end
rs.close
set rs=nothing
end sub
 
sub SaveModify
class1=request.Form("d_position1")
  
pinming=request.Form("pinming")
names=Split(pinming,"|")
pinming=names(0)
guige=names(1)
unit=names(2) 
num=names(3) 
num0=request.Form("use_num")
num1=num-num0
set rs1=server.createobject("adodb.recordset") 
if guige="" then
sql1="select * from yuanliao_store where pinming='"&pinming&"'"
else
sql1="select * from yuanliao_store where pinming='"&pinming&"' and guige='"&guige&"'"
end if
rs1.open sql1,conn,1,3
if not rs1.eof and not rs1.bof then
rs1("number")=rs1("number")-num1
end if
rs1.update
rs1.close
set rs1=nothing
 
set rs=server.createobject("adodb.recordset") 
sql="select * from yuanliao_in_store where id="&request.Form("id")
rs.open sql,conn,1,3
rs("class") = trim(request.Form("d_position1"))
rs("guige") = guige
rs("pinming") = pinming
rs("Unit") = unit
rs("uptime") = request.Form("uptime")
rs("Supplier") = trim(request.Form("Supplier"))
rs("use_num") = request.Form("use_num")
rs("ghfph") = request.Form("ghfph")
rs("caigou") = request.Form("caigou")
rs("cgjcsqdh") = request.Form("cgjcsqdh")
rs("cgddh") = request.Form("cgddh")
rs("sltzdh") = request.Form("sltzdh")
rs("jincbh") = request.Form("jincbh")
rs("shencs") = request.Form("shencs")
rs("wuliaobm") = request.Form("wuliaobm")
rs("pihao") = request.Form("pihao")
rs("beizhu") = trim(request.Form("beizhu"))
rs("content") = trim(request.Form("content"))
rs.update
response.Write "<script language=javascript>alert('修改成功!');</script>"
response.write "<meta http-equiv=""refresh"" content=""0;url=yuanliao_in_store.asp"">"
response.end
rs.close
set rs=nothing
end sub
   
 
  sub delCate()
        conn.execute("delete from yuanliao_in_store where id in ("&Request.Form("selBigClass")&")")
        response.Write "<script language=javascript>alert('删除成功!');</script>"
response.write "<meta http-equiv=""refresh"" content=""0;url=yuanliao_in_store.asp"">"
response.end
  end sub
  %> 
  <% sub myform(isEdit) %>
       
<TABLE width=800 align=center border="1" cellspacing="0" cellpadding="0" bordercolor="#0055E6">
  <TBODY> 
  <TR> 
    <td align="center" valign="top"> <%if oskey="supper" or oskey="yuanliao" then%>
      <%
  
       if isedit then
       set rs=server.createobject("adodb.recordset")
           rs.open "select * from yuanliao_in_store where id=" & request("id"),conn,1,1
%>
      <table width="800" border="0" cellpadding="0" cellspacing="0" >
          <tr >
  
<td height=26 background="images/background.gif">
<b><font color="#ffffff">编 辑 原 料 入 库</font></b></td>
</tr>
</table>
<% else %>
    <table width="800" border="0" cellpadding="0" cellspacing="0" >
          <tr >
  
<td height=26 background="images/background.gif">
<b><font color="#ffffff">添 加 原 料 入 库</font></b>
</td>
</tr>
</table>
<%end if %>
        <table width="800" border="0" cellpadding="0" cellspacing="0" bordercolor="#0055E6">
          <tr class="but"> 
            <td width="12%" height="29" align="center" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'">入库日期</td>
            <td width="10%" height="29" align="center" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'">类 别</td>
            <td width="28%" height="29" align="center" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'">品 名 | 规 格 | 计量单位</td>
            <td width="25%" height="29" align="center" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'">供货单位</td>
            <td width="25%" height="29" align="center" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'">入库数量</td>
          </tr>
          <form name="powersearch" method="post" action="yuanliao_in_store.asp" onSubmit="return Juge(this)" >
          <tr> <input type="Hidden" name="action" value='<% If isedit then%>modify<% Else %>add<% End If %>'> 
          <% If isedit then%><input type="Hidden" name="id" value="<%=rs("id")%>"> <% End If %>
<td height="33" align="center" class="but11" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but11'">
            <input name="uptime" onFocus="show_cele_date(uptime,'','',uptime)" type="text"
  size="10"
  value='<% if isedit then
                                                                 response.write rs("uptime")
                                                                 else
                                                                 response.write date()
                                                                  end if %>'></td>
<td height="33" align="center" class="but11" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but11'">
            <select name='d_position1' onchange='Do_po_Change(this);' valign=top style='width:90'>
            <% if isedit then%>
            <option selected="selected"><%=rs("class")%></option>
            <%else%>
            <option selected value='0000'>请选择类别</option>
            <%end if%>
            
            <%
            
            set rs1=server.createobject("adodb.recordset")
           rs1.open "select * from class",conn,1,1
           if not rs1.eof then
           do while not rs1.eof
            %>
            <option value="<%=rs1("classname")%>"><%=rs1("classname")%></option>
            <%
            rs1.movenext
            loop
            end if
            rs1.close
            set rs1=nothing
            %></select></td>
<td height="33" align="center" class="but11" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but11'">
            <select name='pinming' size=1 style='width:200'>
            <% if isedit then%>
            <option selected="selected" value="<%=rs("pinming")%>|<%=rs("guige")%>|<%=rs("unit")%>|<%=rs("use_num")%>"><%=rs("pinming")%> | <%=rs("guige")%> | <%=rs("unit")%></option>
            <%else%>
            <option>--请选择--</option>
            <%end if%>
            </select>
            </td>
<td height="33" align="center" class="but11" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but11'"><select name="Supplier"
  size="1" style='width:200'>
            <% if isedit then%><option ><%=rs("Supplier")%></option><%end if%>
            <%
            
            set rs3=server.createobject("adodb.recordset")
           rs3.open "select * from Supplier",conn,1,1
           if not rs3.eof then
           do while not rs3.eof
            %>
            <option <% if isedit then
            if trim(rs3("Supplier_name"))=trim(rs("Supplier")) then
            %> selected="selected"<%end if%><%end if%>><%=rs3("Supplier_name")%></option>
            <%
            rs3.movenext
            loop
            end if
            rs3.close
            set rs3=nothing
            %>
            </select>
            </td>
<td height="33" align="center" class="but11" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but11'"><input name="use_num" type="text"
  size="10" value='<% if isedit then response.write rs("use_num") end if %>'></td>
          </tr>
          <tr class="but">
            <td height="16" align="center" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'"> </td>
            
            <td height="16" align="center" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'"> </td>
            <td height="16" align="center" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'"> </td>
            <td height="16" align="center" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'"> </td>
            <td height="16"
  colspan="2" align="center" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'"> </td>
            </tr>
          <tr class="but">
            <td height="36" align="center" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'">购货发票号</td>
            <td height="36" align="center" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'">采购方式</td>
            <td height="36" align="center" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'">采购检测申请单号</td>
            <td height="36" align="center" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'">采购订单号</td>
            <td height="36"
  colspan="2" align="center" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'">收料通知单号</td>
            </tr>
          <tr class="but">
            <td height="18" align="center" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'"><input name="ghfph" type="text" size="10" value='<% if isedit then response.write rs("ghfph")
end if %>'></td>
            <td height="18" align="center" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'"><input name="caigou" type="text" id="caigou" size="10" value='<% if isedit then response.Write rs("caigou") end if %>'></td>
            <td height="18" align="center" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'"><input name="cgjcsqdh" type="text" id="cgjcsqdh" size="10" value='<% if isedit then response.Write rs("cgjcsqdh") end if %>'></td>
            <td height="18" align="center" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'"><input name="cgddh" type="text" id="cgddh" size="10" value='<% if isedit then response.Write rs("cgddh") end if %>'></td>
            <td height="18"
  colspan="2" align="center" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'"><input name="sltzdh" type="text" id="sltzdh" size="10" value='<% if isedit then response.Write rs("sltzddh") end if %>'></td>
            </tr>
          <tr class="but">
            <td height="36" align="center" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'">进厂编号</td>
            <td height="36" align="center" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'">生产商</td>
            <td height="36" align="center" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'">物料编码</td>
            <td height="36" align="center" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'">批号</td>
            <td height="36"
  colspan="2" align="center" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'">保质期</td>
            </tr>
          <tr class="but">
            <td height="18" align="center" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'"><input name="jincbh" type="text" id="jincbh" size="10" value='<% if isedit then response.write rs("jincbh") end if %>'></td>
            <td height="18" align="center" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'"><input name="shencs" type="text" id="shencs" size="10" value='<% if isedit then response.Write rs("shencs") end if %>'></td>
            <td height="18" align="center" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'"><input name="wuliaobm" type="text" id="wuliaobm" size="20" value='<% if isedit then response.Write rs("wuliaobm") end if %>'></td>