<%@ Page language="c#" Codebehind="person_grid.aspx.cs" AutoEventWireup="True" Inherits="health.aspx.person_grid" %>
<%@ Register TagPrefix="uc1" TagName="Pager" Src="../../modules/pager.ascx" %>

<HTML>
	<HEAD>
		<title>xmxx_grid</title>
		<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
		<meta content="C#" name="CODE_LANGUAGE">
		<meta content="JavaScript" name="vs_defaultClientScript">
		<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
		<LINK href="../../css/style.css" type="text/css" rel="stylesheet">
        <script language=javascript> 
	       
    	    function chkSelectAllClick(obj)
	        {
		        var dg = document.getElementById("gdv");
		        for(i=2;i<=dg.rows.length;i++)
		        {
			        var check=document.getElementById("gdv__ctl"+ i +"_chkSelect");
			        check.checked=obj.checked;
		        }
	        }

  	        function chkSelected()
	        {
		        var bRet = false;
		        var dg = document.getElementById("gdv");
		        var stemp="";
		        document.getElementById("tbhSelectID").value="";
		        for(var i=2; i<=dg.rows.length; i++)
		        {
			        var check=document.getElementById("gdv__ctl"+ i +"_chkSelect");
		            if(check!=null && check.checked == true)
			        {
			            if (stemp=="") 
			            {
			               stemp="'"+dg.rows[i-1].cells[0].children[0].value+"'";
			            }
			            else
			            {
			               stemp+=",'"+dg.rows[i-1].cells[0].children[0].value+"'";
			            }
			            bRet = true;					
			        }
		        }
        		document.getElementById("tbhSelectID").value=stemp;
		        return bRet;
	        }

   </script>		
		
        
	</HEAD>
	<body >
		<form id="Form1" method="post" runat="server">
			<br>
			<TABLE id="Table1" cellSpacing="0" cellPadding="0" width="95%" align="center" border="0">
				<TR>
					<TD align="center" colSpan="2">
						<TABLE class="sys_grid" id="Table2" cellSpacing="1" cellPadding="1" width="100%" border="1">
							<TR>
								<TD class="sys_head_cell" align="left" colSpan="3"><IMG src="../../Image/search.gif" align="absMiddle">
                                    <asp:Label ID="lb" runat="server" Font-Bold="True" ForeColor="Red"></asp:Label>
                                    员工健康信息</TD>
							</TR>
							<TR>
								<TD class="sys_grid_cell_label" align="left" height="25"><asp:dropdownlist id="ddl_tj" runat="server" Width="96px">
										<asp:ListItem Value="user_id">员工工号</asp:ListItem>
										<asp:ListItem Value="user_name">员工姓名</asp:ListItem>
										<asp:ListItem Value="birth_date">出生日期</asp:ListItem>
										<asp:ListItem Value="work_type">职务</asp:ListItem>
										<asp:ListItem Value="job_date">工作时间</asp:ListItem>
										<asp:ListItem Value="blood">血型</asp:ListItem>
                                    <asp:ListItem Value="health">健康状况</asp:ListItem>
									</asp:dropdownlist><asp:textbox id="tb_value" runat="server" CssClass="sys_editbox" Width="111px"></asp:textbox>&nbsp;<asp:button id="bntQuery" runat="server" Text="查 询" CssClass="sys_button" onclick="bntQuery_Click"></asp:button>
                                    <FONT face="宋体"><asp:Button ID="btn_out" runat="server" CssClass="sys_button"
                                        OnClick="btn_out_Click" Text="导出EXCEL" /></FONT>
                                    <asp:Button ID="btn_imp" runat="server" CssClass="sys_button" Text="批量导入员工" OnClientClick="Onimp('dangan/imp_person_grid.aspx')" />&nbsp;</TD>
							</TR>
						</TABLE>
						<asp:GridView ID="gdv" runat="server" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False"
                        CssClass="sys_grid" OnRowDataBound="gdv_RowDataBound" OnSorting="gdv_Sorting"  Width="100%">
                        <HeaderStyle CssClass="sys_grid_head_cell" />
                        <Columns>
                            <asp:TemplateField HeaderText="选">
                                  <ItemStyle HorizontalAlign="Center" Width="40px" />
                                  <ItemTemplate>
                                    <input id="hdid" name="hdid" style="width: 47px"  type="hidden" value='<%#DataBinder.Eval(Container.DataItem,"员工工号") %>' />
                                        <asp:CheckBox ID="chkSelect" runat="server"  />
                                  </ItemTemplate>
                                    <HeaderTemplate>
                                        <INPUT onclick="javascript:chkSelectAllClick(this);var s=chkSelected();" type="checkbox">
                                    </HeaderTemplate>
                            </asp:TemplateField>  
                            <asp:BoundField DataField="员工工号" HeaderText="员工工号" SortExpression="员工工号"/>
                            <asp:BoundField DataField="员工姓名" HeaderText="员工姓名" SortExpression="员工姓名" />
                            <asp:BoundField DataField="性别" HeaderText="性别" SortExpression="性别" />
                            <asp:BoundField DataField="出生日期" HeaderText="出生日期" SortExpression="出生日期" DataFormatString="{0:yyyy-MM-dd}" HtmlEncode="False"/>
                            <asp:BoundField DataField="职务" HeaderText="职务" SortExpression="职务" />
                            <asp:BoundField DataField="部门" HeaderText="部门" SortExpression="部门" />
                            <asp:BoundField DataField="工作时间" HeaderText="工作时间" SortExpression="工作时间" DataFormatString="{0:yyyy-MM-dd}" HtmlEncode="False"/>
                            <asp:BoundField DataField="血型" HeaderText="血型" SortExpression="血型" />
                            <asp:BoundField DataField="健康状况" HeaderText="健康状况" SortExpression="健康状况" />
                        </Columns>                        
                        <PagerSettings Visible="False" />
                        <RowStyle HorizontalAlign="Center" Height="25px" />
                    </asp:GridView><uc1:pager id="Pager1" runat="server"></uc1:pager><INPUT id="hd" type="hidden" name="hd" runat="server"><input id="tbhSelectID"  type="hidden" name="tbhSelectID" runat="server" />
                    <INPUT id="hd_deptid"  type="hidden" size="1" name="hd_perid"	runat="server"> <INPUT id="hd_deptname"  type="hidden" size="1" name="hd_pername"	runat="server"></TD>
				</TR>
			</TABLE>
		</form>
		<script language="javascript">
	       var s='<%=url%>';
           if (s!='')
	       {
 	          window.showModalDialog('<%=url%>','','dialogWidth:620px;dialogHeight:620px;help:no;status:no;dialogHide:yes;scrollbars:no;center:yes');
              s='';
              window.location="person_grid.aspx?deptid="+document.getElementById('hd_deptid').value+"&deptname="+document.getElementById('hd_deptname').value+"&tj="+document.getElementById('ddl_tj').value+"&value="+document.getElementById('tb_value').value;
              
           }
   	        function OnRowClickRefresh(s1,s2)
            {

               window.showModalDialog('../showModal.aspx?url='+s1+'?id='+s2,'','dialogWidth:620px;dialogHeight:620px;help:no;status:no;dialogHide:yes;scrollbars:no;center:yes');
               window.location="person_grid.aspx?deptid="+document.getElementById('hd_deptid').value+"&deptname="+document.getElementById('hd_deptname').value+"&tj="+document.getElementById('ddl_tj').value+"&value="+document.getElementById('tb_value').value;

            }
            function Onimp(s1)
	        {
               window.showModalDialog('../showModal.aspx?url='+ s1,'','dialogWidth:450px;dialogHeight:350px;help:no;status:no;dialogHide:yes;scrollbars:no;center:yes');
               s1='';
            }


		</script>
	</body>
</HTML>
