SearchData.aspx
上传用户:xgw_05
上传日期:2009-12-11
资源大小:20208k
文件大小:10k
源码类别:

OA系统

开发平台:

C#

  1. <%@ Import namespace="System"%>
  2. <%@ Import namespace="System.Data"  %>
  3. <%@ Page language="c#" Codebehind="SearchData.aspx.cs" AutoEventWireup="false" Inherits="UDS.SubModule.WorkAttendance.SearchData" %>
  4. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
  5. <HTML>
  6. <HEAD>
  7. <title>SearchData</title>
  8. <META http-equiv="Content-Type" content="text/html; charset=gb2312">
  9. <meta content="Microsoft Visual Studio 7.0" name="GENERATOR">
  10. <meta content="C#" name="CODE_LANGUAGE">
  11. <meta content="JavaScript" name="vs_defaultClientScript">
  12. <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
  13. <LINK href="../../Css/BasicLayout.css" type="text/css" rel="stylesheet">
  14. <script language="JavaScript" src="../../Css/meizzDate.js"></script>
  15. <script language="javascript">
  16. function fillstring(str)
  17. {
  18. if(str.length==1)
  19. {
  20. str = "0" + str; 
  21. }
  22. return(str);
  23. }
  24. function quickseldate(type)
  25. {
  26. var begintime,endtime;
  27. var oneminute = 60*1000;
  28. var onehour   = 60*oneminute;
  29. var oneday    = 24*onehour;
  30. var oneweek   = 7*oneday;
  31. var todayDate = new Date();
  32. var date = todayDate.getDate();
  33. var month= todayDate.getMonth() +1;
  34. var year= todayDate.getYear();
  35. var day = todayDate.getDay();
  36. if(navigator.appName == "Netscape")
  37. {
  38. year = 1900 + year;
  39. }
  40. //-->
  41. if(type=="day")
  42. {
  43. begintime = year.toString() + "-" + fillstring(month.toString()) + "-" + fillstring(date.toString());
  44. endtime = begintime;
  45. }
  46. else if(type=="week")
  47. {
  48. var daytoMon = day-1;
  49. if(day==0) 
  50. daytoMon = 6;
  51. todayDate.setTime(todayDate.getTime()-daytoMon*oneday);
  52. date = todayDate.getDate();
  53. month= todayDate.getMonth() +1;
  54. year= todayDate.getYear();
  55. day = todayDate.getDay();
  56. begintime = year.toString() + "-" + fillstring(month.toString()) + "-" + fillstring(date.toString());
  57. todayDate.setTime(todayDate.getTime()+6*oneday);
  58. date = todayDate.getDate();
  59. month= todayDate.getMonth() +1;
  60. year= todayDate.getYear();
  61. endtime = year.toString() + "-" + fillstring(month.toString()) + "-" + fillstring(date.toString());
  62. }
  63. else if(type=="month")
  64. {
  65. var dateto1 = date-1;
  66. todayDate.setTime(todayDate.getTime()-dateto1*oneday);
  67. date = todayDate.getDate();
  68. month= todayDate.getMonth() +1;
  69. year= todayDate.getYear();
  70. day = todayDate.getDay();
  71. begintime = year.toString() + "-" + fillstring(month.toString()) + "-" + fillstring(date.toString());
  72. todayDate.setMonth(month);
  73. todayDate.setTime(todayDate.getTime()-oneday);
  74. date = todayDate.getDate();
  75. month= todayDate.getMonth() +1;
  76. year= todayDate.getYear();
  77. endtime = year.toString() + "-" + fillstring(month.toString()) + "-" + fillstring(date.toString());
  78. }
  79. document.getElementById("txtbegintime").value = begintime;
  80. document.getElementById("txtendtime").value = endtime;
  81. }
  82. </script>
  83. <script language="C#" runat="server">
  84.  string  GetGridData(string staffid,int type)
  85.  {
  86. //type:0 正常 1:迟到 2:早退 3:未考勤 4:总考勤天数
  87. switch(type)
  88. {
  89. case 0:
  90. dvw.RowFilter = "OnDuty_Status = false and OffDuty_Status = false and staff_id="+staffid;
  91. break;
  92. case 1:
  93. dvw.RowFilter = "OnDuty_Status=true and staff_id="+staffid;
  94. break;
  95. case 2:
  96. dvw.RowFilter = "OffDuty_Status = true and staff_id="+staffid;
  97. break;
  98. case 3:
  99. dvw.RowFilter = "staff_id=" + staffid;
  100. return((dvw1.Count - dvw.Count).ToString());
  101. break;
  102. case 4:
  103. break;
  104. }
  105. return(dvw.Count.ToString());
  106.  
  107.  } 
  108. </script>
  109. </HEAD>
  110. <body leftMargin="0" topMargin="0">
  111. <form id="SearchData" method="post" runat="server">
  112. <FONT face="宋体">
  113. <TABLE id="Table1" borderColor="#111111" height="1" cellSpacing="0" cellPadding="0" width="100%"
  114. border="0">
  115. <TR height="30">
  116. <TD class="GbText" width="3%" background="../../Images/treetopbg.jpg" bgColor="#c0d9e6"><FONT color="#003366" size="3"><IMG alt="" src="../../DataImages/kaoqin2.gif"></FONT></TD>
  117. <TD class="GbText" background="../../Images/treetopbg.jpg" bgColor="#c0d9e6"><B><B>考勤查询</B></B></TD>
  118. </TR>
  119. </TABLE>
  120. <TABLE class="GBText" id="Table1" style="BORDER-COLLAPSE: collapse; HEIGHT: 242px" borderColor="#93bee2"
  121. height="242" cellSpacing="1" cellPadding="1" width="100%" border="1" DESIGNTIMEDRAGDROP="56">
  122. <TR>
  123. <TD style="WIDTH: 84px">输入时间段</TD>
  124. <TD>开始时间:
  125. <asp:textbox id="txtbegintime" onfocus="setday(this);" runat="server" CssClass="inputcss" Columns="10"
  126. ReadOnly="True"></asp:textbox><asp:requiredfieldvalidator id="RequiredFieldValidator1" runat="server" Display="None" ControlToValidate="txtbegintime"
  127. ErrorMessage="开始时间不能为空"></asp:requiredfieldvalidator>--结束时间
  128. <asp:textbox id="txtendtime" onfocus="setday(this);" runat="server" CssClass="inputcss" Columns="10"
  129. ReadOnly="True"></asp:textbox><asp:requiredfieldvalidator id="RequiredFieldValidator2" runat="server" Display="None" ControlToValidate="txtendtime"
  130. ErrorMessage="结束不能为空"></asp:requiredfieldvalidator>&nbsp;
  131. <asp:comparevalidator id="cvdate" runat="server" Display="None" ControlToValidate="txtendtime" ErrorMessage="结束时间应该大于开始时间"
  132. Operator="GreaterThanEqual" ControlToCompare="txtbegintime"></asp:comparevalidator>&nbsp;
  133. <asp:radiobutton id="rbtnthisweek" onclick="quickseldate('week');" runat="server" Text="本周" GroupName="quickdate"></asp:radiobutton><asp:radiobutton id="rbtnthismonth" onclick="quickseldate('month');" runat="server" Text="本月" GroupName="quickdate"></asp:radiobutton></TD>
  134. </TR>
  135. <TR>
  136. <TD style="WIDTH: 84px">查找范围</TD>
  137. <TD><asp:dropdownlist id="ddlsearchbound" runat="server" Width="300px" AutoPostBack="True">
  138. <asp:ListItem Value="0" Selected="True">公司</asp:ListItem>
  139. <asp:ListItem Value="1">职位</asp:ListItem>
  140. <asp:ListItem Value="2">个人</asp:ListItem>
  141. </asp:dropdownlist></TD>
  142. </TR>
  143. <TR>
  144. <TD style="WIDTH: 84px">请选择</TD>
  145. <TD><asp:listbox id="lbstaffs" runat="server" CssClass="inputcss" Width="150px" SelectionMode="Multiple"
  146. Height="141px" Visible="False"></asp:listbox><asp:dropdownlist id="ddldepartments" runat="server" Width="150px" Visible="False"></asp:dropdownlist></TD>
  147. </TR>
  148. <TR>
  149. <TD style="WIDTH: 84px"></TD>
  150. <TD><asp:validationsummary id="vs1" runat="server"></asp:validationsummary></TD>
  151. </TR>
  152. <TR>
  153. <TD align="center" colSpan="2" height="30"><asp:button id="btnsearch" runat="server" CssClass="buttoncss" Text=" 查  询 "></asp:button></TD>
  154. </TR>
  155. <TR>
  156. <TD align="right" colSpan="2"><asp:datagrid id="AttendanceGrid" runat="server" Width="100%" CellPadding="3" BorderWidth="1px"
  157. BorderColor="#93BEE2" DataKeyField="staff_id" EnableViewState="False" AutoGenerateColumns="False">
  158. <HeaderStyle Font-Size="X-Small" BackColor="#E8F4FF"></HeaderStyle>
  159. <Columns>
  160. <asp:BoundColumn DataField="realname" HeaderText="姓名">
  161. <ItemStyle Font-Size="X-Small"></ItemStyle>
  162. <FooterStyle Font-Size="X-Small"></FooterStyle>
  163. </asp:BoundColumn>
  164. <asp:TemplateColumn HeaderText="正常天数">
  165. <ItemTemplate>
  166. <asp:HyperLink Text ='<%# GetGridData(((DataRowView)Container.DataItem)["Staff_ID"].ToString(),0)%>' NavigateUrl='<%# "tmpStaffData.aspx?staffid="+((DataRowView)Container.DataItem)["Staff_ID"].ToString()+"&begintime="+txtbegintime.Text+"&endtime="+txtendtime.Text+"&type=1"%>' Target=_blank Runat=server>
  167. </asp:HyperLink>
  168. </ItemTemplate>
  169. </asp:TemplateColumn>
  170. <asp:TemplateColumn HeaderText="迟到天数">
  171. <ItemTemplate>
  172. <asp:HyperLink Text ='<%# GetGridData(((DataRowView)Container.DataItem)["Staff_ID"].ToString(),1)%>' NavigateUrl='<%# "tmpStaffData.aspx?staffid="+((DataRowView)Container.DataItem)["Staff_ID"].ToString()+"&begintime="+txtbegintime.Text+"&endtime="+txtendtime.Text+"&type=2"%>' Target=_blank Runat=server>
  173. </asp:HyperLink>
  174. </ItemTemplate>
  175. </asp:TemplateColumn>
  176. <asp:TemplateColumn HeaderText="早退天数">
  177. <ItemTemplate>
  178. <asp:HyperLink Text ='<%# GetGridData(((DataRowView)Container.DataItem)["Staff_ID"].ToString(),2)%>' NavigateUrl='<%# "tmpStaffData.aspx?staffid="+((DataRowView)Container.DataItem)["Staff_ID"].ToString()+"&begintime="+txtbegintime.Text+"&endtime="+txtendtime.Text+"&type=3"%>' Target=_blank Runat=server>
  179. </asp:HyperLink>
  180. </ItemTemplate>
  181. </asp:TemplateColumn>
  182. <asp:TemplateColumn HeaderText="未考勤天数">
  183. <ItemTemplate>
  184. <asp:HyperLink Text ='<%# GetGridData(((DataRowView)Container.DataItem)["Staff_ID"].ToString(),3)%>' NavigateUrl='<%# "tmpStaffData.aspx?staffid="+((DataRowView)Container.DataItem)["Staff_ID"].ToString()+"&begintime="+txtbegintime.Text+"&endtime="+txtendtime.Text+"&type=4"%>' Target=_blank Runat=server>
  185. </asp:HyperLink>
  186. </ItemTemplate>
  187. </asp:TemplateColumn>
  188. <asp:TemplateColumn HeaderText="总考勤天数">
  189. <ItemTemplate>
  190. <asp:HyperLink Text ='<%# GetGridData(((DataRowView)Container.DataItem)["Staff_ID"].ToString(),4)%>' NavigateUrl='<%# "tmpStaffData.aspx?staffid="+((DataRowView)Container.DataItem)["Staff_ID"].ToString()+"&begintime="+txtbegintime.Text+"&endtime="+txtendtime.Text+"&type=5"%>' Target=_blank Runat=server ID="Hyperlink1" NAME="Hyperlink1">
  191. </asp:HyperLink>
  192. </ItemTemplate>
  193. </asp:TemplateColumn>
  194. </Columns>
  195. </asp:datagrid><INPUT class="buttoncss" id="btn_Report" type="button" value="打印报表" style="DISPLAY:none"
  196. runat="server"></TD>
  197. </TR>
  198. </TABLE>
  199. </FONT>
  200. </form>
  201. </body>
  202. </HTML>