<%@ page language="C#" autoeventwireup="true" inherits="GZ_system_N25175_Payroll_N25175_Payroll, 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: $("#qp_eid").val(),
                            p_month: $("#qp_month").val(),
                            e_number :$("#qe_number").val(),
                            p_importKey:$("#qp_ImportKey").val(),
                            p_cdate:$("#qp_cdate").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="p_eid" width="70" >所属员工</th>
						
						<th field="e_number" width="140" >身份证号码</th>
						
						
						<th field="p_month" width="120" sortable="true" >所属月份</th>
						<th field="p_yingfagongzi" width="65" sortable="true" >应发工资</th>
						<th field="p_gangweigongzi" width="65" sortable="true" >岗位工资</th>
						<th field="p_xinjigongzi" width="65" sortable="true" >薪级工资</th>
						<th field="p_gaodinggognzi" width="65" sortable="true" >高定工资</th>
						<th field="p_baoliudiqubutie" width="100" sortable="true" >保留地区补贴</th>
						<th field="p_baoliudiqubutieliue" width="120" sortable="true" >保留地区补贴保留额</th>
						<th field="p_guojiajiankubianyuandiqujintie" width="130" sortable="true" >国家艰苦边远地区津贴</th>
						<th field="p_gangweijintie" width="65" sortable="true" >岗位津贴</th>
						<th field="p_narujixiaogongzidehuogongzi" width="150" sortable="true" >纳入绩效工资的活工资</th>
						<th field="p_jixiaogognzi" width="65" sortable="true" >绩效工资</th>
						<th field="p_bufagongzi" width="65" sortable="true" >补发工资</th>
						<th field="p_gerenjibenyiliaobaoxian" width="150" sortable="true" >（个人）基本医疗保险</th>
						<th field="p_shiyedanweishiyebaoxian" width="150" sortable="true" >（个人）事业单位失业保险</th>
						<th field="p_dabingyiliaojiuzhujin" width="150" sortable="true" >（个人）大病医疗救助金</th>
						<th field="p_zhufanggongjijin" width="120" sortable="true" >（个人）住房公积金</th>
						<th field="p_gerensuodeshuei" width="100" sortable="true" >个人所得税</th>
						<th field="p_daikou1" width="65" sortable="true" >代扣1</th>
						<th field="p_daikou2" width="65" sortable="true" >代扣2</th>
						<th field="p_yingfazongeheji" width="100" sortable="true" styler="o_hejiStyler" >应发总额合计</th>
						<th field="p_shifazongeheji" width="100" sortable="true" styler="o_hejiStyler"  >实发总额合计</th>
						

                        <th field="p_cdate" width="130" sortable="true" >录入日期</th>
                        <th field="p_importKey" width="250" sortable="true" >导入操作编号</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="importPayroll()">导入Excel工资表</a>
        <br/>&nbsp;
        		所属员工 ：<input id="qp_eid"  type="text" maxlength="255" onkeydown= "if(event.keyCode==13)query()" style="width: 104px"/>
		        身份证 ：<input id="qe_number"  type="text" maxlength="255" onkeydown= "if(event.keyCode==13)query()" style="width: 120px"/>
		        所属月份 ：<input id="qp_month"  type="text" maxlength="255" onkeydown= "if(event.keyCode==13)query()" onfocus="WdatePicker({dateFmt:'yyyy-MM'})" style="width: 101px"/>
		        创建日期 ：<input id="qp_cdate"  type="text" maxlength="255" onkeydown= "if(event.keyCode==13)query()" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" style="width: 101px"/>
		        
		        导入操作编号 ：<input id="qp_ImportKey"  type="text" maxlength="255" onkeydown= "if(event.keyCode==13)query()" style="width: 101px"/>			
        <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_Payroll_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 o_hejiStyler(value,row,index){
	    return "color:red; background-color:#FFFFFF";
	}
	
	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 deleteItem(key){
	     $.messager.confirm('确认','确定要删除选中吗?',function(r){
	     if(!r){ return }load("删除中...");
	             $.ajax({
	                type: "POST",
	                url:"N25175_Payroll_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_Payroll_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_Payroll_Edit.aspx?id="+key,700,670,0,0,true);
	}
	function Add(){
	 	ShowDialog("add","N25175_Payroll_Insert.aspx",700,670,0,0,true);
	}
	
	function importPayroll(key){
	    ShowDialog("importPayroll","../N25175_Payroll/N25175_Payroll_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){
        $("#qp_ImportKey").val(key);
	    query();
    }
    


</script>

</html>
