📄 jcy_pxb_submit.jsp
字号:
<%@ page contentType="text/html; charset=GBK" language="java" import="java.sql.*,com.vstsoft.std.*" errorPage="" %>
<meta http-equiv="Content-Type" content="text/html; charset=GBK">
<jsp:useBean id="jcypurview" class="com.vstsoft.jcypurview" scope = "session" />
<html>
<%vststd std = new vststd();%>
<%
String pxxh_id = std.getValue(request,"ID"); // 培训班代码
String szt = std.getValue(request,"zt"); // 按钮类别
String imager = "";
String lry =""; //录入人
String lrsj = ""; //录入时间
int ixy = 0;
%>
<%
if (jcypurview.checkLogin() == false)
{
%>
<Script Language=javascript>
alert("用户已断线或未正常登录,请重新登录!")
window.open("../index.htm","_top")
</Script>
<% return;
}
if (szt.equals("del"))
{
if (jcypurview.purviewVerdict("B0500034") == false) //判断是否有删除权限
{
%>
<Script Language=javascript>
alert("您没有操作此页权限!")
window.open("../index.jsp","_top")
</Script>
<% return;
}
}
if (szt.equals("modify"))
{
if (jcypurview.purviewVerdict("B0500033") == false) //判断是否有修改权限
{
%>
<Script Language=javascript>
alert("您没有操作此页权限!")
window.open("../index.jsp","_top")
</Script>
<% return;
}
}
if (szt.equals("new"))
{
if (jcypurview.purviewVerdict("B0500032") == false) //判断是否有新增权限
{
%>
<Script Language=javascript>
alert("您没有操作此页权限!")
window.open("../index.jsp","_top")
</Script>
<% return;
}
}%>
<%
String nowuserid = jcypurview.getUserid(); //取当前用户编号
String nowusername = jcypurview.getUserName(); //取当前用户名称
String nowuserszqx = jcypurview.getUserSzqx(); //取当前用户所在区县
String nowuserszdw = jcypurview.getUserSzdw(); //取当前用户所在单位
%>
<%
//新增培训班
if ( szt.equals("new"))
{
String year = std.getValue(request,"year").trim(); //培训年度
if (year.length() > 4)
{
imager = "年度长度不能超过4位!";
ixy = 1;
}
String pxqc = std.getValue(request,"pxqc").trim(); //培训班期次
if (ixy != 1)
{
if (pxqc.length()> 20)
{
ixy = 1;
imager = "培训班期次长度不能超过20位!";
}
}
String pxrs = std.getValue(request,"pxrs").trim(); //培训人数
if (ixy !=1)
{
if (pxrs.length() > 9)
{
imager = "培训人数长度不能超过9位!";
ixy = 1;
}
}
String pxbm = std.getValue(request,"pxbm"); //培训组织部门
String pxqr = std.getValue(request,"rq"); //培训起时间
String pxzr = std.getValue(request,"rqr"); //培训止时间
if (ixy != 1)
{
String newpxqz = "select count(*) from dual where to_date('"+pxzr+"','yyyy.mm.dd') >= to_date('"+pxqr+"','yyyy.mm.dd')";
sun.jdbc.rowset.CachedRowSet ii = std.getResultBySelect(newpxqz);
ii.next();
String newjl = ii.getString(1);
if (newjl.equals("0"))
{
imager = "请输入正确时间!";
ixy = 1;
}
}
if (ixy == 0)
{
String lrrq = std.getDateStr("YYYY.MM.DD"); //取数据库时间
String qunianqi="select count(*) from jcy_pxb where pxbm='"+pxbm+"' and pxqc='"+pxqc+"' and year='"+year+"'";
sun.jdbc.rowset.CachedRowSet v_qunianqi = std.getResultBySelect(qunianqi);
v_qunianqi.next();
String p_qunianqi=v_qunianqi.getString(1);
if (p_qunianqi.equals("0"))
{
String pxxh ="SELECT LPAD(SEQ_jcyID.NEXTVAL,10,'0') FROM DUAL"; //单位序号
sun.jdbc.rowset.CachedRowSet crs = std.getResultBySelect("SELECT LPAD(SEQ_jcyID.NEXTVAL,10,'0') FROM DUAL");
crs.next();
String suserid = crs.getString(1);
//新增单位信息
String sql_insert = "insert into jcy_pxb (pxxh) values ('"+suserid+"')";
int isi = std.getResultByUpdate(sql_insert);
if (isi == 1 )
{
String sql_update = "update jcy_pxb set pxbm='"+pxbm+"', pxqr=to_date('"+pxqr+"','YYYY.MM.DD'), pxzr=to_date('"+pxzr+"','YYYY.MM.DD'), pxrs='"+pxrs+"',pxqc='"+pxqc+"',year='"+year+"',lry='"+nowuserid+"',lrsj=to_date('"+lrrq+"','YYYY.MM.DD') where pxxh = '"+suserid+"'";
int isu = std.getResultByUpdate(sql_update);
if (isu == 1)
{
imager = "保存成功!";
//return;
}else
{
ixy = 1;
imager = "新增失败!";
}
}
}
else
{
imager = "已经存在此培训班期次";
ixy = 1;
}
}
}
//修改培训班
if (szt.equals("modify"))
{
String year = std.getValue(request,"year").trim(); //培训年度
if (year.length() > 4)
{
imager = "年度长度不能超过4位!";
ixy = 1;
}
String pxqc = std.getValue(request,"pxqc").trim(); //培训班期次
if (ixy != 1)
{
if (pxqc.length()> 20)
{
ixy = 1;
imager = "培训班期次长度不能超过20位!";
}
}
String pxrs = std.getValue(request,"pxrs").trim(); //培训人数
if (ixy !=1)
{
if (pxrs.length() > 9)
{
imager = "培训人数长度不能超过9位!";
ixy = 1;
}
}
String pxbm = std.getValue(request,"pxbm"); //培训组织部门
String pxqr = std.getValue(request,"rq"); //培训起时间
String pxzr = std.getValue(request,"rqr"); //培训止时间
if (ixy != 1)
{
String pxqz = "select count(*) from dual where to_date('"+pxzr+"','yyyy.mm.dd') >= to_date('"+pxqr+"','yyyy.mm.dd')";
sun.jdbc.rowset.CachedRowSet ii = std.getResultBySelect(pxqz);
ii.next();
String jl = ii.getString(1);
if (jl.equals("0"))
{
imager = "请输入正确时间!";
ixy = 1;
}
}
String lrrq = std.getDateStr("YYYY.MM.DD"); //取数据库时间
if(ixy == 0)
{
//判断是否没有修改
String xg = "select pxqc from jcy_pxb where pxxh = '"+pxxh_id+"'";
sun.jdbc.rowset.CachedRowSet v_xg = std.getResultBySelect(xg);
v_xg.next();
String pi_xg =v_xg.getString(1);
//判断如果没有修改过
if (!pi_xg.equals(pxqc))
{
String qunianqi="select count(*) from jcy_pxb where pxbm='"+pxbm+"' and pxqc='"+pxqc+"' and year='"+year+"'";
sun.jdbc.rowset.CachedRowSet v_qunianqi = std.getResultBySelect(qunianqi);
v_qunianqi.next();
String pi_qunianqi=v_qunianqi.getString(1);
if (pi_qunianqi.equals("0"))
{
String sql_modify_update = "update jcy_pxb set pxbm='"+pxbm+"', pxqr=to_date('"+pxqr+"','YYYY.MM.DD'), pxzr=to_date('"+pxzr+"','YYYY.MM.DD'), pxrs='"+pxrs+"',pxqc='"+pxqc+"',year='"+year+"',lry='"+nowuserid+"',lrsj=to_date('"+lrrq+"','YYYY.MM.DD') where pxxh = '"+pxxh_id+"'";
int imodify = std.getResultByUpdate(sql_modify_update);
if (imodify == 1 )
{
imager = "修改成功!";
}
else
{
ixy = 1;
imager = "修改失败!";
}
}
else
{
imager = "已经存在此培训班期次";
ixy = 1;
}
}
else
{
//如果要是没有修改过,保存记录
String sql_modify_update = "update jcy_pxb set pxbm='"+pxbm+"', pxqr=to_date('"+pxqr+"','YYYY.MM.DD'), pxzr=to_date('"+pxzr+"','YYYY.MM.DD'), pxrs='"+pxrs+"',pxqc='"+pxqc+"',year='"+year+"',lry='"+nowuserid+"',lrsj=to_date('"+lrrq+"','YYYY.MM.DD') where pxxh = '"+pxxh_id+"'";
int imodify = std.getResultByUpdate(sql_modify_update);
if (imodify == 1 )
{
imager = "修改成功!";
}
else
{
ixy = 1;
imager = "修改失败!";
}
}
}
}
//删除培训班信息
if(szt.equals("del"))
{
String sql_del = "delete from jcy_pxb where pxxh = '"+pxxh_id+"'";
int idel = std.getResultByUpdate(sql_del);
if (idel == 1)
{
//imager = "减少成功!";
imager = "删除成功!";
// return;
}else
{
ixy = 1;
imager = "删除失败!";
}
}
%>
<head>
<title>
</title>
</head>
<body onLoad="parent.f_imager('<%=imager%>','<%=ixy%>')">
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -