PageRenderTime 20ms CodeModel.GetById 17ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

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