61 lines
2.7 KiB
Plaintext
61 lines
2.7 KiB
Plaintext
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
|
|
<%@ page import="weaver.general.Util" %>
|
|
<%@ page import="java.math.BigDecimal"%>
|
|
<%@ page import="weaver.hrm.HrmUserVarify" %>
|
|
<%@ page import="weaver.hrm.User" %>
|
|
<%@ page import="java.util.Map" %>
|
|
<%@ page import="java.util.HashMap" %>
|
|
<%@ page import="net.sf.json.JSONObject,weaver.common.StringUtil" %>
|
|
|
|
<jsp:useBean id="RecordSet" class="weaver.conn.RecordSet" scope="page" />
|
|
<jsp:useBean id="strUtil" class="weaver.common.StringUtil" scope="page" />
|
|
<jsp:useBean id="dateUtil" class="weaver.common.DateUtil" scope="page" />
|
|
<jsp:useBean id="HrmScheduleDiffUtil" class="weaver.hrm.report.schedulediff.HrmScheduleDiffUtil" scope="page" />
|
|
<jsp:useBean id="ResourceComInfo" class="weaver.hrm.resource.ResourceComInfo" scope="page" />
|
|
<jsp:useBean id="DepartmentComInfo" class="weaver.hrm.company.DepartmentComInfo" scope="page" />
|
|
<%
|
|
|
|
String action = request.getParameter("action");
|
|
String returnString="";
|
|
User user = new User();
|
|
|
|
|
|
if("getLeaveDays".equals(action)){//根据起始日期、起始时间、结束日期、结束时间获得请假天数
|
|
String fromDate=Util.null2String(request.getParameter("fromDate"));
|
|
String fromTime=Util.null2String(request.getParameter("fromTime"));
|
|
String toDate=Util.null2String(request.getParameter("toDate"));
|
|
String toTime=Util.null2String(request.getParameter("toTime"));
|
|
int resourceId=Util.getIntValue(request.getParameter("resourceId"),0);
|
|
String departmentId=ResourceComInfo.getDepartmentID(""+resourceId);
|
|
String subCompanyId=DepartmentComInfo.getSubcompanyid1(departmentId);
|
|
|
|
String sqlHrmResource = "select locationid from HrmResource where id ='"+resourceId+"'";
|
|
RecordSet.executeSql(sqlHrmResource);
|
|
String locationid = "";
|
|
if (RecordSet.next()){
|
|
locationid=RecordSet.getString("locationid");
|
|
}
|
|
String sqlHrmLocations = "select countryid from HrmLocations where id='"+locationid+"'";
|
|
RecordSet.executeSql(sqlHrmLocations);
|
|
String countryId = "";
|
|
if (RecordSet.next()){
|
|
countryId = RecordSet.getString("countryid");
|
|
}
|
|
user.setCountryid(countryId);
|
|
HrmScheduleDiffUtil.setUser(user);
|
|
if(fromDate.length()!=10||toDate.length()!=10){
|
|
returnString="0";
|
|
}else{
|
|
String _totalWorkingHours=HrmScheduleDiffUtil.getTotalWorkingHours(fromDate,fromTime,toDate,toTime,Util.getIntValue(subCompanyId,0));
|
|
BigDecimal totalWorkingHours = new BigDecimal(_totalWorkingHours);
|
|
returnString=totalWorkingHours.divide(new BigDecimal(0.5),0,BigDecimal.ROUND_CEILING).multiply(new BigDecimal(0.5)).toString();
|
|
}
|
|
Map daymap = new HashMap();
|
|
daymap.put("resourceId", resourceId);
|
|
daymap.put("days", returnString);
|
|
|
|
JSONObject jo = JSONObject.fromObject(daymap);
|
|
returnString = jo.toString();
|
|
out.print(returnString);
|
|
}
|
|
%> |