PageRenderTime 15ms CodeModel.GetById 2ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 0ms

/beta/shopfloor/manageOrder.asp

http://github.com/khaneh/Orders
ASP | 617 lines | 539 code | 46 blank | 32 comment | 66 complexity | 262bbe8fd67cf4208df6a663613c0b1e MD5 | raw file
  1<%@LANGUAGE="VBSCRIPT" CODEPAGE="1256"%><%
  2'shopfloor (3)
  3PageTitle="������ ����"
  4SubmenuItem=2
  5if not Auth(3 , 2) then NotAllowdToViewThisPage()
  6
  7'OutService Page Request
  8'By Alix - Last changed: 81/01/13
  9%>
 10<!--#include file="top.asp" -->
 11<!--#include File="../include_farsiDateHandling.asp"-->
 12<%
 13catItem1 = request("catItem")
 14if catItem1="" then catItem1="-1"
 15
 16'-----------------------------------------------------------------------------------------------------
 17'------------------------------------------------------------------------ Submit an OutService request
 18'-----------------------------------------------------------------------------------------------------
 19if request.form("Submit")="��� ������� �����" then
 20	order_ID = request.form("radif")
 21	otypeID = request.form("type")
 22	comment = request.form("comment")
 23	Price = request.form("Price")
 24	qtty = request.form("qtty")
 25	priceComment = request.form("priceComment")
 26	if Price = "" then price = "0"
 27	if comment = "" then comment = "-"
 28	if qtty = "" then qtty = "0"
 29	CreatedBy = session("id")
 30	dueDate = request.form("date1")
 31
 32	if order_ID="" or otypeID="-1" or comment="" or Price="" then
 33		response.write "error"
 34		response.end
 35	end if
 36
 37	set RS4 = conn.Execute ("SELECT * FROM OutServices where ID=" & otypeID)
 38	if (RS4.eof) then
 39		otype="-unknown-"
 40	else
 41		otype=RS4("Name")
 42	end if
 43	RS4.close
 44
 45	mySql="INSERT INTO purchaseRequests (qtty, order_ID, typeName, typeID, comment, ReqDate, price,priceComment, CreatedBy, DueDate, IsService) VALUES ("& qtty & ","& order_ID & ", N'"& otype & "', "& otypeID & ", N'"& comment & "',N'"& shamsiToday() & "', "& price & ",N'"& priceComment & "', "& CreatedBy & ", N'"& DueDate & "' ,1 )"	
 46	'response.write "<div align=left dir=ltr>"
 47	'response.write mySql
 48	'response.end
 49
 50	conn.Execute mySql
 51	'RS2.close
 52
 53	if not request("relatedApprovedInvoiceID")="0" then
 54		call UnApproveInvoice(request("relatedApprovedInvoiceID"),request("relatedApprovedInvoiceBy"))
 55	end if
 56
 57	response.redirect "manageOrder.asp?radif=" & order_ID
 58end if
 59
 60'-----------------------------------------------------------------------------------------------------
 61'-------------------------------------------------------------------- Submit an Inventory Item request
 62'-----------------------------------------------------------------------------------------------------
 63if request.form("Submit")="��� ������� ����" then
 64	order_ID = request.form("radif")
 65	item = request.form("item")
 66	comment = request.form("comment")
 67	qtty = request.form("qtty")
 68	CreatedBy = session("id")
 69	if request.form("CustomerHaveInvItem") ="on" then
 70		CustomerHaveInvItem = 1
 71	else
 72		CustomerHaveInvItem = 0
 73	end if 
 74	if qtty = "" then qtty = "0"
 75	if comment = "" then comment = "-"
 76	if 	not (item = "" or item="-1") then
 77
 78		if order_ID="" or otypeID="-1" or comment="" or qtty="" then
 79			response.write "error"
 80			response.end
 81		end if
 82
 83		set RS4 = conn.Execute ("SELECT * FROM InventoryItems where ID=" & item)
 84		if (RS4.eof) then
 85			otype="-unknown-"
 86			unit=RS4("unit")
 87		else
 88			otype=RS4("Name")
 89			unit=RS4("unit")
 90		end if
 91		RS4.close
 92		
 93		mySql="INSERT INTO InventoryItemRequests (order_ID, ItemName, ItemID, comment, ReqDate, Qtty, unit, CreatedBy, CustomerHaveInvItem) VALUES ("& order_ID & ", N'"& otype & "', "& item & ", N'"& comment & "',N'"& shamsiToday() & "', "& Qtty & ", N'"& unit & "' , "& CreatedBy & " , " & CustomerHaveInvItem & ")"
 94		conn.Execute mySql
 95		'RS2.close
 96
 97		if not request("relatedApprovedInvoiceID")="0" then
 98			call UnApproveInvoice(request("relatedApprovedInvoiceID"), request("relatedApprovedInvoiceBy"))
 99		end if
100
101		response.redirect "manageOrder.asp?radif=" & order_ID
102	end if
103end if
104
105'-----------------------------------------------------------------------------------------------------
106'---------------------------------------------------------------------- Delete an OutReq from an order
107'-----------------------------------------------------------------------------------------------------
108if request("d")="y" then		
109	myRequestID=request("i")
110	set RSX=Conn.Execute ("SELECT * FROM purchaseRequests WHERE id = "& myRequestID )	
111	if RSX("status")="new" then
112	Conn.Execute ("update purchaseRequests SET status = 'del' where id = "& myRequestID )	
113	end if
114
115	if not request("relatedApprovedInvoiceID")="0" then
116		call UnApproveInvoice(request("relatedApprovedInvoiceID") , request("relatedApprovedInvoiceBy"))
117	end if
118	response.redirect "manageOrder.asp?radif=" & request("r")
119end if
120
121'-----------------------------------------------------------------------------------------------------
122'----------------------------------------------------------- Delete an Inventory Request from an order
123'-----------------------------------------------------------------------------------------------------
124if request("di")="y" then		
125	myRequestID=request("i")
126	set RSX=Conn.Execute ("SELECT * FROM InventoryItemRequests WHERE id = "& myRequestID )	
127	if RSX("status")="new" then
128	Conn.Execute ("update InventoryItemRequests SET status = 'del' where id = "& myRequestID )	
129	end if
130
131	if not request("relatedApprovedInvoiceID")="0" then
132		call UnApproveInvoice(request("relatedApprovedInvoiceID"), request("relatedApprovedInvoiceBy"))
133	end if
134	response.redirect "manageOrder.asp?radif=" & request("r")
135end if
136
137'-----------------------------------------------------------------------------------------------------
138'------------------------------------------------------------------------------------------------ Main
139'-----------------------------------------------------------------------------------------------------
140if request("radif")="" then
141	%><br><br><br>
142	<FORM METHOD=POST ACTION="manageOrder.asp?e=y">
143	<TABLE border="0" cellspacing="0" cellpadding="2" dir="RTL" align="center" style="font-family:Tahoma,arial; font-size: 8pt;">
144	<TR>
145		<TD>����� ����� �� ���� ����:</TD>
146		<TD><INPUT Name="Radif" TYPE="text" maxlength="6" size="6" tabIndex="1" dir="LTR"></TD>
147		<TD><INPUT TYPE="submit" Name="Submit" Value="�����" style="width:100px;"  class="inputBut"></TD>
148	</TR>
149	</TABLE>
150	</FORM>
151	<script language="JavaScript">
152	<!--
153	document.all.Radif.focus();
154	//-->
155	</script>
156	<%
157	response.end
158elseif NOT isNumeric(request("radif")) then
159	response.write "<BR>"
160	call showAlert("��� ����� ����� <B>[ " & request("radif")& " ]</B> ������ ���.", CONST_MSG_ERROR )
161	response.end 
162else
163	OrderID=clng(request("radif"))
164end if
165
166
167'-----------------------------------------------------------------------------------------------------
168'------------------------------------------------------------ Details of an Job (Add Request to a JOB)
169'------------------------------------------------------------------------- if request("radif") <> "" :
170'-----------------------------------------------------------------------------------------------------
171set RS1=Conn.Execute ("SELECT orders_trace.*, Invoices.id FROM orders_trace RIGHT OUTER JOIN Orders ON orders_trace.radif_sefareshat = Orders.ID LEFT OUTER JOIN Invoices INNER JOIN InvoiceOrderRelations ON Invoices.ID = InvoiceOrderRelations.Invoice ON Orders.ID = InvoiceOrderRelations.[Order] WHERE (ISNULL(Invoices.issued, 0) = 1) AND (Orders.ID ='"& request("radif") & "') AND (Invoices.Voided = 0)")
172
173set RS2=Conn.Execute ("SELECT * FROM orders_trace WHERE (radif_sefareshat='"& request("radif") & "')")
174
175set RS3=Conn.Execute ("SELECT Invoices.id, Invoices.ApprovedBy FROM Orders LEFT OUTER JOIN Invoices INNER JOIN InvoiceOrderRelations ON Invoices.ID = InvoiceOrderRelations.Invoice ON Orders.ID = InvoiceOrderRelations.[Order] WHERE (ISNULL(Invoices.approved, 0) = 1) AND (Orders.ID ='"& request("radif") & "')")
176
177if RS2.eof then %>
178	<FORM METHOD=POST ACTION="manageOrder.asp"><BR><BR>
179	<TABLE border="0" cellspacing="0" cellpadding="2" dir="RTL" align="center" style="font-family:Tahoma,arial; font-size: 8pt;">
180	<TR>
181		<TD>����� ����� �� ���� ����:</TD>
182		<TD><INPUT Name="Radif" TYPE="text" maxlength="6" size="6" tabIndex="1" dir="LTR"></TD>
183		<TD><INPUT TYPE="submit" Name="Submit" Value="�����" style="width:100px;font-family:Tahoma,arial; font-size: 8pt;"></TD>
184	</TR>
185	</TABLE>
186	</FORM>
187	<br>
188	<%	
189
190	call showAlert("����� ����� �� ����� ������ ���� ����� ����.", CONST_MSG_ERROR )
191	response.end 
192end if
193
194if not RS1.eof then
195	EDITABLE="NO" 
196	response.write "<BR><BR>"
197	call showAlert( "�� ������  ���� ��� ����� �� �� ���  ����� ����� ���� ���� ���.(����� ������: <A HREF='../AR/AccountReport.asp?act=showInvoice&invoice="& RS1("id") & "' target='_blank'>" & RS1("id") & "</a>)<BR> ����� �� ������ ���� ����� �� ��� ����� ���� �����.", CONST_MSG_ALERT  ) 
198
199	if Auth(3 , 5) then
200		response.write "<br>" 
201		call showAlert("��� ���  ��� ����  "& session("CSRName") &  " ����� �� ������ �� ������ ���� ����� ����� ����." , CONST_MSG_INFORM)
202		EDITABLE="YES" 
203	end if
204end if 
205%>
206<!--#include File="../include_JS_InputMasks.asp"-->
207<font face="tahoma">
208
209<font face="tahoma">
210<% if (not RS3.EOF) and RS1.eof then
211	response.write "<BR><BR>"
212	call showAlert("�� ������ ����� ��� �� ����� <A HREF='../AR/AccountReport.asp?act=showInvoice&invoice="& RS3("id") &"' target='_blank'>" & RS3("id") & "</A> ���� ��� ����� ���� ���� <BR>�� �� ����� ����� ���� ��� �� ���� ����� ���� ����� ��." , CONST_MSG_ALERT ) 
213	relatedApprovedInvoiceID = RS3("id")
214	relatedApprovedInvoiceBy = RS3("ApprovedBy")
215else
216	relatedApprovedInvoiceID = 0
217end if %>
218<font face="tahoma">
219
220<br>
221<FORM METHOD=POST disabled>
222<TABLE border="0" cellspacing="0" cellpadding="2" dir="RTL" width="700" align="center">
223<TR bgcolor="black">
224	<TD align="left"><FONT COLOR="YELLOW">����� �����:</FONT></TD>
225	<TD align="right">
226		<!-- Radif -->
227		<INPUT TYPE="text" disabled maxlength="5" size="5" tabIndex="1" dir="LTR" value="<%=RS2("radif_sefareshat")%>">
228		<INPUT TYPE="hidden" NAME="Radif" value="<%=RS2("radif_sefareshat")%>">
229	</TD>
230	<TD align="left"><FONT COLOR="YELLOW">�����:</FONT></TD>
231	<TD><TABLE border="0">
232		<TR>
233			<TD dir="LTR">
234			<INPUT disabled TYPE="text" maxlength="10" size="8"  value="<%=RS2("order_date")%>">
235			<INPUT TYPE="hidden" NAME="OrderDate" value="<%=RS2("order_date")%>">
236			</TD>
237			<TD dir="RTL"><FONT COLOR="YELLOW"><%=weekdayname(weekday(date))%></FONT></TD>
238		</TR>
239		</TABLE></TD>
240	<TD align="left"><FONT COLOR="YELLOW">����:</FONT></TD>
241	<TD align="right">
242	<INPUT disabled TYPE="text" maxlength="5" size="3" dir="LTR" value="<%=RS2("order_time")%>">
243	<INPUT TYPE="hidden" NAME="OrderTime" value="<%=RS2("order_time")%>"></TD>
244</TR>
245<TR bgcolor="#CCCCCC">
246	<TD align="left">��� ����:</TD>
247	<TD align="right">
248		<!-- CompanyName -->
249		<INPUT TYPE="text" NAME="CompanyName" maxlength="50" size="25" tabIndex="2"  value="<%=RS2("company_name")%>"></TD>
250	<TD align="left">���� �����:</TD>
251	<TD><TABLE border="0">
252		<TR>
253			<TD dir="LTR"><INPUT TYPE="text" NAME="ReturnDate" maxlength="10" size="8" tabIndex="5" onKeyPress="return maskDate(this);" onblur="acceptDate(this)" value="<%=RS2("return_date")%>"></TD>
254			<TD dir="RTL">(?����)</TD>
255		</TR>
256		</TABLE></TD>
257	<TD align="left">���� �����:</TD>
258	<TD align="right"><INPUT TYPE="text" NAME="ReturnTime" maxlength="6" size="3" tabIndex="6" value="<%=tmpTime%>" dir="LTR" onKeyPress="return maskTime(this);" value="<%=RS2("return_time")%>"></TD>
259</TR>
260<TR bgcolor="#CCCCCC">
261	<TD align="left">��� �����:</TD>
262	<TD align="right">
263		<!-- CustomerName -->
264		<INPUT TYPE="text" NAME="CustomerName" maxlength="50" size="25" tabIndex="3" value="<%=RS2("customer_name")%>"></TD>
265	<TD align="left">��� �����:</TD>
266	<TD> <INPUT TYPE="text" NAME="OrderKind" maxlength="10" size="8" tabIndex="5"  value="<%=RS2("order_kind")%>"> 
267</TD>
268	<TD align="left">����� ������:</TD>
269	<TD>
270	<INPUT TYPE="text" NAME="SalesPerson" maxlength="10" size="10" tabIndex="5"  value="<%=RS2("salesperson")%>">
271	
272</TD>
273</TR>
274<TR bgcolor="#CCCCCC">
275	<TD align="left">����:</TD>
276	<TD align="right">
277		<!-- Telephone -->
278		<INPUT TYPE="text" NAME="Telephone" maxlength="50" size="25" tabIndex="4" value="<%=RS2("telephone")%>"></TD>
279	<TD align="left">����� ��� ���� ����:</TD>
280	<TD align="right" colspan="4"><INPUT TYPE="text" NAME="OrderTitle" maxlength="255" size="50" tabIndex="9" value="<%=RS2("order_title")%>"></TD>
281</TR>
282<TR bgcolor="#CCCCCC">
283	<TD align="left">�����:</TD>
284	<TD align="right"><INPUT TYPE="text" NAME="Qtty" maxlength="50" size="5" tabIndex="10" dir="LTR" value="<%=RS2("qtty")%>"></TD>
285	<TD align="left">����:</TD>
286	<TD align="right"><INPUT TYPE="text" NAME="Size" maxlength="50" size="8" dir="LTR" tabIndex="11" value="<%=RS2("PaperSize")%>"></TD>
287	<TD align="left">����/����:</TD>
288	<TD><INPUT TYPE="text" NAME="SimplexDuplex" maxlength="10" size="10" tabIndex="5"  value="<%=RS2("SimplexDuplex")%>">
289	
290</TD>
291</TR>
292<TR bgcolor="#CCCCCC">
293	<TD align="left">�����:</TD>
294	<TD colspan="2"><INPUT TYPE="text" NAME="Marhale" maxlength="10" size="16" tabIndex="5"  value="<%=RS2("marhale")%>">
295	
296</TD>
297	<TD align="left">�����:</TD>
298	<TD colspan="2">
299	<INPUT TYPE="text" NAME="Vazyat" maxlength="10" size="16" tabIndex="5"  value="<%=RS2("vazyat")%>">
300</TD>
301</TR>
302<TR bgcolor="#CCCCCC">
303	<TD colspan="6" height="30px">&nbsp;</TD>
304</TR>
305</TABLE><br>
306</FORM>
307	<TABLE cellspacing=0 width=80% align=center>
308	<TR bgcolor=white>
309		<TD>�����</TD>
310		<TD>����</TD>
311		<TD>�����</TD>
312		<TD>�����</TD>
313		<TD>��� ��� �����</TD>
314	</TR>
315	<%
316	set RS_STEP=Conn.Execute ("SELECT InsertedDate, InsertedTime, StepText, StatusText, Users.RealName FROM OrderTraceLog INNER JOIN Users ON OrderTraceLog.InsertedBy = Users.ID WHERE (OrderTraceLog.[Order] = "& request("radif")  & ") order by OrderTraceLog.ID")
317	Do while not RS_STEP.eof	
318	%>
319	<TR>
320		<TD  style="border-bottom: solid 1pt black" dir=ltr align=right><%=RS_STEP("InsertedDate")%> </TD>
321		<TD  style="border-bottom: solid 1pt black" dir=ltr align=right>(<%=RS_STEP("InsertedTime")%>)</TD>
322		<TD  style="border-bottom: solid 1pt black"><%=RS_STEP("StepText")%></TD>
323		<TD  style="border-bottom: solid 1pt black"><%=RS_STEP("StatusText")%></TD>
324		<TD  style="border-bottom: solid 1pt black"><%=RS_STEP("RealName")%></TD>
325	</TR>
326		<%
327		RS_STEP.moveNext
328	loop
329	RS_STEP.close
330	Set RS_STEP = nothing
331
332	if NOT EDITABLE="NO" then
333	%>
334	<TR  bgcolor=white>
335		<TD><A HREF="default.asp?orderNum=<%=request("radif")%>&marhale_box=<%=RS2("step")%>">����� �����</A></TD>
336		<td colspan="2" title="�� ���� ��� ��� ���� �� ���� ������ �� ����� �� ����� ����� ����� �� �� ���� ����� ����� � ����� ����� ����� ���">
337			<%
338			set rsEmail=Conn.Execute("select accounts.AccountTitle, accounts.Dear1, accounts.FirstName1, accounts.LastName1, orders.ID, orders.Customer,accounts.Email1, orders_trace.order_title from Orders inner join Accounts on orders.Customer=accounts.ID inner join orders_trace on orders_trace.radif_sefareshat=orders.ID where orders.ID=" & request("radif") & " and accounts.EMail1 <> ''")
339			if not rsEmail.eof then 
340			%>
341			<span>
342				<form method="post" action="http://my.pdhco.com/sendMail.php">
343					<input type="hidden" name="order_id" value="<%=rsEmail("ID")%>">
344					<input type="hidden" name="customer_id" value="<%=rsEmail("customer")%>">
345					<input type="hidden" name="order_title" value="<%=rsEmail("order_title")%>">
346					<input type="hidden" name="Email" value="<%=rsEmail("Email1")%>">
347					<input type="hidden" name="AccountTitle" value="<%=rsEmail("AccountTitle")%>">
348					<input type="hidden" name="Dear" value="<%=rsEmail("Dear1")%>">
349					<input type="hidden" name="FirstName" value="<%=rsEmail("FirstName1")%>">
350					<input type="hidden" name="LastName" value="<%=rsEmail("LastName1")%>">
351					<input type="submit" name="orderSend" title='<%=rsEmail("email1")%>' value="�� <%=rsEmail("Dear1") & " " & rsEmail("firstName1") & " " & rsEmail("LastName1")%> ����� ���">
352				</form>
353			</span>
354			<%end if%>
355		</td>
356		<td colspan="2" title="�� ���� ��� ��� ���� �� ���� ������ �� ����� �� ����� ����� ����� �� �� ���� ����� ����� � ����� ����� ����� ���">
357			<%
358			set rsEmail=Conn.Execute("select accounts.AccountTitle, accounts.Dear2, accounts.FirstName2, accounts.LastName2, orders.ID, orders.Customer,accounts.Email2, orders_trace.order_title from Orders inner join Accounts on orders.Customer=accounts.ID inner join orders_trace on orders_trace.radif_sefareshat=orders.ID where orders.ID=" & request("radif") & " and accounts.EMail2 <> ''")
359			if not rsEmail.eof then 
360			%>
361			<span>
362				<form method="post" action="http://my.pdhco.com/sendMail.php">
363					<input type="hidden" name="order_id" value="<%=rsEmail("ID")%>">
364					<input type="hidden" name="customer_id" value="<%=rsEmail("customer")%>">
365					<input type="hidden" name="order_title" value="<%=rsEmail("order_title")%>">
366					<input type="hidden" name="Email" value="<%=rsEmail("Email2")%>">
367					<input type="hidden" name="AccountTitle" value="<%=rsEmail("AccountTitle")%>">
368					<input type="hidden" name="Dear" value="<%=rsEmail("Dear2")%>">
369					<input type="hidden" name="FirstName" value="<%=rsEmail("FirstName2")%>">
370					<input type="hidden" name="LastName" value="<%=rsEmail("LastName2")%>">
371					<input type="submit" name="orderSend" title='<%=rsEmail("email2")%>' value="�� <%=rsEmail("Dear2") & " " & rsEmail("firstName2") & " " & rsEmail("LastName2")%> ����� ���">
372				</form>
373			</span>
374			<%end if%>
375		</td>
376	</TR>
377	<% end if %>
378	</TABLE>
379
380<br>
381<table width="700"  align="center">
382<tr>
383<td  valign=top>
384	<TABLE border="0" cellspacing="0" cellpadding="2" dir="RTL" align="center" width="350" >
385	<TR bgcolor="black" >
386		<TD align="right" colspan=2><FONT COLOR="YELLOW">���������� ���� �� �����:</FONT></TD>
387	</TR>
388		<TR bgcolor="#CCCCCC" ><td colspan=2>
389		<FORM METHOD=POST ACTION="manageOrder.asp" name='findInv'>
390			<INPUT TYPE="hidden" name="relatedApprovedInvoiceBy" value="<%=relatedApprovedInvoiceBy%>">
391			<INPUT TYPE="hidden" name="relatedApprovedInvoiceID" value="<%=relatedApprovedInvoiceID%>">
392			<INPUT TYPE="hidden" name="radif" value="<%=request("radif")%>">
393			<SELECT NAME="catItem" style='font-family: tahoma,arial ; font-size: 9pt; font-weight: bold' size="1"  onchange="document.forms['findInv'].submit()"  style="width:300">
394			<option value="-1">���� ���� ���� �� ������ ����: </option>
395			<option value="-1">----------------------------------------------</option>
396<%
397				set RS4 = conn.Execute ("SELECT InventoryItemCategories.Name, InventoryItemCategories.ID FROM InventoryItemCategories INNER JOIN InventoryItemCategoryRelations ON InventoryItemCategories.ID = InventoryItemCategoryRelations.Cat_ID INNER JOIN InventoryItems ON InventoryItemCategoryRelations.Item_ID = InventoryItems.ID WHERE (InventoryItems.outByOrder = 1) GROUP BY InventoryItemCategories.ID, InventoryItemCategories.Name")
398				while not (RS4.eof) %>
399					<OPTION value="<%=RS4("ID")%>"<%
400					if trim(catItem1) = trim(RS4("ID")) then
401					response.write " selected "
402					end if
403					%>>* <%=RS4("Name")%> </option>
404<%						RS4.MoveNext
405				wend
406				RS4.close
407				%>
408			</SELECT><br><br>
409			<SELECT NAME="item" style='font-family: tahoma,arial ; font-size: 9pt; font-weight: bold' size="1" style="width:300">
410			<option value="-1">��� ���� �� ������ ����: </option>
411			<option value="-1">----------------------------------------------</option>
412			<%
413			if catItem1<>"-1" then
414				set RS5 = conn.Execute ("SELECT InventoryItems.* FROM InventoryItemCategoryRelations INNER JOIN InventoryItems ON InventoryItemCategoryRelations.Item_ID = InventoryItems.ID WHERE (InventoryItemCategoryRelations.Cat_ID = "& catItem1& ") AND (InventoryItems.outByOrder = 1) ORDER BY Replace([Name],' ','') " )
415				while not (RS5.eof) 
416			 %>
417					<OPTION value="<%=RS5("ID")%>">* <%=RS5("Name")%> (<%=RS5("Unit")%>)</option>
418			<%	RS5.MoveNext
419				wend
420				RS5.close
421				%>
422			<% end if %>
423			</SELECT><br><br>
424			<INPUT TYPE="checkbox" NAME="CustomerHaveInvItem" > ����� ������ ��� ����� <br><br>
425			�����: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<INPUT TYPE="text" NAME="qtty" size=40 onKeyPress="return maskNumber(this);"><br><br>
426			�������: <TEXTAREA NAME="comment" ROWS="7" COLS="32"></TEXTAREA>
427			<br><center><br>
428			<INPUT  class="inputBut" TYPE="submit" Name="Submit" Value="��� ������� ����"  style="width:120px;" tabIndex="14" <%
429			if catItem1="-1" or EDITABLE="NO"  then
430				response.write " disabled "
431			end if
432			%>>
433			</center>
434		</FORM>
435		<hr>
436
437		</FONT></TD>
438	</TR>
439	<%
440	'Gets Request for services list from DB
441'set RS3=Conn.Execute ("SELECT dbo.InventoryItemRequests.Comment, dbo.InventoryItemRequests.ID, dbo.InventoryItemRequests.Status, dbo.InventoryItemRequests.ItemName, dbo.InventoryItemRequests.CustomerHaveInvItem, dbo.InventoryItemRequests.Qtty, dbo.InventoryItemRequests.unit, dbo.InventoryItemRequests.ReqDate FROM dbo.InventoryPickuplists FULL OUTER JOIN dbo.InventoryPickuplistItems ON dbo.InventoryPickuplists.id = dbo.InventoryPickuplistItems.pickupListID FULL OUTER JOIN dbo.InventoryItemRequests ON dbo.InventoryPickuplistItems.RequestID = dbo.InventoryItemRequests.ID WHERE (dbo.InventoryItemRequests.Order_ID = "& request("radif") & ") AND (NOT (dbo.InventoryItemRequests.Status = 'del')) GROUP BY dbo.InventoryItemRequests.Comment, dbo.InventoryItemRequests.ID, dbo.InventoryItemRequests.Status, dbo.InventoryItemRequests.ItemName, dbo.InventoryItemRequests.CustomerHaveInvItem, dbo.InventoryItemRequests.Qtty, dbo.InventoryItemRequests.unit, dbo.InventoryItemRequests.ReqDate")
442	set RS3=Conn.Execute ("SELECT InventoryItemRequests.*,InventoryPickuplistItems.pickupListID  FROM InventoryItemRequests left outer join InventoryPickuplistItems on InventoryItemRequests.ID=InventoryPickuplistItems.RequestID WHERE InventoryItemRequests.order_ID="& request("radif") )
443
444	'set RS3=Conn.Execute ("SELECT * FROM InventoryItemRequests WHERE (order_ID="& request("radif") & " ) and not status = 'del'")
445	%>
446		<%
447		Do while not RS3.eof
448		%>
449		<TR bgcolor="#CCCCCC" title="<% 
450			Comment = RS3("Comment")
451			if Comment<>"-" then
452				response.write "�����: " & Comment
453			else
454				response.write "����� �����"
455			end if
456		%>">
457			<TD align="right" valign=top><FONT COLOR="black">
458			<INPUT TYPE="checkbox" NAME="outReq" VALUE="<%=RS3("id")%>" <%
459			if RS3("status") = "new" then
460				response.write " checked disabled "
461			else 
462				response.write " disabled "
463			end if
464			%>><%=RS3("ItemName")%> 
465			<%
466			if (not isNull(RS3("pickupListID"))) then 
467				response.write "<a href='../inventory/default.asp?ed="&RS3("pickupListID")&"'>"
468			end if
469		%>
470			<%
471			if RS3("CustomerHaveInvItem")  then
472				response.write "<b style='color:red'> ������ </b>" 
473			end if 
474			%>
475			
476			<small dir=ltr>(�����: <%=RS3("qtty")%> <%=RS3("unit")%> - �����: <span dir=ltr><%=RS3("ReqDate")%></span>)</small>
477			<%
478			if (not isNull(RS3("pickupListID"))) then 
479				response.write "</a>"
480			end if
481			if RS3("status") = "del" then response.write ("<font color=red>��� ���</font>")
482		%>
483			
484			</td>
485			<td align=left width=5%>
486			<%
487			
488			if RS3("status") = "new" then
489			%><a href="manageOrder.asp?di=y&i=<%=RS3("id")%>&r=<%=request("radif")%>&relatedApprovedInvoiceID=<%=relatedApprovedInvoiceID%>&relatedApprovedInvoiceBy=<%=relatedApprovedInvoiceBy%>"><b>���</b></a><%
490			end if %></td>
491		</tr>
492		<% 
493		RS3.moveNext
494		Loop
495		%>
496	</TABLE>
497</td>
498<td valign=top>
499	<FORM METHOD=POST ACTION="manageOrder.asp">
500	<TABLE border="0" cellspacing="0" cellpadding="2" dir="RTL" align="center" width="350" >
501	<TR bgcolor="black" >
502		<TD align="right" colspan=2><FONT COLOR="YELLOW">���������� ���� ����� � ����:</FONT></TD>
503	</TR>
504		<TR bgcolor="#CCCCCC" ><td colspan=2>
505		<center><!INPUT TYPE="submit" Name="Submit" Value="����� ����� "  style="width:150px;" tabIndex="14"> </center></form>
506
507		<FORM METHOD=POST ACTION="manageOrder.asp">
508			<INPUT TYPE="hidden" name="relatedApprovedInvoiceBy" value="<%=relatedApprovedInvoiceBy%>">
509			<INPUT TYPE="hidden" name="relatedApprovedInvoiceID" value="<%=relatedApprovedInvoiceID%>">
510			<INPUT TYPE="hidden" name="radif" value="<%=request("radif")%>">
511			<SELECT NAME="type" style='font-family: tahoma,arial ; font-size: 9pt; font-weight: bold' size="1"  style="width:300">
512			<option value="-1">��� ���� �� ������ ����: </option>
513			<option value="-1">----------------------------------------------</option>
514<%
515				set RS4 = conn.Execute ("SELECT * FROM OutServices")
516				while not (RS4.eof) %>
517					<OPTION value="<%=RS4("ID")%>">* <%=RS4("Name")%></option>
518<%						RS4.MoveNext
519				wend
520				RS4.close
521				%>
522			</SELECT><br>
523			<SCRIPT LANGUAGE="JavaScript">
524			<!--
525			function hideIT()
526			{
527			if(document.all.tavafogh.checked) 
528				{
529					document.all.priceTavafoghi.style.visibility= 'visible'
530				}
531				else
532				{
533					document.all.price.value= ''
534					document.all.priceComment.value= ''
535					document.all.priceTavafoghi.style.visibility= 'hidden'
536				}
537			}
538			//-->
539			</SCRIPT><br>
540			<INPUT TYPE="checkbox" onclick="hideIT()" name="tavafogh">����� ���� ���� ���� ����� ���<BR>
541			<div name="priceTavafoghi" id="priceTavafoghi" style="visibility:'hidden'">����: &nbsp;<INPUT TYPE="text" NAME="price" ID="price" size=5 onKeyPress="return maskNumber(this);"> ���: <INPUT TYPE="text" NAME="priceComment" id="priceComment" size=26 ></div>
542
543			������ �� ���� ���� ���: <INPUT dir=ltr TYPE="text" NAME="date1" size=12 value="<%=shamsiToday()%>" onKeyPress="return maskDate(this);"  onblur="acceptDate(this)" > &nbsp; �����: <INPUT dir=ltr TYPE="text" NAME="qtty" size=7  onKeyPress="return maskNumber(this);"><br><br>
544
545			�������: <TEXTAREA NAME="comment" ROWS="7" COLS="32"></TEXTAREA>
546			<br><br><center>
547			<INPUT TYPE="submit" Name="Submit" Value="��� ������� �����"  style="width:120px;" tabIndex="14" class="inputBut" <%
548			if EDITABLE="NO"  then
549				response.write " disabled "
550			end if
551			%>>
552			</center>
553		</FORM>
554		<hr>
555
556		</FONT></TD>
557	</TR>
558	<%
559	'Gets Request for services list from DB
560	'set RS3=Conn.Execute ("SELECT * FROM purchaseRequests WHERE (order_ID="& request("radif") & " ) and not status = 'del'")
561	set RS3=Conn.Execute ("SELECT PurchaseRequestOrderRelations.*,purchaseRequests.*,case when isnull(PurchaseOrders.price,-1)=-1 then purchaseRequests.price else purchaseOrders.price end as thisPrice  FROM purchaseRequests LEFT OUTER JOIN PurchaseRequestOrderRelations ON PurchaseRequests.id = PurchaseRequestOrderRelations.Req_ID left outer join PurchaseOrders on PurchaseOrders.ID=PurchaseRequestOrderRelations.ord_id WHERE (order_ID="& request("radif") & " )")
562	%>
563		
564		<%
565		Do while not RS3.eof
566		%>
567		<TR bgcolor="#CCCCCC" title="<% 
568			Comment = RS3("Comment")
569			if Comment<>"-" then
570				response.write "�����: " & Comment
571			else
572				response.write "����� �����"
573			end if
574		%>">
575			<TD align="right" valign=top><FONT COLOR="black">
576			<INPUT TYPE="checkbox" NAME="outReq" VALUE="<%=RS3("id")%>" <%
577			if RS3("status") = "new" then
578				response.write " checked disabled "
579			else 
580				response.write " disabled "
581			end if
582			%>>
583			<%
584			if (not isNull(RS3("Ord_ID"))) then 
585				response.write "<a href='../purchase/outServiceTrace.asp?od="&RS3("Ord_ID")&"'>"
586			end if
587			%>
588			<%=RS3("typeName")%>  <small >(�����: <%=RS3("qtty")%>� ����: <%=RS3("thisPrice")%> - �����: <span dir=ltr><%=RS3("ReqDate")%></span>)</small>
589			<%
590			if (not isNull(RS3("Ord_ID"))) then 
591				response.write "</a>"
592			end if
593			%>
594			</td>
595			<td align=left width=5%><%
596			if RS3("status") = "new" then
597			%><a href="manageOrder.asp?d=y&i=<%=RS3("id")%>&r=<%=request("radif")%>&relatedApprovedInvoiceID=<%=relatedApprovedInvoiceID%>&relatedApprovedInvoiceBy=<%=relatedApprovedInvoiceBy%>"><b>���</b></a><%
598			end if 
599			if RS3("status") = "del" then response.write ("<font color=red>��� ���</font>")
600			%>
601			</td>
602		</tr>
603		<% 
604		RS3.moveNext
605		Loop
606		%>
607	</TABLE>
608</td>
609</tr>
610</table>
611
612<%
613
614Conn.Close
615%>
616</font>
617<!--#include file="tah.asp" -->