PageRenderTime 48ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/AC/m001a1201.asp

http://github.com/boss2009/ASP-site
ASP | 229 lines | 220 code | 9 blank | 0 comment | 17 complexity | 316294548f28374ad76bfd03570a62b0 MD5 | raw file
  1. <%@language="JAVASCRIPT"%>
  2. <!--#include file="../inc/ASPUtility.inc" -->
  3. <!--#include file="../Connections/cnnASP02.asp" -->
  4. <!--#include file="../inc/ASPCheckLogin.inc" -->
  5. <%
  6. var MM_editAction = Request.ServerVariables("URL");
  7. if (Request.QueryString) {
  8. MM_editAction += "?" + Request.QueryString;
  9. }
  10. if (String(Request("MM_insert")) == "true") {
  11. var Year = ((Request.Form("Year")!="")?Request.Form("Year"):0);
  12. var Cycle = ((Request.Form("Cycle")!="")?Request.Form("Cycle"):0);
  13. var Notes = String(Request.Form("ServiceNotes")).replace(/'/g, "''");
  14. var rsServiceRequested = Server.CreateObject("ADODB.Recordset");
  15. rsServiceRequested.ActiveConnection = MM_cnnASP02_STRING;
  16. rsServiceRequested.Source = "{call dbo.cp_ac_srv_note("+Request.QueryString("intAdult_id")+",0,'"+Request.Form("ServiceDate")+"',"+Year+","+Cycle+","+Request.Form("ServiceProvider")+",'"+Notes+"','"+Request.Form("ServiceRequestHexCode")+"',0,'A',0)}";
  17. rsServiceRequested.CursorType = 0;
  18. rsServiceRequested.CursorLocation = 2;
  19. rsServiceRequested.LockType = 3;
  20. rsServiceRequested.Open();
  21. Response.Redirect("InsertSuccessful.html");
  22. }
  23. var rsServiceRequestedType = Server.CreateObject("ADODB.Recordset");
  24. rsServiceRequestedType.ActiveConnection = MM_cnnASP02_STRING;
  25. rsServiceRequestedType.Source = "{call dbo.cp_service_type(0,0,1,2)}";
  26. rsServiceRequestedType.CursorType = 0;
  27. rsServiceRequestedType.CursorLocation = 2;
  28. rsServiceRequestedType.LockType = 3;
  29. rsServiceRequestedType.Open();
  30. var rsFundingSource = Server.CreateObject("ADODB.Recordset");
  31. rsFundingSource.ActiveConnection = MM_cnnASP02_STRING;
  32. rsFundingSource.Source = "{call dbo.cp_funding_source_attributes(0,0,0,0,1,0,0,0,2,'Q',0)}";
  33. rsFundingSource.CursorType = 0;
  34. rsFundingSource.CursorLocation = 2;
  35. rsFundingSource.LockType = 3;
  36. rsFundingSource.Open();
  37. var rsStaff = Server.CreateObject("ADODB.Recordset");
  38. rsStaff.ActiveConnection = MM_cnnASP02_STRING;
  39. rsStaff.Source = "{call dbo.cp_ASP_lkup(10)}";
  40. rsStaff.CursorType = 0;
  41. rsStaff.CursorLocation = 2;
  42. rsStaff.LockType = 3;
  43. rsStaff.Open();
  44. %>
  45. <html>
  46. <head>
  47. <title>New Service Requested</title>
  48. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  49. <link rel="stylesheet" href="../css/MyStyle.css" type="text/css">
  50. <script language="Javascript" src="../js/MyFunctions.js"></script>
  51. <script for="document" event="onkeyup()" language="JavaScript">
  52. if (window.event.ctrlKey) {
  53. switch (window.event.keyCode) {
  54. case 83 :
  55. //alert("S");
  56. Save();
  57. break;
  58. case 76 :
  59. //alert("L");
  60. window.close();
  61. break;
  62. }
  63. }
  64. </script>
  65. <script language="Javascript">
  66. var count = 1;
  67. function Save(){
  68. if (!CheckDate(document.frm1201.ServiceDate.value)){
  69. alert("Invalid Service Date.");
  70. document.frm1201.ServiceDate.focus();
  71. return ;
  72. }
  73. if (count < 1){
  74. alert("Select Service Type.");
  75. document.frm1201.ServiceType[0].focus();
  76. return ;
  77. }
  78. var temp = "";
  79. for (var i=0; i < count; i++){
  80. temp = temp + PadDecToHex(document.frm1201.ServiceType[i].value) + PadDecToHex(document.frm1201.FundingSource[i].value);
  81. }
  82. var zero = 40 - temp.length;
  83. for (var j = 0; j < zero; j++){
  84. temp = temp + String("0");
  85. }
  86. document.frm1201.ServiceRequestHexCode.value=temp;
  87. // alert(count);
  88. // alert(temp);
  89. document.frm1201.submit();
  90. }
  91. function AddService(){
  92. document.frm1201.ServiceType[count].style.visibility = "visible";
  93. //document.frm1201.FundingSource[count].style.visibility = "visible";
  94. count++;
  95. document.frm1201.Remove.disabled = false;
  96. if (count == 10) document.frm1201.Add.disabled = true;
  97. }
  98. function RemoveService(){
  99. count--;
  100. document.frm1201.ServiceType[count].style.visibility = "hidden";
  101. document.frm1201.FundingSource[count].style.visibility = "hidden";
  102. document.frm1201.Add.disabled = false;
  103. if (count == 1) document.frm1201.Remove.disabled = true;
  104. }
  105. function Init(){
  106. document.frm1201.ServiceType[count-1].style.visibility = "visible";
  107. // document.frm1201.FundingSource[count].style.visibility = "visible";
  108. document.frm1201.Remove.disabled = true;
  109. document.frm1201.ServiceDate.focus();
  110. }
  111. </script>
  112. </head>
  113. <body onLoad="Init();" >
  114. <form action="<%=MM_editAction%>" method="POST" name="frm1201">
  115. <h5>New Service Requested</h5>
  116. <hr>
  117. <table cellpadding="1" cellspacing="1">
  118. <tr>
  119. <td nowrap>Service Date:</td>
  120. <td nowrap>
  121. <input type="textbox" name="ServiceDate" value="<%=CurrentDate()%>" accesskey="F" tabindex="1" size="11" maxlength="10" onChange="FormatDate(this)">
  122. <span style="font-size: 7pt">(mm/dd/yyyy)</span>
  123. </td>
  124. </tr>
  125. <tr>
  126. <td nowrap>Service Provider:</td>
  127. <td nowrap><select name="ServiceProvider" tabindex="2">
  128. <%
  129. while (!rsStaff.EOF) {
  130. %>
  131. <option value="<%=rsStaff.Fields.Item("insStaff_id").Value%>" <%=((Session("insStaff_id")==rsStaff.Fields.Item("insStaff_id").Value)?"SELECTED":"")%>><%=rsStaff.Fields.Item("chvName").Value%>
  132. <%
  133. rsStaff.MoveNext();
  134. }
  135. rsStaff.MoveFirst();
  136. %>
  137. </select></td>
  138. </tr>
  139. <tr>
  140. <td nowrap>Year/Cycle:</td>
  141. <td nowrap>
  142. <input type="textbox" name="Year" value="<%=CurrentYear()%>" size="4" maxlength="4" tabindex="3" onKeypress="AllowNumericOnly();">
  143. <input type="textbox" name="Cycle" value="<%=ZeroPadFormat(CurrentMonth(),2)%>" size="2" maxlength="2" tabindex="4" onKeypress="AllowNumericOnly();">
  144. </td>
  145. </tr>
  146. <tr>
  147. <td nowrap valign="top">Service Notes:</td>
  148. <td nowrap valign="top"><textarea name="ServiceNotes" rows="8" cols="68" tabindex="5" accesskey="L"></textarea></td>
  149. </tr>
  150. <tr>
  151. <td valign="top">Service Received:</td>
  152. <td valign="top">
  153. <div class="BrowsePanel" style="width: 362px; height: 139px">
  154. <table cellpadding="1" cellspacing="1" border="0">
  155. <tr>
  156. <td>Service Type</td>
  157. <td></td>
  158. <!-- <td>Funding Source</td>-->
  159. </tr>
  160. <%
  161. for (var i=5; i< 25; i=i+2){
  162. %>
  163. <tr>
  164. <td nowrap>
  165. <select name="ServiceType" tabindex="<%=i%>" style="width: 180px; visibility='hidden'">
  166. <%
  167. while (!rsServiceRequestedType.EOF) {
  168. %>
  169. <option value="<%=rsServiceRequestedType.Fields.Item("insService_type_id").Value%>"><%=rsServiceRequestedType.Fields.Item("chvname").Value%>
  170. <%
  171. rsServiceRequestedType.MoveNext();
  172. }
  173. rsServiceRequestedType.MoveFirst();
  174. %>
  175. </select>
  176. </td>
  177. <td nowrap>
  178. <select name="FundingSource" tabindex="<%=i+1%>" style="width: 150px; visibility='hidden'">
  179. <%
  180. while (!rsFundingSource.EOF) {
  181. %>
  182. <option value="<%=rsFundingSource.Fields.Item("insFunding_source_id").Value%>"><%=rsFundingSource.Fields.Item("chvfunding_source_name").Value%>
  183. <%
  184. rsFundingSource.MoveNext();
  185. }
  186. rsFundingSource.MoveFirst();
  187. %>
  188. </select>
  189. </td>
  190. </tr>
  191. <%
  192. }
  193. %>
  194. </table>
  195. </div>
  196. </td>
  197. </tr>
  198. </table>
  199. <div style="position: absolute; top: 385px">
  200. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  201. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  202. <input type="button" name="Add" value="Add Service" onClick="AddService();" tabindex="26" class="btnstyle">
  203. <input type="button" name="Remove" value="Remove Service" onClick="RemoveService();" tabindex="27" class="btnstyle">
  204. <hr>
  205. <table cellpadding="1" cellspacing="1">
  206. <tr>
  207. <td><input type="button" value="Save" onClick="Save();" tabindex="28" class="btnstyle"></td>
  208. <td><input type="button" value="Close" onClick="window.close();" tabindex="29" class="btnstyle"></td>
  209. </tr>
  210. </table>
  211. </div>
  212. <input type="hidden" name="MM_insert" value="true">
  213. <input type="hidden" name="ServiceRequestHexCode">
  214. </form>
  215. </body>
  216. </html>
  217. <%
  218. rsFundingSource.Close();
  219. rsServiceRequestedType.Close();
  220. %>