📄 contract_add.jsp
字号:
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*"%>
<%@ page import="java.util.Date"%>
<%@ page import="com.zh.conpool.Condata"%>
<%@ page import="com.zh.util.*"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>合同添加</title>
<link href="../css/style1.css" rel="stylesheet">
</head>
<script language="javascript">
<!--
function CheckDates(INDate)
{ if (INDate=="")
{return true;}
subYY=INDate.substr(0,4)
//转换月份
if(INDate.indexOf('-',0)!=-1){ separate="-"}
else{
if(INDate.indexOf('/',0)!=-1){separate="/"}
else {return true;}}
area=INDate.indexOf(separate,0)
subMM=INDate.substr(area+1,INDate.indexOf(separate,area+1)-(area+1))
if(subMM.length<2){subMM="0"+subMM}
//转换日
area=INDate.lastIndexOf(separate)
subDD=INDate.substr(area+1,INDate.length-area-1)
if(eval(subDD)<10){subDD="0"+eval(subDD)}
NewDate=subYY+"-"+subMM+"-"+subDD
if(NewDate.length!=10){return true;}
if(NewDate.substr(4,1)!="-"){return true;}
if(NewDate.substr(7,1)!="-"){return true;}
if(NewDate.substr(5,2)>"12"){return true;}
if(NewDate.substr(8,2)>"31"){return true;}
return false;}
-->
</script>
<script language="javascript">
<!--
function check(){
if(form1.text1.value==""){
alert("请输入你的合同编号");
form1.text1.focus();
return false;
}
if(form1.text2.value==""){
alert("请输入你的合同名称");
form1.text2.focus();
return false;
}
if(form1.text3.value==""){
alert("请输入你的客户名称");
form1.text3.focus();
return false;
}
if(form1.text4.value==""){
alert("请输入项目名称");
form1.text4.focus();
return false;
}
if(form1.text5.value==""){
alert("请输入合同的签约金额");
form1.text5.focus();
return false;
}else if(isNaN(form1.text5.value)){
alert("请输入数值型数据");
form1.text5.focus();
return false;
}
if(form1.text6.value==""){
alert("输入的签约的日期不能为空");
form1.text6.focus();
return false;
}else{
if(CheckDates(form1.text6.value)){
alert("输入的日期格式有误");
form1.text6.focus();
return false;
}
}
if(form1.text7.value==""){
alert("结束日期不能空");
form1.text7.focus();
return false;
}else{
if(CheckDates(form1.text7.value)){
alert("输入的日期格式有误");
form1.text7.focus();
return false;
}
}
if(form1.text8.value==""){
alert("请输入签约人");
form1.text8.focus();
return false;
}
}
-->
</script>
<body>
<%
Date dat=new Date();
String tag=request.getParameter("tag");
if(tag.equals("1")){
%>
<br>
<img src="../images/Manual1.gif" width="16" height="16"> 签订新合同
<hr color="#006699" size="1">
<table width="100%" border="1" cellspacing="0" cellpadding="0" bordercolor="#FFFFFF" bordercolordark="#EEF2F9" bordercolorlight="#FFFFFF">
<form action="Contract_Add_Update.jsp" method="post" name="form1" target="bottomFrame">
<tr align="center">
<td width="12%" height="25">合同编号</td>
<td width="20%" align="left"><input name="text1" type="text" class="txt_grey"></td>
<td width="13%">合同名称</td>
<td width="20%" align="left"><input name="text2" type="text" class="txt_grey"></td>
<td width="12%">客户名称</td>
<td width="23%" align="left">
<select name="text3" class="wenbenkuang">
<option>---请选择---</option>
<%
Condata con=new Condata();
Connection conn=con.getConnection();
ClientSql client=new ClientSql();
ResultSet rs=con.executeQuery(client.getClient());
while(rs.next()){
String clientname=rs.getString(2);
out.println("<option value="+clientname+">"+clientname+"</option>");
}
%>
</select>
</td>
</tr>
<tr align="center">
<td>项目名称</td>
<td align="left"><input name="text4" type="text" class="txt_grey"></td>
<td height="25">签约金额</td>
<td height="25" align="left"><input name="text5" type="text" class="txt_grey"></td>
<td height="25">签约日期</td>
<td height="25" align="left"><input name="text6" type="text" class="txt_grey" value="<%=dat.toLocaleString().substring(0,9)%>"></td>
</tr>
<tr align="center">
<td height="25">完成日期</td>
<td height="25" align="left"><input name="text7" type="text" class="txt_grey" value="<%=dat.toLocaleString().substring(0,9)%>">
</td>
<td height="25">签约人</td>
<td height="25" align="left">
<select name="text8" class="wenbenkuang">
<option>---请选择---</option>
<%
ResultSet rst=con.executeQuery(client.getPerson());
while(rst.next()){
String person=rst.getString(3);
out.println("<option value="+person+">"+person+"</option>");
}
%>
</select></td>
<td height="25"> </td>
<td height="25" align="left"> </td>
</tr>
<tr align="center" bgcolor="#EEF2F9">
<td height="26" colspan="6"><input name="Submit" type="submit" class="btn_grey" onClick="return check()" value="保存">
<input name="Submit2" type="reset" class="btn_grey" value="重置"></td>
</tr>
</form>
</table>
<%
try{
conn.close();
conn=null;
}catch(Exception e){
}
try{
con.close();
con=null;
}catch(Exception e){
}
}else if(tag.equals("2")){
%>
<jsp:useBean id="cont" class="com.zh.util.contractgetsql"></jsp:useBean>
<br>
<img src="../images/Manual1.gif" width="16" height="16"> 修订合同
<hr color="#006699" size="1">
<table width="100%" border="1" cellspacing="0" cellpadding="0" bordercolor="#FFFFFF" bordercolordark="#EEF2F9" bordercolorlight="#FFFFFF">
<form action="Contract_Add_Update.jsp" method="post" name="form1" target="bottomFrame">
<tr align="center">
<%
String id=request.getParameter("id");
cont.RsSql(id);
%>
<td width="12%" height="25">合同编号</td>
<td width="20%" align="left"><input name="text1" type="text" class="txt_grey" value="<%=cont.getText1()%>"></td>
<td width="13%">合同名称</td>
<td width="20%" align="left"><input name="text2" type="text" class="txt_grey" value="<%=cont.getText2()%>"></td>
<td width="12%">客户名称</td>
<td width="23%" align="left">
<input name="text3" type="text" class="txt_grey" value="<%=cont.getText3()%>">
</td>
</tr>
<tr align="center">
<td>项目名称</td>
<td align="left"><input name="text4" type="text" class="txt_grey" value="<%=cont.getText4()%>"></td>
<td height="25">签约金额</td>
<td height="25" align="left"><input name="text5" type="text" class="txt_grey" value="<%=cont.getText5()%>"></td>
<td height="25">签约日期</td>
<td height="25" align="left"><input name="text6" type="text" class="txt_grey" value="<%=cont.getText6()%>"></td>
</tr>
<tr align="center">
<td height="25">完成日期</td>
<td height="25" align="left"><input name="text7" type="text" class="txt_grey" value="<%=cont.getText7()%>">
</td>
<td height="25">签约人</td>
<td height="25" align="left">
<input name="text8" type="text" class="txt_grey" value="<%=cont.getText8()%>">
</td>
<td height="25"> </td>
<td height="25" align="left"> </td>
</tr>
<tr align="center" bgcolor="#EEF2F9">
<td height="26" colspan="6"><input name="Submit" type="submit" class="btn_grey" onClick="return check()" value="修改">
<input name="Submit2" type="reset" class="btn_grey" value="重置"></td>
<input name="modify" type="hidden" value="modify">
<input name="id" type="hidden" value="<%=id%>">
</tr>
</form>
</table>
<%
}
%>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -