PageRenderTime 28ms CodeModel.GetById 9ms RepoModel.GetById 0ms app.codeStats 0ms

/PS/m022a0102.asp

http://github.com/boss2009/ASP-site
ASP | 255 lines | 247 code | 8 blank | 0 comment | 16 complexity | b2a6f267c03702ba025bfafff6269de9 MD5 | raw file
  1. <%@language="JAVASCRIPT"%>
  2. <!--#include file="../inc/ASPUtility.inc" -->
  3. <!--#include file="../Connections/cnnASP02.asp" -->
  4. <%
  5. var MM_editAction = Request.ServerVariables("URL");
  6. if (Request.QueryString) {
  7. MM_editAction += "?" + Request.QueryString;
  8. }
  9. if (String(Request("MM_insert")) == "true") {
  10. var FirstName = String(Request.Form("FirstName")).replace(/'/g, "''");
  11. var MiddleName = String(Request.Form("MiddleName")).replace(/'/g, "''");
  12. var LastName = String(Request.Form("LastName")).replace(/'/g, "''");
  13. var IsFirstNation = ((Request.Form("IsFirstNation")=="1")?"1":"0");
  14. var cmdInsertPILATStudent = Server.CreateObject("ADODB.Command");
  15. cmdInsertPILATStudent.ActiveConnection = MM_cnnASP02_STRING;
  16. cmdInsertPILATStudent.CommandText = "dbo.cp_PILAT_Student";
  17. cmdInsertPILATStudent.CommandType = 4;
  18. cmdInsertPILATStudent.CommandTimeout = 0;
  19. cmdInsertPILATStudent.Prepared = true;
  20. cmdInsertPILATStudent.Parameters.Append(cmdInsertPILATStudent.CreateParameter("RETURN_VALUE", 3, 4));
  21. cmdInsertPILATStudent.Parameters.Append(cmdInsertPILATStudent.CreateParameter("@intpID", 3, 1,1,0));
  22. cmdInsertPILATStudent.Parameters.Append(cmdInsertPILATStudent.CreateParameter("@chvFst_name", 200, 1,20,FirstName));
  23. cmdInsertPILATStudent.Parameters.Append(cmdInsertPILATStudent.CreateParameter("@chvMdl_name", 200, 1,20,MiddleName));
  24. cmdInsertPILATStudent.Parameters.Append(cmdInsertPILATStudent.CreateParameter("@chvLst_name", 200, 1,20,LastName));
  25. cmdInsertPILATStudent.Parameters.Append(cmdInsertPILATStudent.CreateParameter("@chrSIN_no", 129, 1,20,Request.Form("SIN")));
  26. cmdInsertPILATStudent.Parameters.Append(cmdInsertPILATStudent.CreateParameter("@dtsBirth_date", 200,1,30,Request.Form("DateOfBirth")));
  27. cmdInsertPILATStudent.Parameters.Append(cmdInsertPILATStudent.CreateParameter("@insStdnt_Status_id", 2, 1,1,Request.Form("Status")));
  28. cmdInsertPILATStudent.Parameters.Append(cmdInsertPILATStudent.CreateParameter("@insDsbty1_id", 2, 1,1,Request.Form("Disability")));
  29. cmdInsertPILATStudent.Parameters.Append(cmdInsertPILATStudent.CreateParameter("@insCase_mngr_id", 2, 1,1,Request.Form("CaseManager")));
  30. cmdInsertPILATStudent.Parameters.Append(cmdInsertPILATStudent.CreateParameter("@insRegion_num", 2, 1,1,Request.Form("Region")));
  31. cmdInsertPILATStudent.Parameters.Append(cmdInsertPILATStudent.CreateParameter("@chrPEN_num", 129, 1,20,Request.Form("PEN")));
  32. cmdInsertPILATStudent.Parameters.Append(cmdInsertPILATStudent.CreateParameter("@bitIs_FirstNations", 2, 1,1,IsFirstNation));
  33. cmdInsertPILATStudent.Parameters.Append(cmdInsertPILATStudent.CreateParameter("@bitGender_is_male", 2, 1,1,Request.Form("Gender")));
  34. cmdInsertPILATStudent.Parameters.Append(cmdInsertPILATStudent.CreateParameter("@insUser_id", 2, 1,1,Session("insStaff_id")));
  35. cmdInsertPILATStudent.Parameters.Append(cmdInsertPILATStudent.CreateParameter("@inspSrtBy", 2, 1,1,1));
  36. cmdInsertPILATStudent.Parameters.Append(cmdInsertPILATStudent.CreateParameter("@inspSrtOrd", 2, 1,1,0));
  37. cmdInsertPILATStudent.Parameters.Append(cmdInsertPILATStudent.CreateParameter("@chvFilter", 200, 1,1,""));
  38. cmdInsertPILATStudent.Parameters.Append(cmdInsertPILATStudent.CreateParameter("@insMode", 16, 1,1,0));
  39. cmdInsertPILATStudent.Parameters.Append(cmdInsertPILATStudent.CreateParameter("@chvTask", 129, 1,1,'A'));
  40. cmdInsertPILATStudent.Parameters.Append(cmdInsertPILATStudent.CreateParameter("@intRtnValue", 2, 2));
  41. cmdInsertPILATStudent.Execute();
  42. Response.Redirect("m022FS3.asp?intPStdnt_id="+cmdInsertPILATStudent.Parameters.Item("@intRtnValue").Value);
  43. }
  44. var rsRegion = Server.CreateObject("ADODB.Recordset");
  45. rsRegion.ActiveConnection = MM_cnnASP02_STRING;
  46. rsRegion.Source = "{call dbo.cp_Region}";
  47. rsRegion.CursorType = 0;
  48. rsRegion.CursorLocation = 2;
  49. rsRegion.LockType = 3;
  50. rsRegion.Open();
  51. var rsStatus = Server.CreateObject("ADODB.Recordset");
  52. rsStatus.ActiveConnection = MM_cnnASP02_STRING;
  53. rsStatus.Source = "{call dbo.cp_ASP_Lkup2(8,0,'',0,'1', 0)}";
  54. rsStatus.CursorType = 0;
  55. rsStatus.CursorLocation = 2;
  56. rsStatus.LockType = 3;
  57. rsStatus.Open();
  58. var rsDisability = Server.CreateObject("ADODB.Recordset");
  59. rsDisability.ActiveConnection = MM_cnnASP02_STRING;
  60. rsDisability.Source = "{call dbo.cp_ASP_Lkup2(9, 0, '', 0, '1',0)}";
  61. rsDisability.CursorType = 0;
  62. rsDisability.CursorLocation = 2;
  63. rsDisability.LockType = 3;
  64. rsDisability.Open();
  65. var rsCaseManager = Server.CreateObject("ADODB.Recordset");
  66. rsCaseManager.ActiveConnection = MM_cnnASP02_STRING;
  67. rsCaseManager.Source = "{call dbo.cp_CaseMgr}";
  68. rsCaseManager.CursorType = 0;
  69. rsCaseManager.CursorLocation = 2;
  70. rsCaseManager.LockType = 3;
  71. rsCaseManager.Open();
  72. var FirstName = "";
  73. var MiddleName = "";
  74. var LastName = "";
  75. var Region = "";
  76. var Disability = 0;
  77. var IsFirstNation = 0;
  78. var DateOfBirth = "";
  79. var Pen = "";
  80. var Sin = "";
  81. var Status = 0;
  82. var CaseManager = 0;
  83. var Gender = 1;
  84. if (String(Request.QueryString("IsNew"))=="No") {
  85. var rsClient = Server.CreateObject("ADODB.Recordset");
  86. rsClient.ActiveConnection = MM_cnnASP02_STRING;
  87. rsClient.Source = "{call dbo.cp_Idv_Adult_Client("+ Request.QueryString("intAdult_id") + ")}";
  88. rsClient.CursorType = 0;
  89. rsClient.CursorLocation = 2;
  90. rsClient.LockType = 3;
  91. rsClient.Open();
  92. FirstName=rsClient.Fields.Item("chvFst_Name").Value;
  93. MiddleName=rsClient.Fields.Item("chvMdl_name").Value;
  94. LastName=rsClient.Fields.Item("chvLst_Name").Value;
  95. Status=rsClient.Fields.Item("insStdnt_status_id").Value;
  96. Region=rsClient.Fields.Item("insRegion_num").Value;
  97. Disability=rsClient.Fields.Item("insDsbty1_id").Value;
  98. CaseManager=rsClient.Fields.Item("insCase_mngr_id").Value;
  99. Gender=rsClient.Fields.Item("bitGender_is_male").Value;
  100. IsFirstNation=rsClient.Fields.Item("bitIs_FirstNations").Value;
  101. Pen=rsClient.Fields.Item("chvPENno").Value;
  102. Sin=rsClient.Fields.Item("chrSIN_no").Value;
  103. DateOfBirth=FilterDate(rsClient.Fields.Item("dtsBirth_date").Value);
  104. }
  105. %>
  106. <html>
  107. <head>
  108. <title>New Temp Student</title>
  109. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  110. <link rel="stylesheet" href="../css/MyStyle.css" type="text/css">
  111. <script language="Javascript" src="../js/MyFunctions.js"></script>
  112. <script for="document" event="onkeyup()" language="JavaScript">
  113. if (window.event.ctrlKey) {
  114. switch (window.event.keyCode) {
  115. case 83 :
  116. //alert("S");
  117. Save();
  118. break;
  119. case 76 :
  120. //alert("L");
  121. window.close();
  122. break;
  123. }
  124. }
  125. </script>
  126. <script language="Javascript">
  127. function InputDate(DateField){
  128. DateField.value = FormatDate(LeaveDigits(DateField));
  129. }
  130. function Save(){
  131. if (!CheckSIN(document.frm0102.Sin.value)) {
  132. alert("Invalid Social Insurance Number.");
  133. document.frm0102.Sin.focus();
  134. return ;
  135. }
  136. if (!CheckDate(document.frm0102.DateOfBirth.value)){
  137. alert("Invalid Date of Birth.");
  138. document.frm0102.DateOfBirth.focus();
  139. return ;
  140. }
  141. if (Trim(document.frm0102.FirstName.value)=="") {
  142. alert("Enter First Name.");
  143. document.frm0102.FirstName.focus();
  144. return ;
  145. }
  146. if (Trim(document.frm0102.LastName.value)=="") {
  147. alert("Enter Last Name.");
  148. document.frm0102.LastName.focus();
  149. return ;
  150. }
  151. document.frm0102.Sin.value = LeaveDigits(document.frm0102.Sin.value);
  152. document.frm0102.submit();
  153. }
  154. </script>
  155. </head>
  156. <body onLoad="javascript:document.frm0102.FirstName.focus()">
  157. <form ACTION="<%=MM_editAction%>" METHOD="POST" name="frm0102">
  158. <h5>New PILAT Student:</h5>
  159. <hr>
  160. <table cellpadding="1" cellspacing="1">
  161. <tr>
  162. <td nowrap>First Name:</td>
  163. <td width="200"><input type="text" name="FirstName" value="<%=FirstName%>" maxlength="20" tabindex="1" accesskey="F"></td>
  164. <td nowrap>Region:</td>
  165. <td width="200"><select name="Region" tabindex="7" style="width: 200px">
  166. <%
  167. while (!rsRegion.EOF) {
  168. %>
  169. <option value="<%=(rsRegion.Fields.Item("insRegion_num").Value)%>" <%=((rsRegion.Fields.Item("insRegion_num").Value == Region)?"SELECTED":"")%>><%=(rsRegion.Fields.Item("chvname").Value)%></option>
  170. <%
  171. rsRegion.MoveNext();
  172. }
  173. %>
  174. </select></td>
  175. </tr>
  176. <tr>
  177. <td nowrap>Middle Name:</td>
  178. <td nowrap><input type="text" name="MiddleName" value="<%=MiddleName%>" maxlength="20" tabindex="2"></td>
  179. <td nowrap>Case Manager:</td>
  180. <td nowrap><select name="CaseManager" tabindex="8" style="width: 200px">
  181. <%
  182. while (!rsCaseManager.EOF) {
  183. %>
  184. <option value="<%=(rsCaseManager.Fields.Item("insId").Value)%>" <%=((rsCaseManager.Fields.Item("insId").Value == CaseManager)?"SELECTED":"")%>><%=(rsCaseManager.Fields.Item("chvName").Value)%></option>
  185. <%
  186. rsCaseManager.MoveNext();
  187. }
  188. %>
  189. </select></td>
  190. </tr>
  191. <tr>
  192. <td nowrap>Last Name:</td>
  193. <td nowrap><input type="text" name="LastName" value="<%=LastName%>" maxlength="20" tabindex="3"></td>
  194. <td nowrap>Disability:</td>
  195. <td nowrap><select name="Disability" tabindex="9" style="width: 200px" accesskey="D">
  196. <%
  197. while (!rsDisability.EOF) {
  198. %>
  199. <option value="<%=(rsDisability.Fields.Item("insDisability_id").Value)%>" <%=((rsDisability.Fields.Item("insDisability_id").Value == Disability)?"SELECTED":"")%>><%=(rsDisability.Fields.Item("chvname").Value)%></option>
  200. <%
  201. rsDisability.MoveNext();
  202. }
  203. %>
  204. </select></td>
  205. </tr>
  206. <tr>
  207. <td nowrap>SIN:</td>
  208. <td nowrap><input type="text" name="Sin" value="<%=Sin%>" size="15" maxlength="11" tabindex="4" onChange="FormatSIN(this);"></td>
  209. <td nowrap>Date of Birth:</td>
  210. <td nowrap>
  211. <input type="text" name="DateOfBirth" value="<%=DateOfBirth%>" size="11" maxlength="10" tabindex="10" onChange="FormatDate(this)">
  212. <span style="font-size: 7pt">(mm/dd/yyyy)</span>
  213. </td>
  214. </tr>
  215. <tr>
  216. <td nowrap>PEN:</td>
  217. <td nowrap><input type="text" name="Pen" value="<%=Pen%>" size="15" maxlength="9" tabindex="5" onKeyPress="AllowNumericOnly();"></td>
  218. <td nowrap>Is First Nation:</td>
  219. <td nowrap><input type="checkbox" name="IsFirstNation" value="1" <%=((IsFirstNation==1)?"CHECKED":"")%> tabindex="11" accesskey="L" class="chkstyle"></td>
  220. </tr>
  221. <tr>
  222. <td nowrap>Gender:</td>
  223. <td nowrap><select name="Gender" tabindex="6">
  224. <option value="1" <%=((Gender==1)?"SELECTED":"")%>>Male
  225. <option value="0" <%=((Gender==0)?"SELECTED":"")%>>Female
  226. </select></td>
  227. <td colspan="2"></td>
  228. </tr>
  229. </table>
  230. <hr>
  231. <table cellpadding="1" cellspacing="1">
  232. <tr>
  233. <td><input type="button" value="Save" tabindex="12" onClick="Save();" class="btnstyle"></td>
  234. <td><input type="button" value="Cancel" tabindex="13" onClick="window.close();" class="btnstyle"></td>
  235. </tr>
  236. </table>
  237. <input type="hidden" name="MM_insert" value="true">
  238. <input type="hidden" name="Status" value="<%=Status%>">
  239. </form>
  240. </body>
  241. </html>
  242. <%
  243. rsRegion.Close();
  244. rsStatus.Close();
  245. rsDisability.Close();
  246. rsCaseManager.Close();
  247. %>