/beta/home/goodReq.asp

http://github.com/khaneh/Orders · ASP · 161 lines · 137 code · 15 blank · 9 comment · 21 complexity · 0f08e5064f7895bb6788b73434d2f237 MD5 · raw file

  1. <%@LANGUAGE="VBSCRIPT" CODEPAGE="1256"%><%
  2. 'Home (0)
  3. PageTitle= " "
  4. SubmenuItem=5
  5. if not Auth(0 , 5) then NotAllowdToViewThisPage()
  6. %>
  7. <!--#include file="top.asp" -->
  8. <!--#include File="../include_farsiDateHandling.asp"-->
  9. <!--#include File="../include_JS_InputMasks.asp"-->
  10. <%
  11. catItem1 = request("catItem")
  12. if catItem1="" then catItem1="-1"
  13. '-----------------------------------------------------------------------------------------------------
  14. '----------------------------------------------------------- Delete an Inventory Request from an order
  15. '-----------------------------------------------------------------------------------------------------
  16. if request("di")="y" then
  17. myRequestID=request("i")
  18. set RSX=Conn.Execute ("SELECT * FROM InventoryItemRequests WHERE id = "& myRequestID )
  19. if RSX("status")="new" then
  20. Conn.Execute ("update InventoryItemRequests SET status = 'del' where id = "& myRequestID )
  21. end if
  22. response.redirect "goodReq.asp?radif=" & request("r")
  23. end if
  24. '-----------------------------------------------------------------------------------------------------
  25. '-------------------------------------------------------------------- Submit an Inventory Item request
  26. '-----------------------------------------------------------------------------------------------------
  27. if request.form("Submit")=" " then
  28. order_ID = request.form("radif")
  29. item = request.form("item")
  30. comment = request.form("comment")
  31. qtty = request.form("qtty")
  32. CreatedBy = session("id")
  33. if not item = "" then
  34. if comment="" then
  35. comment = "-"
  36. end if
  37. if order_ID="" or item="-1" or qtty="" or qtty="0" then
  38. response.write "<br><br><center>! "
  39. response.write "<br><br><A HREF='goodReq.asp'>ѐ</A></center>"
  40. response.end
  41. end if
  42. set RS4 = conn.Execute ("SELECT * FROM InventoryItems where ID=" & item)
  43. if (RS4.eof) then
  44. otype="-unknown-"
  45. unit=RS4("unit")
  46. else
  47. otype=RS4("Name")
  48. unit=RS4("unit")
  49. end if
  50. RS4.close
  51. mySql="INSERT INTO InventoryItemRequests (orderID, ItemName, ItemID, comment, ReqDate, Qtty, unit, CreatedBy) VALUES ("& order_ID & ", N'"& otype & "', "& item & ", N'"& comment & "',getDate(), "& Qtty & ", N'"& unit & "' , "& CreatedBy & " )"
  52. conn.Execute mySql
  53. 'RS1.close
  54. response.redirect "goodReq.asp"
  55. end if
  56. end if
  57. %>
  58. <center>
  59. <BR><BR>
  60. <TABLE border="0" cellspacing="0" cellpadding="2" dir="RTL" align="center" width="350" >
  61. <TR bgcolor="black" >
  62. <TD align="right" colspan=2><FONT COLOR="YELLOW"> :</FONT></TD>
  63. </TR>
  64. <TR bgcolor="#CCCCCC" ><td colspan=2>
  65. <FORM METHOD=POST ACTION="goodReq.asp">
  66. <INPUT TYPE="hidden" name="radif" value="-1">
  67. <SELECT NAME="catItem" style='font-family: tahoma,arial ; font-size: 9pt; font-weight: bold' size="1" onchange="document.forms[0].submit()">
  68. <option value="-1"> : </option>
  69. <option value="-1">----------------------------------------------</option>
  70. <%
  71. set RS4 = conn.Execute ("SELECT * FROM InventoryItemCategories")
  72. while not (RS4.eof) %>
  73. <OPTION value="<%=RS4("ID")%>"<%
  74. if trim(catItem1) = trim(RS4("ID")) then
  75. response.write " selected "
  76. end if
  77. %>>* <%=RS4("Name")%> </option>
  78. <% RS4.MoveNext
  79. wend
  80. RS4.close
  81. %>
  82. </SELECT><br><br>
  83. <%
  84. if not catItem1="-1" then
  85. %>
  86. <SELECT NAME="item" style='font-family: tahoma,arial ; font-size: 9pt; font-weight: bold' size="1">
  87. <option value="-1"> : </option>
  88. <option value="-1">----------------------------------------------</option>
  89. <%
  90. set RS5 = conn.Execute ("SELECT * FROM InventoryItemCategoryRelations where Cat_ID=" & catItem1)
  91. while not (RS5.eof)
  92. set RS4 = conn.Execute ("SELECT * FROM InventoryItems where id=" & RS5("Item_ID") ) %>
  93. <OPTION value="<%=RS4("ID")%>">* <%=RS4("Name")%> (<%=RS4("Unit")%>)</option>
  94. <% RS5.MoveNext
  95. wend
  96. RS5.close
  97. %>
  98. </SELECT><br><br>
  99. <% end if %>
  100. : &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<INPUT TYPE="text" NAME="qtty" size=40 onKeyPress="return maskNumber(this);"><br><br>
  101. : <TEXTAREA NAME="comment" ROWS="7" COLS="32"></TEXTAREA>
  102. <br><center>
  103. <INPUT TYPE="submit" Name="Submit" Value=" " style="width:120px;" tabIndex="14"<%
  104. if catItem1="-1" then
  105. response.write " disabled "
  106. end if
  107. %>>
  108. </center>
  109. </FORM>
  110. <hr>
  111. </FONT></TD>
  112. </TR>
  113. <%
  114. 'Gets Request for services list from DB
  115. set RS3=Conn.Execute ("SELECT InventoryItemRequests.*, InventoryItemRequests.ID AS Expr2, InventoryPickuplists.Status AS Expr1 FROM InventoryPickuplists FULL OUTER JOIN InventoryPickuplistItems ON InventoryPickuplists.id = InventoryPickuplistItems.pickupListID FULL OUTER JOIN InventoryItemRequests ON InventoryPickuplistItems.RequestID = InventoryItemRequests.ID WHERE (InventoryItemRequests.OrderID = - 1) AND (InventoryItemRequests.CreatedBy = "& session("id") & ") AND (NOT (InventoryItemRequests.Status = 'del' or InventoryItemRequests.Status = 'pick')) AND (NOT InventoryPickuplists.Status = N'done' OR InventoryPickuplists.Status IS NULL)")
  116. %>
  117. <%
  118. Do while not RS3.eof
  119. %>
  120. <TR bgcolor="#CCCCCC" title="<%
  121. Comment = RS3("Comment")
  122. if Comment<>"-" then
  123. response.write ": " & Comment
  124. else
  125. response.write " "
  126. end if
  127. %>">
  128. <TD align="right" valign=top><FONT COLOR="black">
  129. <INPUT TYPE="checkbox" NAME="outReq" VALUE="<%=RS3("id")%>" <%
  130. if RS3("status") = "new" then
  131. response.write " checked disabled "
  132. else
  133. response.write " disabled "
  134. end if
  135. %>><%=RS3("ItemName")%> - <%=RS3("qtty")%> <%=RS3("unit")%> <small>(<%=RS3("ReqDate")%>)</small></td>
  136. <td align=left width=5%><%
  137. if RS3("status") = "new" then
  138. %><a href="goodReq.asp?di=y&i=<%=RS3("id")%>&r=<%=request("radif")%>"><b></b></a><%
  139. end if %></td>
  140. </tr>
  141. <%
  142. RS3.moveNext
  143. Loop
  144. %>
  145. </table><BR>
  146. <!--#include file="tah.asp" -->