📄 addnew.asp
字号:
<% option explicit%>
<!-- #include virtual="include/MyFunc.asp" -->
<!-- #include virtual="include/DataEnvi.asp" -->
<!-- #include virtual="Include/SelectValue.asp" -->
<!-- #include virtual="include/Roles.asp" -->
<%
Dim ObjDB,StrSQL
Dim C
Dim IntID,rs,sql,ObjRS,ObjRSH,ObjDBF,ObjDBT
Session("Table_id")=""
Session("TableName")=""
Set ObjDB= Server.CreateObject("ADODB.Connection")
OpenDBH ObjDB
Set ObjDBT= Server.CreateObject("ADODB.Connection")
OpenDB ObjDBT
StrSQL = "Select Count(*) From T_Hrms_Sys_Contract "
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("_FirBegDate")="" then'aaa
call MsgBox("首次签订合同的开始时间不能为空!","Back","none")
response.end
end if
if request("_FirEndDate")="" then'aaa
call MsgBox("首次签订合同的结束时间不能为空!","Back","none")
response.end
end if
if request("_ConCode")="" then
call MsgBox("合同代号不能为空!","Back","none")
response.end
else
if Len(request("_ConCode"))>10 then
call MsgBox("合同代号超出10个字符了!","Back","none")
response.end
end if
end if
if request("_ConName")="" then
call MsgBox("名称不能为空,请先到员工基本信息进行设置!","Back","none")
response.end
else
if Len(request("_ConName"))>20 then
call MsgBox("合同名称超出20个字符了!","Back","none")
response.end
end if
end if
if request("_ConDesc")<>"" then
if Len(request("_ConDesc"))>200 then
call MsgBox("合同备注信息超出200个字符了!","Back","none")
response.end
end if
end if
if CInt(DateDiff("y", cdate(request("_FirBegDate")), cdate(request("_FirEndDate"))))<0 then
call MsgBox("首次合同开始日期超过结束日期了!","Back","none")
response.end
end if
' -------------------------------------------判断结束'
Set rs = Server.CreateObject("ADODB.Recordset")
sql="select * from T_Hrms_Employees_ConName"
rs.open sql,ObjDB,3,3
rs.addnew
Sql="select Count(*) from T_Hrms_Employees_ConName where ConCode='" & trim(request("_ConCode"))&"'"
Set ObjRS = ObjDB.Execute(Sql)
if ObjRS(0) = 0 Then
rs("ConCode")=request("_ConCode")
rs("ConName")=request("_ConName")
rs("FirBegDate")=request("_FirBegDate")
rs("FirEndDate")=request("_FirEndDate")
rs("ConType")=request("_ConType")
if CInt(DateDiff("yyyy", cdate(request("_FirBegDate")), cdate(request("_FirEndDate"))))<>0 then
rs("FirTerm")=CInt(DateDiff("yyyy", cdate(request("_FirBegDate")), cdate(request("_FirEndDate"))))
else
rs("FirTerm")=1
end if
'
rs("AddTerm")=rs("FirTerm")
rs("LastTerm")=request("_FirEndDate")
rs("ConDesc")=request("_ConDesc")
rs("ConContent")=request("_ConContent")
rs("CreatorID")=AddNewComID(ObjDBT)
If Request.Form("Attachs")<>"" Then
rs("Attachs") = ","&Request.Form ("Attachs")
End If
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"
else
call MsgBox("该名称已经存在了!","Back","none")
response.end
end IF
End If
Sub Main
%>
<script language=javascript>
var IsHTML = 1
function setIsHTML(t)
{
var f = document.forms[0]
IsHTML = t
TBody1.style.display = "none"
TBody2.style.display = "none"
if(t==0)
{
TBody1.style.display = ""
if(BodyFrame.getText()!="")
f.BodyText.value = BodyFrame.getText()
}
if(t==1)
{
TBody2.style.display = ""
if(f.BodyText.value!="")
BodyFrame.setHTML(f.BodyText.value)
}
}
function MyCheck(f)
{
if(IsHTML==0)
f.Body.value = f.BodyText.value
else
f.Body.value = BodyFrame.getHTML()
return CheckForm(f)
}
function EditAttach()
{
var r =window.showModalDialog("../../Attach/Index.asp?IDs=" + document.forms[0].Attachs.value + "&BasePath=ContractAttach&R=" + Math.random(),"AttachWin","dialogHeight=240px,dialogWidth=420px,resizable=No,status=1,scrollbars=1");
if(r!=null)
{
ReturnAttachs(r)
}
}
function ReturnAttachs(v)
{
document.forms[0].AttachsShow.value = v[0]
document.forms[0].Attachs.value = v[1]
}
</script>
<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><input type="text" class=Input Check=0 name="_ConCode"></td>
</tr>
<tr class=Ltr>
<td align="center">姓名</td>
<td> <select type="text" class=Input Check=0 name="_ConName" 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 name="_FirBegDate" type="text" class=Input id="_FirBegDate" readonly="true" onclick="InputDate(this)" Check=0></td>
</tr>
<tr class=Ltr>
<td height="39" align="center">首次合同结束日期</td>
<td><input name="_FirEndDate" type="text" id="_FirEndDate" readonly="true" onclick="InputDate(this)" ></td>
</tr>
<tr class=Ltr>
<td align="center">合同类型</td>
<td><select type="text" class=Input Check=0 name="_ConType" style="width: 150;" >
<%=SelectValue(ObjDB,"Select ID,ConName from T_Hrms_Sys_Contract")
%> </SELECT> </td>
</tr>
<tr class=Ltr>
<td align="center">续签合同开始日期</td>
<td><input name="_AddBegDate" type="text" class="readonlyinput" id="_AddBegDate" Check=0 readonly="true" end if%>
</td>
</tr>
<tr class=Ltr>
<td align="center">续签合同结束日期</td>
<td><input name="_AddEndDate" type="text" class="readonlyinput" id="_AddEndDate" readonly="true" Check=0></td>
</tr>
<tr class=Ltr>
<td align="center">最后合同到期时间</td>
<td><input name="_LastTerm" type="text" class="readonlyinput" id="_LastTerm" Check=0 readonly="true" value=""></td>
</tr>
<tr class=Ltr>
<td align="center">累计合同期限</td>
<td><input name="_AddTerm" type="text" class="readonlyinput" id="_AddTerm" Check=0 readonly="true" value="0">
年</td>
</tr>
<tr class=Ltr>
<td align="center">续签次数</td>
<td><input name="_AddNum" type="text" id="_AddNum" class="readonlyinput" readonly="true" value="0">
次</td>
</tr>
<tr class=Ltr>
<td align="center">合同备注</td>
<td><textarea name="_ConDesc" cols="60" rows="10" class="Input" id="_ConDesc" check="0"></textarea></td>
</tr>
<tr class=Ltr>
<td align="center">合同内容</td>
<td><textarea name="_ConContent" cols="60" rows="10" class="Input" id="_ConContent" check="0"></textarea></td>
</tr>
<tr class=Ltr>
<td align="center">添加附件</td>
<td><input name=AttachsShow class=Input disabled value=""> <input name=Attachs type=hidden>
<input onclick="EditAttach()" type=button class=button 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 + -