Set.aspx
上传用户:xuming1973
上传日期:2014-02-27
资源大小:17511k
文件大小:8k
源码类别:

WEB源码(ASP,PHP,...)

开发平台:

C#

  1. <%@ Page language="c#" Codebehind="Set.aspx.cs" AutoEventWireup="false" Inherits="UDS.SubModule.WorkAttendance.Set" %>
  2. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
  3. <HTML>
  4. <HEAD>
  5. <title>Set</title>
  6. <meta content="Microsoft Visual Studio 7.0" name="GENERATOR">
  7. <meta content="C#" name="CODE_LANGUAGE">
  8. <meta content="JavaScript" name="vs_defaultClientScript">
  9. <LINK href="../../Css/BasicLayout.css" type="text/css" rel="stylesheet">
  10. <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
  11. <script language="JavaScript" src="../../Css/meizzDate.js"></script>
  12. <script language="javascript">
  13. function fillstring(str)
  14. {
  15. if(str.length==1)
  16. {
  17. str = "0" + str; 
  18. }
  19. return(str);
  20. }
  21. function quickseldate(type)
  22. {
  23. var begintime,endtime;
  24. var oneminute = 60*1000;
  25. var onehour   = 60*oneminute;
  26. var oneday    = 24*onehour;
  27. var oneweek   = 7*oneday;
  28. var todayDate = new Date();
  29. var date = todayDate.getDate();
  30. var month= todayDate.getMonth() +1;
  31. var year= todayDate.getYear();
  32. var day = todayDate.getDay();
  33. if(navigator.appName == "Netscape")
  34. {
  35. year = 1900 + year;
  36. }
  37. //-->
  38. if(type=="day")
  39. {
  40. begintime = year.toString() + "-" + fillstring(month.toString()) + "-" + fillstring(date.toString());
  41. endtime = begintime;
  42. }
  43. else if(type=="week")
  44. {
  45. var daytoMon = day-1;
  46. if(day==0) 
  47. daytoMon = 6;
  48. todayDate.setTime(todayDate.getTime()-daytoMon*oneday);
  49. date = todayDate.getDate();
  50. month= todayDate.getMonth() +1;
  51. year= todayDate.getYear();
  52. day = todayDate.getDay();
  53. begintime = year.toString() + "-" + fillstring(month.toString()) + "-" + fillstring(date.toString());
  54. todayDate.setTime(todayDate.getTime()+6*oneday);
  55. date = todayDate.getDate();
  56. month= todayDate.getMonth() +1;
  57. year= todayDate.getYear();
  58. endtime = year.toString() + "-" + fillstring(month.toString()) + "-" + fillstring(date.toString());
  59. }
  60. else if(type=="month")
  61. {
  62. var dateto1 = date-1;
  63. todayDate.setTime(todayDate.getTime()-dateto1*oneday);
  64. date = todayDate.getDate();
  65. month= todayDate.getMonth() +1;
  66. year= todayDate.getYear();
  67. day = todayDate.getDay();
  68. begintime = year.toString() + "-" + fillstring(month.toString()) + "-" + fillstring(date.toString());
  69. todayDate.setMonth(month);
  70. todayDate.setTime(todayDate.getTime()-oneday);
  71. date = todayDate.getDate();
  72. month= todayDate.getMonth() +1;
  73. year= todayDate.getYear();
  74. endtime = year.toString() + "-" + fillstring(month.toString()) + "-" + fillstring(date.toString());
  75. }
  76. document.getElementById("txtbegintime").value = begintime;
  77. document.getElementById("txtendtime").value = endtime;
  78. }
  79. function checkdutytime(source,arguments)
  80. {
  81. var ondutytime,offdutytime;
  82. var begindate,enddate;
  83. ondutytime = document.getElementById('tbx_OnDutyTime').value;
  84. offdutytime = document.getElementById('tbx_OffDutyTime').value;
  85. begindate = Date.parse('1/1/1900 '+ondutytime);
  86. enddate = Date.parse('1/1/1900 '+offdutytime);
  87. if(enddate<begindate)
  88. arguments.IsValid = false;
  89. else
  90. arguments.IsValid = true;
  91. }
  92. function checkdutydate()
  93. {
  94. var begindate,enddate;
  95. begindate = document.getElementById('txtbegintime').value;
  96. enddate = document.getElementById('txtendtime').value;
  97. if(begindate.replace(' ','')=='' || enddate.replace(' ','')=='')
  98. {
  99. alert('日期不能为空');
  100. return false;
  101. }
  102. else
  103. {
  104. if(begindate>enddate)
  105. {
  106. alert('开始时间不能大于结束时间');
  107. return false
  108. }
  109. }
  110. return true;
  111. }
  112. </script>
  113. </HEAD>
  114. <body leftMargin="0" topMargin="0" MS_POSITIONING="GridLayout">
  115. <form id="Set" method="post" runat="server">
  116. <TABLE id="Table1" borderColor="#111111" height="1" cellSpacing="0" cellPadding="0" width="100%"
  117. border="0">
  118. <TR height="30">
  119. <TD class="GbText" width="3%" background="../../Images/treetopbg.jpg" bgColor="#c0d9e6"><FONT color="#003366" size="3"><IMG alt="" src="../../DataImages/workadmin2.gif"></FONT></TD>
  120. <TD class="GbText" background="../../Images/treetopbg.jpg" bgColor="#c0d9e6"><B><B>考勤设置</B></B></TD>
  121. </TR>
  122. </TABLE>
  123. <TABLE class="GBText" id="Table1" style="BORDER-COLLAPSE: collapse; HEIGHT: 109px" borderColor="#93bee2"
  124. height="109" cellSpacing="1" cellPadding="1" width="100%" border="1" DESIGNTIMEDRAGDROP="56">
  125. <TR>
  126. <TD style="WIDTH: 130px; HEIGHT: 54px" align="center">考勤日设置</TD>
  127. <TD style="HEIGHT: 54px">开始时间:
  128. <asp:textbox id="txtbegintime" onfocus="setday(this);" runat="server" ReadOnly="True" Columns="10"
  129. CssClass="inputcss"></asp:textbox>--结束时间
  130. <asp:textbox id="txtendtime" onfocus="setday(this);" runat="server" ReadOnly="True" Columns="10"
  131. CssClass="inputcss"></asp:textbox>&nbsp;
  132. <asp:comparevalidator id="cvdate" runat="server" ControlToCompare="txtbegintime" Operator="GreaterThanEqual"
  133. ErrorMessage="结束时间应该大于开始时间" ControlToValidate="txtendtime" Display="None"></asp:comparevalidator>&nbsp;
  134. <asp:radiobutton id="rbtnthisweek" onclick="quickseldate('week');" runat="server" GroupName="quickdate"
  135. Text="本周"></asp:radiobutton><asp:radiobutton id="rbtnthismonth" onclick="quickseldate('month');" runat="server" GroupName="quickdate"
  136. Text="本月"></asp:radiobutton><input language="javascript" class="buttoncss" id="btnsetdate" title="设置考勤日期" onclick="if (checkdutydate())  window.open('ShowDay.aspx?begintime='+document.Set.txtbegintime.value+'&amp;endtime='+document.Set.txtendtime.value,'_blank','menubar=no,location=no,toolbar=no'); "
  137. type="button" value="详细情况" name="btnsetdate" runat="server"></TD>
  138. </TR>
  139. <TR>
  140. <TD style="WIDTH: 130px" align="center"><FONT face="宋体">设置公司考勤时间</FONT></TD>
  141. <TD><FONT face="宋体">上班时间
  142. <asp:textbox id="tbx_OnDutyTime" runat="server" CssClass="inputcss" Width="81px"></asp:textbox><asp:requiredfieldvalidator id="RequiredFieldValidator3" runat="server" ErrorMessage="上班时间不能为空" ControlToValidate="tbx_OnDutyTime"
  143. Display="Dynamic"></asp:requiredfieldvalidator><asp:regularexpressionvalidator id="RegularExpressionValidator1" runat="server" ErrorMessage="时间格式错误" ControlToValidate="tbx_OnDutyTime"
  144. Display="Dynamic" ValidationExpression="(((0|1)[0-9])|(2[0-3])|([0-9])):([0-5][0-9])"></asp:regularexpressionvalidator>下班时间
  145. <asp:textbox id="tbx_OffDutyTime" runat="server" CssClass="inputcss" Width="79px"></asp:textbox><asp:requiredfieldvalidator id="RequiredFieldValidator4" runat="server" ErrorMessage="下班时间不能为空" ControlToValidate="tbx_OffDutyTime"
  146. Display="Dynamic"></asp:requiredfieldvalidator><asp:regularexpressionvalidator id="RegularExpressionValidator2" runat="server" ErrorMessage="时间格式错误" ControlToValidate="tbx_OffDutyTime"
  147. Display="Dynamic" ValidationExpression="(((0|1)[0-9])|(2[0-3])|([0-9])):([0-5][0-9])"></asp:regularexpressionvalidator><asp:customvalidator id="CustomValidator1" runat="server" ErrorMessage="下班时间不能早于上班时间" Display="Dynamic"
  148. ClientValidationFunction="checkdutytime"></asp:customvalidator>(时间格式采用09:00或9:00)
  149. <asp:button id="btn_SetTime" runat="server" CssClass="buttoncss" Text=" 保  存"></asp:button></FONT></TD>
  150. </TR>
  151. <TR>
  152. <TD style="WIDTH: 130px" align="center"><FONT face="宋体"></FONT></TD>
  153. <TD><FONT face="宋体"></FONT></TD>
  154. </TR>
  155. </TABLE>
  156. </form>
  157. </body>
  158. </HTML>