<%@ page contentType="text/html; charset=utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="cm" uri="/commons-tags" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>每日考勤统计</title>
<link href="../resources/style/base.css" rel="stylesheet" type="text/css"/>
<s:include value="../common/head.jsp" />
<script language="javascript" src="../code/vm/ExtCodeJs.htm"></script>
<script language="javascript" src="../resources/js/calendar/calendar.js"></script>
<script type="text/javascript">
function typeInit(){
	$month=$("#attMonth");
	msgConfirm("您确认要重新初始化"+$month.val()+"的考勤统计吗？",function(){
		iframeWindow("../common/message_dir.jsp?url="+encodeURIComponent("<s:url action='attTotalMonthInit'/>?monthTotal.attMonth="+$month.val()),550,300,"初始化考勤月统计",refreshWindow);
	});	
}

function typeEdit(){
	if(getCheckedCount("sid")!=1){
		msgAlert("请选择一条您要修改的记录。");
		return;
	}
	iframeWindow("<s:url action='attTotalMonthEdit'/>?monthTotal.id="+getCheckedValue("sid"),550,400,"修改考勤月统计",refreshWindow);
}

function typeFreeze(){
	$month=$("#attMonth");
	msgConfirm("您确认要对"+$month.val()+"的考勤统计进行封帐操作吗？",function(){
		iframeWindow("<s:url action='attTotalMonthFreeze'/>?monthTotal.attMonth="+$month.val(),400,200,"考勤月统计封帐",refreshWindow);
	});	
}

function typeUnfreeze(){
	$month=$("#attMonth");
	msgConfirm("您确认要对"+$month.val()+"的考勤统计进行解封操作吗？",function(){
		iframeWindow("<s:url action='attTotalMonthUnfreeze'/>?monthTotal.attMonth="+$month.val(),400,200,"考勤月统计解封",refreshWindow);
	});	
}

function changeMonth(v){
	$am=$("#attMonth");
	$am.val(addMonth($am.val(),v));
	query();
}
</script>
</head>

<body>
<div class="body_list">
  <s:include value="../common/body.jsp" />
  <s:form action="attTotalMonthManage" id="queryForm" onsubmit="return checkForm(this)">
    <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="table_line">
      <tr class="form_title">
        <td colspan="5">查询条件</td>
      </tr>
      <tr class="form_item">
        <td width="28%">月份：
          <input type="button" value="&lt;" title="前一个月" onclick="changeMonth(-1)" />
		  <s:textfield id="attMonth" name="monthTotal.attMonth" readonly="true" onClick="showCalendar('yyyyMM',this,false)" cssClass="date_input" cssStyle="width:60px;"/>
		  <input type="button" value="&gt;" title="后一个月" onclick="changeMonth(1)" /></td>
        <td width="28%">工号：
          <s:textfield name="monthTotal.emplInfo.emplNo" title="工号必须为数字。"  cssStyle="width:100px;"/></td>
        <td width="34%">姓名：
          <s:textfield name="monthTotal.emplInfo.name" cssStyle="width:100px;"/></td>
        <td width="10%" align="center"><input name="q" value="查 询" onclick="query()" type="button" /></td>
      </tr>
    </table>
    <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0"  style="margin:15px 0 5px 0;" >
      <tr>
        <td width="66%">
          <s:if test="totalFlag==null">
            <input type="button" name="add" onclick="typeInit()" value="初始化"/>
          </s:if>
          <s:else>
            <s:if test="!(totalFlag.isFreeze)">
              <input type="button" name="add" onclick="typeInit()" value="重新初始化"/>
              <input type="button" name="edit" onclick="typeEdit()" value="手工修改"/>
              <input type="button" name="free" onclick="typeFreeze()" value="封 帐"/>
            </s:if>
            <s:else>
              <input type="button" name="free" onclick="typeUnfreeze()" value="解 封"/>
            </s:else>
          </s:else>
		&nbsp;&nbsp;&nbsp;&nbsp;
		<strong> 日期范围：</strong><s:date name="beginDate" format="yyyy-MM-dd"/>至<s:date name="endDate" format="yyyy-MM-dd"/>
		</td>
      </tr>
    </table>
    <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="table_line">
      <tr class="list_title">
        <td width="3%" align="center"><input type="radio" name="array" onclick="checkedAll(this)" value="checkbox" /></td>
        <td width="5%">月份</td>
        <td width="5%">工号</td>
        <td width="5%">姓名</td>
        <td width="10%">部门</td>
        <td width="8%">全勤</td>
        <td width="7%">出勤</td>
        <td width="6%">缺勤</td>
        <td width="6%">旷工</td>
        <td width="5%">迟到</td>
        <td width="5%">早退</td>
        <td width="6%">请假</td>
        <td width="11%">请假明细</td>
        <td width="13%">普通|周末|节日加班</td>
        <td width="5%">出差</td>
      </tr>
      <s:iterator value="monthTotalList" status="st">
        <s:set name="row_cls" value=""/>
        <s:if test="#st.Even">
          <s:set name="row_cls" value="%{'row_a'}"/>
        </s:if>
        <s:set name="error_row" value=""/>
        <s:if test="exception!=null">
          <s:set name="error_row" value="%{'error_row'}"/>
        </s:if>
        <tr class="list_data <s:property value='#row_cls'/> <s:property value='#error_row'/>">
          <td align="center"><input type="radio" name="array" value="<s:property value='id'/>" lang="sid"/></td>
          <td class="center"><s:property value="attMonth"/></td>
          <td class="center"><s:property value="emplInfo.emplNo"/></td>
          <td class="center"><s:property value="emplInfo.name"/></td>
          <td><s:property value="emplInfo.emplOrg.fullName"/></td>
          <td class="center"><s:property value="attTimes"/>
            小时</td>
          <td class="center"><s:property value="attendTimes"/>
            小时</td>
          <td class="center"><s:property value="absentTimes"/>
            小时</td>
          <td class="center"><s:property value="kuangTimes"/>
            小时</td>
          <td class="center"><s:property value="lateNum"/>
            次</td>
          <td class="center"><s:property value="earlyNum"/>
            次</td>
          <td class="center"><s:property value="leaveTimes"/>
            小时</td>
          <td style="padding: 0 5px;">
		  <s:if test="leaveMap!=null && leaveMap.size()>0">
		  	<s:iterator value="leaveMap.values()">
              <div style="padding:2px 0; text-align:right;"><s:property value="attLeaveType.name"/><s:property value="leaveTime"/>小时</div>
            </s:iterator>
		  </s:if>
		  <s:else>&nbsp;</s:else>
		  </td>
          <td class="center"><s:property value="normalOvertimes"/> | <s:property value="weekendOvertimes"/> | <s:property value="holidayOvertimes"/>
            小时</td>
          <td class="center"><s:property value="travelDays"/>
            天</td>
        </tr>
      </s:iterator>
    </table>
  <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="list_page">
    <tr>
      <td width="59%" style="text-align:left;">
	  <div class="info">
	  <strong>只统计</strong>审批通过、已备案、已销假的请假单；审批通过、已备案、已核准的非调休加班单；审批通过、已备案、已核销的出差单。	  </div>
	  </td>
	  <td width="41%" valign="top"><cm:pager/></td>
    </tr>
  </table>
  </s:form>
</div>
</body>
</html>