PageRenderTime 27ms CodeModel.GetById 10ms app.highlight 7ms RepoModel.GetById 2ms app.codeStats 0ms

/beta/purchase/outServiceTrace.asp

http://github.com/khaneh/Orders
ASP | 666 lines | 571 code | 47 blank | 48 comment | 89 complexity | c1a6b21ea4d6ba6fb6128f542146ff3b MD5 | raw file
  1<%@LANGUAGE="VBSCRIPT" CODEPAGE="1256"%><%
  2'Response.Buffer = False
  3'Purchase (4)
  4PageTitle=" ������ ����"
  5SubmenuItem=4
  6if not Auth(4 , 4) then NotAllowdToViewThisPage()
  7
  8'OutService Page Trace
  9'By Alix - Last changed: 81/01/13
 10'By Alix - Last changed: 83/12/06 - Enable changing related order (job) of this purchase order
 11%>
 12<!--#include file="top.asp" -->
 13<!--#include File="../include_farsiDateHandling.asp"-->
 14<!--#include File="../include_JS_InputMasks.asp"-->
 15<!--#include File="../include_UtilFunctions.asp"-->
 16<SCRIPT LANGUAGE="JavaScript">
 17<!--
 18function edit_order_id(reqID) {
 19	tmp = document.getElementById("orderID_span").innerText
 20	document.getElementById("orderID_span").innerHTML="<INPUT id='orderID_edit_field' style='border:0pt; width:40pt' Type='text' value='"+tmp+"'> <input type='hidden' id='ireqID' value='"+reqID+"'>"
 21	document.getElementById("orderID_edit_field").select()
 22	document.getElementById("dokme_sabt").innerHTML=' &nbsp;<A HREF="javascript:xmlsend(\'RelatedOrder\',\'ireqID\',\'orderID_edit_field\')">[���]</A>'
 23}
 24function edit_purchase_price(reqID) {
 25	tmp = document.getElementById("purchase_price").innerText;
 26	document.getElementById("purchase_price").innerHTML="<input id='purchase_price_value' style='border:0pt; width:40pt' Type='text' value='"+tmp+"'> <input type='hidden' id='purchaseID' value='"+reqID+"'>";
 27	document.getElementById("purchase_price_value").select();
 28	document.getElementById("purchase_price_submit").innerHTML=" &nbsp;<A HREF='javascript:xmlsend(\"PurchasePrice\",\"purchaseID\",\"purchase_price_value\")'>[���]</A>";
 29}
 30function xmlsend(myFile,myID,myValue) {
 31	url = "/beta/purchase/XMLchange" + myFile + ".asp?value=" + document.getElementById(myValue).value + "&id="+ document.getElementById(myID).value;
 32	if (window.XMLHttpRequest) {
 33		var xmldoc=new XMLHttpRequest();
 34	} else if (window.ActiveXObject) {
 35		var xmldoc = new ActiveXObject("Microsoft.XMLHTTP");
 36	}
 37	//objHTTP.open('GET',url,false)
 38	//objHTTP.send()
 39	//tmpStr = unescape(objHTTP.responseText)
 40
 41	document.getElementsByTagName('body')[0].style.cursor = 'wait';
 42
 43	url = url + "&<%=currentTime10()%>";
 44	
 45	xmldoc.open('GET',url,false);
 46	xmldoc.setRequestHeader("Cache-Control","no-cache");
 47	try {xmldoc.send(valval);} catch (e) {xmldoc.send();}
 48	{
 49		//alert(xmldoc.status);
 50		if (xmldoc.readyState==4)
 51		{ 
 52		 document.getElementsByTagName('body')[0].style.cursor = 'auto';
 53		 returnobj = xmldoc.responseText;
 54		}
 55		if (returnobj=="ok") 
 56		{
 57		document.getElementById("orderID_span").innerHTML="<a href='../shopfloor/manageOrder.asp?radif="+document.getElementById(myID).value+"'>"+document.getElementById(myID).value+"</a>";
 58		document.getElementById("dokme_sabt").innerHTML="";
 59		//alert(returnobj)
 60		//document.getElementById()
 61		} else {alert("����� ������ ���")};
 62		
 63	};
 64
 65}
 66//-->
 67</SCRIPT>
 68<%
 69if request("act")="search" then 
 70%>
 71<br>
 72<FORM METHOD=POST ACTION="?act=select" onsubmit="if (document.all.search.value=='') return false;">
 73<div dir='rtl'><B>��� ��� : ����� ���� ��� ����</B>
 74	<INPUT TYPE="text" NAME="search">&nbsp;
 75	<INPUT TYPE="submit" value="�����"><br>
 76	<input type="hidden" name="id" value="<%=request("id")%>"
 77</div>
 78</FORM>
 79<SCRIPT type="text/javascript">
 80	document.all.search.focus();
 81</SCRIPT>
 82<%
 83	response.end
 84elseif request("act")="select" then
 85	if request("search") <> "" then
 86		SA_TitleOrName=request("search")
 87		SA_Action="return true;"
 88		'SA_Action="return selectOperations();"
 89		SA_SearchAgainURL="voucherInput.asp"
 90		SA_StepText="" '"��� ��� : ������ ����"
 91		SA_ActName			= "select"	
 92		SA_SearchBox	="search"		
 93		SA_IsVendor = 1
 94%>
 95		<FORM METHOD=POST ACTION="?act=check">
 96			<input type="hidden" name="id" value="<%=request("id")%>">
 97		<!--#include File="../AR/include_SelectAccount.asp"-->
 98		</FORM>
 99<%
100	response.end
101	end if
102elseif request("act")="check" then
103	PurchaseOrderID=request("id")
104	vendorID=request("selectedCustomer")
105	set rs = Conn.Execute("select * from PurchaseOrders where id=" & PurchaseOrderID)
106	oldVendorID = rs("vendor_ID")
107	PurchaseOrder = rs("typeName") & "(" & rs("comment") & ")"
108	set rs= Conn.Execute("select * from accounts where id=" & oldVendorID)
109	oldAccountTitle = rs("accountTitle") & "(" & rs("id") & ")"
110	set rs= Conn.Execute("select * from accounts where id=" & vendorID)
111	newAccountTitle = rs("accountTitle") & "(" & rs("id") & ")"
112%>
113<br>
114<span>��� ����� ����� �� ���� </span><b><%=PurchaseOrder%></b><br>
115<span>���� �������: </span><%=oldAccountTitle%><br>
116<span>�� �������: </span><B><%=newAccountTitle%></B>
117<span>������� ������ ��Ͽ</span><br><br>
118<form method=post action="?act=change">
119	<input type="hidden" name="PurchaseOrderID" value="<%=PurchaseOrderID%>">
120	<input type="hidden" name="vendorID" value="<%=vendorID%>">
121	<input type="submit" name="ok" value="���">
122	<input type="button" value="���" onclick="window.location='?od=<%=PurchaseOrderID%>';"/>
123</form>
124<%
125	response.end
126elseif request("act")="change" then
127	Conn.Execute ("update PurchaseOrders set vendor_ID=" & request("vendorID") & " where id=" & request("PurchaseOrderID"))
128	response.redirect "?od=" & request("PurchaseOrderID")
129end if
130'-----------------------------------------------------------------------------------------------------
131'-------------------------------------------------------------------- Remove Relation to Inventory Log
132'---------------------------------------------------------------------------------------84-10-18-Alix-
133if request("removeRelation")="yes" then	
134	invLogID	=	request("invLogID")
135	ordID		=	request("ordID")
136	newComment = "(��� ����� �� ����� ���� " & ordID & " �� ����� " & shamsitoday() & " ���� " & session("CSRName") & ")"
137	Conn.Execute ("update InventoryLog set relatedID=-1, comments = comments + N'" & newComment & "' where id=" &invLogID & "")	
138	response.write "<br>"
139	alertMsg = "����� ����� ���� ����� " & ordID & " �� ���� �� ����� ����� " & invLogID & " �� ����� " & shamsitoday() & " ��� ��"
140	'call showAlert( alertMsg , CONST_MSG_INFORM)
141	
142	response.redirect "outServiceTrace.asp?od=" & ordID & "&msg=" & alertMsg
143
144
145end if
146'-----------------------------------------------------------------------------------------------------
147'------------------------------------------------------------------ Show an Out Service Order's detail
148'-----------------------------------------------------------------------------------------------------
149if request("od")<>"" then		
150	ordID=request("od")
151	set RSOD=Conn.Execute ("SELECT * FROM purchaseOrders WHERE id = "& ordID )	
152	if not RSOD.eof then
153		VendorID=RSOD("Vendor_ID")
154		comment=RSOD("comment")
155		otypeName=RSOD("TypeName")
156		TypeID=RSOD("TypeID")
157		Price=RSOD("Price")
158		status=RSOD("status")
159		printed=RSOD("printed")
160		qtty=RSOD("qtty")
161		HasVoucher=RSOD("HasVoucher")
162		%><br>
163		<center><h2>������ ����� ���� </h2>
164		����� �����: <%=ordID%>
165		</center>
166		<TABLE dir=rtl align=center width=680>
167		<TR bgcolor="#CCCCCC">
168			<TD width=50%>
169				<li>��� ���: <%=otypeName%><br>
170				<li>����: <%
171				if auth(4,7) then 
172				%>
173				<span id='purchase_price'><%=price%></span>
174				<span id='purchase_price_submit'>
175					&nbsp;<A HREF="javascript:edit_purchase_price(<%=ordID%>)">[�����]</A>
176				</span>
177				<%	
178				else
179					response.write Price
180				end if
181				%>
182				<br>
183				<li>�����: <%=qtty%><br>
184				<li>�������: <%=comment%><br>
185				<li>�����: <%=status%><br>
186					<%
187					'===================================================
188					' show voucher, if exists
189					'===================================================
190					set RSV=Conn.Execute ("SELECT Vouchers.verified, Vouchers.id, Vouchers.paid FROM Vouchers INNER JOIN VoucherLines ON Vouchers.id = VoucherLines.Voucher_ID WHERE (VoucherLines.RelatedPurchaseOrderID = "& ordID & ") AND voided=0")
191					
192					if not RSV.eof then
193						response.write "<hR>"
194						'linkto = "verify"
195						'if not RSV("verified")=0 and RSV("paid")=0 then
196						'	linkto = "payment"
197						'end if 
198
199						response.write "���� ��� ����� �� "
200						response.write "<A target='_blank' HREF='../AP/AccountReport.asp?act=showVoucher&voucher="& RSV("ID") & "'> ������ �� ����� " & RSV("ID") & " </A>"
201						response.write "���� ��� �� �����"
202						if RSV("verified")=0 then
203							response.write " ����"
204							isPaid = 0
205						else
206							response.write " ���"
207							isPaid = 1
208						end if
209						response.write " � ������"
210						if RSV("paid")=0 then
211							response.write " ����"
212							isPaid = 0
213						else
214							response.write " ���"
215							isPaid = 1
216						end if
217						response.write " ���. <br>"
218						if Not HasVoucher then
219							response.write "<BR>��� �� ������ �� �� ���� �� ���!"
220							response.write "<BR><BR>����� ��� ����� �� �� ���� ����� ����� ����"
221						end if
222					else
223						if HasVoucher then
224							response.write "<BR><HR>�� ������� �� ���� ��! ������ �� ��� ��� ����� �� ������ ����� ����. ��� �����."
225							response.write "<BR><BR>����� ��� ����� �� �� ���� ����� ����� ����"
226						end if
227					end if
228					%>
229			</TD>
230			<TD width=50%>
231				<%
232				set RSOD=Conn.Execute ("SELECT * FROM Accounts WHERE ID = "& VendorID )	
233				if not RSOD.eof then ' 4,8
234					%>
235					<li><%=RSOD("accounttitle")%> <a href="CRM/AccountInfo.asp?act=show&selectedCustomer=<%=VendorID%>">(<%=VendorID%>)</a> 
236					<%
237					if not HasVoucher then 
238						if auth(4,8) then 
239					%>
240					<a href="?act=search&id=<%=ordID%>">[�����]</a>
241					<%
242						end if
243					end if 
244					%>
245					<br>
246					<li>��� �������: <%=RSOD("firstName1")%> <%=RSOD("lastName1")%><br>
247					<li>��� ����: <%=RSOD("companyName")%><br>
248					<li>�����: <%=RSOD("city1")%> - <%=RSOD("Address1")%> -<BR> Tel: <%=RSOD("tel1")%> - Fax: <%=RSOD("fax1")%> - Email: <%=RSOD("email1")%><br><br>
249
250					<% 	ReportLogRow = PrepareReport ("purchaseOrder.rpt", "Pord_ID", ordID, "/beta/dialog_printManager.asp?act=Fin") %>
251					<INPUT TYPE="button" value=" �ǁ �ѐ ����� ����� " style="height:25px; border:2 solid <%=SelectedMenuColor%>; width:100%; cursor:hand; background-Color:'white'; " onMouseOver="this.style.borderColor='white';" onMouseOut="this.style.borderColor='<%=SelectedMenuColor%>';" onclick="printThisReport(this,<%=ReportLogRow%>);">
252					<%
253				else
254					response.write "<li> ���: ������� ���� ��� ���� ��� <br>" 
255				end if 
256				%>
257			</TD>
258		</TR>
259		<TR>
260			<TD>
261				<%
262				set RSOD=Conn.Execute ("SELECT purchaseOrderStatus.*,users.realName FROM purchaseOrderStatus left outer join users on purchaseOrderStatus.user_id=users.id WHERE Ord_ID = "& ordID )	
263				'response.write "SELECT * FROM purchaseOrderStatus WHERE Ord_ID = "& ordID 
264				Do while not RSOD.eof
265					%>
266					<span dir=ltr><%=RSOD("StatusDate")%></span> 
267					<span dir=ltr>(<%=RSOD("StatusTime")%>)</span> : <%=RSOD("StatusDetail")%>
268					<%if not IsNull(RSOD("realName")) then %>
269					<small style="color:#44F;">(<%=RSOD("realName")%>)</small>
270					<%end if%>
271					<br>
272					<%
273				RSOD.moveNext
274				Loop
275				%>
276			</TD>
277			<TD>
278				<FORM METHOD=POST ACTION="?">
279					<INPUT TYPE="hidden" name="ordID" value="<%=ordID%>">
280					��� ����� ����:<br>
281					<INPUT TYPE="radio" NAME="st" value="1" <% if status="OK" and isPaid=1 then %> disabled <% else %> checked <% end if %>>
282					<SELECT NAME="stdet1" onfocus="document.all.st[0].checked='true'" <% if status="OK" and isPaid=1 then %> disabled <% end if %>>
283					<option <% if status="OUT" then%>selected<% end if %> value="11">����� ���� ������� ����� ��</option>
284					<option <% if status="RETURN" then%>selected<% end if %> value="12">����� �� ���� ��Ґ��</option>
285					<option <% if status="CANCEL" then%>selected<% end if %> value="13">����� ��� ��</option>
286					<option <% if status="OK" then%>selected<% end if %> value="20">����� ����� ��</option>
287					<option <% if status="Unknown" then%>selected<% end if %> value="14">�������</option>
288					</SELECT><br>
289					<INPUT TYPE="radio" NAME="st" value="2"><INPUT TYPE="text" NAME="stdet12" onfocus="document.all.st[1].checked='true'"><br>
290					�����<INPUT TYPE="text" NAME="stDate" value="<%=shamsiToday()%>" dir=ltr onblur="acceptDate(this);" onKeyPress="return maskDate(this);" ><br>
291					<center>
292					<INPUT TYPE="submit" Name="Submit" Value="��� �����" style="width:100px;" tabIndex="14">
293					</center>
294				</FORM>
295			</TD>
296		</TR>
297		<TR >
298			<TD colspan=2>
299				<!------------------------------------------------------------>
300				<%
301				set RSS=Conn.Execute ("SELECT InventoryLog.comments, InventoryLog.CreatedBy, InventoryLog.owner, InventoryLog.logDate, InventoryLog.Qtty, InventoryLog.RelatedID, InventoryLog.ItemID, InventoryLog.ID, InventoryItems.OldItemID, InventoryItems.Name, InventoryItems.Unit, Users.RealName FROM InventoryLog INNER JOIN InventoryItems ON InventoryLog.ItemID = InventoryItems.ID INNER JOIN Users ON InventoryLog.CreatedBy = Users.ID WHERE InventoryLog.IsInput=1 and InventoryLog.Voided=0 and (InventoryLog.RelatedID = "& ordID & ")")	
302				if not RSS.EOF then
303				%>
304				<TABLE dir=rtl align=center width=600>
305					<TR bgcolor="eeeeee" >
306						<TD colspan=7><H4>���� ���� �� ����� ����� �� ��� ����� ����</H4></TD>
307					</TR>
308					<TR bgcolor="eeeeee" >
309						<TD><!A HREF="default.asp?s=1"><SMALL>��� �����</SMALL></A></TD>
310						<TD><!A HREF="default.asp?s=1"><SMALL>�� ����</SMALL></A></TD>
311						<TD><!A HREF="default.asp?s=2"><SMALL>��� ����</SMALL></A></TD>
312						<TD><!A HREF="default.asp?s=3"><SMALL>����� ����</SMALL></A></TD>
313						<TD><!A HREF="default.asp?s=5"><SMALL>����� ����</SMALL></A></TD>
314						<TD><!A HREF="default.asp?s=6"><SMALL>����� ����� ����</SMALL></A></TD>
315						<TD><!A HREF="default.asp?s=7"><SMALL>����</SMALL></A></TD>
316					</TR>
317					<%
318					tmpCounter=0
319					Do while not RSS.eof
320						tmpCounter = tmpCounter + 1
321						if tmpCounter mod 2 = 1 then
322							tmpColor="#FFFFFF"
323							tmpColor2="#FFFFBB"
324						Else
325							tmpColor="#DDDDDD"
326							tmpColor2="#EEEEBB"
327						End if 
328
329					%>
330					<TR bgcolor="<%=tmpColor%>" title="<%=RSS("comments")%>">
331						<TD align=center><a onclick="return confirm('��� ����� �� ������ ��� ���� �� ����� �� �� ��� ����� ���� ������Ͽ')" href="?removeRelation=yes&invLogID=<%=RSS("ID")%>&ordID=<%=ordID%>">X</a></TD>
332						<TD><INPUT TYPE="hidden" name="id" value="<%=RSS("ID")%>"><%=RSS("OldItemID")%></TD>
333						<TD><!A HREF="default.asp?itemDetail=<%=RSS("ID")%>"><%=RSS("Name")%></A></TD>
334						<TD><%=RSS("Qtty")%>&nbsp;<%=RSS("Unit")%></TD>
335						<TD><span dir=ltr><%=RSS("logDate")%></span></TD>
336						<TD><% if RSS("RelatedID")= "-1" then
337								response.write "�����"
338							 else
339								response.write RSS("RelatedID")
340							 end if	%></TD>
341						<TD><%=RSS("RealName")%></TD>
342					</TR>
343						 
344					<% 
345					RSS.moveNext
346					Loop
347				%>
348				</TABLE><br>
349				<% end if %>
350				<!------------------------------------------------------------>
351				<TABLE width=100% bgcolor="#CCCCCC">
352				<TR><TD COLSPAN=5><CENTER><B>���� ������� ��� ����� �� ��� �����</B></CENTER><hr></TD></TR>
353				<tr>
354				<TD>��� ������</TD>
355				<TD>����� �������</TD>
356				<TD>���� ���� ���</TD>
357				<TD>����� ������</TD>
358				<TD width=8%>���� </TD>
359				</tr>
360				<TR><TD COLSPAN=5><hr></TD></TR>
361				<%
362				set RSOD=Conn.Execute ("SELECT * FROM purchaseRequestOrderRelations WHERE Ord_ID = "& OrdID )	
363				Do while not RSOD.eof
364					set RSX=Conn.Execute ("SELECT * FROM purchaseRequests WHERE id = "& RSOD("req_ID") )	
365					%>
366					<tr>
367					<TD><%=RSX("typeName")%></TD>
368					<TD><span dir=ltr><%=RSX("ReqDate")%></span></TD>
369					<TD><%=RSX("price")%></TD>
370					<TD><% if RSX("orderID")=-1 then%>�����<% else %><span id="orderID_span"><a href="../order/order.asp?act=show&id=<%=RSX("orderID")%>"><%=RSX("orderID")%></a></span><% if Auth(4 , 6) then %><span id="dokme_sabt"> &nbsp;<A HREF="javascript:edit_order_id(<%=RSX("id")%>)">[�����]</A></span><% end if %><% end if %></TD>
371					<TD width=8%><%=RSOD("PercentOfAll")%></TD>
372					</tr>
373					<%	
374					RSOD.moveNext 
375				loop %>
376			</TD>
377		</TR>
378		</TABLE>
379	<%
380	end if
381	'response.redirect "?radif=" & request("r")
382	RSOD.close
383	response.end
384
385end if
386
387'-----------------------------------------------------------------------------------------------------
388'---------------------------------------------------------------- change status of an OutService Order
389'-----------------------------------------------------------------------------------------------------
390if request.form("Submit")="��� �����" then
391	ordID = request.form("ordID") 
392	st = request.form("st")
393	stDate = request.form("stDate")
394	hasUnpaidVoucher = "no"
395
396	if st=1 then
397		stid=request.form("stdet1")
398		if stid="11" then 
399			stdetl="����� ���� ������� ����� ��"
400			orderStatus = "OUT"
401		elseif stid="12" then 
402			stdetl="����� �� ���� ��Ґ��"
403			orderStatus = "RETURN"
404		elseif stid="13" then 
405			stdetl="����� ��� ��"
406			orderStatus = "CANCEL"
407		elseif stid="20" then 
408			stdetl="����� ����� ��"
409			orderStatus = "OK"
410		elseif stid="14" then 
411			stdetl="����� �� ���� ������� �����"
412			orderStatus = "Unknown"
413		end if
414	else
415		stdetl=request.form("stdet12")
416		stid=3
417		orderStatus = "NOT CHANGED"
418	end if
419
420	conn.Execute ("INSERT INTO purchaseOrderStatus (Ord_ID, statusTime, statusDate, statusCode, StatusDetail,user_id) VALUES ("& OrdID & ", '"& currentTime10() & "', '"& stDate & "', "& stid & ", N'"& stdetl & "' ," & session("ID") & ")")
421
422	if NOT orderStatus = "NOT CHANGED" then 
423		Conn.Execute ("update purchaseOrders SET status = '"& orderStatus & "' where id = "& OrdID )	
424	end if 
425
426	if orderStatus = "OK" then
427		'===================================================
428		' check to see if exists
429		'===================================================
430		set RSV=Conn.Execute ("SELECT Vouchers.* FROM Vouchers INNER JOIN VoucherLines ON Vouchers.id = VoucherLines.Voucher_ID WHERE (VoucherLines.RelatedPurchaseOrderID = "& ordID & ")")
431
432		if not RSV.eof then
433			if RSV("paid")=0 then
434				VoucherID = RSV("ID")
435				VendorID = RSV("VendorID")
436				TotalPrice = RSV("TotalPrice")
437				hasUnpaidVoucher = "yes"
438
439				'---------------------------------------------------------------------------------------------------
440				'------ Next line has been Commented by Alix - 82-02-18 
441				'------ Routine changed: Account will be updated when Voucher verified. (only in AP/Verify.asp page)
442				'---------------------------------------------------------------------------------------------------
443
444				'Conn.Execute ("UPDATE Accounts SET APBalance=APBalance+"& TotalPrice & " WHERE (ID = "& VendorID & ")")	
445			else
446				response.write "<BR><BR>"
447				response.write "���! ��� ����� ���� ������ ��� ���. �� ���� �� ���� ����� ���� ����"
448				response.write "<BR><BR>"
449				response.write "���� ����� ���!"
450			end if
451		end if
452		'===================================================
453	end if 
454
455	response.redirect "?od=" & ordID
456
457end if
458
459'-----------------------------------------------------------------------------------------------------
460'------------------------------------------------------------------------------------------------ Main
461'-----------------------------------------------------------------------------------------------------
462'Gets all Request for services list from DB
463
464set RST=Conn.Execute ("SELECT count(*) as CNT FROM purchaseOrders WHERE (Status = 'NEW')")
465C1 = RST("CNT")
466set RST=Conn.Execute ("SELECT count(*) as CNT FROM purchaseOrders WHERE (Status = 'OUT')")
467C2 = RST("CNT")
468set RST=Conn.Execute ("SELECT count(*) as CNT FROM purchaseOrders WHERE (Status = 'RETURN')")
469C3 = RST("CNT")
470
471eventDate	=	sqlSafe(request("eventDate"))
472
473%>
474<br><br>
475<CENTER>
476<FORM METHOD=POST ACTION="">
477����� ����� ����: <INPUT TYPE="text" NAME="od" size=6><INPUT TYPE="submit" value="����� ������">
478</FORM>
479</CENTER>
480<br><TABLE dir=rtl align=center width=600 class=t8pt>
481<TR bgcolor="eeeeee">
482	<TD align=center bgcolor=ffffff><B>������ ����� ��� ���� </B></TD>
483	<TD align=center><A HREF="?lstOrd=NEW"><IMG SRC="../images/folder<% if C1=0 then %>0<% else%>1<% end if %>.gif" BORDER=0><br>���� </A>(<%=C1%>)</TD>
484	<TD align=center><A HREF="?lstOrd=OUT"><IMG SRC="../images/folder<% if C2=0 then %>0<% else%>1<% end if %>.gif" BORDER=0><br>���� �� ���� </A>(<%=C2%>)</TD>
485	<TD align=center><A HREF="?lstOrd=RETURN"><IMG SRC="../images/folder<% if C3=0 then %>0<% else%>1<% end if %>.gif" BORDER=0><br>�ѐ��� �� ���� </A>(<%=C3%>)</TD>
486	<TD align=center><A HREF="?lstOrd=CANCEL"><IMG SRC="../images/folder2.gif" BORDER=0 alt="�����"><br>��� ��� </A></TD>
487	<TD align=center><A HREF="?lstOrd=OK"><IMG SRC="../images/folder2.gif" BORDER=0 alt="�����"><br>����� ��� </A></TD>
488	<TD align=center><A HREF="?lstOrd=Unknown"><IMG SRC="../images/folder2.gif" BORDER=0 alt="�����"><br>������� </A></TD>
489</TR>
490<TR bgcolor="eeeeee">
491	<FORM METHOD=POST ACTION="?act=showEvents">
492	<TD align=center bgcolor=ffffff><B>������ �� �� ����� </B></TD>
493	<TD align=right valign=bottom colspan=6 >
494		<INPUT dir="LTR" TYPE="text" NAME="eventDate" maxlength="10" size="10" onblur="acceptDate(this)" onKeyPress="return maskDate(this);" value="<%=eventDate%>">
495		<INPUT TYPE="submit" Value="�����" class="genButton">
496	</TD>
497	</FORM>
498</TR>
499</TABLE><br>
500<%
501sortBy=request("s")
502if sortBy="2" then 
503	sB="PurchaseOrders.typeName"
504elseif sortBy="3" then 
505	sB="PurchaseOrders.OrdDate"
506elseif sortBy="4" then 
507	sB="PurchaseOrders.price"
508elseif sortBy="5" then 
509	sB="PurchaseOrders.Qtty"
510else 
511	sB="PurchaseOrders.id DESC"
512end if
513
514
515if request("act") = "showEvents" then			
516
517
518	'mySQL="SELECT * FROM PurchaseOrderStatus INNER JOIN PurchaseOrders ON PurchaseOrderStatus.Ord_ID = PurchaseOrders.ID WHERE (PurchaseOrderStatus.StatusDate = '"& eventDate & "') ORDER BY PurchaseOrderStatus.Ord_ID DESC, PurchaseOrderStatus.StatusTime DESC"
519	mySQL="SELECT * FROM PurchaseOrderStatus INNER JOIN PurchaseOrders ON PurchaseOrderStatus.Ord_ID = PurchaseOrders.ID WHERE (PurchaseOrderStatus.StatusDate = '"& eventDate & "') ORDER BY PurchaseOrderStatus.Ord_ID DESC, PurchaseOrderStatus.ID DESC"
520
521	set RSS=Conn.Execute (mySQL)
522	%><br>
523	<TABLE dir=rtl align=center width=600>
524	<TR bgcolor="eeeeee" >
525		<TD align=center colspan=6><B>����� ��� �������� ����</B></TD>
526	</TR>
527	<TR bgcolor="eeeeee" height=20>
528		<TD><SMALL>�����</SMALL></TD>
529		<TD width=200><SMALL>��� �����</SMALL></TD>
530		<TD><SMALL>����� �����</SMALL></TD>
531		<TD width=200><SMALL>���</SMALL></TD>
532		<TD><SMALL>����</SMALL></TD>
533		<TD><SMALL>�����</SMALL></TD>
534	</TR>
535	<%
536	tmpCounter=0
537	Do while not RSS.eof
538		if not tmpid = RSS("id") then
539			tmpCounter = tmpCounter + 1
540		end if 
541		if tmpCounter mod 2 = 1 then
542			tmpColor="#FFFFFF"
543			tmpColor2="#FFFFBB"
544		Else
545			tmpColor="#DDDDDD"
546			tmpColor2="#EEEEBB"
547		End if 
548		tmpid = RSS("id")
549	%>
550	<TR bgcolor="<%=tmpColor%>" height=20 title="<% 
551		Comment = RSS("Comment")
552		if Comment<>"-" then
553			response.write "�����: " & Comment
554		else
555			response.write "����� �����"
556		end if
557	%>">
558		<TD><%=RSS("id")%></TD>
559		<TD><A HREF="?od=<%=RSS("id")%>" target="_blank"><%=RSS("TypeName")%></A></TD>
560		<TD><span dir=ltr><%=RSS("OrdDate")%></span></TD>
561		<TD><%=RSS("StatusDetail")%></TD>
562		<TD><%=RSS("price")%></TD>
563		<TD><%=RSS("qtty")%></TD>
564	 
565	<% 
566	RSS.moveNext
567	Loop
568	%>
569	</TABLE><br>
570
571	</body></html>
572	<% 
573	response.end
574end if 
575
576if request("lstOrd") = "" then			
577response.end
578end if 
579'-----------------------------------------------------------------------------------------------------
580'------------------------------------------------------------------------------ List OutService Orders 
581'---------------------------------------------------------------------- (NEW, OUT, RETURN, CANCEL, OK)
582'-----------------------------------------------------------------------------------------------------
583
584
585'-----------------------------------------------------------------------------------------------------
586' OK or cancel Orders
587'-----------------------------------------------------------------------------------------------------
588
589
590'======================== old query (changed 82-10-15 by ALix) =======================================
591'SELECT PurchaseOrders.*, PurchaseRequests.Order_ID AS Order_ID, Invoices.Approved AS Approved, Invoices.Issued AS Issued FROM PurchaseRequests FULL OUTER JOIN Invoices FULL OUTER JOIN InvoiceOrderRelations ON Invoices.ID = InvoiceOrderRelations.Invoice ON PurchaseRequests.Order_ID = InvoiceOrderRelations.[Order] FULL OUTER JOIN PurchaseOrders LEFT OUTER JOIN PurchaseRequestOrderRelations ON PurchaseOrders.ID = PurchaseRequestOrderRelations.Ord_ID ON PurchaseRequests.ID = PurchaseRequestOrderRelations.Req_ID where ISNULL(Invoices.voided,0)=0 and (PurchaseOrders.Status =
592
593if request("lstOrd") <> "" then			
594	lstOrd = request("lstOrd")
595	set RSS=Conn.Execute ("SELECT top 100 dbo.PurchaseOrders.*, dbo.PurchaseRequests.OrderID, ISNULL(DERIVEDTBL.Approved2, 0) AS Approved, ISNULL(DERIVEDTBL.Issued2, 0) AS Issued, DERIVEDTBL.id AS invoice_ID FROM dbo.PurchaseRequests FULL OUTER JOIN (SELECT Invoices.id, isnull(Invoices.Approved, 0) AS Approved2, isnull(Invoices.Issued, 0) AS Issued2 FROM dbo.Invoices WHERE isnull(Invoices.voided, 0) = 0 and (isnull(Invoices.Approved, 0) = 1 OR isnull(Invoices.Issued, 0) = 1)) DERIVEDTBL INNER JOIN dbo.InvoiceOrderRelations ON DERIVEDTBL.id = dbo.InvoiceOrderRelations.Invoice ON dbo.PurchaseRequests.OrderID = dbo.InvoiceOrderRelations.[Order] FULL OUTER JOIN dbo.PurchaseOrders LEFT OUTER JOIN dbo.PurchaseRequestOrderRelations ON dbo.PurchaseOrders.ID = dbo.PurchaseRequestOrderRelations.Ord_ID ON dbo.PurchaseRequests.ID = dbo.PurchaseRequestOrderRelations.Req_ID WHERE (dbo.PurchaseOrders.Status = '"& lstOrd & "') order by " & sB)
596	%><br>
597	<TABLE dir=rtl align=center width=600>
598	<TR bgcolor="eeeeee" >
599		<TD align=center colspan=6><B>�������� ���� (<%=lstOrd%>)</B></TD>
600	</TR>
601	<TR bgcolor="eeeeee" height=20>
602		<TD><A HREF="?lstOrd=<%=lstOrd%>&s=1"><SMALL>�����</SMALL></A></TD>
603		<TD><A HREF="?lstOrd=<%=lstOrd%>&s=2"><SMALL>��� �����</SMALL></A></TD>
604		<TD><A HREF="?lstOrd=<%=lstOrd%>&s=3"><SMALL>����� �����</SMALL></A></TD>
605		<TD align=center><A HREF="?lstOrd=<%=lstOrd%>&s=3"><SMALL>����� �����</SMALL></A></TD>
606		<TD><A HREF="?lstOrd=<%=lstOrd%>&s=4"><SMALL>����</SMALL></A></TD>
607		<TD><A HREF="?lstOrd=<%=lstOrd%>&s=5"><SMALL>�����</SMALL></A></TD>
608	</TR>
609	<%
610	tmpCounter=0
611	Do while not RSS.eof
612		if not tmpid = RSS("id") then
613			tmpCounter = tmpCounter + 1
614		end if 
615		if tmpCounter mod 2 = 1 then
616			tmpColor="#FFFFFF"
617			tmpColor2="#FFFFBB"
618		Else
619			tmpColor="#DDDDDD"
620			tmpColor2="#EEEEBB"
621		End if 
622		tmpid = RSS("id")
623	%>
624	<TR bgcolor="<%=tmpColor%>" height=20 title="<% 
625		Comment = RSS("Comment")
626		if Comment<>"-" then
627			response.write "�����: " & Comment
628		else
629			response.write "����� �����"
630		end if
631	%>">
632		<TD><%=RSS("id")%></TD>
633		<TD><A HREF="?od=<%=RSS("id")%>"><%=RSS("TypeName")%></A></TD>
634		<TD><span dir=ltr><%=RSS("OrdDate")%></span></TD>
635		<TD align=center><%
636		if RSS("orderID") = "-1" then
637			response.write "-"
638		else
639			response.write "<A target='_blank' HREF='../shopfloor/manageOrder.asp?radif=" & RSS("orderID") & "'>" & RSS("orderID") & "</a>"
640
641			if RSS("Approved") then
642				response.write "<br>" & "������ ����� ���"
643			end if 
644
645			if RSS("Issued") then
646				response.write "<br>" & "����� ����� ���"
647			end if 
648
649		end if
650		%></TD>
651		<TD><%=RSS("price")%></TD>
652		<TD><%=RSS("qtty")%></TD>
653	 
654	<% 
655	RSS.moveNext
656	Loop
657	%>
658	</TABLE><br>
659
660	</body></html>
661	<% 
662	response.end
663end if 
664Conn.Close
665%>
666<!--#include file="tah.asp" -->