PageRenderTime 40ms CodeModel.GetById 0ms RepoModel.GetById 0ms app.codeStats 0ms

/AC/m001q0606.asp

http://github.com/boss2009/ASP-site
ASP | 278 lines | 249 code | 29 blank | 0 comment | 112 complexity | 4542ea8191f563161ab1a8d6b4c54e5e 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 rsLoanOwnForm = Server.CreateObject("ADODB.Recordset");
  7. rsLoanOwnForm.ActiveConnection = MM_cnnASP02_STRING;
  8. rsLoanOwnForm.Source = "{call dbo.cp_Idv_LoanOwn_Form("+ Request.QueryString("intAdult_id") + ")}";
  9. rsLoanOwnForm.CursorType = 0;
  10. rsLoanOwnForm.CursorLocation = 2;
  11. rsLoanOwnForm.LockType = 3;
  12. rsLoanOwnForm.Open();
  13. var rsLoanOwnForm_numRows = 0;
  14. %>
  15. <%
  16. var Repeat1__numRows = -1;
  17. var Repeat1__index = 0;
  18. rsLoanOwnForm_numRows += Repeat1__numRows;
  19. %>
  20. <%
  21. // *** Recordset Stats, Move To Record, and Go To Record: declare stats variables
  22. // set the record count
  23. var rsLoanOwnForm_total = rsLoanOwnForm.RecordCount;
  24. // set the number of rows displayed on this page
  25. if (rsLoanOwnForm_numRows < 0) { // if repeat region set to all records
  26. rsLoanOwnForm_numRows = rsLoanOwnForm_total;
  27. } else if (rsLoanOwnForm_numRows == 0) { // if no repeat regions
  28. rsLoanOwnForm_numRows = 1;
  29. }
  30. // set the first and last displayed record
  31. var rsLoanOwnForm_first = 1;
  32. var rsLoanOwnForm_last = rsLoanOwnForm_first + rsLoanOwnForm_numRows - 1;
  33. // if we have the correct record count, check the other stats
  34. if (rsLoanOwnForm_total != -1) {
  35. rsLoanOwnForm_numRows = Math.min(rsLoanOwnForm_numRows, rsLoanOwnForm_total);
  36. rsLoanOwnForm_first = Math.min(rsLoanOwnForm_first, rsLoanOwnForm_total);
  37. rsLoanOwnForm_last = Math.min(rsLoanOwnForm_last, rsLoanOwnForm_total);
  38. }
  39. %>
  40. <%
  41. // *** Recordset Stats: if we don't know the record count, manually count them
  42. if (rsLoanOwnForm_total == -1) {
  43. // count the total records by iterating through the recordset
  44. for (rsLoanOwnForm_total=0; !rsLoanOwnForm.EOF; rsLoanOwnForm.MoveNext()) {
  45. rsLoanOwnForm_total++;
  46. }
  47. // reset the cursor to the beginning
  48. if (rsLoanOwnForm.CursorType > 0) {
  49. if (!rsLoanOwnForm.BOF) rsLoanOwnForm.MoveFirst();
  50. } else {
  51. rsLoanOwnForm.Requery();
  52. }
  53. // set the number of rows displayed on this page
  54. if (rsLoanOwnForm_numRows < 0 || rsLoanOwnForm_numRows > rsLoanOwnForm_total) {
  55. rsLoanOwnForm_numRows = rsLoanOwnForm_total;
  56. }
  57. // set the first and last displayed record
  58. rsLoanOwnForm_last = Math.min(rsLoanOwnForm_first + rsLoanOwnForm_numRows - 1, rsLoanOwnForm_total);
  59. rsLoanOwnForm_first = Math.min(rsLoanOwnForm_first, rsLoanOwnForm_total);
  60. }
  61. %>
  62. <% var MM_paramName = ""; %>
  63. <%
  64. // *** Move To Record and Go To Record: declare variables
  65. var MM_rs = rsLoanOwnForm;
  66. var MM_rsCount = rsLoanOwnForm_total;
  67. var MM_size = rsLoanOwnForm_numRows;
  68. var MM_uniqueCol = "";
  69. MM_paramName = "";
  70. var MM_offset = 0;
  71. var MM_atTotal = false;
  72. var MM_paramIsDefined = (MM_paramName != "" && String(Request(MM_paramName)) != "undefined");
  73. %>
  74. <%
  75. // *** Move To Record: handle 'index' or 'offset' parameter
  76. if (!MM_paramIsDefined && MM_rsCount != 0) {
  77. // use index parameter if defined, otherwise use offset parameter
  78. r = String(Request("index"));
  79. if (r == "undefined") r = String(Request("offset"));
  80. if (r && r != "undefined") MM_offset = parseInt(r);
  81. // if we have a record count, check if we are past the end of the recordset
  82. if (MM_rsCount != -1) {
  83. if (MM_offset >= MM_rsCount || MM_offset == -1) { // past end or move last
  84. if ((MM_rsCount % MM_size) != 0) { // last page not a full repeat region
  85. MM_offset = MM_rsCount - (MM_rsCount % MM_size);
  86. } else {
  87. MM_offset = MM_rsCount - MM_size;
  88. }
  89. }
  90. }
  91. // move the cursor to the selected record
  92. for (var i=0; !MM_rs.EOF && (i < MM_offset || MM_offset == -1); i++) {
  93. MM_rs.MoveNext();
  94. }
  95. if (MM_rs.EOF) MM_offset = i; // set MM_offset to the last possible record
  96. }
  97. %>
  98. <%
  99. // *** Move To Record: if we dont know the record count, check the display range
  100. if (MM_rsCount == -1) {
  101. // walk to the end of the display range for this page
  102. for (var i=MM_offset; !MM_rs.EOF && (MM_size < 0 || i < MM_offset + MM_size); i++) {
  103. MM_rs.MoveNext();
  104. }
  105. // if we walked off the end of the recordset, set MM_rsCount and MM_size
  106. if (MM_rs.EOF) {
  107. MM_rsCount = i;
  108. if (MM_size < 0 || MM_size > MM_rsCount) MM_size = MM_rsCount;
  109. }
  110. // if we walked off the end, set the offset based on page size
  111. if (MM_rs.EOF && !MM_paramIsDefined) {
  112. if ((MM_rsCount % MM_size) != 0) { // last page not a full repeat region
  113. MM_offset = MM_rsCount - (MM_rsCount % MM_size);
  114. } else {
  115. MM_offset = MM_rsCount - MM_size;
  116. }
  117. }
  118. // reset the cursor to the beginning
  119. if (MM_rs.CursorType > 0) {
  120. if (!MM_rs.BOF) MM_rs.MoveFirst();
  121. } else {
  122. MM_rs.Requery();
  123. }
  124. // move the cursor to the selected record
  125. for (var i=0; !MM_rs.EOF && i < MM_offset; i++) {
  126. MM_rs.MoveNext();
  127. }
  128. }
  129. %>
  130. <%
  131. // *** Move To Record: update recordset stats
  132. // set the first and last displayed record
  133. rsLoanOwnForm_first = MM_offset + 1;
  134. rsLoanOwnForm_last = MM_offset + MM_size;
  135. if (MM_rsCount != -1) {
  136. rsLoanOwnForm_first = Math.min(rsLoanOwnForm_first, MM_rsCount);
  137. rsLoanOwnForm_last = Math.min(rsLoanOwnForm_last, MM_rsCount);
  138. }
  139. // set the boolean used by hide region to check if we are on the last record
  140. MM_atTotal = (MM_rsCount != -1 && MM_offset + MM_size >= MM_rsCount);
  141. %>
  142. <%
  143. // *** Go To Record and Move To Record: create strings for maintaining URL and Form parameters
  144. // create the list of parameters which should not be maintained
  145. var MM_removeList = "&index=";
  146. if (MM_paramName != "") MM_removeList += "&" + MM_paramName.toLowerCase() + "=";
  147. var MM_keepURL="",MM_keepForm="",MM_keepBoth="",MM_keepNone="";
  148. // add the URL parameters to the MM_keepURL string
  149. for (var items=new Enumerator(Request.QueryString); !items.atEnd(); items.moveNext()) {
  150. var nextItem = "&" + items.item().toLowerCase() + "=";
  151. if (MM_removeList.indexOf(nextItem) == -1) {
  152. MM_keepURL += "&" + items.item() + "=" + Server.URLencode(Request.QueryString(items.item()));
  153. }
  154. }
  155. // add the Form variables to the MM_keepForm string
  156. for (var items=new Enumerator(Request.Form); !items.atEnd(); items.moveNext()) {
  157. var nextItem = "&" + items.item().toLowerCase() + "=";
  158. if (MM_removeList.indexOf(nextItem) == -1) {
  159. MM_keepForm += "&" + items.item() + "=" + Server.URLencode(Request.Form(items.item()));
  160. }
  161. }
  162. // create the Form + URL string and remove the intial '&' from each of the strings
  163. MM_keepBoth = MM_keepURL + MM_keepForm;
  164. if (MM_keepBoth.length > 0) MM_keepBoth = MM_keepBoth.substring(1);
  165. if (MM_keepURL.length > 0) MM_keepURL = MM_keepURL.substring(1);
  166. if (MM_keepForm.length > 0) MM_keepForm = MM_keepForm.substring(1);
  167. %>
  168. <%
  169. // *** Move To Record: set the strings for the first, last, next, and previous links
  170. var MM_moveFirst="",MM_moveLast="",MM_moveNext="",MM_movePrev="";
  171. var MM_keepMove = MM_keepBoth; // keep both Form and URL parameters for moves
  172. var MM_moveParam = "index";
  173. // if the page has a repeated region, remove 'offset' from the maintained parameters
  174. if (MM_size > 1) {
  175. MM_moveParam = "offset";
  176. if (MM_keepMove.length > 0) {
  177. params = MM_keepMove.split("&");
  178. MM_keepMove = "";
  179. for (var i=0; i < params.length; i++) {
  180. var nextItem = params[i].substring(0,params[i].indexOf("="));
  181. if (nextItem.toLowerCase() != MM_moveParam) {
  182. MM_keepMove += "&" + params[i];
  183. }
  184. }
  185. if (MM_keepMove.length > 0) MM_keepMove = MM_keepMove.substring(1);
  186. }
  187. }
  188. // set the strings for the move to links
  189. if (MM_keepMove.length > 0) MM_keepMove += "&";
  190. var urlStr = Request.ServerVariables("URL") + "?" + MM_keepMove + MM_moveParam + "=";
  191. MM_moveFirst = urlStr + "0";
  192. MM_moveLast = urlStr + "-1";
  193. MM_moveNext = urlStr + (MM_offset + MM_size);
  194. MM_movePrev = urlStr + Math.max(MM_offset - MM_size,0);
  195. %>
  196. <html>
  197. <head>
  198. <title>Loan Own Form</title>
  199. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  200. <link rel="stylesheet" href="../css/MyStyle.css" type="text/css">
  201. <Script language="Javascript">
  202. if (window.focus) self.focus();
  203. function openWindow(page, name){
  204. if (page!='nothing') win1=window.open(page, name, "width=290,height=150,scrollbars=1,left=0,top=0,status=1");
  205. return ;
  206. }
  207. </Script>
  208. </head>
  209. <body>
  210. <h5>Loan Own Form</h5>
  211. <table cellspacing="1">
  212. <tr>
  213. <td><% if (MM_offset != 0) { %> <a href="<%=MM_moveFirst%>">First Page</a> <% } else { %> First Page <% } // end MM_offset != 0 %> |</td>
  214. <td><% if (MM_offset != 0) { %> <a href="<%=MM_movePrev%>">Previous Page</a> <% } else { %> Previous Page <% } // end MM_offset != 0 %>|</td>
  215. <td><% if (!MM_atTotal) { %> <a href="<%=MM_moveNext%>">Next Page</a> <% } else { %> Next Page <% } // end !MM_atTotal %> |</td>
  216. <td><% if (!MM_atTotal) { %> <a href="<%=MM_moveLast%>">Last Page</a> <% } else { %> Last Page <% } // end !MM_atTotal %></td>
  217. </tr>
  218. <tr>
  219. <td colspan="4">Displaying Records <%=rsLoanOwnForm_first%> To <%=rsLoanOwnForm_last%> Of <%=rsLoanOwnForm_total%></td>
  220. </tr>
  221. </table>
  222. <hr>
  223. <table cellpadding="2" cellspacing="1" class="Mtable">
  224. <tr>
  225. <th class="headrow" align="left">Date Received</th>
  226. </tr>
  227. <%
  228. while ((Repeat1__numRows-- != 0) && (!rsLoanOwnForm.EOF)) {
  229. %>
  230. <tr>
  231. <td><a href="m001e0606.asp?intAdult_id=<%=(rsLoanOwnForm.Fields.Item("intAdult_id").Value)%>"><%=FilterDate(rsLoanOwnForm.Fields.Item("dtsLOform_rx_date").Value)%></a></td>
  232. </tr>
  233. <%
  234. Repeat1__index++;
  235. rsLoanOwnForm.MoveNext();
  236. }
  237. %>
  238. </table>
  239. <hr>
  240. <table cellpadding="1" cellspacing="1">
  241. <tr>
  242. <td><a href="javascript: openWindow('m001a0606.asp?intAdult_id=<%=Request.QueryString("intAdult_id")%>','wA0606');">Add Loan Own Form</a></td>
  243. </tr>
  244. </table>
  245. </body>
  246. </html>
  247. <%
  248. rsLoanOwnForm.Close();
  249. %>