PageRenderTime 30ms CodeModel.GetById 13ms RepoModel.GetById 1ms app.codeStats 0ms

/BO/m010a0301.asp

http://github.com/boss2009/ASP-site
ASP | 264 lines | 255 code | 9 blank | 0 comment | 22 complexity | 72365eb1f9c6c19505a519dc07088feb 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 MM_editAction = Request.ServerVariables("URL");
  7. if (Request.QueryString) {
  8. MM_editAction += "?" + Request.QueryString;
  9. }
  10. //InventoryID on the screen is the barcode ID that the user enters.
  11. //The real intEquip_set_id is hInventoryID
  12. var ClassID = 0;
  13. switch (String(Request("MM_action"))) {
  14. case "GetInventory":
  15. var rsInventory = Server.CreateObject("ADODB.Recordset");
  16. rsInventory.ActiveConnection = MM_cnnASP02_STRING;
  17. rsInventory.Source = "{call dbo.cp_Get_EqCls_Inventory_barcode(1,0,'',1," + Request.Form("InventoryID") + ",0)}";
  18. rsInventory.CursorType = 0;
  19. rsInventory.CursorLocation = 2;
  20. rsInventory.LockType = 3;
  21. rsInventory.Open();
  22. if (!rsInventory.EOF) ClassID = rsInventory.Fields.Item("insEquip_Class_id").Value;
  23. break;
  24. case "Insert":
  25. var Comments = String(Request.Form("Comments")).replace(/'/g, "''");
  26. var ReturnedBy = ((Request.Form("DateReturned") == "")?"0":Request.Form("ReturnedBy"));
  27. var rsInventorySold = Server.CreateObject("ADODB.Recordset");
  28. rsInventorySold.ActiveConnection = MM_cnnASP02_STRING;
  29. rsInventorySold.Source = "{call dbo.cp_buyout_eqp_sold(0,"+Request.QueryString("intBuyout_req_id")+","+Request.Form("hInventoryID")+","+Request.Form("SoldPrice")+",'"+Request.Form("DateReturned")+"',"+ReturnedBy+",0,'"+Comments+"',0,'A',0)}";
  30. rsInventorySold.CursorType = 0;
  31. rsInventorySold.CursorLocation = 2;
  32. rsInventorySold.LockType = 3;
  33. rsInventorySold.Open();
  34. rsInventorySold.ActiveConnection = MM_cnnASP02_STRING;
  35. rsInventorySold.Source = "{call dbo.cp_buyout_eqp_sold(0,"+Request.QueryString("intBuyout_req_id")+","+Request.Form("hInventoryID")+","+Request.Form("SoldPrice")+",'"+Request.Form("DateReturned")+"',"+ReturnedBy+",0,'"+Comments+"',0,'A',0)}";
  36. rsInventorySold.CursorType = 0;
  37. rsInventorySold.CursorLocation = 2;
  38. rsInventorySold.LockType = 3;
  39. rsInventorySold.Open();
  40. Response.Redirect("AddDeleteSuccessful.asp?action=Add");
  41. break;
  42. }
  43. var rsStatus = Server.CreateObject("ADODB.Recordset");
  44. rsStatus.ActiveConnection = MM_cnnASP02_STRING;
  45. rsStatus.Source = "{call dbo.cp_ASP_lkup(36)}";
  46. rsStatus.CursorType = 0;
  47. rsStatus.CursorLocation = 2;
  48. rsStatus.LockType = 3;
  49. rsStatus.Open();
  50. var rsStaff = Server.CreateObject("ADODB.Recordset");
  51. rsStaff.ActiveConnection = MM_cnnASP02_STRING;
  52. rsStaff.Source = "{call dbo.cp_ASP_lkup(10)}";
  53. rsStaff.CursorType = 0;
  54. rsStaff.CursorLocation = 2;
  55. rsStaff.LockType = 3;
  56. rsStaff.Open();
  57. %>
  58. <html>
  59. <head>
  60. <title>New Equipment Sold</title>
  61. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  62. <link rel="stylesheet" href="../css/MyStyle.css" type="text/css">
  63. <script language="Javascript" src="../js/MyFunctions.js"></script>
  64. <script for="document" event="onkeyup()" language="JavaScript">
  65. if (window.event.ctrlKey) {
  66. switch (window.event.keyCode) {
  67. case 83 :
  68. //alert("S");
  69. Save1();
  70. break;
  71. case 76 :
  72. //alert("L");
  73. window.close();
  74. break;
  75. }
  76. }
  77. </script>
  78. <script language="Javascript">
  79. function openWindow(page, name){
  80. if (page!='nothing') win1=window.open(page, "", "width=750,height=500,scrollbars=1,left=0,top=0,status=1");
  81. return ;
  82. }
  83. function CheckInventory(){
  84. if (document.frm0301.InventoryID.value==0) {
  85. alert("Select a Inventory.");
  86. document.frm0301.InventoryID.focus();
  87. return ;
  88. }
  89. document.frm0301.MM_action.value="GetInventory";
  90. document.frm0301.submit();
  91. }
  92. function ViewAcc(){
  93. if (document.frm0301.InventoryID.value > 0) temp = window.showModalDialog("m010pop.asp?InventoryID="+document.frm0301.InventoryID.value,"","dialogHeight: 200px; dialogWidth: 375px; dialogTop: px; dialogLeft: px; edge: Sunken; center: Yes; help: No; resizable: No; status: No;");
  94. }
  95. function Save1(){
  96. if (document.frm0301.InventoryID.value==0) {
  97. alert("Select a Inventory.");
  98. document.frm0301.InventoryID.focus();
  99. return ;
  100. }
  101. if (isNaN(document.frm0301.SoldPrice.value)) {
  102. alert("Invalid Sold Price.");
  103. document.frm0301.SoldPrice.focus();
  104. return ;
  105. }
  106. if (!CheckDate(document.frm0301.DateReturned.value)) {
  107. alert("Invalid Date Returned.");
  108. document.frm0301.DateReturned.focus();
  109. return ;
  110. }
  111. if (Trim(document.frm0301.SoldPrice.value)=="") {
  112. <%
  113. if (String(Request("MM_action"))=="GetInventory") {
  114. if (!rsInventory.EOF) {
  115. %>
  116. document.frm0301.SoldPrice.value = "<%=rsInventory.Fields.Item("fltList_Unit_Cost").Value%>";
  117. <%
  118. }
  119. }
  120. %>
  121. }
  122. document.frm0301.MM_action.value="Insert";
  123. document.frm0301.submit();
  124. }
  125. function Init(){
  126. <%
  127. if (String(Request("MM_action"))=="GetInventory") {
  128. if (!rsInventory.EOF) {
  129. %>
  130. document.frm0301.InventoryName.value="<%=FilterQuotes(rsInventory.Fields.Item("chvInventory_Name").Value)%>";
  131. document.frm0301.hInventoryID.value="<%=(rsInventory.Fields.Item("intEquip_Set_id").Value)%>";
  132. document.frm0301.InventoryStatus.value="<%=(rsInventory.Fields.Item("insCurrent_Status").Value)%>";
  133. document.frm0301.Vendor.value="<%=FilterQuotes(rsInventory.Fields.Item("chvVendor_Name").Value)%>";
  134. document.frm0301.ModelNumber.value="<%=(rsInventory.Fields.Item("chvModel_Number").Value)%>";
  135. document.frm0301.SerialNumber.value="<%=(rsInventory.Fields.Item("chvSerial_Number").Value)%>";
  136. document.frm0301.PurchaseRequisitionNumber.value="<%=(rsInventory.Fields.Item("intRequisition_no").Value)%>";
  137. document.frm0301.EquipmentCost.value="<%=FormatCurrency(rsInventory.Fields.Item("fltList_Unit_Cost").Value)%>";
  138. document.frm0301.SoldPrice.value="<%=(rsInventory.Fields.Item("fltList_Unit_Cost").Value)%>";
  139. <%
  140. if (rsInventory.Fields.Item("insCurrent_Status").Value!="1") {
  141. %>
  142. alert("This equipment is not available for sale.");
  143. document.frm0301.Save.disabled=true;
  144. <%
  145. }
  146. } else {
  147. %>
  148. alert("Equipment not found.");
  149. document.frm0301.Save.disabled=true;
  150. <%
  151. }
  152. }
  153. %>
  154. document.frm0301.InventoryID.focus();
  155. }
  156. </script>
  157. </head>
  158. <body onLoad="Init();">
  159. <form name="frm0301" method="POST" action="<%=MM_editAction%>">
  160. <h5>New Equipment Sold</h5>
  161. <hr>
  162. <table cellpadding="1" cellspacing="1">
  163. <tr>
  164. <td nowrap>Inventory ID:</td>
  165. <td nowrap>
  166. <input type="text" name="InventoryID" size="12" value="<%=Request("InventoryID")%>" tabindex="1" accesskey="F" onKeypress="AllowNumericOnly();">
  167. <input type="button" value="Check Inventory" tabindex="2" onClick="CheckInventory();" class="btnstyle">
  168. <input type="button" value="View Accessory" tabindex="3" onClick="ViewAcc();" class="btnstyle">
  169. </td>
  170. </tr>
  171. <tr>
  172. <td nowrap>Inventory Name:</td>
  173. <td nowrap><input type="text" name="InventoryName" size="60" tabindex="4" readonly></td>
  174. </tr>
  175. <tr>
  176. <td nowrap>Inventory Status:</td>
  177. <td nowrap><select name="InventoryStatus" tabindex="5">
  178. <%
  179. rsStatus.MoveFirst();
  180. while (!rsStatus.EOF) {
  181. %>
  182. <option value="<%=(rsStatus.Fields.Item("insEquip_status_id").Value)%>"><%=(rsStatus.Fields.Item("chvStatusDesc").Value)%>
  183. <%
  184. rsStatus.MoveNext();
  185. }
  186. %>
  187. </select></td>
  188. </tr>
  189. <tr>
  190. <td nowrap>Vendor:</td>
  191. <td nowrap><input type="text" name="Vendor" size="40" tabindex="6" readonly></td>
  192. </tr>
  193. <tr>
  194. <td nowrap>Model Number:</td>
  195. <td nowrap><input type="text" name="ModelNumber" size="12" tabindex="7" readonly></td>
  196. </tr>
  197. <tr>
  198. <td nowrap>Serial Number:</td>
  199. <td nowrap><input type="text" name="SerialNumber" size="12" tabindex="8" readonly></td>
  200. </tr>
  201. <tr>
  202. <td nowrap>PR Number:</td>
  203. <td nowrap><input type="text" name="PurchaseRequisitionNumber" size="12" tabindex="9" readonly></td>
  204. </tr>
  205. <tr>
  206. <td nowrap>Equipment Cost:</td>
  207. <td nowrap><input type="text" name="EquipmentCost" size="12" tabindex="10" readonly></td>
  208. </tr>
  209. <tr>
  210. <td nowrap>Sold Price:</td>
  211. <td nowrap>$<input type="text" name="SoldPrice" size="11" value="<%=Request.Form("SoldPrice")%>" tabindex="11" onKeypress="AllowNumericOnly();"></td>
  212. </tr>
  213. <tr>
  214. <td nowrap>Date Returned:</td>
  215. <td nowrap>
  216. <input type="text" name="DateReturned" size="11" value="<%=Request.Form("DateReturned")%>" tabindex="12" maxlength="10" onChange="FormatDate(this)">
  217. <span style="font-size: 7pt">(mm/dd/yyyy)</span>
  218. </td>
  219. </tr>
  220. <tr>
  221. <td nowrap>Returned By:</td>
  222. <td nowrap><select name="ReturnedBy" tabindex="13">
  223. <option value="0">N/A
  224. <%
  225. while (!rsStaff.EOF) {
  226. %>
  227. <option value="<%=rsStaff.Fields.Item("insStaff_id").Value%>"><%=rsStaff.Fields.Item("chvName").Value%>
  228. <%
  229. rsStaff.MoveNext();
  230. }
  231. %>
  232. </select></td>
  233. </tr>
  234. <tr>
  235. <td nowrap valign="top">Comments:</td>
  236. <td nowrap valign="top"><textarea name="Comments" rows="5" cols="65" tabindex="14" accesskey="L"><%=Request.Form("Comments")%></textarea></td>
  237. </tr>
  238. </table>
  239. <hr>
  240. <table cellpadding="1" cellspacing="1">
  241. <tr>
  242. <td><input type="button" name="Save" value="Save" onClick="Save1();" tabindex="15" class="btnstyle"></td>
  243. <td><input type="button" value="Close" onClick="window.close();" tabindex="16" class="btnstyle"></td>
  244. </tr>
  245. </table>
  246. <input type="hidden" name="MM_action" value="">
  247. <input type="hidden" name="ClassID" value="<%=ClassID%>">
  248. <input type="hidden" name="hInventoryID">
  249. </form>
  250. </body>
  251. </html>
  252. <%
  253. rsStatus.Close();
  254. rsStaff.Close();
  255. %>