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

📄 edit.asp

📁 功能齐全的oa系统
💻 ASP
字号:
<% option explicit%>
<!-- #include virtual="include/DataEnvi.asp" -->
<!-- #include virtual="Include/Page.asp" -->
<%
Dim C,SqlStr
Dim IntID,count
Dim ObjRS,conn,rs,RSGtype,RSGindustry
IntID = Request.QueryString("ID")

if Cint(IntID)=0 Then
	Response.Write "<script language=javascript>alert('请选择产品');history.back();</script>"
	Response.End
End if

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

Set C = Server.CreateObject ("CMS2003.DBhandle")
C.Init(conn)
   
If Request.Form.Count > 0 Then
  If Trim(Request("_productname"))="" then
    Response.Write "<script language=javascript>alert('请填写产品名称');history.back();</script>"
   	Response.End
 	End if

  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
 	      
  IntID = Request.Form("ID")
  Call C.Edit(IntID,"_","T_CRM_Product")
  Response.Redirect "list.asp"   
End If

Set ObjRS = C.View("Select * From T_CRM_Product Where ID = " & IntID)
%>

<script language = "JavaScript">
var onecount;
onecount=0;
subcat = new Array();

<%
<!--读取分类字段赋给JS数组-->

set rs=server.createobject("adodb.recordset")
rs.open "select * from T_CRM_Guest_industry",conn,1,3
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
		Set rs=Nothing
%>
		
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> 
<%Sub Main%>
	<form action="" method="post" onsubmit="return(CheckForm(this))" id=form1 name=myform>
	<input type=hidden name=ID value="<%=Request.QueryString("ID")%>">
	<table class=Ltable cellspacing=1 cellpadding=3>
    <tr class=LHtr align="middle">
      <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="_productname" value="<%=ObjRS("productname")%>"></td>
    </tr>
    <tr class=Ltr>
      <td>产品大类</td>
      <td>
      <%
	    set rs=server.createobject("adodb.recordset")
		  Set rs = conn.Execute("select * from T_CRM_Guest_type") 
		  if rs.eof and rs.bof then
			  Response.Write "请先添加产品大类信息"
		  else
		  	set RSGtype=server.createobject("adodb.recordset")
		  	Set RSGtype = conn.Execute("select * from T_CRM_Guest_type Where ID="&cint(ObjRS("bigclass")))
		  	if RSGtype.Eof and RSGtype.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="<%=RSGtype("ID")%>"><%=trim(RSGtype("Gtype"))%></option>
        <%      
		 dim selclass
		 selclass=rs("ID")
		 
		 do while not rs.eof
		 	if rs("ID")=RSGtype("ID") Then
		 	
		 	else
		 	%>
        <option value="<%=rs("ID")%>"><%=trim(rs("Gtype"))%></option>
        <%		End if
		 rs.movenext
		 loop
		end if
		End if
		rs.close
		RSGtype.close
		set RSGtype=Nothing
		%>
      </select>
	  </td>
  </tr>
  <tr class=Ltr>
    <td>产品小类</td>
    <td>
      <%
      		set RSGindustry=server.createobject("adodb.recordset")
		Set RSGindustry = conn.Execute("select * from T_CRM_Guest_industry Where ID="&cint(ObjRS("smallclass")))	
      		if RSGindustry.Eof and RSGindustry.Bof Then
      			Response.Write "没有相关的产品小类信息"
      		else
      %>
	<select name="_smallclass" style="width:133px">
        <%

		rs.open "select * from T_CRM_Guest_industry where Gtype_ID="&Cint(selclass) ,conn,1,3
		if not(rs.eof and rs.bof) then
		
		%>
        <option value="<%=RSGindustry("ID")%>" selected><%=RSGindustry("Gindustry")%></option>
        <%
		'rs.movenext
		do while not rs.eof
			if rs("ID")=RSGindustry("ID") Then
	 		
	 		else
	 	%>
        <option value="<%=rs("ID")%>"><%=rs("Gindustry")%></option>
        <%		End if
		rs.movenext
		loop
		end if
		rs.close
		RSGindustry.close
		Set RSGindustry=Nothing
%>

	</select>
      <%End if%>
	</td>
  </tr>
    <tr class=Ltr>
      <td>供应商</td>
      <td><input type="text" class=Input Check=0 Show="供应商" name="_supply" value="<%=ObjRS("supply")%>"></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="<%=ObjRS("shortname")%>"></td>
      <td>产品规格</td>
      <td><input type="text" class=Input Check=0 Show="产品规格" name="_spec" value="<%=ObjRS("spec")%>"></td>
    </tr>
    <tr class=Ltr>
      <td>产品产地</td>
      <td><input type="text" class=Input Check=0 Show="产品产地" name="_proarea" value="<%=ObjRS("proarea")%>"></td>
    	<td>生产商</td>
	    <td><input type="text" class=Input Check=0 Show="生产商" name="_producer" value="<%=ObjRS("producer")%>"></td>
    </tr>
    <tr class=Ltr>
	    <td>成本价</td>
	    <td><input type="text" class=Input Check=0 Show="成本价" name="_costprice" value="<%=ObjRS("costprice")%>"> 元</td>
   	  <td>市场价</td>
	    <td><input type="text" class=Input Check=0 Show="市场价" name="_marketprice" value="<%=ObjRS("marketprice")%>"> 元</td>
    </tr>
    <tr class=Ltr>
	    <td>代理价</td>
      <td><input type="text" class=Input Check=0 Show="代理价" name="_supplyprice" value="<%=ObjRS("supplyprice")%>"> 元</td>
      <td>条形码</td>
      <td><input type="text" class=Input Check=0 Show="条形码" name="_barcode" value="<%=ObjRS("barcode")%>"></td>
    </tr>
	  <tr class=Ltr>
		  <td>产品详细描述</td>
		  <td colspan=3><textarea rows="5" cols="40" class=Input Check=0 Show="产品详细描述" name="_remark"><%=ObjRS("remark")%></textarea></td>
	  </tr>
	  <tr class=Ltr>
		  <td>产品评价</td>
		  <td colspan=3><textarea rows="5" cols="40" class=Input Check=0 Show="产品评价" name="_appraise"><%=ObjRS("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>
<%	conn.Close
	Set conn = Nothing
%>
<%
End Sub
%>
<!-- #include virtual="templet\templet.asp" -->

⌨️ 快捷键说明

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