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

📄 addnew.asp

📁 功能齐全的oa系统
💻 ASP
字号:
<% option explicit%>
<!-- #include virtual="include/DataEnvi.asp" -->
<!-- #include virtual="include/Page.asp" -->
<!-- #include virtual="include/String.asp" -->
<%
Dim ObjRS,rs,conn,StrSQL
%>
<%
if session("AccountID")="" then
%>
<script language=javascript>
  alert("因登录时间过长,会话失效,请退出重新登陆!")
</script>
<%  
  Response.End
end if

Set conn=Server.CreateObject("ADODB.Connection")
OpenDBCrm( conn )
%>

<script language = "JavaScript">
var onecount;
onecount=0;
subcat = new Array();
<%
<!--读取分类字段赋给JS数组-->
dim count
set rs=server.createobject("adodb.recordset")
rs.open "select * from T_CRM_Guest_industry",conn,1,1
count = 0
do while not rs.eof 
%>
  subcat[<%=count%>] = new Array("<%= trim(rs("Gindustry"))%>","<%= rs("Gtype_ID")%>","<%= rs("ID")%>");
<%
  count = count + 1
  rs.movenext
loop
rs.close
%>
		
onecount=<%=count%>;

function changelocation(locationid)
{
  document.myform._smallclass.length = 0; 

  var locationid=locationid;
  var i;
  for (i=0;i < onecount; i++)
  {
    if (subcat[i][1] == locationid)
    { 
      document.myform._smallclass.options[document.myform._smallclass.length] = new Option(subcat[i][0], subcat[i][2]);
    }        
  }
        
}    
</script> 
<%
If Request.Form.Count > 0 Then
  Dim C,SqlStr
  Dim IntID
  
  if (Request.Form("_costprice") <> "" and NOT IsNumeric(Request.Form("_costprice"))) then
%>
<script language=javascript>
    alert("请重新输入成本价,不可包含字母、汉字等信息!")
    history.back()
</script>
<%
    Response.End
  end if

  if Request.Form("_marketprice") <> "" and NOT IsNumeric(Request.Form("_marketprice")) then
%>
<script language=javascript>
    alert("请重新输入市场价,不可包含字母、汉字等信息!")
    history.back()
</script>
<%
    Response.End
  end if

  if Request.Form("_supplyprice") <> "" and NOT IsNumeric(Request.Form("_supplyprice")) then
%>
<script language=javascript>
    alert("请重新输入代理价,不可包含字母、汉字等信息!")
    history.back()
</script>
<%
    Response.End
  end if
  
  Dim costprice,marketprice,supplyprice
  
  if Request.Form("_costprice") = "" then
    costprice = 0
  else
    costprice = CDbl(Request.Form("_costprice"))
  end if
  
  if Request.Form("_marketprice") = "" then
    marketprice = 0
  else
    marketprice = CDbl(Request.Form("_marketprice"))
  end if

  if Request.Form("_supplyprice") = "" then
    supplyprice = 0
  else
    supplyprice = CDbl(Request.Form("_supplyprice"))
  end if

  Set ObjRS = Server.CreateObject ("ADODB.RecordSet")
  
  StrSQL = "Select * from T_CRM_Product where 1=1"
  ObjRS.Open StrSQL,conn,1,3
  ObjRS.AddNew
  'Response.Write "Name=" & Request.Form("_costprice")
  'Response.End
	ObjRS("productname") = Request.Form("_productname")
	ObjRS("shortname")   = Request.Form("_shortname")
	ObjRS("bigclass")    = Request.Form("_bigclass")
	ObjRS("smallclass")  = Request.Form("_smallclass")
	ObjRS("supply")      = Request.Form("_supply")
	ObjRS("spec")        = Request.Form("_spec")
	ObjRS("proarea")     = Request.Form("_proarea")
	ObjRS("producer")    = Request.Form("_producer")
	ObjRS("costprice")   = costprice
	ObjRS("marketprice") = marketprice
	ObjRS("supplyprice") = supplyprice
	ObjRS("barcode")     = Request.Form("_barcode")
	ObjRS("appraise")    = Request.Form("_appraise")
	ObjRS("remark")      = Request.Form("_remark")
	ObjRS("CreateTime")  = CStr(Date())
	ObjRS.Update 
	ObjRS.Close 
	conn.Close
	Set conn = Nothing
  
  Response.Redirect "List.asp"
End If

Sub Main
%>
<HTML><HEAD>
  <form name="myform" action="" method="post" onsubmit="return(CheckForm(this))">
  <input type=hidden name=_AccountID value=<%=Session("AccountID")%>>
  <table class=Ltable cellspacing=1 cellpadding=3>
  <tr class=LStr>
	  <td width="15%">新增产品</td>
	  <td width="85%" colspan=3> </td>
  </tr>
  <tr class=Ltr>
    <td>产品名称</td>
    <td><input type="text" class=Input Check=1 Show="产品名称" name="_productname" value=""></td>
  </tr>
  <tr class=Ltr>
     <td>产品大类</td>
     <td>
       <%
		  Set rs = conn.Execute("select * from T_CRM_Guest_type") 
		  if rs.eof and rs.bof then
		    Response.Write "请先添加产品大类信息"
		  else
			%>
	  <select name="_bigclass" style="width:133px" onChange="changelocation(document.myform._bigclass.options[document.myform._bigclass.selectedIndex].value)">
        
		<option selected value="<%=rs("ID")%>"><%=trim(rs("Gtype"))%></option>
        <%      
		   dim selclass
		   selclass=rs("ID")
		   rs.movenext
		 do while not rs.eof
		%>
        <option value="<%=rs("ID")%>"><%=trim(rs("Gtype"))%></option>
        <%
		   rs.movenext
		 loop
		end if
		rs.close
		%>

      </select>
	  </td>
  </tr>
  <tr class=Ltr>
    <td>产品小类</td>
    <td>
	<%
		rs.open "select * from T_CRM_Guest_industry where Gtype_ID="&Cint(selclass) ,conn,1,3
		if rs.eof and rs.Bof then
        response.Write "请先添加产品小类信息"
		rs.close
		else
		%>
	<select name="_smallclass" style="width:133px">
        <option value="<%=rs("ID")%>" selected><%=rs("Gindustry")%></option>
        <%
		rs.movenext
		do while not rs.eof
		%>
        <option value="<%=rs("ID")%>"><%=rs("Gindustry")%></option>
        <%
		rs.movenext
		loop
		end if
%>
	</select>
	</td>
  </tr>
  <tr class=Ltr>
    <td>供应商</td>
    <td><input type="text" class=Input Check=0 Show="供应商" name="_supply" value=""></td>
  </tr>
  </table>
  <table id=MoreInfo class=Ltable cellspacing=1 cellpadding=3>
  <tr class=LStr>
	<td width="15%">详细信息</td>
	<td width="85%" colspan=3> </td>
  </tr>
  <tr class=Ltr>
    <td>产品简称</td>
    <td><input type="text" class=Input Check=0 Show="产品简称" name="_shortname" value=""></td>

    <td>产品规格</td>
    <td><input type="text" class=Input Check=0 Show="产品规格" name="_spec" value=""></td>
  </tr>
  <tr class=Ltr>
    <td>产品产地</td>
    <td><input type="text" class=Input Check=0 Show="产品产地" name="_proarea" value=""></td>

    <td>生产商</td>
    <td><input type="text" class=Input Check=0 Show="生产商" name="_producer" value=""></td>
  </tr>
  <tr class=Ltr>
    <td>成本价</td>
    <td><input type="text" class=Input Check=0 Show="成本价" name="_costprice" value=""> 元</td>

    <td>市场价</td>
    <td><input type="text" class=Input Check=0 Show="市场价" name="_marketprice" value=""> 元</td>
  </tr>
  <tr class=Ltr>
	  <td>代理价</td>
    <td><input type="text" class=Input Check=0 Show="代理价" name="_supplyprice" value=""> 元</td>
    <td>条形码</td>
    <td><input type="text" class=Input Check=0 Show="条形码" name="_barcode" value=""></td>
  </tr>
	<tr class=Ltr>
		<td>产品详细描述</td>
		<td colspan=3><textarea rows="5" cols="40" class=Input Check=0 Show="产品详细描述" name="_remark"></textarea></td>
	</tr>
	<tr class=Ltr>
		<td>产品评价</td>
		<td colspan=3><textarea rows="5" cols="40" class=Input Check=0 Show="产品评价" name="_appraise"></textarea></td>
	</tr>
  </table>
  <table cellspacing=1 cellpadding=3>
  <tr>
    <td>
    <input type="submit"  name="Submit" class=Button value="提 交"><input type="button" class=Button value="取 消" onclick="doList()" id=button1 name=button1></td>
    <td></td>
  </tr>
  </table>
  </FORM>
<%
End Sub
%>
<!-- #include virtual="Templet/Templet.asp" -->

⌨️ 快捷键说明

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