<%@ page language="C#" autoeventwireup="true" inherits="GZ_system_N25175_Overtime_N25175_Overtime, GZQuery_deploy" enableEventValidation="false" %>

<!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>
    <title>操作</title>
    <script type="text/javascript" language="javascript" src="<%=ResolveUrl("~/GZ/control/easy_ui/jquery.min.js?v=1")%>"></script>
    <script type="text/javascript" language="javascript" src="<%=ResolveUrl("~/GZ/control/easy_ui/jquery.easyui.min.js?v=1")%>"></script>
    <script type="text/javascript" language="javascript" src="<%=ResolveUrl("~/GZ/control/easy_ui/locale/easyui-lang-zh_CN.js?v=1")%>"></script>
    <script type="text/javascript" language="javascript" src="<%=ResolveUrl("~/GZ/control/easy_ui/jquery.load.js?v=1")%>"></script>
    <script type="text/javascript" language="javascript" src="<%=ResolveUrl("~/GZ/control/easy_ui/jquery.json.js?v=1")%>"></script>
    <script type="text/javascript" language="javascript" src="<%=ResolveUrl("~/GZ/control/easy_ui/jquery.easyui.validtor.js?v=1")%>"></script>
    <script type="text/javascript" language="javascript" src="<%=ResolveUrl("~/GZ/control/js/PageDialog.js?v=1")%>"></script>
    <link rel="stylesheet" type="text/css" href="<%=ResolveUrl("~/GZ/control/easy_ui/themes/gray/easyui.css?v=1")%>" />
    <link rel="stylesheet" type="text/css" href="<%=ResolveUrl("~/GZ/control/easy_ui/themes/icon.css?v=1")%>" />
    <link rel="stylesheet" type="text/css" href="<%=ResolveUrl("~/GZ/control/easy_ui/load.css?v=1")%>" />
    <link rel="stylesheet" type="text/css" href="<%=ResolveUrl("~/GZ/control/css/main.css?v=1")%>" />
    
    <script type="text/javascript" language="javascript" src="<%=ResolveUrl("~/GZ/control/js/My97DatePicker/WdatePicker.js?v=1")%>"></script>
        
    <script language="javascript" type="text/javascript">
       function query(){
	        $("#dataview").datagrid("load",{
					e_name: $("#qo_eid").val(),
					e_number:$("#qe_number").val(),
					o_month: $("#qo_month").val(),
					o_cdate: $("#qo_cdate").val(),
					o_importKey: $("#qo_importKey").val()
			});
   	   }
   </script>
   
   
</head>
<body class="easyui-layout" style="visibility:hidden">
    <div region="center" border="false">
        <table id="dataview">
            <thead>
                <tr>  
					<th field="ck" checkbox="true"></th>
						<th field="id" width="80" formatter='OperFormat'>操作</th>
						<th field="o_eid" width="65" sortable="true" >所属员工</th> 
						<th field="e_number" width="150" >身份证号码</th>
						
						<th field="o_month" width="80" >所属月份</th>
						<th field="o_zhiwujintie" width="65" >职务津贴</th>
						<th field="o_xingzheng" width="65" >行政</th>
						<th field="o_keshijiegou" width="80" >课时结构费</th>
						<th field="o_caokeshifei" width="65" >超课时费</th>
						<th field="o_zaodufei" width="65" >早读费</th>
						<th field="o_wanzixi" width="65" >晚自习费</th>
						<th field="o_kaoqing" width="65" >考勤</th>
						<th field="o_kaoqingbeizhu" width="150" >考勤备注（文本）</th>
						<th field="o_heji" width="65" styler="o_hejiStyler" >合计</th>
						<th field="o_by1" width="120" >备用字段1（数值）</th>
						<th field="o_by2" width="120" >备用字段2（数值）</th>
						<th field="o_by3" width="120" >备用字段3（文本）</th>
						
						<th field="o_cdate" width="135" >创建日期</th>
						<th field="o_importKey" width="250" >导入编号</th>


				</tr>
            </thead>
        </table>
    </div>
    <div id="toolbar" >
        <a class="easyui-linkbutton" iconcls="icon-add" plain="true" onclick="Add()">添 加</a>
        <a class="easyui-linkbutton" iconcls="icon-remove" plain="true" onclick="deleteList()">删除</a>
        <a class="easyui-linkbutton" iconcls="icon-remove" plain="true" onclick="importOvertime()">导入Excel加班费</a>
        <br/>&nbsp;
        		所属员工 ：<input id="qo_eid"  type="text" maxlength="255" onkeydown= "if(event.keyCode==13)query()" style="width: 110px"/>
        		 身份证 ：<input id="qe_number"  type="text" maxlength="255" onkeydown= "if(event.keyCode==13)query()" style="width: 110px"/>
				所属月份 ：<input id="qo_month"  type="text" maxlength="255" onkeydown= "if(event.keyCode==13)query()" onfocus="WdatePicker({dateFmt:'yyyy-MM'})" style="width: 100px" />
				创建日期 ：<input id="qo_cdate"  type="text" maxlength="255" onkeydown= "if(event.keyCode==13)query()" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" style="width: 100px" />
				导入编号 ：<input id="qo_importKey"  type="text" maxlength="255" onkeydown= "if(event.keyCode==13)query()" style="width: 120px" />
		   
        <a class="easyui-linkbutton" iconcls="icon-search" plain="true" onclick="query()">查询 </a>
        <a class="easyui-linkbutton" iconcls="icon-book" plain="true" onclick="$('#dataview').datagrid('load',{})">全部显示</a>
    </div>
    
    <div id="OperMenu" class="easyui-menu" style="width:120px;">    
            <div onclick='editItem(currentMenuKey)' data-options="iconCls:'icon-edit'" >编辑信息</div>
            <div onclick='Add()' data-options="iconCls:'icon-add'" >添加信息</div>
            <div class="menu-sep"></div>
            <div onclick="deleteItem(currentMenuKey)" data-options="iconCls:'icon-cancel'">删除信息</div>
    </div>
    
</body>

<script language="javascript" type="text/javascript">
var currentMenuKey = null;
$(function(){

    $("#dataview").datagrid({
        toolbar:"#toolbar",
        fit:true,
        idfield:"id",
        border:false,
        pageSize:30,
        resizable:true,
        pagination:true,
        rownumbers:true,
        url:"N25175_Overtime_Dataview.aspx",
        onLoadSuccess:function(){ $('#dataview').datagrid("unselectAll"); },
        onRowContextMenu:function(e,rowindex,row){
            e.preventDefault();
            openMenu(e.pageX,e.pageY,row.id,row.isEdit,row.isDelete);
            $('#dataview').datagrid("unselectAll").datagrid("selectRow",rowindex);
        }
    });
    $("body").css("visibility","visible"); 
});
    function openMenu(left,top,id){
        $('#OperMenu').menu('show',{  
                left:left,  
                top: top 
        });
        currentMenuKey = id;
    }
		
	function OperFormat(value,row,index){
		return "<a href='javascript:void(0)' onclick=\"editItem('"+value+"')\">编辑</a>&nbsp;|&nbsp;<a href='javascript:void(0)' onclick=\"deleteItem('"+value+"')\">删除</a>";
	}	
	
	function o_hejiStyler(value,row,index){
	    return "color:red;background-color:#FFFFFF";
	}
	
	
	function deleteItem(key){
	     $.messager.confirm('确认','确定要删除选中吗?',function(r){
	     if(!r){ return }load("删除中...");
	             $.ajax({
	                type: "POST",
	                url:"N25175_Overtime_Delete.aspx",
	                dataType:"json",
	                data: {"deleteKey": key},
	                success: function(data){
	                  unload();
	                  if(data.state==1){
	                      $.messager.show({title: '提示', msg: data.data});
	                      $('#dataview').datagrid('reload').datagrid("unselectAll");
	                  }
	                  else{
	                     $.messager.alert('错误',data.data,'message');
	                  }
	               }
	            });
	     });
	}
	function deleteList(){
	     var row = $('#dataview').datagrid('getSelections');
	     if(row.length==0){$.messager.alert('提示',"请选择删除项！",'message'); return;}
	     $.messager.confirm('确认','确定要删除选中吗?',function(r){
	     if(r){
	                 load("删除中...");
	                 var list = new Array();
	                 for(var index =0; index<row.length;index++){ list.push(row[index].id);  }
	                 $.ajax({
	                    type: "POST",
	                    url:"N25175_Overtime_Delete.aspx",
	                    dataType:"json",
	                    data: {"deleteList": list.join(",")}, 
	                    success: function(data){
	                      unload();
	                      if(data.state==1){
	                          $.messager.show({ title: '提示', msg: "总共删除"+data.data+"条信息" });
	                          $('#dataview').datagrid('reload').datagrid("unselectAll");
	                      }else{
	                         $.messager.alert('错误',data.data,'message');
	                      }
	                   }
	                });
	     }
	     });
	}
	
	function editItem(key){
	    ShowDialog("edit","N25175_Overtime_Edit.aspx?id="+key,600,450,0,0,true);
	}
	function Add(){
	 	ShowDialog("add","N25175_Overtime_Insert.aspx",600,450,0,0,true);
	}
	
	function importOvertime(key){
	    ShowDialog("importOvertime","N25175_Overtime_Import.aspx",500,300,0,0,true);
	}
	
	function reload(param){
	    if(param=='last'){
	        var grid = $('#dataview'); 
	        var gridOptions = grid.datagrid("options"); 
	        var options = grid.datagrid('getPager').data("pagination").options;  
	        var pagenumber = options.total==0?1:Math.ceil( options.total/options.pageSize);
	        gridOptions.pageNumber = pagenumber 
	        options.pageNumber = pagenumber;
	        $('#dataview').datagrid('reload');
	    }
	    $('#dataview').datagrid('reload');
	}

    function reloadImport(key){
        $("#qo_importKey").val(key);
	    query();
    }
    

</script>

</html>
