AnnualPeriodOperation.jsp
6.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
<%@ page import="weaver.general.Util" %>
<%@ page import="java.util.*" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" %> <%@ include file="/systeminfo/init_wev8.jsp" %>
<jsp:useBean id="SysMaintenanceLog" class="weaver.systeminfo.SysMaintenanceLog" scope="page" />
<jsp:useBean id="RecordSet" class="weaver.conn.RecordSet" scope="page" />
<jsp:useBean id="rs" class="weaver.conn.RecordSet" scope="page" />
<jsp:useBean id="SubCompanyComInfo" class="weaver.hrm.company.SubCompanyComInfo" scope="page" />
<jsp:useBean id="CheckSubCompanyRight" class="weaver.systeminfo.systemright.CheckSubCompanyRight" scope="page" />
<%
String operation = Util.null2String(request.getParameter("operation"));
String subcompanyid = Util.null2String(request.getParameter("subcompanyid"));
String sql = "";
String allsubcompanyid = SubCompanyComInfo.getSubCompanyTreeStr(subcompanyid+"")+subcompanyid;
ArrayList rightsub = SubCompanyComInfo.getRightSubCompany(user.getUID(),"AnnualPeriod:All");
String temp1=",";
int a[] = CheckSubCompanyRight.getSubComByUserRightId(user.getUID(),"AnnualPeriod:All");
for(int j=0;j<a.length;j++) {
temp1+=a[j]+",";
}
String temp = "";
if(rightsub!=null){
for(int i=0;i<rightsub.size();i++){
if((","+allsubcompanyid).indexOf(","+rightsub.get(i).toString()+",")>-1 && temp1.indexOf(","+rightsub.get(i).toString()+",")>-1 ) temp += rightsub.get(i).toString()+",";
}
}
allsubcompanyid = temp + subcompanyid;
if(operation.equals("add")){
if(!HrmUserVarify.checkUserRight("AnnualPeriod:All" , user)) {
response.sendRedirect("/notice/noright.jsp") ;
return ;
}
String annualyear = Util.null2String(request.getParameter("annualyear"));
String startdate = Util.null2String(request.getParameter("startdate"));
String enddate = Util.null2String(request.getParameter("enddate"));
sql = "select * from hrmannualperiod where annualyear = '" + annualyear + "' and subcompanyid='"+subcompanyid+"'";
RecordSet.executeSql(sql);
if(RecordSet.next()){
response.sendRedirect("AnnualPeriodAdd.jsp?msgid=12&subcompanyid="+subcompanyid);
return;
}
sql = "insert into hrmannualperiod (annualyear,startdate,enddate,subcompanyid) values ('" + annualyear + "','" + startdate + "','" + enddate + "','" + subcompanyid + "')";
RecordSet.executeSql(sql);
response.sendRedirect("AnnualPeriodAdd.jsp?isclose=1&subcompanyid="+subcompanyid);
}else if(operation.equals("edit")){
if(!HrmUserVarify.checkUserRight("AnnualPeriod:All" , user)) {
response.sendRedirect("/notice/noright.jsp") ;
return ;
}
String annualyear = Util.null2String(request.getParameter("annualyear"));
String startdate = Util.null2String(request.getParameter("startdate"));
String enddate = Util.null2String(request.getParameter("enddate"));
String id = Util.null2String(request.getParameter("id"));
sql = "select * from hrmannualperiod where annualyear = '" + annualyear + "' and id not in("+id+") and subcompanyid = '" + subcompanyid + "'";
RecordSet.executeSql(sql);
if(RecordSet.next()){
response.sendRedirect("AnnualPeriodEdit.jsp?isclose=1&msgid=12&id="+id+"&subcompanyid="+subcompanyid);
return;
}
sql = "update hrmannualperiod set annualyear = '"+annualyear+"',startdate = '" + startdate +"',enddate = '" + enddate + "' where id = " + id;
RecordSet.executeSql(sql);
response.sendRedirect("AnnualPeriodEdit.jsp?isclose=1&id="+id+"&subcompanyid="+subcompanyid);
}else if(operation.equals("delete")){
if(!HrmUserVarify.checkUserRight("AnnualPeriod:All" , user)) {
response.sendRedirect("/notice/noright.jsp") ;
return ;
}
String id = Util.null2String(request.getParameter("id"));
String ids = Util.null2String(request.getParameter("ids"));
if(!id.equals("")){
sql = "delete from hrmannualperiod where id = " + id;
}
if(!ids.equals("")){
ids = ids + "-1";
sql = "delete from hrmannualperiod where id in (" + ids + ")";
}
RecordSet.executeSql(sql);
response.sendRedirect("AnnualPeriodView.jsp?subcompanyid="+subcompanyid);
}else if(operation.equals("syn")){
if(!HrmUserVarify.checkUserRight("AnnualPeriod:All" , user)) {
response.sendRedirect("/notice/noright.jsp") ;
return ;
}
String ids = request.getParameter("ids");
if(ids.length()==0)ids="-1";
String _annualyear = "";
sql = "select * from hrmannualperiod where id in (" + ids + ")";
RecordSet.executeSql(sql);
while(RecordSet.next()){
_annualyear += RecordSet.getString("annualyear") + ",";
}
_annualyear += "-1";
sql = "delete from hrmannualperiod where subcompanyid in ("+allsubcompanyid+") and subcompanyid <> " + subcompanyid + " and annualyear in (" + _annualyear + ")";
RecordSet.executeSql(sql);
String _tempsubcompanyid[] = Util.TokenizerString2(allsubcompanyid,",");
sql = "select * from hrmannualperiod where subcompanyid = " + subcompanyid + " and id in (" + ids + ")";
RecordSet.executeSql(sql);
while(RecordSet.next()){
String annualyear = RecordSet.getString("annualyear");
String startdate = RecordSet.getString("startdate");
String enddate = RecordSet.getString("enddate");
for(int i=0;i<_tempsubcompanyid.length;i++){
if(_tempsubcompanyid[i].equals(subcompanyid)) continue;
sql = "insert into hrmannualperiod (annualyear,startdate,enddate,subcompanyid) values ('" + annualyear + "','" + startdate + "','" + enddate + "','" + _tempsubcompanyid[i] + "')";
rs.executeSql(sql);
}
}
response.sendRedirect("AnnualPeriodView.jsp?subcompanyid="+subcompanyid);
}else if(operation.equals("syndelete")){
if(!HrmUserVarify.checkUserRight("AnnualPeriod:All" , user)) {
response.sendRedirect("/notice/noright.jsp") ;
return ;
}
String ids = request.getParameter("ids") + "-1";
String _annualyear = "";
sql = "select * from hrmannualperiod where id in (" + ids + ")";
RecordSet.executeSql(sql);
while(RecordSet.next()){
_annualyear += RecordSet.getString("annualyear") + ",";
}
_annualyear += "-1";
sql = "delete from hrmannualperiod where subcompanyid in ("+allsubcompanyid+") and annualyear in (" + _annualyear + ")";
RecordSet.executeSql(sql);
response.sendRedirect("AnnualPeriodView.jsp?subcompanyid="+subcompanyid);
}
%>