PageRenderTime 26ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/BO/m010q0301b.asp

http://github.com/boss2009/ASP-site
ASP | 238 lines | 225 code | 13 blank | 0 comment | 21 complexity | a7fe48f9196edf99c8c04f0298bdac28 MD5 | raw file
  1. <%@language="JAVASCRIPT"%>
  2. <!--#include file="../inc/ASPUtility.inc" -->
  3. <!--#include file="../inc/ASPCheckLogin.inc" -->
  4. <!--#include file="../Connections/cnnASP02.asp" -->
  5. <%
  6. var gst = 0;
  7. var pst = 0;
  8. var shipping = 0;
  9. var rsGST = Server.CreateObject("ADODB.Recordset");
  10. rsGST.ActiveConnection = MM_cnnASP02_STRING;
  11. rsGST.Source = "{call dbo.cp_charge_rate(1,'',0,0.0,1,'Q',0)}";
  12. rsGST.CursorType = 0;
  13. rsGST.CursorLocation = 2;
  14. rsGST.LockType = 3;
  15. rsGST.Open();
  16. if (!rsGST.EOF) gst = Number(rsGST.Fields.Item("fltPercentage").Value);
  17. rsGST.Close();
  18. var rsPST = Server.CreateObject("ADODB.Recordset");
  19. rsPST.ActiveConnection = MM_cnnASP02_STRING;
  20. rsPST.Source = "{call dbo.cp_charge_rate(2,'',0,0.0,1,'Q',0)}";
  21. rsPST.CursorType = 0;
  22. rsPST.CursorLocation = 2;
  23. rsPST.LockType = 3;
  24. rsPST.Open();
  25. if (!rsPST.EOF) pst = Number(rsPST.Fields.Item("fltPercentage").Value);
  26. rsPST.Close();
  27. var rsShipping = Server.CreateObject("ADODB.Recordset");
  28. rsShipping.ActiveConnection = MM_cnnASP02_STRING;
  29. rsShipping.Source = "{call dbo.cp_charge_rate(3,'',0,0.0,1,'Q',0)}";
  30. rsShipping.CursorType = 0;
  31. rsShipping.CursorLocation = 2;
  32. rsShipping.LockType = 3;
  33. rsShipping.Open();
  34. if (!rsShipping.EOF) shipping = Number(rsShipping.Fields.Item("fltPercentage").Value);
  35. rsShipping.Close();
  36. var rsInventorySold = Server.CreateObject("ADODB.Recordset");
  37. rsInventorySold.ActiveConnection = MM_cnnASP02_STRING;
  38. rsInventorySold.Source = "select * from tbl_buyout_equip_sold where intBuyout_req_id = " + Request.QueryString("intBuyout_req_id");
  39. rsInventorySold.CursorType = 0;
  40. rsInventorySold.CursorLocation = 2;
  41. rsInventorySold.LockType = 3;
  42. rsInventorySold.Open();
  43. var rsInventorySold_total = 0;
  44. while (!rsInventorySold.EOF) {
  45. rsInventorySold_total++;
  46. rsInventorySold.MoveNext();
  47. }
  48. rsInventorySold.Requery();
  49. %>
  50. <html>
  51. <head>
  52. <title>Equipment Sold</title>
  53. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  54. <link rel="stylesheet" href="../css/MyStyle.css" type="text/css">
  55. <Script language="Javascript">
  56. if (window.focus) self.focus();
  57. function openWindow(page, name){
  58. if (page!='nothing') win1=window.open(page, "", "width=750,height=500,scrollbars=1,left=0,top=0,status=1");
  59. return ;
  60. }
  61. </Script>
  62. </head>
  63. <body>
  64. <h5>Equipment Sold</h5>
  65. <table cellspacing="1">
  66. <tr>
  67. <td nowrap width="450"><a href="javascript: openWindow('m010a0301.asp?intBuyout_req_id=<%=Request.QueryString("intBuyout_req_id")%>','w010A02');">Add Equipment Sold</a></td>
  68. <td nowrap align="left">Displaying <b><%=(rsInventorySold_total)%></b> Records.</td>
  69. </tr>
  70. </table>
  71. <hr>
  72. <div class="BrowsePanel" style="width: 100%; height: 221px">
  73. <table cellpadding="2" cellspacing="1">
  74. <tr>
  75. <th nowrap class="headrow" align="left">Inventory Name</th>
  76. <th nowrap class="headrow" align="left">Inventory ID</th>
  77. <th nowrap class="headrow" align="left">Status</th>
  78. <th nowrap class="headrow" align="left">Date Processed</th>
  79. <th nowrap class="headrow" align="left">Sold Price</th>
  80. <th nowrap class="headrow" align="left">Equipment Cost</th>
  81. <th nowrap class="headrow" align="left">Serial Number</th>
  82. <th nowrap class="headrow" align="left">Model Number</th>
  83. <th nowrap class="headrow" align="left">PR Number</th>
  84. <th nowrap class="headrow" align="left">Vendor</th>
  85. <th nowrap class="headrow" align="left">Date Returned</th>
  86. <th nowrap class="headrow" align="left">Returned By</th>
  87. <th nowrap class="headrow" align="left">Comments</th>
  88. </tr>
  89. <%
  90. //Getting Date Processed from shipping detail
  91. var rsBuyout = Server.CreateObject("ADODB.Recordset");
  92. rsBuyout.ActiveConnection = MM_cnnASP02_STRING;
  93. rsBuyout.Source = "{call dbo.cp_Buyout_request3("+ Request.QueryString("intBuyout_Req_id") + ",0,0,'',0,'',0,0,0,0,1,'Q',0)}";
  94. rsBuyout.CursorType = 0;
  95. rsBuyout.CursorLocation = 2;
  96. rsBuyout.LockType = 3;
  97. rsBuyout.Open();
  98. var intShip_dtl_id = 0;
  99. if (!rsBuyout.EOF) {
  100. if (rsBuyout.Fields.Item("intShip_dtl_id").Value != null) intShip_dtl_id = rsBuyout.Fields.Item("intShip_dtl_id").Value;
  101. }
  102. var rsMethod = Server.CreateObject("ADODB.Recordset");
  103. rsMethod.ActiveConnection = MM_cnnASP02_STRING;
  104. rsMethod.Source = "{call dbo.cp_buyout_ship_method3("+ intShip_dtl_id + ",0,0,'',0,0,0,'',0,0,'','',0,0,'Q',0)}";
  105. rsMethod.CursorType = 0;
  106. rsMethod.CursorLocation = 2;
  107. rsMethod.LockType = 3;
  108. rsMethod.Open();
  109. var IsNew = ((rsMethod.EOF)?true:false);
  110. var total_sold_price = 0;
  111. var total_cost = 0;
  112. var tax = 0;
  113. var total_shipping = 0;
  114. var Vendor = "";
  115. var ReturnedBy = "";
  116. var DateProcessed = "";
  117. if (!IsNew) DateProcessed = FilterDate(rsMethod.Fields.Item("dtsUser_Ship_date").Value);
  118. while (!rsInventorySold.EOF) {
  119. var rsInventoryDetail = Server.CreateObject("ADODB.Recordset");
  120. rsInventoryDetail.ActiveConnection = MM_cnnASP02_STRING;
  121. rsInventoryDetail.Source = "{call dbo.cp_Get_EqCls_Inventory(1,0,'',1," + rsInventorySold.Fields.Item("intEquip_set_id").Value + ",0)}";
  122. rsInventoryDetail.CursorType = 0;
  123. rsInventoryDetail.CursorLocation = 2;
  124. rsInventoryDetail.LockType = 3;
  125. rsInventoryDetail.Open();
  126. if ((rsInventoryDetail.Fields.Item("intRequisition_no").Value > 0) && (rsInventoryDetail.Fields.Item("intRequisition_no").Value < 30000)){
  127. var rsPurchaseHeader = Server.CreateObject("ADODB.Recordset");
  128. rsPurchaseHeader.ActiveConnection = MM_cnnASP02_STRING;
  129. rsPurchaseHeader.Source = "{call dbo.cp_FrmHdr(14,"+rsInventoryDetail.Fields.Item("intRequisition_no").Value+")}";
  130. rsPurchaseHeader.CursorType = 0;
  131. rsPurchaseHeader.CursorLocation = 2;
  132. rsPurchaseHeader.LockType = 3;
  133. rsPurchaseHeader.Open();
  134. if (!rsPurchaseHeader.EOF) {
  135. Vendor = Trim(rsPurchaseHeader.Fields.Item("chvVendor").Value);
  136. } else {
  137. Vendor = "";
  138. }
  139. } else {
  140. Vendor = "";
  141. }
  142. if (rsInventorySold.Fields.Item("insRtned_by_id").Value > 0) {
  143. var rsStaff = Server.CreateObject("ADODB.Recordset");
  144. rsStaff.ActiveConnection = MM_cnnASP02_STRING;
  145. rsStaff.Source = "{call dbo.cp_staff2("+rsInventorySold.Fields.Item("insRtned_by_id").Value+",0,'','',0,'','',0,0,0,0,0,0,0,0,0,1,0,'',1,'Q',0)}"
  146. rsStaff.CursorType = 0;
  147. rsStaff.CursorLocation = 2;
  148. rsStaff.LockType = 3;
  149. rsStaff.Open();
  150. if (!rsStaff.EOF) {
  151. ReturnedBy = Trim(rsStaff.Fields.Item("chvFst_Name").Value) + " " + Trim(rsStaff.Fields.Item("chvLst_Name").Value);
  152. } else {
  153. ReturnedBy = "";
  154. }
  155. } else {
  156. ReturnedBy = "";
  157. }
  158. switch (String(rsInventoryDetail.Fields.Item("chvSbjTotax").Value)) {
  159. //pst
  160. case "1":
  161. tax = tax + (rsInventorySold.Fields.Item("fltEqp_Sold_Price").Value * (pst/100));
  162. break;
  163. //gst
  164. case "2":
  165. tax = tax + (rsInventorySold.Fields.Item("fltEqp_Sold_Price").Value * (gst/100));
  166. break;
  167. //both
  168. case "3":
  169. tax = tax + (rsInventorySold.Fields.Item("fltEqp_Sold_Price").Value * ((gst+pst)/100));
  170. break;
  171. }
  172. total_cost += rsInventoryDetail.Fields.Item("fltPurchase_Cost").Value;
  173. total_sold_price += rsInventorySold.Fields.Item("fltEqp_Sold_Price").Value;
  174. %>
  175. <tr>
  176. <td nowrap align="left"><a href="m010e0301.asp?intBO_Eqp_Sold_id=<%=rsInventorySold.Fields.Item("intBO_Eqp_Sold_id").Value%>&intBuyout_req_id=<%=Request.QueryString("intBuyout_req_id")%>"><%=(rsInventoryDetail.Fields.Item("chvInventory_Name").Value)%></a>&nbsp;</td>
  177. <td nowrap align="center"><%=ZeroPadFormat(rsInventoryDetail.Fields.Item("intBar_Code_no").Value,8)%>&nbsp;</td>
  178. <td nowrap align="left"><%=(rsInventoryDetail.Fields.Item("chvEqp_Status").Value)%>&nbsp;</td>
  179. <td nowrap align="center"><%=DateProcessed%>&nbsp;</td>
  180. <td nowrap align="right"><%=FormatCurrency(rsInventorySold.Fields.Item("fltEqp_Sold_Price").Value)%>&nbsp;</td>
  181. <td nowrap align="right"><%=FormatCurrency(rsInventoryDetail.Fields.Item("fltPurchase_Cost").Value)%>&nbsp;</td>
  182. <td nowrap align="left"><%=(rsInventoryDetail.Fields.Item("chvSerial_Number").Value)%>&nbsp;</td>
  183. <td nowrap align="left"><%=(rsInventoryDetail.Fields.Item("chvModel_Number").Value)%>&nbsp;</td>
  184. <td nowrap align="center"><%=ZeroPadFormat(rsInventoryDetail.Fields.Item("intRequisition_no").Value,8)%>&nbsp;</td>
  185. <td nowrap align="left"><%=(Vendor)%>&nbsp;</td>
  186. <td nowrap align="center"><%=FilterDate(rsInventorySold.Fields.Item("dtsDate_Returned").Value)%>&nbsp;</td>
  187. <td nowrap align="left"><%=(ReturnedBy)%>&nbsp;</td>
  188. <td nowrap align="left"><%=(rsInventorySold.Fields.Item("chvComments").Value)%>&nbsp;</td>
  189. </tr>
  190. <%
  191. rsInventorySold.MoveNext();
  192. }
  193. total_shipping = total_sold_price * (shipping/100);
  194. %>
  195. </table>
  196. </div>
  197. <div style="position: absolute; top: 310px">
  198. <table cellpadding="0" cellspacing="1">
  199. <tr>
  200. <td width="350"><b>Total Equipment Cost:</b></td>
  201. <td align="right"><b><%=FormatCurrency(total_cost)%></b></td>
  202. </tr>
  203. <tr>
  204. <td width="350"><b>Total Sold Cost without taxes/shipping:</b></td>
  205. <td align="right"><b><%=FormatCurrency(total_sold_price)%></b></td>
  206. </tr>
  207. <tr>
  208. <td width="350"><b>Taxes:</b></td>
  209. <td align="right"><b><%=FormatCurrency(tax)%></b></td>
  210. </tr>
  211. <tr>
  212. <td width="350"><b>Shipping:</b></td>
  213. <td align="right"><b><%=FormatCurrency(total_shipping)%></b></td>
  214. </tr>
  215. <tr>
  216. <td width="350"><b>Total Buyout Cost with taxes/shipping:</b></td>
  217. <td align="right"><b><%=FormatCurrency(total_sold_price+tax+total_shipping)%></b></td>
  218. </tr>
  219. </table>
  220. </div>
  221. </body>
  222. </html>
  223. <%
  224. rsInventorySold.Close();
  225. %>