PageRenderTime 45ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/SH/m012q0801.asp

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