PageRenderTime 59ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 1ms

/AC/m001q0801.asp

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