HrmResourceSalaryLog.jsp
8.28 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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@page import="weaver.hrm.common.database.dialect.DialectUtil"%>
<%@ include file="/systeminfo/init_wev8.jsp" %>
<%@ page import="weaver.general.Util" %>
<%@ page import="java.util.*" %>
<%@ taglib uri="/WEB-INF/weaver.tld" prefix="wea"%>
<jsp:useBean id="rs" class="weaver.conn.RecordSet" scope="page" />
<jsp:useBean id="rs1" class="weaver.conn.RecordSet" scope="page" />
<jsp:useBean id="BankComInfo" class="weaver.hrm.finance.BankComInfo" scope= "page"/>
<jsp:useBean id="ResourceComInfo" class="weaver.hrm.resource.ResourceComInfo" scope="page" />
<jsp:useBean id="SalaryComInfo" class="weaver.hrm.finance.SalaryComInfo" scope="page" />
<jsp:useBean id="HrmListValidate" class="weaver.hrm.resource.HrmListValidate" scope="page" />
<jsp:useBean id="CheckSubCompanyRight" class="weaver.systeminfo.systemright.CheckSubCompanyRight" scope="page" />
<jsp:useBean id="DepartmentComInfo" class="weaver.hrm.company.DepartmentComInfo" scope="page"/>
<HTML>
<%
boolean isfromtab = Util.null2String(request.getParameter("isfromtab")).equals("true")?true:false;
String id = Util.null2String(request.getParameter("id"));
if(id.equals("")) id=String.valueOf(user.getUID());
Calendar thedate = Calendar.getInstance ();
//String yearmonth = Util.add0(thedate.get(thedate.YEAR), 4) +"-"+Util.add0(thedate.get(thedate.MONTH) + 1, 2) ;
String yearmonth="";
String yearmonthsql="select distinct(max(p.paydate)) yearmonth from Hrmsalarypaydetail d left join Hrmsalarypay p on d.payid=p.id where hrmid='"+id+"' and sent=1 ";
rs.executeSql(yearmonthsql);
if(rs.next()){
yearmonth=Util.null2String(rs.getString("yearmonth"));
}
int hrmid = user.getUID();
int departmentid = user.getUserDepartment();
boolean ishe = (hrmid == Util.getIntValue(id));
boolean ishr = (HrmUserVarify.checkUserRight("HrmResourceEdit:Edit",user,departmentid));
boolean ishasF =HrmUserVarify.checkUserRight("HrmResourceWelfareEdit:Edit",user);
//if(!ishe&&!ishr ){
if(!ishe&&!ishasF ){
response.sendRedirect("/notice/noright.jsp") ;
return;
}
%>
<HEAD>
<LINK href="/css/Weaver_wev8.css" type=text/css rel=STYLESHEET>
</HEAD>
<%
String imagefilename = "/images/hdMaintenance_wev8.gif";
String titlename = SystemEnv.getHtmlLabelName(367,user.getLanguage())+":"+SystemEnv.getHtmlLabelName(189,user.getLanguage())+SystemEnv.getHtmlLabelName(87,user.getLanguage());
String needfav ="1";
String needhelp ="";
int detachable=Util.getIntValue(String.valueOf(session.getAttribute("detachable")),0);
int operatelevel=0;
if(detachable==1){
String deptid=ResourceComInfo.getDepartmentID(id);
String subcompanyid=DepartmentComInfo.getSubcompanyid1(deptid) ;
if(subcompanyid == null || subcompanyid.equals("")){
subcompanyid = "0";
}
operatelevel=CheckSubCompanyRight.ChkComRightByUserRightCompanyId(user.getUID(),"HrmResourceEdit:Edit",Integer.parseInt(subcompanyid));
}else{
if(HrmUserVarify.checkUserRight("HrmResourceEdit:Edit", user))
operatelevel=2;
}
%>
<BODY>
<%if(!request.getParameter("from").equals("psersonalView")){ %>
<%@ include file="/systeminfo/RightClickMenuConent_wev8.jsp" %>
<%@ include file="/systeminfo/TopTitle_wev8.jsp" %>
<%@ include file="/systeminfo/RightClickMenu_wev8.jsp" %>
<%} %>
<%
boolean show = false;
if(isfromtab){
if(HrmListValidate.isValidate(61))show= true;
}else{
show = true;
}
if(show){%>
<TABLE class="ListStyle" cellspacing=1 >
<thead>
<tr class="HeaderForXtalbe intervalTR">
<%
boolean isLight = false;
ArrayList itemlist=new ArrayList();
ArrayList salaryitems = new ArrayList() ;
ArrayList salarys = new ArrayList() ;
int payid=0;
String sql="select a.id,b.itemid ,b.salary from HrmSalaryPay a,HrmSalaryPaydetail b,hrmsalaryitem c where a.id=b.payid and REPLACE(REPLACE(b.itemid,'_1',''),'_2','')=convert(varchar,c.id) and c.isshow='1' and b.sent=1 and a.paydate='"+yearmonth+"' and b.hrmid = " + id +" order by c.showorder,b.itemid";
if("oracle".equalsIgnoreCase(rs.getDBType())){
sql="select a.id,b.itemid ,b.salary from HrmSalaryPay a,HrmSalaryPaydetail b,hrmsalaryitem c where a.id=b.payid and to_number(REPLACE(REPLACE(b.itemid,'_1',''),'_2',''))=c.id and c.isshow='1' and b.sent=1 and a.paydate='"+yearmonth+"' and b.hrmid = " + id +" order by c.showorder,b.itemid";
}else if(DialectUtil.isMySql(rs.getDBType())){
sql="select a.id,b.itemid ,b.salary from HrmSalaryPay a,HrmSalaryPaydetail b,hrmsalaryitem c where a.id=b.payid and REPLACE(REPLACE(b.itemid,'_1',''),'_2','')=convert(c.id,char) and c.isshow='1' and b.sent=1 and a.paydate='"+yearmonth+"' and b.hrmid = " + id +" order by c.showorder,b.itemid";
}
rs.executeSql(sql);
while( rs.next() ) {
if(payid==0) payid=rs.getInt("id");
String itemid = rs.getString("itemid") ;
String salary = rs.getString("salary") ;
if(salaryitems.indexOf(itemid)<0){
salaryitems.add(itemid) ;
salarys.add(salary) ;
}
}
sql="select a.id,b.itemid ,b.salary from HrmSalaryPay a,HrmSalaryPaydetail b where a.id=b.payid and b.sent=1 and a.paydate='"+yearmonth+"'and b.hrmid = " + id +" and REPLACE(REPLACE(b.itemid,'_1',''),'_2','') not in(select convert(varchar,id) from hrmsalaryitem) order by b.itemid";
if("oracle".equalsIgnoreCase(rs.getDBType())){
sql="select a.id,b.itemid ,b.salary from HrmSalaryPay a,HrmSalaryPaydetail b where a.id=b.payid and b.sent=1 and a.paydate='"+yearmonth+"'and b.hrmid = " + id +" and to_number(REPLACE(REPLACE(b.itemid,'_1',''),'_2','')) not in(select id from hrmsalaryitem) order by b.itemid";
}else if(DialectUtil.isMySql(rs.getDBType())){
sql="select a.id,b.itemid ,b.salary from HrmSalaryPay a,HrmSalaryPaydetail b where a.id=b.payid and b.sent=1 and a.paydate='"+yearmonth+"'and b.hrmid = " + id +" and REPLACE(REPLACE(b.itemid,'_1',''),'_2','') not in(select convert(id,char) from hrmsalaryitem) order by b.itemid";
}
rs.executeSql(sql);
while( rs.next() ) {
if(payid==0) payid=rs.getInt("id");
String itemid = rs.getString("itemid") ;
String salary = rs.getString("salary") ;
if(salaryitems.indexOf(itemid)<0){
salaryitems.add(itemid) ;
salarys.add(salary) ;
}
}
if(salaryitems.size()<1){
itemlist=SalaryComInfo.getSubCompanySalary(Util.getIntValue(DepartmentComInfo.getSubcompanyid1(ResourceComInfo.getDepartmentID(id))));
}else{
itemlist=salaryitems;
}
%>
<TH style="TEXT-ALIGN:LEFT;TEXT-VALIGN:middle"><nobr><%=SystemEnv.getHtmlLabelName(97,user.getLanguage())%></TH>
<%
for(int i=0;i<itemlist.size();i++) {
String itemid=(String)itemlist.get(i);
if(itemid.indexOf("_")>-1) itemid=itemid.substring(0,itemid.indexOf("_"));
String itemname = SalaryComInfo.getSalaryname(itemid);
String itemtype = SalaryComInfo.getSalaryItemtype(itemid);
if( !itemtype.equals("9") ) {
%>
<TH style="TEXT-ALIGN:LEFT;TEXT-VALIGN:middle"><nobr><%=itemname%></TH>
<% } else {i++;%>
<TH style="TEXT-ALIGN:LEFT"><nobr><%=itemname+"("+SystemEnv.getHtmlLabelName(6087,user.getLanguage())+")"%></TH>
<TH style="TEXT-ALIGN:LEFT"><nobr><%=itemname+"("+SystemEnv.getHtmlLabelName(1851,user.getLanguage())+")"%></TH>
<% }
}
%>
</tr>
</thead>
<TBODY>
<%
if(salaryitems.size()>0){
isLight = !isLight ;
%>
<tr class='<%=( isLight ? "datalight" : "datadark" )%>'>
<td><nobr><%=yearmonth%></td>
<%
for(int j=0;j<itemlist.size();j++){
String itemid = (String)itemlist.get(j) ;
String titles="";
boolean iscaltype=false;
int salaryindex=salaryitems.indexOf(itemid);
String salary = "0.00" ;
if(salaryindex>-1){
salary=(String)salarys.get(salaryindex);
}
if(itemid.indexOf("_")<0){
if(SalaryComInfo.getSalaryItemtype(itemid).equals("4")){
iscaltype=true;
}
}else{
iscaltype=true;
}
if(iscaltype){
titles=SalaryComInfo.getTitles(Util.getIntValue(id),itemid,payid,user.getLanguage(),yearmonth);
}
%>
<td title="<%=titles%>" <%if(!titles.equals("")){%>style="cursor:hand"<%}%>><nobr><%=salary%></td>
<%
}
%>
</tr>
<%
}
%>
</TBODY>
</TABLE>
<%}%>
</BODY>
</HTML>