PageRenderTime 69ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/AC/m001a1301.asp

http://github.com/boss2009/ASP-site
ASP | 194 lines | 187 code | 7 blank | 0 comment | 9 complexity | 51bd0975d56d33ef95d5a91ab006af94 MD5 | raw file
  1. <%@language="JAVASCRIPT"%>
  2. <!--#include file="../inc/ASPUtility.inc" -->
  3. <!--#include file="../inc/ASPCheckLogin.inc" -->
  4. <!--#include file="../Connections/cnnASP02.asp" -->
  5. <%
  6. var MM_editAction = Request.ServerVariables("URL");
  7. if (Request.QueryString) {
  8. MM_editAction += "?" + Request.QueryString;
  9. }
  10. if (String(Request("MM_action")) == "insert") {
  11. var Equipment = String(Request.Form("Equipment")).replace(/'/g, "''");
  12. var rsTraining = Server.CreateObject("ADODB.Recordset");
  13. rsTraining.ActiveConnection = MM_cnnASP02_STRING;
  14. rsTraining.Source = "{call dbo.cp_ac_training_request(0,"+Request.QueryString("intAdult_id")+",'"+CurrentDate()+"','"+Equipment+"','"+Request.Form("TrainingStatus")+"','"+Request.Form("Date")+"',"+Request.Form("Reason")+","+Request.Form("TrainedBy")+","+Request.Form("Hours")+","+Request.Form("Minutes")+",0,'A',0)}";
  15. rsTraining.CursorType = 0;
  16. rsTraining.CursorLocation = 2;
  17. rsTraining.LockType = 3;
  18. rsTraining.Open();
  19. Response.Redirect("InsertSuccessful.html");
  20. }
  21. var rsStaff = Server.CreateObject("ADODB.Recordset");
  22. rsStaff.ActiveConnection = MM_cnnASP02_STRING;
  23. rsStaff.Source = "{call dbo.cp_ASP_lkup(10)}";
  24. rsStaff.CursorType = 0;
  25. rsStaff.CursorLocation = 2;
  26. rsStaff.LockType = 3;
  27. rsStaff.Open();
  28. var rsReason = Server.CreateObject("ADODB.Recordset");
  29. rsReason.ActiveConnection = MM_cnnASP02_STRING;
  30. rsReason.Source = "{call dbo.cp_doc_cdn_rsn(0,'5','',2,'Q',0)}";
  31. rsReason.CursorType = 0;
  32. rsReason.CursorLocation = 2;
  33. rsReason.LockType = 3;
  34. rsReason.Open();
  35. %>
  36. <html>
  37. <head>
  38. <title>New Training Request</title>
  39. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  40. <link rel="stylesheet" href="../css/MyStyle.css" type="text/css">
  41. <script language="Javascript" src="../js/MyFunctions.js"></script>
  42. <script for="document" event="onkeyup()" language="JavaScript">
  43. if (window.event.ctrlKey) {
  44. switch (window.event.keyCode) {
  45. case 83 :
  46. //alert("S");
  47. Save();
  48. break;
  49. case 76 :
  50. //alert("L");
  51. window.close();
  52. break;
  53. }
  54. }
  55. </script>
  56. <script language="Javascript">
  57. function Init(){
  58. ChangeTrainingStatus();
  59. document.frm1301.TrainingStatus.focus();
  60. }
  61. function ChangeTrainingStatus(){
  62. Reason.style.visibility = "hidden";
  63. TrainedBy.style.visibility = "hidden";
  64. TrainedTime.style.visibility = "hidden";
  65. Hours.style.visibility = "hidden";
  66. Minutes.style.visibility = "hidden";
  67. document.frm1301.Reason.style.visibility = "hidden";
  68. document.frm1301.TrainedBy.style.visibility = "hidden";
  69. document.frm1301.Hours.style.visibility = "hidden";
  70. document.frm1301.Minutes.style.visibility = "hidden";
  71. switch (document.frm1301.TrainingStatus.value) {
  72. case "0":
  73. Reason.style.visibility = "visible";
  74. document.frm1301.Reason.style.visibility = "visible";
  75. break;
  76. case "2":
  77. TrainedTime.style.visibility = "visible";
  78. TrainedBy.style.visibility = "visible";
  79. Hours.style.visibility = "visible";
  80. Minutes.style.visibility = "visible";
  81. document.frm1301.TrainedBy.style.visibility = "visible";
  82. document.frm1301.Hours.style.visibility = "visible";
  83. document.frm1301.Minutes.style.visibility = "visible";
  84. break;
  85. }
  86. }
  87. function Save(){
  88. if (!CheckDate(document.frm1301.Date.value)) {
  89. alert("Invalid Date.");
  90. document.frm1301.Date.focus();
  91. return ;
  92. }
  93. document.frm1301.submit();
  94. }
  95. </script>
  96. </head>
  97. <body onLoad="Init();">
  98. <form ACTION="<%=MM_editAction%>" METHOD="POST" name="frm1301">
  99. <h5>New Training Request</h5>
  100. <hr>
  101. <table cellpadding="1" cellspacing="1">
  102. <tr>
  103. <td>Equipment:</td>
  104. <td><input type="text" name="Equipment" accesskey="F" tabindex="1" size="65"></td>
  105. </tr>
  106. <tr>
  107. <td>Training Status:</td>
  108. <td><select name="TrainingStatus" tabindex="2" onChange="ChangeTrainingStatus();">
  109. <option value="0">Unable to arrange
  110. <option value="1">Declined
  111. <option value="2" SELECTED>Completed
  112. </select></td>
  113. </tr>
  114. <tr>
  115. <td>Date:</td>
  116. <td>
  117. <input type="text" name="Date" value="<%=CurrentDate()%>" size="11" maxlength="10" tabindex="3" onChange="FormatDate(this)">
  118. <span style="font-size: 7pt">(mm/dd/yyyy)</span>
  119. </td>
  120. </tr>
  121. <tr>
  122. <td><span id="Reason">Reason:</span></td>
  123. <td><select name="Reason" tabindex="4">
  124. <%
  125. while (!rsReason.EOF) {
  126. %>
  127. <option value="<%=rsReason.Fields.Item("intDoc_id").Value%>"><%=rsReason.Fields.Item("chvDocDesc").Value%>
  128. <%
  129. rsReason.MoveNext();
  130. }
  131. %>
  132. </select></td>
  133. </tr>
  134. <tr>
  135. <td><span id="TrainedBy">Trained By:</span></td>
  136. <td><select name="TrainedBy" tabindex="5">
  137. <%
  138. var staffid = Session("insStaff_id");
  139. while (!rsStaff.EOF) {
  140. %>
  141. <option value="<%=(rsStaff.Fields.Item("insStaff_id").Value)%>" <%=((rsStaff.Fields.Item("insStaff_id").Value==staffid)?"SELECTED":"")%>><%=(rsStaff.Fields.Item("chvName").Value)%></option>
  142. <%
  143. rsStaff.MoveNext();
  144. }
  145. %>
  146. </select></td>
  147. </tr>
  148. <tr>
  149. <td><span id="TrainedTime">Trained Time:</span></td>
  150. <td>
  151. <select name="Hours" tabindex="6">
  152. <option value="1">0
  153. <option value="1" SELECTED>1
  154. <option value="2">2
  155. <option value="3">3
  156. <option value="4">4
  157. <option value="5">5
  158. <option value="6">6
  159. <option value="7">7
  160. <option value="8">8
  161. </select>
  162. <span id="Hours">Hours</span>
  163. <select name="Minutes" tabindex="7">
  164. <option value="0">0
  165. <option value="15">15
  166. <option value="30">30
  167. <option value="45">45
  168. </select>
  169. <span id="Minutes">Minutes</span>
  170. </td>
  171. </tr>
  172. </table>
  173. <hr>
  174. <table cellpadding="1" cellspacing="1">
  175. <tr>
  176. <td><input type="button" value="Save" tabindex="8" onClick="Save();" class="btnstyle"></td>
  177. <td><input type="button" value="Close" tabindex="9" onClick="window.close();" class="btnstyle"></td>
  178. </tr>
  179. </table>
  180. <input type="hidden" name="MM_action" value="insert">
  181. </form>
  182. </body>
  183. </html>
  184. <%
  185. rsStaff.Close();
  186. rsReason.Close();
  187. %>