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

📄 addnew.asp

📁 功能齐全的oa系统
💻 ASP
字号:
<% option explicit%>
<!-- #include virtual="include/DataEnvi.asp" -->
<!-- #include virtual="include/MyFunc.asp" -->
<!-- #include virtual="Include/SelectValue.asp" -->
<!-- #include virtual="include/Roles.asp" -->

<%  
 Dim ObjDB,ObjRSH,StrSQL 
  Dim C
  Dim IntID,rs,sql,ObjDBT

Set ObjDB= Server.CreateObject("ADODB.Connection")
  OpenDBH ObjDB
  
    Set ObjDBT= Server.CreateObject("ADODB.Connection")
  OpenDB ObjDBT
  
   StrSQL = "Select Count(*) From t_Hrms_Employees_UsersBasic"
   Set ObjRSH = ObjDB.Execute(StrSQL)
  
  IF ObjRSH(0)=0 then 
    call MsgBox("姓名为空,请先在员工基本信息里设置员工姓名!","Back","none")
          response.end  
  end if 
  
If Request.Form.Count > 0 Then
 

 ' ----------------------------------------判断开始'	
		 if request("_Fee")<>"" then
       if  NOT IsNumeric(request("_Fee")) then
       call MsgBox("费用必须是数字!","Back","none")
	    response.end  
		else
		if request("_Fee")<0 or request("_Fee")>9999 then
		call MsgBox("费用超出范围,请填写0-9999之间的数值!","Back","none")
	    response.end 
		end if
  end if 
  end if
  
    if request("_Score")<>"" then
  if  NOT IsNumeric(request("_Score")) then
  call MsgBox("成绩必须是数字!","Back","none")
     response.end  
	 else
	 if  request("_Score")>100 or request("_Score")<0 then
	 call MsgBox("成绩超出范围,请填写0-100之间的数值!","Back","none")
	 response.end  
	 end if
  end if 
    end if
	
   if request("_LesTime")<>"" then
  if  NOT IsNumeric(request("_LesTime")) then
     call MsgBox("培训时限必须是数字!","Back","none")
    response.end  
	 else
	 if  request("_LesTime")>365 or request("_LesTime")<0 then
	 call MsgBox("培训时限超出范围,请填写0-100之间的数值!","Back","none")
	 response.end  
	 end if
  end if 
  end if
  
  
  if request("_BeginTime")<>"" then
  if  NOT IsDate(request("_BeginTime")) then
       call MsgBox("必须是日期!","Back","none")
     response.end  
  end if 
  end if
  
    if request("_EndTime")<>"" then
  if  NOT IsDate(request("_EndTime")) then
         call MsgBox("必须是日期!","Back","none")
    response.end  
  end if 
  end if
  
  if request("_LesName")="" then
         call MsgBox("名称不能为空,请先到员工基本信息里添加人!","Back","none")
          response.end  
		  else
		  if Len(request("_LesName"))>20 then
		   call MsgBox("名称超出20个字符了!","Back","none")
          response.end  
		  end if
  end if
 ' -------------------------------------------判断结束'
     Set rs = Server.CreateObject("ADODB.Recordset")
sql="select * from T_Hrms_Employees_Train_Record"
rs.open sql,ObjDB,3,3


rs.addnew

rs("LesName")=request("_LesName")
rs("LesCode")=request("_LesCode")
if  request("_LesTime")<>"" then
rs("LesTime")=request("_LesTime")
end if

if  not IsEmpty(request("_BeginTime"))  then
if  IsDate (request("_BeginTime")) then
rs("BeginTime")=request("_BeginTime")
end if
end if

if  not IsEmpty(request("_EndTime"))  then
if  IsDate (request("_EndTime")) then
rs("EndTime")=request("_EndTime")
end if
end if

if  request("_Score")<>"" then
rs("Score")=request("_Score")
end if
rs("TestResult")=request("_TestResult")

if  request("_Fee")<>"" then
rs("Fee")=request("_Fee")
end if
rs("CreatorID")=AddNewComID(ObjDBT)

rs.update
'添加日志
dim FirstMenu,SecondMenu,Opertion,OTime,OName,OIP,ODesc,OChang
OIP=Request.ServerVariables("REMOTE_ADDR")
OName= Session("AccountName") 

if OName="administrator" then
OName="系统管理员"
end if

call AddLog("员工管理","培训纪录","新增",now(),OName ,OIP,"","",ObjDB)

'日志结束
rs.close
 ObjDB.Close
  Set ObjDB = Nothing
   ObjDBT.Close
   Set ObjDBT = Nothing
  Response.Redirect "List.asp"
  
End If
Sub Main
%>


<HTML><HEAD>
  <form action="" method="post" >
  <input type=hidden name=_AccountID value=<%=Session("AccountID")%>>
  <table class=Ltable cellspacing=1 cellpadding=3>
    <tr class=LHtr align="middle">
    <td width="15%">新增培训纪录</td>
    <td width="85%"> </td>
  </tr>
   
  <tr class=Ltr>
      <td align="center">课程代号</td>
    <td><select type="text" class=Input Check=0  name="_LesCode"  style="width: 150;" >
	<%=SelectValue(ObjDB,"Select ID,LesCode from T_Hrms_Employees_Train_Lesson")
	%>
	</SELECT></td>
  </tr>
  <tr class=Ltr>
      <td align="center">姓名</td>
    <td><select type="text" class=Input Check=0  name="_LesName"  style="width: 150;" >
	<%=SelectValue(ObjDB,"Select ID,Name from t_Hrms_Employees_UsersBasic")
	%>
	</SELECT>
	</td>
  </tr>
  <tr class=Ltr>
      <td align="center">培训时限</td>
    <td><input type="text" class=Input Check=0  name="_LesTime" value="">
        天</td>
  </tr>
  <tr class=Ltr>
      <td align="center">开始时间</td>
    <td><input type="text" class=Input Check=0  onclick="InputDate(this)" readonly="true"   name="_BeginTime" value=""></td>
  </tr>
  <tr class=Ltr>
      <td align="center">结束时间</td>
    <td><input type="text" class=Input Check=0  name="_EndTime"  readonly="true"   onclick="InputDate(this)" value=""></td>
  </tr>
  <tr class=Ltr>
      <td align="center">成绩</td>
    <td><input type="text" class=Input Check=0  name="_Score" value="">
        分</td>
  </tr>
  <tr class=Ltr>
      <td align="center">测试</td>
    <td><select  name="_TestResult">
          <option value="0">优</option>
          <option value="1">良</option>
          <option value="2">及格</option>
          <option value="3">差</option>
        </select>
      </td>
  </tr>
  <tr class=Ltr>
      <td align="center">费用</td>
    <td><input type="text" class=Input Check=0  name="_Fee" value="">
        元</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 + -