PageRenderTime 49ms CodeModel.GetById 24ms RepoModel.GetById 0ms app.codeStats 0ms

/LN/m008a0301.asp

http://github.com/boss2009/ASP-site
ASP | 210 lines | 204 code | 6 blank | 0 comment | 17 complexity | 193f0a397155e2c88c4eecb2478d2653 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 rsInventoryLoan = Server.CreateObject("ADODB.Recordset");
  27. rsInventoryLoan.ActiveConnection = MM_cnnASP02_STRING;
  28. rsInventoryLoan.Source = "{call dbo.cp_eqp_loaned(0,"+Request.QueryString("intLoan_req_id")+","+Request.Form("hInventoryID")+",'',0,0,'"+Request.Form("DateProcessed")+"','"+Comments+"',0,'A',0)}";
  29. rsInventoryLoan.CursorType = 0;
  30. rsInventoryLoan.CursorLocation = 2;
  31. rsInventoryLoan.LockType = 3;
  32. rsInventoryLoan.Open();
  33. Response.Redirect("AddDeleteSuccessful.asp?action=Add");
  34. break;
  35. }
  36. var rsStatus = Server.CreateObject("ADODB.Recordset");
  37. rsStatus.ActiveConnection = MM_cnnASP02_STRING;
  38. rsStatus.Source = "{call dbo.cp_ASP_lkup(36)}";
  39. rsStatus.CursorType = 0;
  40. rsStatus.CursorLocation = 2;
  41. rsStatus.LockType = 3;
  42. rsStatus.Open();
  43. %>
  44. <html>
  45. <head>
  46. <title>New Equipment Loaned</title>
  47. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  48. <link rel="stylesheet" href="../css/MyStyle.css" type="text/css">
  49. <script language="Javascript" src="../js/MyFunctions.js"></script>
  50. <script for="document" event="onkeyup()" language="JavaScript">
  51. if (window.event.ctrlKey) {
  52. switch (window.event.keyCode) {
  53. case 83 :
  54. //alert("S");
  55. Save();
  56. break;
  57. case 76 :
  58. //alert("L");
  59. window.close();
  60. break;
  61. }
  62. }
  63. </script>
  64. <script language="Javascript">
  65. function openWindow(page, name){
  66. if (page!='nothing') win1=window.open(page, "", "width=750,height=500,scrollbars=1,left=0,top=0,status=1");
  67. return ;
  68. }
  69. function CheckInventory(){
  70. if (document.frm0301.InventoryID.value==0) {
  71. alert("Select a Inventory.");
  72. document.frm0301.InventoryID.focus();
  73. return ;
  74. }
  75. document.frm0301.MM_action.value="GetInventory";
  76. document.frm0301.submit();
  77. }
  78. function ViewAcc(){
  79. if (document.frm0301.ClassID.value > 0) temp=window.showModalDialog("m008pop.asp?ClassID="+document.frm0301.ClassID.value,"","dialogHeight: 200px; dialogWidth: 375px; dialogTop: px; dialogLeft: px; edge: Sunken; center: Yes; help: No; resizable: No; status: No;");
  80. }
  81. function Save(){
  82. if (document.frm0301.InventoryID.value==0) {
  83. alert("Select a Inventory.");
  84. document.frm0301.InventoryID.focus();
  85. return ;
  86. }
  87. if ((!CheckDate(document.frm0301.DateProcessed.value)) || (Trim(document.frm0301.DateProcessed.value)=="")){
  88. alert("Invalid Date Processed.");
  89. document.frm0301.DateProcessed.focus();
  90. return ;
  91. }
  92. document.frm0301.MM_action.value="Insert";
  93. document.frm0301.submit();
  94. }
  95. function Init(){
  96. <%
  97. if (String(Request("MM_action"))=="GetInventory") {
  98. if (!rsInventory.EOF) {
  99. %>
  100. document.frm0301.InventoryName.value="<%=FilterQuotes(rsInventory.Fields.Item("chvInventory_Name").Value)%>";
  101. document.frm0301.hInventoryID.value="<%=(rsInventory.Fields.Item("intEquip_Set_id").Value)%>";
  102. document.frm0301.InventoryStatus.value="<%=(rsInventory.Fields.Item("insCurrent_Status").Value)%>";
  103. document.frm0301.Vendor.value="<%=FilterQuotes(rsInventory.Fields.Item("chvVendor_Name").Value)%>";
  104. document.frm0301.ModelNumber.value="<%=(rsInventory.Fields.Item("chvModel_Number").Value)%>";
  105. document.frm0301.SerialNumber.value="<%=(rsInventory.Fields.Item("chvSerial_Number").Value)%>";
  106. document.frm0301.PurchaseRequisitionNumber.value="<%=(rsInventory.Fields.Item("intRequisition_no").Value)%>";
  107. document.frm0301.EquipmentCost.value="<%=FormatCurrency(rsInventory.Fields.Item("fltList_Unit_Cost").Value)%>";
  108. <%
  109. if (rsInventory.Fields.Item("insCurrent_Status").Value!="1") {
  110. %>
  111. alert("This equipment is not available for loan.");
  112. document.frm0301.btnSave.disabled = true;
  113. <%
  114. }
  115. } else {
  116. %>
  117. alert("Equipment not found.");
  118. document.frm0301.btnSave.disabled = true;
  119. <%
  120. }
  121. }
  122. %>
  123. document.frm0301.InventoryID.focus();
  124. }
  125. </script>
  126. </head>
  127. <body onLoad="Init();">
  128. <form name="frm0301" method="POST" action="<%=MM_editAction%>">
  129. <h5>New Equipment Loaned</h5>
  130. <hr>
  131. <table cellpadding="1" cellspacing="1">
  132. <tr>
  133. <td nowrap>Inventory ID:</td>
  134. <td nowrap>
  135. <input type="text" name="InventoryID" size="12" value="<%=Request("InventoryID")%>" tabindex="1" accesskey="F" onKeypress="AllowNumericOnly();">
  136. <input type="button" value="Check Inventory" tabindex="2" onClick="CheckInventory();" class="btnstyle">
  137. <input type="button" name="ViewAccessory" value="View Accessory" tabindex="3" onClick="ViewAcc();" class="btnstyle">
  138. </td>
  139. </tr>
  140. <tr>
  141. <td nowrap>Inventory Name:</td>
  142. <td nowrap><input type="text" name="InventoryName" size="60" tabindex="4" readonly></td>
  143. </tr>
  144. <tr>
  145. <td nowrap>Inventory Status:</td>
  146. <td nowrap><select name="InventoryStatus" tabindex="5">
  147. <%
  148. while (!rsStatus.EOF) {
  149. %>
  150. <option value="<%=(rsStatus.Fields.Item("insEquip_status_id").Value)%>"><%=(rsStatus.Fields.Item("chvStatusDesc").Value)%>
  151. <%
  152. rsStatus.MoveNext();
  153. }
  154. %>
  155. </select></td>
  156. </tr>
  157. <tr>
  158. <td nowrap>Vendor:</td>
  159. <td nowrap><input type="textbox" name="Vendor" size="40" tabindex="6" readonly></td>
  160. </tr>
  161. <tr>
  162. <td nowrap>Model Number:</td>
  163. <td nowrap><input type="text" name="ModelNumber" size="12" tabindex="7" readonly></td>
  164. </tr>
  165. <tr>
  166. <td nowrap>Serial Number:</td>
  167. <td nowrap><input type="text" name="SerialNumber" size="12" tabindex="8" readonly></td>
  168. </tr>
  169. <tr>
  170. <td nowrap>PR Number:</td>
  171. <td nowrap><input type="text" name="PurchaseRequisitionNumber" size="12" tabindex="9" readonly></td>
  172. </tr>
  173. <tr>
  174. <td nowrap>Equipment Cost:</td>
  175. <td nowrap><input type="text" name="EquipmentCost" size="12" tabindex="10" readonly></td>
  176. </tr>
  177. <tr>
  178. <td nowrap>Date Processed:</td>
  179. <td nowrap>
  180. <input type="text" name="DateProcessed" size="11" tabindex="11" value="<%=((String(Request.Form("DateProcessed"))=="undefined")?CurrentDate():Request.Form("DateProcessed"))%>" maxlength="10" onChange="FormatDate(this)">
  181. <span style="font-size: 7pt">(mm/dd/yyyy)</span>
  182. </td>
  183. </tr>
  184. <tr>
  185. <td nowrap valign="top">Comments:</td>
  186. <td nowrap valign="top"><textarea name="Comments" rows="5" cols="65" tabindex="12" accesskey="L"><%=Request.Form("Comments")%></textarea></td>
  187. </tr>
  188. </table>
  189. <hr>
  190. <table cellpadding="1" cellspacing="1">
  191. <tr>
  192. <td><input type="button" name="btnSave" value="Save" onClick="Save();" tabindex="13" class="btnstyle"></td>
  193. <td><input type="button" value="Close" onClick="window.close();" tabindex="14" class="btnstyle"></td>
  194. </tr>
  195. </table>
  196. <input type="hidden" name="MM_action">
  197. <input type="hidden" name="ClassID" value="<%=ClassID%>">
  198. <input type="hidden" name="hInventoryID">
  199. </form>
  200. </body>
  201. </html>
  202. <%
  203. rsStatus.Close();
  204. %>