<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<head>
<title>日历表格</title>
<script language="javascript" type="text/javascript">
function initdata(){
var myDate = new Date();
var nianyue="";
var nianchinese="";
if($("#selTime").val()!=null && $("#selTime").val()!=""){
nianyue=$("#selTime").val();
nianchinese=baodate2chinese(nianyue+"-01");
}else{
nianyue=myDate.getFullYear()+""; //获取当前年份(2位)
nianchinese=baodate2chinese(nianyue+"-01-01");
}
nianchinese=nianchinese.substr(0,4)+"年";
var deptId=$(".crm_select option:selected").val();
var strs= new Array(); //定义一数组
strs=nianyue.split("-"); //字符分割
var new_date = new Date(strs[0],strs[1],1);
var monthLength=new Date(new_date.getTime()-1000*60*60*24).getDate();
//alert(parseInt(dd));
//table添加tr td
var yuefen="";
if(strs[1]=="01")
yuefen="一月";
else if(strs[1]=="02")
yuefen="二月";
else if(strs[1]=="03")
yuefen="三月";
else if(strs[1]=="04")
yuefen="四月";
else if(strs[1]=="05")
yuefen="五月";
else if(strs[1]=="06")
yuefen="六月";
else if(strs[1]=="07")
yuefen="七月";
else if(strs[1]=="08")
yuefen="八月";
else if(strs[1]=="09")
yuefen="九月";
else if(strs[1]=="10")
yuefen="十月";
else if(strs[1]=="11")
yuefen="十一月";
else if(strs[1]=="12")
yuefen="十二月";
var strTemp = "<table id='calendar' class='table' border='0' cellspacing='0' cellpadding='0'><tr><td width='100' style='display:none'></td><td style='display:none'></td><td colspan='"+(parseInt(monthLength)+2)+"' align='center'>"+nianchinese+yuefen+"</td></tr><tr>";
var temp=" ";
//得到当月的所有假期
strTemp+="<input type='text' value=<s:property value="yueholidays" /> id='hol' style='display:none'>"
strTemp += "<td width='100px;'>" + "项目参与人员"+ "</td><td></td>";
for(var i = 1; i <= parseInt(monthLength); i++){
strTemp += "<td width='18px;'>" + i + "</td>";
}
strTemp += "</tr>";
var show="none";
var yueholiday="<s:property value="yueholidays" />"; //1,5,9,12,16,19,26
var holidayarr=new Array();
holidayarr=yueholiday.split(",");
<s:iterator value="#request.allEmpList" status="empinfoList" >
var aczstartdayarr=new Array();
var aczenddayarr=new Array();
var acstartdayarr=new Array();
var acenddayarr=new Array();
var acstartday="<s:property value="ACSTARTDAY" />"; //1,4 //获取开始时间
var acendday="<s:property value="ACENDDAY" />"; //4,9 //获取结束时间
var startday="<s:property value="STARTDAY" />"; //1,4,7 //获取开始时间
var endday="<s:property value="ENDDAY" />"; //4,9,12 //获取结束时间
var proname="<s:property value="PRONAME" />"; //获取项目名称
var colour="<s:property value="COLOUR" />"; //获取项目颜色
var zstartdayarr=new Array();
var zenddayarr=new Array();
var startdayarr=new Array();
var enddayarr=new Array();
var pronamearr=new Array();
var colourarr=new Array();
var douhao=0;
douhao=startday.split(",");
if(douhao!=0){
zstartdayarr=startday.split(","); //[1,8]
zenddayarr=endday.split(","); //[4,9]
aczstartdayarr=acstartday.split(","); //[1,8]
aczenddayarr=acendday.split(","); //[4,9]
pronamearr=proname.split(",");
colourarr=colour.split(",");
}else{
zstartdayarr[0]=startday;
zenddayarr[0]=endday;
aczstartdayarr[0]=acstartday;
aczenddayarr[0]=acendday;
pronamearr[0]=proname;
colourarr[0]=colour;
}
zstartdayarr.forEach(function(data,index,arr){
startdayarr.push(+data);
});
zenddayarr.forEach(function(data,index,arr){
enddayarr.push(+data);
});
aczstartdayarr.forEach(function(data,index,arr){
acstartdayarr.push(+data);
});
aczenddayarr.forEach(function(data,index,arr){
acenddayarr.push(+data);
});
var startarrlength=enddayarr.length;
var begin=0;
show="block";
var s=0;
//存在字符转义问题 应先去掉空格
var empName="<s:property value="EMPNAME"/>";
empName= empName.replace(/\s+/g,"")
strTemp += "<tr ><td style='vertical-align:middle;'>"+"<s:property value="EMPNAME" />"+
"<input type='text' style='display:none' value="+empName+"></td>"+
"<td style='display:none' name='startTime'>"+
"<input type='text' value=<s:property value="STARTTIME" /> > </td>"+
"<td style='display:none' id='endTime'>"+
"<input type='text' value=<s:property value="ENDTIME" /> > </td>"+
"<td style='display:none' id='acstarttime'>"+
"<input type='text' value=<s:property value="ACSTARTTIME" /> > </td>"+
"<td style='display:none' id='acendtime'>"+
"<input type='text' value=<s:property value="ACENDTIME"/> > </td>"+
"<td style='display:none' id='proname'>"+
"<input type='text' value=<s:property value="PRONAME" /> ></td>"+
"<td style='display:none'>"+
"<input type='text' value=<s:property value="DEPNAME" /> ></td>"+
"<td style='display:none'>"+
"<input type='text' value=<s:property value="PROTOTALAMOUNT" /> ></td>"+
"<td width='28px;' height='18px;'>预订</td>";
for(var r = 1; r <= parseInt(monthLength); r++){
//var s=r-1;
var h=r-1;
if(s<startarrlength){
var begin=enddayarr[s];
var beginstart=startdayarr[s];
var biaozhi=r;
if(r<=begin && r>=beginstart){
if(r==holidayarr[h]){
strTemp +="<td width='18px;' class='hover' height='18px;' style='background-color:#E0E0E0'>" +temp + "</td>";
}else if(r>=startdayarr[s] && r<=enddayarr[s]){
strTemp +="<td width='18px;' class='hover' title='"+pronamearr[s]+"' height='18px;' style='background-color:"+colourarr[s]+"'>" +temp + "</td>";
}else{
strTemp +="<td width='18px;' height='18px;'>" + temp + "</td>";
}
}else{
begin=enddayarr[s];
beginstart=startdayarr[s];
if(startarrlength>1){
if(biaozhi>begin){
s+=1;
begin=enddayarr[s];
beginstart=startdayarr[s];
}
if(r==holidayarr[h]){
strTemp +="<td width='18px;' class='hover' height='18px;' style='background-color:#E0E0E0'>" +temp + "</td>";
}else if(r>=startdayarr[s] && r<=enddayarr[s]){
strTemp +="<td width='18px;' class='hover' title='"+pronamearr[s]+"' height='18px;' style='background-color:"+colourarr[s]+"'>" +temp + "</td>";
}else{
strTemp +="<td width='18px;' height='18px;'>" + temp + "</td>";
}
}else{
if(r==holidayarr[h]){
strTemp +="<td width='18px;' class='hover' height='18px;' style='background-color:#E0E0E0'>" +temp + "</td>";
}else if(r>=startdayarr[s] && r<=enddayarr[s]){
strTemp +="<td width='18px;' class='hover' title='"+pronamearr[s]+"' height='18px;' style='background-color:"+colourarr[s]+"'>" +temp + "</td>";
}else{
strTemp +="<td width='18px;' height='18px;'>" + temp + "</td>";
}
}
}
}else{
if(r==holidayarr[h]){
strTemp +="<td width='18px;' class='hover' height='18px;' style='background-color:#E0E0E0'>" +temp + "</td>";
}else{
strTemp +="<td width='18px;' height='18px;'>" + temp + "</td>";
}
//strTemp +="<td width='18px;' height='18px;'>" + temp + "</td>";
}
}
strTemp += "</tr>";
//acstartdayarr [0,0,0]
//acenddayarr [0,0,]
if(acstartdayarr[0]!=0 && startdayarr[0]!=0){
begin=0;
startarrlength=acenddayarr.length;
s=0;
strTemp += "<tr><td style='vertical-align:middle;'>"+"<s:property value="EMPNAME" />"+"</td><td id='topdashed' width='28px;' height='18px;'>实际</td>";
for(var r = 1; r <= parseInt(monthLength); r++){
//var s=r-1;
var h=r-1;
if(s<startarrlength){
var begin=acenddayarr[s];
var beginstart=acstartdayarr[s];
var biaozhi=r;
if(r<=begin && r>=beginstart){
if(r==holidayarr[h]){
strTemp +="<td width='18px;' class='hover' id='topdashed' height='18px;' style='background-color:#E0E0E0'>" +temp + "</td>";
}else if(r>=acstartdayarr[s] && r<=acenddayarr[s]){
strTemp +="<td width='18px;' class='hover' id='topdashed' title='"+pronamearr[s]+"' height='18px;' style='background-color:"+colourarr[s]+"'>" +temp + "</td>";
}else{
strTemp +="<td width='18px;' id='topdashed' height='18px;'>" + temp + "</td>";
}
}else{
begin=acenddayarr[s];
beginstart=acstartdayarr[s];
if(startarrlength>1){
if(biaozhi>begin){
s+=1;
begin=acenddayarr[s];
beginstart=acstartdayarr[s];
}
if(r==holidayarr[h]){
strTemp +="<td width='18px;' class='hover' id='topdashed' height='18px;' style='background-color:#E0E0E0'>" +temp + "</td>";
}else if(r>=acstartdayarr[s] && r<=acenddayarr[s]){
strTemp +="<td width='18px;' class='hover' id='topdashed' title='"+pronamearr[s]+"' height='18px;' style='background-color:"+colourarr[s]+"'>" +temp + "</td>";
}else{
strTemp +="<td width='18px;' id='topdashed' height='18px;'>" + temp + "</td>";
}
}else{
if(r==holidayarr[h]){
strTemp +="<td width='18px;' class='hover' id='topdashed' height='18px;' style='background-color:#E0E0E0'>" +temp + "</td>";
}else if(r>=acstartdayarr[s] && r<=acenddayarr[s]){
strTemp +="<td width='18px;' class='hover' id='topdashed' title='"+pronamearr[s]+"' height='18px;' style='background-color:"+colourarr[s]+"'>" +temp + "</td>";
}else{
strTemp +="<td width='18px;' id='topdashed' height='18px;'>" + temp + "</td>";
}
}
}
}else{
if(r==holidayarr[h]){
strTemp +="<td width='18px;' class='hover' id='topdashed' height='18px;' style='background-color:#E0E0E0'>" +temp + "</td>";
}else{
strTemp +="<td width='18px;' id='topdashed' height='18px;'>" + temp + "</td>";
}
//strTemp +="<td width='18px;' height='18px;'>" + temp + "</td>";
}
}
strTemp += "</tr>";
}
</s:iterator>
strTemp += "</table>";
document.getElementById("calendardiv").style.display=show;
document.getElementById("summaryresult").style.display=show;
document.getElementById("calendardiv").innerHTML=strTemp;
}
</script>
</head>
<body >
<div id="calendardiv" style="display: none;">
</div>
</body>
</html>
pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<head>
<title>日历表格</title>
<script language="javascript" type="text/javascript">
function initdata(){
var myDate = new Date();
var nianyue="";
var nianchinese="";
if($("#selTime").val()!=null && $("#selTime").val()!=""){
nianyue=$("#selTime").val();
nianchinese=baodate2chinese(nianyue+"-01");
}else{
nianyue=myDate.getFullYear()+""; //获取当前年份(2位)
nianchinese=baodate2chinese(nianyue+"-01-01");
}
nianchinese=nianchinese.substr(0,4)+"年";
var deptId=$(".crm_select option:selected").val();
var strs= new Array(); //定义一数组
strs=nianyue.split("-"); //字符分割
var new_date = new Date(strs[0],strs[1],1);
var monthLength=new Date(new_date.getTime()-1000*60*60*24).getDate();
//alert(parseInt(dd));
//table添加tr td
var yuefen="";
if(strs[1]=="01")
yuefen="一月";
else if(strs[1]=="02")
yuefen="二月";
else if(strs[1]=="03")
yuefen="三月";
else if(strs[1]=="04")
yuefen="四月";
else if(strs[1]=="05")
yuefen="五月";
else if(strs[1]=="06")
yuefen="六月";
else if(strs[1]=="07")
yuefen="七月";
else if(strs[1]=="08")
yuefen="八月";
else if(strs[1]=="09")
yuefen="九月";
else if(strs[1]=="10")
yuefen="十月";
else if(strs[1]=="11")
yuefen="十一月";
else if(strs[1]=="12")
yuefen="十二月";
var strTemp = "<table id='calendar' class='table' border='0' cellspacing='0' cellpadding='0'><tr><td width='100' style='display:none'></td><td style='display:none'></td><td colspan='"+(parseInt(monthLength)+2)+"' align='center'>"+nianchinese+yuefen+"</td></tr><tr>";
var temp=" ";
//得到当月的所有假期
strTemp+="<input type='text' value=<s:property value="yueholidays" /> id='hol' style='display:none'>"
strTemp += "<td width='100px;'>" + "项目参与人员"+ "</td><td></td>";
for(var i = 1; i <= parseInt(monthLength); i++){
strTemp += "<td width='18px;'>" + i + "</td>";
}
strTemp += "</tr>";
var show="none";
var yueholiday="<s:property value="yueholidays" />"; //1,5,9,12,16,19,26
var holidayarr=new Array();
holidayarr=yueholiday.split(",");
<s:iterator value="#request.allEmpList" status="empinfoList" >
var aczstartdayarr=new Array();
var aczenddayarr=new Array();
var acstartdayarr=new Array();
var acenddayarr=new Array();
var acstartday="<s:property value="ACSTARTDAY" />"; //1,4 //获取开始时间
var acendday="<s:property value="ACENDDAY" />"; //4,9 //获取结束时间
var startday="<s:property value="STARTDAY" />"; //1,4,7 //获取开始时间
var endday="<s:property value="ENDDAY" />"; //4,9,12 //获取结束时间
var proname="<s:property value="PRONAME" />"; //获取项目名称
var colour="<s:property value="COLOUR" />"; //获取项目颜色
var zstartdayarr=new Array();
var zenddayarr=new Array();
var startdayarr=new Array();
var enddayarr=new Array();
var pronamearr=new Array();
var colourarr=new Array();
var douhao=0;
douhao=startday.split(",");
if(douhao!=0){
zstartdayarr=startday.split(","); //[1,8]
zenddayarr=endday.split(","); //[4,9]
aczstartdayarr=acstartday.split(","); //[1,8]
aczenddayarr=acendday.split(","); //[4,9]
pronamearr=proname.split(",");
colourarr=colour.split(",");
}else{
zstartdayarr[0]=startday;
zenddayarr[0]=endday;
aczstartdayarr[0]=acstartday;
aczenddayarr[0]=acendday;
pronamearr[0]=proname;
colourarr[0]=colour;
}
zstartdayarr.forEach(function(data,index,arr){
startdayarr.push(+data);
});
zenddayarr.forEach(function(data,index,arr){
enddayarr.push(+data);
});
aczstartdayarr.forEach(function(data,index,arr){
acstartdayarr.push(+data);
});
aczenddayarr.forEach(function(data,index,arr){
acenddayarr.push(+data);
});
var startarrlength=enddayarr.length;
var begin=0;
show="block";
var s=0;
//存在字符转义问题 应先去掉空格
var empName="<s:property value="EMPNAME"/>";
empName= empName.replace(/\s+/g,"")
strTemp += "<tr ><td style='vertical-align:middle;'>"+"<s:property value="EMPNAME" />"+
"<input type='text' style='display:none' value="+empName+"></td>"+
"<td style='display:none' name='startTime'>"+
"<input type='text' value=<s:property value="STARTTIME" /> > </td>"+
"<td style='display:none' id='endTime'>"+
"<input type='text' value=<s:property value="ENDTIME" /> > </td>"+
"<td style='display:none' id='acstarttime'>"+
"<input type='text' value=<s:property value="ACSTARTTIME" /> > </td>"+
"<td style='display:none' id='acendtime'>"+
"<input type='text' value=<s:property value="ACENDTIME"/> > </td>"+
"<td style='display:none' id='proname'>"+
"<input type='text' value=<s:property value="PRONAME" /> ></td>"+
"<td style='display:none'>"+
"<input type='text' value=<s:property value="DEPNAME" /> ></td>"+
"<td style='display:none'>"+
"<input type='text' value=<s:property value="PROTOTALAMOUNT" /> ></td>"+
"<td width='28px;' height='18px;'>预订</td>";
for(var r = 1; r <= parseInt(monthLength); r++){
//var s=r-1;
var h=r-1;
if(s<startarrlength){
var begin=enddayarr[s];
var beginstart=startdayarr[s];
var biaozhi=r;
if(r<=begin && r>=beginstart){
if(r==holidayarr[h]){
strTemp +="<td width='18px;' class='hover' height='18px;' style='background-color:#E0E0E0'>" +temp + "</td>";
}else if(r>=startdayarr[s] && r<=enddayarr[s]){
strTemp +="<td width='18px;' class='hover' title='"+pronamearr[s]+"' height='18px;' style='background-color:"+colourarr[s]+"'>" +temp + "</td>";
}else{
strTemp +="<td width='18px;' height='18px;'>" + temp + "</td>";
}
}else{
begin=enddayarr[s];
beginstart=startdayarr[s];
if(startarrlength>1){
if(biaozhi>begin){
s+=1;
begin=enddayarr[s];
beginstart=startdayarr[s];
}
if(r==holidayarr[h]){
strTemp +="<td width='18px;' class='hover' height='18px;' style='background-color:#E0E0E0'>" +temp + "</td>";
}else if(r>=startdayarr[s] && r<=enddayarr[s]){
strTemp +="<td width='18px;' class='hover' title='"+pronamearr[s]+"' height='18px;' style='background-color:"+colourarr[s]+"'>" +temp + "</td>";
}else{
strTemp +="<td width='18px;' height='18px;'>" + temp + "</td>";
}
}else{
if(r==holidayarr[h]){
strTemp +="<td width='18px;' class='hover' height='18px;' style='background-color:#E0E0E0'>" +temp + "</td>";
}else if(r>=startdayarr[s] && r<=enddayarr[s]){
strTemp +="<td width='18px;' class='hover' title='"+pronamearr[s]+"' height='18px;' style='background-color:"+colourarr[s]+"'>" +temp + "</td>";
}else{
strTemp +="<td width='18px;' height='18px;'>" + temp + "</td>";
}
}
}
}else{
if(r==holidayarr[h]){
strTemp +="<td width='18px;' class='hover' height='18px;' style='background-color:#E0E0E0'>" +temp + "</td>";
}else{
strTemp +="<td width='18px;' height='18px;'>" + temp + "</td>";
}
//strTemp +="<td width='18px;' height='18px;'>" + temp + "</td>";
}
}
strTemp += "</tr>";
//acstartdayarr [0,0,0]
//acenddayarr [0,0,]
if(acstartdayarr[0]!=0 && startdayarr[0]!=0){
begin=0;
startarrlength=acenddayarr.length;
s=0;
strTemp += "<tr><td style='vertical-align:middle;'>"+"<s:property value="EMPNAME" />"+"</td><td id='topdashed' width='28px;' height='18px;'>实际</td>";
for(var r = 1; r <= parseInt(monthLength); r++){
//var s=r-1;
var h=r-1;
if(s<startarrlength){
var begin=acenddayarr[s];
var beginstart=acstartdayarr[s];
var biaozhi=r;
if(r<=begin && r>=beginstart){
if(r==holidayarr[h]){
strTemp +="<td width='18px;' class='hover' id='topdashed' height='18px;' style='background-color:#E0E0E0'>" +temp + "</td>";
}else if(r>=acstartdayarr[s] && r<=acenddayarr[s]){
strTemp +="<td width='18px;' class='hover' id='topdashed' title='"+pronamearr[s]+"' height='18px;' style='background-color:"+colourarr[s]+"'>" +temp + "</td>";
}else{
strTemp +="<td width='18px;' id='topdashed' height='18px;'>" + temp + "</td>";
}
}else{
begin=acenddayarr[s];
beginstart=acstartdayarr[s];
if(startarrlength>1){
if(biaozhi>begin){
s+=1;
begin=acenddayarr[s];
beginstart=acstartdayarr[s];
}
if(r==holidayarr[h]){
strTemp +="<td width='18px;' class='hover' id='topdashed' height='18px;' style='background-color:#E0E0E0'>" +temp + "</td>";
}else if(r>=acstartdayarr[s] && r<=acenddayarr[s]){
strTemp +="<td width='18px;' class='hover' id='topdashed' title='"+pronamearr[s]+"' height='18px;' style='background-color:"+colourarr[s]+"'>" +temp + "</td>";
}else{
strTemp +="<td width='18px;' id='topdashed' height='18px;'>" + temp + "</td>";
}
}else{
if(r==holidayarr[h]){
strTemp +="<td width='18px;' class='hover' id='topdashed' height='18px;' style='background-color:#E0E0E0'>" +temp + "</td>";
}else if(r>=acstartdayarr[s] && r<=acenddayarr[s]){
strTemp +="<td width='18px;' class='hover' id='topdashed' title='"+pronamearr[s]+"' height='18px;' style='background-color:"+colourarr[s]+"'>" +temp + "</td>";
}else{
strTemp +="<td width='18px;' id='topdashed' height='18px;'>" + temp + "</td>";
}
}
}
}else{
if(r==holidayarr[h]){
strTemp +="<td width='18px;' class='hover' id='topdashed' height='18px;' style='background-color:#E0E0E0'>" +temp + "</td>";
}else{
strTemp +="<td width='18px;' id='topdashed' height='18px;'>" + temp + "</td>";
}
//strTemp +="<td width='18px;' height='18px;'>" + temp + "</td>";
}
}
strTemp += "</tr>";
}
</s:iterator>
strTemp += "</table>";
document.getElementById("calendardiv").style.display=show;
document.getElementById("summaryresult").style.display=show;
document.getElementById("calendardiv").innerHTML=strTemp;
}
</script>
</head>
<body >
<div id="calendardiv" style="display: none;">
</div>
</body>
</html>