PageRenderTime 26ms CodeModel.GetById 24ms RepoModel.GetById 1ms app.codeStats 0ms

/AC/m001q02.asp

http://github.com/boss2009/ASP-site
ASP | 326 lines | 292 code | 34 blank | 0 comment | 111 complexity | 64220dee8923534deb019351f869f000 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 rsClient__chvFilter = "e.dtsRefral_date >= '01/01/1900'";
  7. if (String(Request.QueryString("chvFilter")) != "undefined") {
  8. rsClient__chvFilter = String(Request.QueryString("chvFilter"));
  9. }
  10. var rsClient = Server.CreateObject("ADODB.Recordset");
  11. rsClient.ActiveConnection = MM_cnnASP02_STRING;
  12. rsClient.Source = "{call dbo.cp_Adult_Client2E("+ Request.QueryString("inspSrtBy") + ","+ Request.QueryString("inspSrtOrd") + ",'"+ rsClient__chvFilter.replace(/'/g, "''") + "')}";
  13. rsClient.CursorType = 0;
  14. rsClient.CursorLocation = 2;
  15. rsClient.LockType = 3;
  16. rsClient.Open();
  17. var rsClient_numRows = 0;
  18. %>
  19. <%
  20. var Repeat1__numRows = -1;
  21. var Repeat1__index = 0;
  22. rsClient_numRows += Repeat1__numRows;
  23. %>
  24. <%
  25. // set the record count
  26. var rsClient_total = rsClient.RecordCount;
  27. // set the number of rows displayed on this page
  28. if (rsClient_numRows < 0) { // if repeat region set to all records
  29. rsClient_numRows = rsClient_total;
  30. } else if (rsClient_numRows == 0) { // if no repeat regions
  31. rsClient_numRows = 1;
  32. }
  33. // set the first and last displayed record
  34. var rsClient_first = 1;
  35. var rsClient_last = rsClient_first + rsClient_numRows - 1;
  36. // if we have the correct record count, check the other stats
  37. if (rsClient_total != -1) {
  38. rsClient_numRows = Math.min(rsClient_numRows, rsClient_total);
  39. rsClient_first = Math.min(rsClient_first, rsClient_total);
  40. rsClient_last = Math.min(rsClient_last, rsClient_total);
  41. }
  42. // *** Recordset Stats: if we don't know the record count, manually count them
  43. if (rsClient_total == -1) {
  44. // count the total records by iterating through the recordset
  45. for (rsClient_total=0; !rsClient.EOF; rsClient.MoveNext()) {
  46. rsClient_total++;
  47. }
  48. // reset the cursor to the beginning
  49. if (rsClient.CursorType > 0) {
  50. if (!rsClient.BOF) rsClient.MoveFirst();
  51. } else {
  52. rsClient.Requery();
  53. }
  54. // set the number of rows displayed on this page
  55. if (rsClient_numRows < 0 || rsClient_numRows > rsClient_total) {
  56. rsClient_numRows = rsClient_total;
  57. }
  58. // set the first and last displayed record
  59. rsClient_last = Math.min(rsClient_first + rsClient_numRows - 1, rsClient_total);
  60. rsClient_first = Math.min(rsClient_first, rsClient_total);
  61. }
  62. var MM_paramName = "";
  63. // *** Move To Record and Go To Record: declare variables
  64. var MM_rs = rsClient;
  65. var MM_rsCount = rsClient_total;
  66. var MM_size = rsClient_numRows;
  67. var MM_uniqueCol = "";
  68. MM_paramName = "";
  69. var MM_offset = 0;
  70. var MM_atTotal = false;
  71. var MM_paramIsDefined = (MM_paramName != "" && String(Request(MM_paramName)) != "undefined");
  72. // *** Move To Record: handle 'index' or 'offset' parameter
  73. if (!MM_paramIsDefined && MM_rsCount != 0) {
  74. // use index parameter if defined, otherwise use offset parameter
  75. r = String(Request("index"));
  76. if (r == "undefined") r = String(Request("offset"));
  77. if (r && r != "undefined") MM_offset = parseInt(r);
  78. // if we have a record count, check if we are past the end of the recordset
  79. if (MM_rsCount != -1) {
  80. if (MM_offset >= MM_rsCount || MM_offset == -1) { // past end or move last
  81. if ((MM_rsCount % MM_size) != 0) { // last page not a full repeat region
  82. MM_offset = MM_rsCount - (MM_rsCount % MM_size);
  83. } else {
  84. MM_offset = MM_rsCount - MM_size;
  85. }
  86. }
  87. }
  88. // move the cursor to the selected record
  89. for (var i=0; !MM_rs.EOF && (i < MM_offset || MM_offset == -1); i++) {
  90. MM_rs.MoveNext();
  91. }
  92. if (MM_rs.EOF) MM_offset = i; // set MM_offset to the last possible record
  93. }
  94. // *** Move To Record: if we dont know the record count, check the display range
  95. if (MM_rsCount == -1) {
  96. // walk to the end of the display range for this page
  97. for (var i=MM_offset; !MM_rs.EOF && (MM_size < 0 || i < MM_offset + MM_size); i++) {
  98. MM_rs.MoveNext();
  99. }
  100. // if we walked off the end of the recordset, set MM_rsCount and MM_size
  101. if (MM_rs.EOF) {
  102. MM_rsCount = i;
  103. if (MM_size < 0 || MM_size > MM_rsCount) MM_size = MM_rsCount;
  104. }
  105. // if we walked off the end, set the offset based on page size
  106. if (MM_rs.EOF && !MM_paramIsDefined) {
  107. if ((MM_rsCount % MM_size) != 0) { // last page not a full repeat region
  108. MM_offset = MM_rsCount - (MM_rsCount % MM_size);
  109. } else {
  110. MM_offset = MM_rsCount - MM_size;
  111. }
  112. }
  113. // reset the cursor to the beginning
  114. if (MM_rs.CursorType > 0) {
  115. if (!MM_rs.BOF) MM_rs.MoveFirst();
  116. } else {
  117. MM_rs.Requery();
  118. }
  119. // move the cursor to the selected record
  120. for (var i=0; !MM_rs.EOF && i < MM_offset; i++) {
  121. MM_rs.MoveNext();
  122. }
  123. }
  124. // *** Move To Record: update recordset stats
  125. // set the first and last displayed record
  126. rsClient_first = MM_offset + 1;
  127. rsClient_last = MM_offset + MM_size;
  128. if (MM_rsCount != -1) {
  129. rsClient_first = Math.min(rsClient_first, MM_rsCount);
  130. rsClient_last = Math.min(rsClient_last, MM_rsCount);
  131. }
  132. // set the boolean used by hide region to check if we are on the last record
  133. MM_atTotal = (MM_rsCount != -1 && MM_offset + MM_size >= MM_rsCount);
  134. // *** Go To Record and Move To Record: create strings for maintaining URL and Form parameters
  135. // create the list of parameters which should not be maintained
  136. var MM_removeList = "&index=";
  137. if (MM_paramName != "") MM_removeList += "&" + MM_paramName.toLowerCase() + "=";
  138. var MM_keepURL="",MM_keepForm="",MM_keepBoth="",MM_keepNone="";
  139. // add the URL parameters to the MM_keepURL string
  140. for (var items=new Enumerator(Request.QueryString); !items.atEnd(); items.moveNext()) {
  141. var nextItem = "&" + items.item().toLowerCase() + "=";
  142. if (MM_removeList.indexOf(nextItem) == -1) {
  143. MM_keepURL += "&" + items.item() + "=" + Server.URLencode(Request.QueryString(items.item()));
  144. }
  145. }
  146. // add the Form variables to the MM_keepForm string
  147. for (var items=new Enumerator(Request.Form); !items.atEnd(); items.moveNext()) {
  148. var nextItem = "&" + items.item().toLowerCase() + "=";
  149. if (MM_removeList.indexOf(nextItem) == -1) {
  150. MM_keepForm += "&" + items.item() + "=" + Server.URLencode(Request.Form(items.item()));
  151. }
  152. }
  153. // create the Form + URL string and remove the intial '&' from each of the strings
  154. MM_keepBoth = MM_keepURL + MM_keepForm;
  155. if (MM_keepBoth.length > 0) MM_keepBoth = MM_keepBoth.substring(1);
  156. if (MM_keepURL.length > 0) MM_keepURL = MM_keepURL.substring(1);
  157. if (MM_keepForm.length > 0) MM_keepForm = MM_keepForm.substring(1);
  158. // *** Move To Record: set the strings for the first, last, next, and previous links
  159. var MM_moveFirst="",MM_moveLast="",MM_moveNext="",MM_movePrev="";
  160. var MM_keepMove = MM_keepBoth; // keep both Form and URL parameters for moves
  161. var MM_moveParam = "index";
  162. // if the page has a repeated region, remove 'offset' from the maintained parameters
  163. if (MM_size > 1) {
  164. MM_moveParam = "offset";
  165. if (MM_keepMove.length > 0) {
  166. params = MM_keepMove.split("&");
  167. MM_keepMove = "";
  168. for (var i=0; i < params.length; i++) {
  169. var nextItem = params[i].substring(0,params[i].indexOf("="));
  170. if (nextItem.toLowerCase() != MM_moveParam) {
  171. MM_keepMove += "&" + params[i];
  172. }
  173. }
  174. if (MM_keepMove.length > 0) MM_keepMove = MM_keepMove.substring(1);
  175. }
  176. }
  177. // set the strings for the move to links
  178. if (MM_keepMove.length > 0) MM_keepMove += "&";
  179. var urlStr = Request.ServerVariables("URL") + "?" + MM_keepMove + MM_moveParam + "=";
  180. MM_moveFirst = urlStr + "0";
  181. MM_moveLast = urlStr + "-1";
  182. MM_moveNext = urlStr + (MM_offset + MM_size);
  183. MM_movePrev = urlStr + Math.max(MM_offset - MM_size,0);
  184. %>
  185. <html>
  186. <head>
  187. <title>Client - Browse</title>
  188. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  189. <link rel="stylesheet" href="../css/MyStyle.css" type="text/css">
  190. <script language="Javascript" src="../js/MyFunctions.js"></script>
  191. <Script language="Javascript">
  192. function JumpRecord(){
  193. if (document.frmq02.JumpToRecord.value=="") {
  194. alert("Enter Record Number.");
  195. }
  196. if (!IsID(document.frmq02.JumpToRecord.value)) {
  197. alert("Invalid Record Number.");
  198. } else {
  199. window.location.href="..<%Response.Write(Request.ServerVariables("URL") + "?" + MM_keepMove + MM_moveParam + "=")%>"+String(document.frmq02.JumpToRecord.value-1);
  200. }
  201. }
  202. if (window.focus) self.focus();
  203. function openWindow(page, name){
  204. if (page!='nothing') win1=window.open(page, "", "width=750,height=500,scrollbars=1,left=0,top=0,status=1");
  205. return ;
  206. }
  207. </Script>
  208. </head>
  209. <body>
  210. <form name="frmq02">
  211. <h3>Client - Browse</h3>
  212. <table cellspacing="1">
  213. <tr>
  214. <td align="left" width="900">Displaying Records <b><%=(rsClient_first)%></b> to <b><%=(rsClient_last)%></b> of <b><%=(rsClient_total)%></b></td>
  215. <td nowrap><a href="javascript: openWindow('m001a0101a.asp','wQA01');">Add Client</a></td>
  216. </tr>
  217. </table>
  218. <div class="BrowsePanel" style="width: 100%; height: 340px">
  219. <table cellpadding="2" cellspacing="1">
  220. <tr>
  221. <th nowrap class="headrow" align="left" width="180">Name</th>
  222. <th nowrap class="headrow" align="left">&nbsp;</th>
  223. <th nowrap class="headrow" align="left" width="80">SIN</th>
  224. <th nowrap class="headrow" align="left" width="130">Status</th>
  225. <th nowrap class="headrow" align="left">Case Manager</th>
  226. <th nowrap class="headrow" align="left">Disability</th>
  227. <th nowrap class="headrow" align="left">Referral Type</th>
  228. <th nowrap class="headrow" align="left">Referring Agent</th>
  229. <!--
  230. <th nowrap class="headrow" align="left">Referral Date</th>
  231. <th nowrap class="headrow" align="left">Re-referral Date</th>
  232. -->
  233. <%
  234. if ( Session("MM_UserAuthorization") >= 6 ) {
  235. %>
  236. <th nowrap class="headrow" align="left">&nbsp;</th>
  237. <%
  238. }
  239. %>
  240. </tr>
  241. <%
  242. function FormatPhone(phone){
  243. if ((Trim(phone) == "") || (phone == null)) return "";
  244. phone = LeaveDigits(phone);
  245. return "(" + phone.substring(0,3) + ") " + phone.substring(4,7) + "-" + phone.substring(6,10);
  246. }
  247. while ((Repeat1__numRows-- != 0) && (!rsClient.EOF)) {
  248. %>
  249. <tr>
  250. <td nowrap><a href="javascript: openWindow('m001FS3.asp?intAdult_id=<%=(rsClient.Fields.Item("intAdult_Id").Value)%>','wQE01');"><%=(rsClient.Fields.Item("chvLst_Name").Value)%>, <%=(rsClient.Fields.Item("chvFst_Name").Value)%></a></td>
  251. <td nowrap><a href="javascript: openWindow('m001q01j.asp?intAdult_id=<%=rsClient.Fields.Item("intAdult_Id").Value%>','Summary');"><img src="../i/summary.gif" ALT="<%=(rsClient.Fields.Item("chvLst_Name").Value)%>, <%=(rsClient.Fields.Item("chvFst_Name").Value)%> summary information"></a></td>
  252. <td nowrap><%=FormatSIN(rsClient.Fields.Item("chrSIN_no").Value)%>&nbsp;</td>
  253. <td nowrap><%=(rsClient.Fields.Item("chvStatus").Value)%>&nbsp;</td>
  254. <!--
  255. // code removed + Oct.28.2005
  256. -->
  257. <td nowrap><%=(rsClient.Fields.Item("chvCaseManager").Value)%>&nbsp;</td>
  258. <td nowrap align="center"><%=(rsClient.Fields.Item("chvDisability").Value)%>&nbsp;</td>
  259. <td nowrap align="center">
  260. <%if (rsClient.Fields.Item("bitRef_Type").Value=="1") { %>
  261. <a href="javascript: openWindow('m001pop1.asp?intAdult_id=<%=rsClient.Fields.Item("intadult_id").Value%>','wP01');"><img src="../i/summary.gif" alt="Show Referral Type For <%=rsClient.Fields.Item("chvLst_Name").Value%>, <%=rsClient.Fields.Item("chvFst_Name").Value%>"></a>
  262. <%}%>
  263. </td>
  264. <td nowrap align="center">
  265. <%if (rsClient.Fields.Item("bitRef_Agent").Value=="1") { %>
  266. <a href="javascript: openWindow('m001pop2.asp?intAdult_id=<%=rsClient.Fields.Item("intadult_id").Value%>','wP02');"><img src="../i/summary.gif" alt="Show Referring Agent For <%=rsClient.Fields.Item("chvLst_Name").Value%>, <%=rsClient.Fields.Item("chvFst_Name").Value%>"></a>
  267. <%}%>
  268. </td>
  269. <!--
  270. <td nowrap><%=FilterDate(rsClient.Fields.Item("dtsRefral_date").Value)%>&nbsp;</td>
  271. <td nowrap><%=FilterDate(rsClient.Fields.Item("dtsRe_refral_date").Value)%>&nbsp;</td>
  272. -->
  273. <%
  274. if ( Session("MM_UserAuthorization") >= 6 ) {
  275. %>
  276. <%
  277. }
  278. %>
  279. </tr>
  280. <%
  281. Repeat1__index++;
  282. rsClient.MoveNext();
  283. }
  284. %>
  285. </table>
  286. </div>
  287. </form>
  288. </body>
  289. </html>
  290. <%
  291. rsClient.Close();
  292. %>