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

📄 clientbase_edit.asp

📁 OFFICE办公自动化
💻 ASP
字号:
<%
'==============================================================
'OA 表单生成器
'版本: 1.1.0 -- 2005-5-24
'程序版权:(c) 2004 by 展亮
'说明:本代码为自由代码,用户可以自由使用,但请保留作者文件头部说明
'   在使用过程中如出现什么问题请及时与作者联系。
'   电子邮件:zlbox@yeah.net QQ:2343397
'=============================================================
'功能:添加/编辑工商户
'参数:	request.form("addedit_subed")="true"#表单提交; request("id")#要编辑记录的ID;
'=============================================================
%>

<!--#include file="../inc/Secure.asp"-->
<!--#include file="../inc/conn.asp"-->
<!--#include file="../inc/Const.asp"-->
<!--#include file="../inc/ronger.asp"-->
<!-- #include file="Upload.asp" -->

<%
'response.buffer=false
'------------------------------------------------设置参数
LoginID=clng(trim(Session("LoginID"))) '当前用户ID
pid=clng(request("id")) '记录ID
'------------------------------------------------
'------------------------------------------------添加/修改记录
table="tbioaClientBase" '表名
path = "./photo/"'上传路径
set Upload = new DoteyUpload
Upload.ProgressID = Request.QueryString("ProgressID")
Upload.Upload() '上传文件
if upload.Form("addedit_subed")="true" then
'表单提交后

	'接受录入参数
	area=upload.Form("area")
	zch=upload.Form("zch")
	zhmc=upload.Form("zhmc")
	fzr=upload.Form("fzr")
	jylx=upload.Form("jylx")
	lx=upload.Form("lx")
	ssdq=upload.Form("ssdq")
	jydz=upload.Form("jydz")
	hy=upload.Form("hy")
	jyfw=upload.Form("jyfw")
	jyqxs=upload.Form("jyqxs")
	jyqxe=upload.Form("jyqxe")
	cyry=upload.Form("cyry")
	lxdh=upload.Form("lxdh")
	jgry=upload.Form("jgry")
	bpld=upload.Form("bpld")
	zp=upload.Form("zp")
	bz=upload.Form("bz")

	if oConn.Execute("SELECT count(zch) FROM "&table&" WHERE zch='"&zch&"' AND id<>'"&pid&"'")(0)>0 then '判断注册号唯一性
		response.write "<script>alert('注册号重复,请重新提交!');history.back()</script>"
		response.end
	end if

	field1=array("area","zch","zhmc","fzr","jylx","lx","ssdq","jydz","hy","jyfw","jyqxs","jyqxe","cyry","lxdh","jgry","bpld","bz","sdate","userid")
	value1=array(area,zch,zhmc,fzr,jylx,lx,ssdq,jydz,hy,jyfw,jyqxs,jyqxe,cyry,lxdh,jgry,bpld,bz,date(),LoginID)
	if pid=0 then
		for i=0 to ubound(field1)
			value1(i)=replace(value1(i),"'","''")
		next
		sql = "INSERT INTO "&table&" (" & Join(field1, ",") & ") VALUES ('" & Join(value1, "','") & "')"
		sql = replace(replace(sql,",'',",",null,"),",'',",",null,")
		'response.write sql
		oConn.Execute sql
		maxid=oConn.Execute("select max(id) FROM "&table)(0)

		For each File in Upload.Files.Items'保存照片
			filename=path & DateToStr(now()) & File.FileExt
			oConn.Execute("UPDATE "&table&" SET zp='"&filename&"' WHERE id='"&maxid&"'")
			File.SaveAs filename
		Next

	  response.write "<script>alert('工商户注册信息提交成功!');history.go(-2)</script>"
		response.end
	else
		sql="UPDATE "&table&" SET "
		for i=0 to ubound(field1)
			if value1(i)="" then
				sql = sql & field1(i) & "=null"
			else
				sql = sql & field1(i) & "='" & replace(value1(i),"'","''") & "'"
			end if
			if i <> ubound(field1) then sql=sql & ","  else  sql=sql & " where id='" & pid & "'"
		next
		'response.write sql
		oConn.Execute sql

		For each File in Upload.Files.Items'保存照片
			zpname=oConn.Execute("SELECT zp FROM "&table&" WHERE id='"&pid&"'")(0)
			if zpname<>null or zpname<>"" then call DeleteOneFile(zpname)'删除照片
			filename=path & DateToStr(now()) & File.FileExt
			oConn.Execute("UPDATE "&table&" SET zp='"&filename&"' WHERE id='"&pid&"'")
			File.SaveAs filename
		Next

	  response.write "<script>alert('工商户注册信息修改成功!');history.go(-2)</script>"
		response.end
	end if
end if
'------------------------------------------------
'--------------------------------------------取记录
set rs=Server.CreateObject("ADODB.RecordSet")
sql="select * from " & table & " where ID="&pid
rs.open sql,oConn,1,1
'------------------------------------------------
function showvalue(field)
	if rs.eof then
		showvalue=""
	else
		if (isnull(rs(field))) then showvalue="" else showvalue=Server.HTMLEncode(rs(field))
	end if
end function
%>


<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="../css/main.css" type=text/css>
<title>main</title>
<script src="../js/Popup.js"></script>
<script src="../js/formatdate.js"></script>
<script src="../js/front_chec.js"></script>
<script src="../js/user_select.js"></script>
<script language="JavaScript">
<!--
 function select_users(f_xm,f_id){
	strtmpusers = SelectUsers(f_id.value);
	if (strtmpusers != "") {
		strtmpusers=strtmpusers.split("_")
		f_id.value=strtmpusers[0]
		f_xm.value=strtmpusers[1]
	}
 }
-->
</script>
</head>

<body topmargin="10" leftmargin="10">

<!--#include file="ClientBase_menu.html"-->

<hr width="100%" size=1 color="#000000">
<br>
<div align="center">
<table width="500" cellspacing="1" cellpadding="2" class="tab">
  <tr>
    <td width="100%" class="tdTop">
      <table border="0" width="100%" cellspacing="0" cellpadding="0">
        <tr>
          <td class="tdTop">
            <p align="left"><img border="0" src="../images/icon_title.gif" align="left">录入工商户</p>
          </td>
          <td width="90" class="tdTop">
            <p align="left"><img border="0" src="../images/icon_return.gif" align="left">
            <a href="javascript:history.back()" class="linkTop">返回列表</a>
          </td>
        </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td width="25%" class="td1">

    <form name="eventfrm" method="POST" action="?id=<%=pid%>" onSubmit="return checknull(this)" enctype="multipart/form-data">
      <input type=hidden name="addedit_subed" value="true">
      <table border="0" width="100%" cellspacing="10" cellpadding="0">
        <tr>
          <td width="100" align="right" valign="top" nowrap>所属所:</td>
          <td width="400" nowrap>
          	<select size="1" name="area" class="input">
	        	<option value="<%=Session("DepID")%>" <%if area=Session("DepID") then response.write"selected"%>><%=GetTableValue("tbioaDepartment","Name","id",Session("DepID"))%></option>
	        	<%Call pOptions("tbioaDepartment","Name",Session("DepID"),showvalue("area"),"├-")%>
	      	</select> <font COLOR="RED">*</font>
          </td>
        </tr>
        <tr>
          <td width="100" align="right" valign="top" nowrap>注册号:</td>
          <td width="400" nowrap><input type="text" name="zch" value="<%=showvalue("zch")%>" size="40" maxlength="250" class="input" check_null="请填写注册号" check_int="注册号必须为数字"> <font COLOR="RED">*</font>
          </td>
        </tr>
        <tr>
          <td width="100" align="right" valign="top" nowrap>字号名称:</td>
          <td width="400" nowrap><input type="text" name="zhmc" value="<%=showvalue("zhmc")%>" size="40" maxlength="250" class="input" check_null="请填写字号名称"> <font COLOR="RED">*</font>
          </td>
        </tr>
        <tr>
          <td width="100" align="right" valign="top" nowrap>负责人:</td>
          <td width="400" nowrap><input type="text" name="fzr" value="<%=showvalue("fzr")%>" size="40" maxlength="250" class="input" check_null="请填写负责人"> <font COLOR="RED">*</font>
          </td>
        </tr>
        <tr>
          <td width="100" align="right" valign="top" nowrap>经营户类型:</td>
          <td width="400" nowrap>
          	<input type="radio" value="1" name="jylx" checked>农资经营户
          	<input type="radio" value="2" name="jylx" <%if showvalue("jylx")="2" then response.write"checked"%>>食品经营户
          	<input type="radio" value="3" name="jylx" <%if showvalue("jylx")="3" then response.write"checked"%>>其他经营户
            <font COLOR="RED">*</font>
          </td>
        </tr>
        <tr>
          <td width="100" align="right" valign="top" nowrap>企业类型:</td>
          <td width="400" nowrap>
            <input type="radio" value="1" name="lx" checked>企业
            <input type="radio" value="0" name="lx" <%if showvalue("lx")="0" then response.write"checked"%>>个体工商户
            <font COLOR="RED">*</font>
          </td>
        </tr>
        <tr>
          <td width="100" align="right" valign="top" nowrap>所属地区:</td>
          <td width="400" nowrap>
          	<select size="1" name="ssdq" class="input" check_null="请选择所属地区">
          	  <%Call pOptions("tbioaAreaSort","Name",0,showvalue("ssdq"),"")%>
          	</select>
          	<font COLOR="RED">*</font>
          </td>
        </tr>
        <tr>
          <td width="100" align="right" valign="top" nowrap>经营地址:</td>
          <td width="400" nowrap><input type="text" name="jydz" value="<%=showvalue("jydz")%>" size="40" maxlength="250" class="input" check_null="请填写经营地址"> <font COLOR="RED">*</font>
          </td>
        </tr>
        <tr>
          <td width="100" align="right" valign="top" nowrap>行业:</td>
          <td width="400" nowrap>
          	<select size="1" name="hy" class="input" check_null="请选择所属行业">
          	  <%Call pOptions("TbioaBusinessSort","Name",0,showvalue("hy"),"")%>
          	</select>
          	<font COLOR="RED">*</font>
          </td>
        </tr>
        <tr>
          <td width="100" align="right" valign="top" nowrap>经营范围:</td>
          <td width="400" nowrap><input type="text" name="jyfw" value="<%=showvalue("jyfw")%>" size="40" maxlength="250" class="input" check_null="请填写经营范围"> <font COLOR="RED">*</font>
          </td>
        </tr>
        <tr>
          <td width="100" align="right" valign="top" nowrap>经营期限:</td>
          <td width="400" nowrap>
          	<input TYPE="TEXT" SIZE="12" MAXLENGTH="12" NAME="jyqxs" value="<%=showvalue("jyqxs")%>" class="input" check_date="日期格式错误" onKeyUp="DateFormat(this,this.value,event,false,'2')" check_null="请填写经营期限开始"> <a href=# title="选择日期" onClick="fPopUpDlg('../js/calendar.htm', document.eventfrm.jyqxs, 'winpop', 234, 261);return false"><img src="../images/datetime.gif" border=0></a> ~
          	<input TYPE="TEXT" SIZE="12" MAXLENGTH="12" NAME="jyqxe" value="<%=showvalue("jyqxe")%>" class="input" check_date="日期格式错误" onKeyUp="DateFormat(this,this.value,event,false,'2')" check_null="请填写经营期限截止"> <a href=# title="选择日期" onClick="fPopUpDlg('../js/calendar.htm', document.eventfrm.jyqxe, 'winpop', 234, 261);return false"><img src="../images/datetime.gif" border=0></a>
          	<font COLOR="RED">*</font>
          </td>
        </tr>
        <tr>
          <td width="100" align="right" valign="top" nowrap>从业人员:</td>
          <td width="400" nowrap><input type="text" name="cyry" value="<%=showvalue("cyry")%>" size="40" maxlength="250" class="input">
          </td>
        </tr>
        <tr>
          <td width="100" align="right" valign="top" nowrap>联系电话:</td>
          <td width="400" nowrap><input type="text" name="lxdh" value="<%=showvalue("lxdh")%>" size="40" maxlength="250" class="input" check_null="请填写联系电话"> <font COLOR="RED">*</font>
          </td>
        </tr>
        <tr>
          <td width="100" align="right" valign="top" nowrap>监管人员:</td>
          <td width="400" nowrap>
          	<input type="text" name="jgry_xm" value="<%=GetUserNames(showvalue("jgry"),",")%>" size="25" readonly class="input" check_null="请选择监管人员">
		 	<input type=hidden name="jgry" value="<%=showvalue("jgry")%>">
		 	<img src="../images/selectman.gif" border="0" onclick="select_users(eventfrm.jgry_xm,eventfrm.jgry)" style="cursor:hand">
          	<font COLOR="RED">*</font>
          </td>
        </tr>
        <tr>
          <td width="100" align="right" valign="top" nowrap>包片领导:</td>
          <td width="400" nowrap>
          	<input type="text" name="bpld_xm" value="<%=GetUserNames(showvalue("bpld"),",")%>" size="25" readonly class="input" check_null="请选择包片领导">
		 	<input type=hidden name="bpld" value="<%=showvalue("bpld")%>">
		 	<img src="../images/selectman.gif" border="0" onclick="select_users(eventfrm.bpld_xm,eventfrm.bpld)" style="cursor:hand">
          	<font COLOR="RED">*</font>
          </td>
        </tr>
        <tr>
          <td width="100" align="right" valign="top" nowrap>照片:</td>
          <td width="400" nowrap>
          	<%if showvalue("zp")<>"" then response.write "<a href='"&showvalue("zp")&"' target='_blank'><img src='"&showvalue("zp")&"' width=19 height=19 align=absmiddle border=0></a>"%><input type="file" name="zp" value="<%=showvalue("zp")%>" size="30" maxlength="250" class="input" check_filename="上传的照片文件格式不正确,请上传BMP、JPG或GIF文件" sufname="bmp|jpg|gif">
            <%if pid<>0 then response.write "<br>(为空表示不修改照片!)"%>
          </td>
        </tr>
        <tr>
          <td width="100" align="right" valign="top" nowrap>备注:</td>
          <td width="400" nowrap><textarea name="bz" rows="5" cols="39" class="textarea"><%=showvalue("bz")%></textarea>
          </td>
        </tr>
        <tr>
          <td width="100%" colspan="2" align="center">
           <input type="submit" value="确定" class="button0" onmouseout=className="button0" onmouseover=className="button1"> <input type="reset" value="全部重写" class="button0" onmouseout=className="button0" onmouseover=className="button1">
          </td>
        </tr>
      </table>

    </form>

    </td>
  </tr>
  <tr>
    <td width="25%" class="tdBottom">
    </td>
  </tr>
</table>
</div>
</body>

</html>

<%'释放对象变量
rs.close
oConn.close
%> 

⌨️ 快捷键说明

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