PageRenderTime 33ms CodeModel.GetById 18ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 1ms

/beta/order/TraceOrder.asp

http://github.com/khaneh/Orders
ASP | 1452 lines | 1364 code | 72 blank | 16 comment | 126 complexity | 1361e962bb4993bf454338dd38a68986 MD5 | raw file

Large files files are truncated, but you can click here to view the full file

   1<%@LANGUAGE="VBSCRIPT" CODEPAGE="1256"%><%
   2'Order (2)
   3PageTitle="������ �����"
   4SubmenuItem=3
   5if not Auth(2 , 3) then NotAllowdToViewThisPage()
   6%>
   7<!--#include file="top.asp" -->
   8<!--#include File="../include_farsiDateHandling.asp"-->
   9<!--#include File="../include_UtilFunctions.asp"-->
  10<%
  11'Server.ScriptTimeout = 3600
  12%>
  13<STYLE>
  14	.CustTable {font-family:tahoma; width:80%; border:1 solid black; direction: RTL; background-color:black;}
  15	.CustTable td {padding:5;}
  16	.CustTable a {text-decoration:none;color:#000088}
  17	.CustTable a:hover {text-decoration:underline;}
  18	.CusTableHeader {background-color: #33AACC; text-align: center; font-weight:bold;}
  19	.CusTD1 {background-color: #CCCC66; text-align: left; font-weight:bold;}
  20	.CusTD2 {background-color: #DDDDDD; direction: LTR; text-align: right; font-size:9pt;}
  21	.CusTD3 {background-color: #DDDDDD; direction: LTR; text-align: center; font-size:9pt;}
  22	.CusTD4 {background-color: #CCCC66; direction: LTR; text-align: center; font-size:9pt;}
  23	a.aYellow:link {color: yellow;}
  24	a.aYellow:visited {color: green;}
  25	a.aYellow:hover {color: gray;}
  26	.mySection{border: 1px #F90 dashed;margin: 15px 10px 0 15px;padding: 5px 0 5px 0;}
  27	.myRow{border: 2px #F05 dashed;margin: 10px 0 10px 0;padding: 0 3px 5px 0;}
  28	.exteraArea{border: 1px #33F dotted;margin: 5px 0 0 5px;padding: 0 3px 5px 0;}
  29	.myLabel {margin: 0px 3px 0 0px;white-space: nowrap;padding: 5px 0 5px 0;}
  30	.myProp {font-weight: bold;color: #40F; margin: 0px 3px 0 0px;padding: 5px 0 5px 0;}
  31	div.btn label{background-color:yellow;color: blue;padding: 3px 30px 3px 30px;cursor: pointer;}
  32	div.btn{margin: -5px 250px 0px 5px;}
  33	div.btn img{margin: 0px 20px -5px 0;cursor: pointer;}
  34	div.report{visibility: collapse; height: 0px;}
  35	div.price{float: left;border: 1px solid #999;margin: 0 0 0 10px;color: black;background-color: yellow;padding: 1px 3px 1px 3px;}
  36	.time{direction: ltr;}
  37</STYLE>
  38<script type="text/javascript" src="/js/jquery-1.7.min.js"></script>
  39<script type="text/javascript" src="/js/jquery.printElement.min.js"></script>
  40<SCRIPT LANGUAGE='JavaScript'>
  41<!--
  42function checkValidation(){
  43	if (document.all.search_box.value != ''){
  44		return true;
  45	}
  46	else{
  47		document.all.search_box.focus();
  48		return false;
  49	}
  50}
  51
  52//-->
  53
  54</SCRIPT>
  55
  56<%
  57if request("act")="" then
  58%>
  59	<hr>
  60	<TABLE border="4" cellspacing="0" cellpadding="0" width="600" align="center" bordercolor="#555599">
  61	<FORM METHOD=POST ACTION="TraceOrder.asp?act=search" onSubmit="return checkValidation();">
  62	<TR><TD>
  63		<TABLE border="0" cellspacing="0" cellpadding="5" dir="RTL" width="100%">
  64		<TR bgcolor="#AAAAEE">
  65			<TD>��� ����� �� ���� �� ����� �����:</TD>
  66			<TD><INPUT TYPE="text" NAME="search_box" value="<%=request.form("search_box")%>"></TD>
  67			<TD><INPUT TYPE="submit" NAME="SubmitB" Value="�����" style="font-family:tahoma,arial; font-size:10pt;width:100px;"></TD>
  68			<TD align="left"><% if Auth(2 , 5) then %><A HREF="TraceOrder.asp?act=advancedSearch">������ �������</A><% End If %></TD>
  69		</TR>
  70		</TABLE>
  71	</TD></TR>
  72	</FORM>
  73	</TABLE>
  74	<script language="JavaScript">
  75	<!--
  76		document.all.search_box.focus();
  77	//-->
  78	</script>
  79	<hr>
  80<%
  81	'
  82elseif request("act")="search" then
  83%>
  84	<hr>
  85	<TABLE border="4" cellspacing="0" cellpadding="0" width="600" align="center" bordercolor="#555599">
  86	<FORM METHOD=POST ACTION="TraceOrder.asp?act=search" onSubmit="return checkValidation();">
  87	<TR><TD>
  88		<TABLE border="0" cellspacing="0" cellpadding="5" dir="RTL" width="100%">
  89		<TR bgcolor="#AAAAEE">
  90			<TD>��� ����� �� ���� �� ����� �����:</TD>
  91			<TD><INPUT TYPE="text" NAME="search_box" value="<%=request.form("search_box")%>"></TD>
  92			<TD><INPUT TYPE="submit" NAME="SubmitB" Value="�����" style="font-family:tahoma,arial; font-size:10pt;width:100px;"></TD>
  93			<TD align="left"><% if Auth(2 , 5) then %><A HREF="TraceOrder.asp?act=advancedSearch">������ �������</A><% End If %></TD>
  94		</TR>
  95		</TABLE>
  96	</TD></TR>
  97	</FORM>
  98	</TABLE>
  99	<script language="JavaScript">
 100	<!--
 101		document.all.search_box.focus();
 102	//-->
 103	</script>
 104	<hr>
 105<%
 106	
 107	search=request("search_box")
 108	if search="" then
 109		'By Default show Open Orders of Current User
 110		myCriteria= "Orders.CreatedBy = " & session("ID")
 111	elseif isNumeric(search) then
 112		search=clng(search)
 113		myCriteria= "radif_sefareshat = '"& search & "'"
 114	else
 115		search=sqlSafe(search)
 116		myCriteria= "REPLACE([company_name], ' ', '') LIKE REPLACE(N'%"& search & "%', ' ', '') OR REPLACE([customer_name], ' ', '') LIKE REPLACE(N'%"& search & "%', ' ', '')"
 117	End If
 118
 119'	mySQL="SELECT orders_trace.*, OrderTraceStatus.Name AS StatusName, OrderTraceStatus.Icon FROM Orders INNER JOIN orders_trace ON Orders.ID = orders_trace.radif_sefareshat INNER JOIN OrderTraceStatus ON orders_trace.status = OrderTraceStatus.ID WHERE ("& myCriteria & ") AND (Orders.Closed=0) ORDER BY order_date DESC, radif_sefareshat DESC"	
 120	'mySQL="SELECT orders_trace.*, Orders.closed, OrderTraceStatus.Name AS StatusName, OrderTraceStatus.Icon,DRV_Invoice.price, ghar.return_date as ghDate, ghar.return_time as ghTime FROM Orders INNER JOIN  orders_trace ON Orders.ID = orders_trace.radif_sefareshat INNER JOIN  OrderTraceStatus ON orders_trace.status = OrderTraceStatus.ID left outer join (select InvoiceOrderRelations.[Order],SUM(InvoiceLines.Price + InvoiceLines.Vat - InvoiceLines.Discount -InvoiceLines.Reverse) as price from InvoiceOrderRelations inner join Invoices on InvoiceOrderRelations.Invoice=Invoices.ID inner join InvoiceLines on Invoices.ID=InvoiceLines.Invoice where Invoices.Voided=0 group by InvoiceOrderRelations.[Order]) DRV_Invoice on Orders.ID=DRV_Invoice.[Order] inner join (select [order],return_date,return_time from OrderTraceLog where ID in (select min(id) from OrderTraceLog where return_date is not null group by [Order])) as ghar on orders_trace.radif_sefareshat =ghar.[order] WHERE ("& myCriteria & ") ORDER BY order_date DESC, radif_sefareshat DESC"
 121	mySQL="SELECT orders_trace.*, OrderTraceStatus.Name AS StatusName, OrderTraceStatus.Icon , Invoices.ID AS InvoiceID, Invoices.Approved, Invoices.Voided, Invoices.Issued,DRV_invoice.price, ghar.return_date as ghDate, ghar.return_time as ghTime FROM Invoices INNER JOIN InvoiceOrderRelations ON Invoices.ID = InvoiceOrderRelations.Invoice RIGHT OUTER JOIN Orders INNER JOIN orders_trace ON Orders.ID = orders_trace.radif_sefareshat INNER JOIN OrderTraceStatus ON orders_trace.status = OrderTraceStatus.ID ON InvoiceOrderRelations.[Order] = Orders.ID left outer join (select InvoiceOrderRelations.[Order],SUM(InvoiceLines.Price + InvoiceLines.Vat - InvoiceLines.Discount -InvoiceLines.Reverse) as price from InvoiceOrderRelations inner join Invoices on InvoiceOrderRelations.Invoice=Invoices.ID inner join InvoiceLines on Invoices.ID=InvoiceLines.Invoice where Invoices.Voided=0 group by InvoiceOrderRelations.[Order]) DRV_invoice on Orders.id=DRV_invoice.[Order] left outer join (select [order],return_date,return_time from OrderTraceLog where ID in (select min(id) from OrderTraceLog where return_date is not null group by [Order])) as ghar on orders_trace.radif_sefareshat =ghar.[order] WHERE ("& myCriteria & ") AND (Orders.Closed=0) ORDER BY orders_trace.order_date DESC, orders_trace.radif_sefareshat DESC"
 122
 123
 124	set RS1=Conn.Execute (mySQL)
 125	if not RS1.eof then
 126		tmpCounter=0
 127%>
 128	<div align="center" dir="LTR" >
 129	<table border="1" cellspacing="0" cellpadding="2" dir="RTL"  borderColor="#555588" >
 130		<TR valign=top bgcolor="#CCCCFF">
 131			<TD width="40"># �����</TD>
 132			<TD width="65">����� �����<br>����� �����</TD>
 133			<TD width="130">��� ���� - �����</TD>
 134			<TD width="80">����� ���</TD>
 135			<TD width="36">���</TD>
 136			<TD width="45">�����</TD>
 137			<TD width="38">����� ������</TD>
 138			<TD width="18">���</TD>
 139			<TD width="30">������</TD>
 140			<td width="50">����</td>
 141		</TR>
 142<%		Do while not RS1.eof
 143			tmpCounter=tmpCounter+1
 144		if isnull(RS1("price")) then
 145			InvoiceStatus="<span style='color:red;'><b>�����</b></span>"
 146		else
 147			if RS1("Voided") then
 148				style="style='color:Red' Title='���� ���'"
 149			elseif RS1("Issued") then
 150				style="style='color:Red' Title='���� ���'"
 151			elseif RS1("Approved") then
 152				style="style='color:Green' Title='����� ���'"
 153			else
 154				style="style='color:#3399FF' Title='����� ����'"
 155			end if
 156			InvoiceStatus="<A " & style & " HREF='../AR/AccountReport.asp?act=showInvoice&invoice=" & RS1("InvoiceID")& "' Target='_blank'>" & RS1("InvoiceID") & "</A>"
 157		end if
 158			
 159		if tmpCounter mod 2 = 1 then
 160			if IsNull(RS1("return_date")) then 
 161				tmpColor="#FF0000"
 162			else
 163				tmpColor="#FFFFFF"
 164			end if
 165		Else
 166			if IsNull(RS1("return_date")) then 
 167				tmpColor="#DD8888"
 168			else
 169				tmpColor="#DDDDDD"
 170			end if
 171		End If 
 172%>
 173		<TR valign=top bgcolor="<%=tmpColor%>">
 174			<TD DIR="LTR"><A HREF="TraceOrder.asp?act=show&order=<%=RS1("radif_sefareshat")%>" target="_blank"><%=RS1("radif_sefareshat")%></A></TD>
 175			<TD DIR="LTR">
 176				<div title="����� ����� �������"><%=RS1("ghDate") & " ("& RS1("ghTime") & ")"%></div>
 177			<% if RS1("return_date")<>RS1("ghDate") or RS1("return_time")<>RS1("ghTime") then %>
 178				<div title="����� ����� ����" style="color:#F80;"><%=RS1("return_date") & " ("& RS1("return_time") & ")"%></div>
 179			<% end if%>
 180			</TD>
 181			<TD><%=RS1("company_name")%><br><span style='color:gray'><%=RS1("customer_name")%></span><br>����:(<%=RS1("telephone")%>)&nbsp;</TD>
 182			<TD><%=RS1("order_title")%>&nbsp;</TD>
 183			<TD><%=RS1("order_kind")%></TD>
 184			<TD><%=RS1("marhale")%></TD>
 185			<TD><%=RS1("salesperson")%>&nbsp;</TD>
 186			<TD><IMG SRC="<%=RS1("Icon")%>" WIDTH="20" HEIGHT="20" BORDER=0 ALT="<%=RS1("StatusName")%>"></TD>
 187			<TD><%=InvoiceStatus%>&nbsp;</TD>
 188			<td><%if isnull(RS1("price")) then response.write "----" else response.write Separate(RS1("price")) end if %></td>
 189		</TR>
 190		<TR bgcolor="#FFFFFF">
 191			<TD colspan="10" style="height:10px"></TD>
 192		</TR>
 193<%			RS1.moveNext
 194		Loop
 195%>		<TR bgcolor="#ccccFF">
 196			<TD colspan="10">����� ����� �����: <%=tmpCounter%></TD>
 197		</TR>
 198	</TABLE>
 199	</div>
 200	<HR>
 201<%	elseif request("search_box")<>"" then
 202%>	<TABLE border="1" cellspacing="0" cellpadding="0" dir="RTL" align="center" width="600">
 203		<TR bgcolor="#FFFFDD">
 204			<TD align="center" style="height:40px;font-size:12pt;font-weight:bold;color:red;padding:5px;">��� ����� ���� ������ ����<br>
 205			(�� ���� ������ ��� �� ���� ��� � �� ���� ���� �����)<br><br>
 206			���� ������� �� <A HREF="TraceOrder.asp?act=show&order=<%=request("search_box")%>" style="color:blue;">����� � �����</A> ������ ����.</TD>
 207		</TR>
 208	</TABLE>
 209<%		End If
 210elseif request("act")="show" then
 211  if isnumeric(request("order")) then
 212	Order=request("order")
 213	mySQL="SELECT orders_trace.*, Accounts.ID AS AccID, Accounts.AccountTitle FROM Orders INNER JOIN Accounts ON Orders.Customer = Accounts.ID INNER JOIN orders_trace ON Orders.ID = orders_trace.radif_sefareshat WHERE (orders_trace.radif_sefareshat='"& Order & "')"
 214	set RS1=conn.execute (mySQL)
 215	if RS1.EOF then
 216		response.write "<BR><BR><BR><BR><CENTER>����� ����� ����� ����</CENTER>"
 217		response.end
 218	End If
 219
 220	if RS1("Status")=2 then
 221		stamp="<div style='border:2 dashed red;width:150px; text-align:center; padding: 10px;color:red;font-size:15pt;font-weight:bold;'>���� ���</div>"
 222	End If
 223
 224%>
 225	<table border="0" cellpadding="0" cellspacing="0" align="center">
 226		<tr height="10">
 227			<td colspan=2></td>
 228		</tr>
 229		<tr height="10">
 230			<td width="150"></td>
 231			<td valign="top"><div style='position:absolute;'><%=stamp%></div></td>
 232		</tr>
 233		<tr height="20">
 234			<td colspan=2></td>
 235		</tr>
 236	</table>
 237
 238	<CENTER>
 239		<input type="button" value="�����" Class="GenButton" onclick="window.location='OrderEdit.asp?e=y&radif=<%=Order%>';">&nbsp;
 240		<% 	ReportLogRow = PrepareReport ("OrderForm.rpt", "Order_ID", Order, "/beta/dialog_printManager.asp?act=Fin") %>
 241		<!--INPUT TYPE="button" value=" �ǁ " Class="GenButton" style="border:1 solid blue;" onclick="printThisReport(this,<%=ReportLogRow%>);"-->
 242		<input type="button" value=" �ǁ " class="GenButton" style="border:1 solid blue;" onclick="$('#orderProperty').printElement({overrideElementCSS:['/css/order_property.css'],pageTitle:'��� ����� - <%=Order%>',printMode:'popup'});">
 243		<!-- ,leaveOpen:true,printMode:'popup' -->
 244		<input type="button" value="������" Class="GenButton" onclick="window.location='../AR/InvoiceInput.asp?act=submitsearch&query=<%=Order%>';">
 245		<!-----------------------SAM----------------------------
 246		<INPUT type='button' value='������' class='GenButton' style='border:1 solid blue;' onclick=''-->
 247	</CENTER>
 248	
 249	<BR>
 250	<TABLE cellspacing=0 Style="width:80%;border:2 solid #330066" align=center>
 251	<TR bgcolor=white>
 252		<TD>�����</TD>
 253		<TD>����</TD>
 254		<TD>�����</TD>
 255		<TD>�����</TD>
 256		<TD>��� ��� �����</TD>
 257	</TR>
 258	<%
 259	returnDate=""
 260	actualReturnDate=""
 261	returnTime=""
 262	actualReturnTime=""
 263	set RS_STEP=Conn.Execute ("SELECT OrderTraceLog.*, Users.RealName FROM OrderTraceLog INNER JOIN Users ON OrderTraceLog.InsertedBy = Users.ID WHERE (OrderTraceLog.[Order] = "& Order  & ") order by OrderTraceLog.ID")
 264	Do while not RS_STEP.eof	
 265%>
 266	<TR style="cursor:pointer" onclick="window.open('viewOrderLog.asp?logid=<%=RS_STEP("id")%>','orderLog','width=700, height=210')">
 267		<TD  style="border-bottom: solid 1pt black" dir=ltr align=right><%=RS_STEP("InsertedDate")%> </TD>
 268		<TD  style="border-bottom: solid 1pt black" dir=ltr align=right>(<%=RS_STEP("InsertedTime")%>)</TD>
 269		<TD  style="border-bottom: solid 1pt black"><%=RS_STEP("StepText")%></TD>
 270		<TD  style="border-bottom: solid 1pt black"><%=RS_STEP("StatusText")%></TD>
 271		<TD  style="border-bottom: solid 1pt black"><%=RS_STEP("RealName")%></TD>
 272	</TR>
 273<%
 274		if returnDate="" and not IsNull(RS_STEP("return_date")) then returnDate = RS_STEP("return_date")
 275		if returnTime="" and not IsNull(RS_STEP("return_time")) then returnTime = RS_STEP("return_time")
 276		if returnDate<>"" and RS_STEP("return_date")<>returnDate then actualReturnDate = RS_STEP("return_date")
 277		if returnTime<>"" and RS_STEP("return_time")<>returnTime then actualReturnTime = RS_STEP("return_time")
 278		RS_STEP.moveNext
 279	loop
 280	RS_STEP.close
 281	if returnDate="" then returnDate = "<font color=red>���� ����� ����!</font>"
 282	if actualReturnTime<>"" and actualReturnDate="" then actualReturnDate = returnDate
 283	if actualReturnDate="" then actualReturnDate = "<font color=red>�����</font>"
 284	
 285	'set RS_STEP = nothing
 286%>
 287	<tr>
 288		<td  align="center"><A HREF="../shopfloor/default.asp?orderNum=<%=order%>">����� �����</A></td>
 289		<td colspan="2" title="�� ���� ��� ��� ���� �� ���� ������ �� ����� �� ����� ����� ����� �� �� ���� ����� ����� � ����� ����� ����� ���">
 290			<%
 291			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=" & Order & " and accounts.EMail1 <> ''")
 292			if not rsEmail.eof then 
 293			%>
 294			<span>
 295				<form method="post" action="http://my.pdhco.com/sendMail.php">
 296					<input type="hidden" name="order_id" value="<%=rsEmail("ID")%>">
 297					<input type="hidden" name="customer_id" value="<%=rsEmail("customer")%>">
 298					<input type="hidden" name="order_title" value="<%=rsEmail("order_title")%>">
 299					<input type="hidden" name="Email" value="<%=rsEmail("Email1")%>">
 300					<input type="hidden" name="AccountTitle" value="<%=rsEmail("AccountTitle")%>">
 301					<input type="hidden" name="Dear" value="<%=rsEmail("Dear1")%>">
 302					<input type="hidden" name="FirstName" value="<%=rsEmail("FirstName1")%>">
 303					<input type="hidden" name="LastName" value="<%=rsEmail("LastName1")%>">
 304					<input type="submit" name="orderSend" title='<%=rsEmail("email1")%>' value="�� <%=rsEmail("Dear1") & " " & rsEmail("firstName1") & " " & rsEmail("LastName1")%> ����� ���">
 305				</form>
 306			</span>
 307			<%end if%>
 308		</td>
 309		<td colspan="2" title="�� ���� ��� ��� ���� �� ���� ������ �� ����� �� ����� ����� ����� �� �� ���� ����� ����� � ����� ����� ����� ���">
 310			<%
 311			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=" & Order & " and accounts.EMail2 <> ''")
 312			if not rsEmail.eof then 
 313			%>
 314			<span>
 315				<form method="post" action="http://my.pdhco.com/sendMail.php">
 316					<input type="hidden" name="order_id" value="<%=rsEmail("ID")%>">
 317					<input type="hidden" name="customer_id" value="<%=rsEmail("customer")%>">
 318					<input type="hidden" name="order_title" value="<%=rsEmail("order_title")%>">
 319					<input type="hidden" name="Email" value="<%=rsEmail("Email2")%>">
 320					<input type="hidden" name="AccountTitle" value="<%=rsEmail("AccountTitle")%>">
 321					<input type="hidden" name="Dear" value="<%=rsEmail("Dear2")%>">
 322					<input type="hidden" name="FirstName" value="<%=rsEmail("FirstName2")%>">
 323					<input type="hidden" name="LastName" value="<%=rsEmail("LastName2")%>">
 324					<input type="submit" name="orderSend" title='<%=rsEmail("email2")%>' value="�� <%=rsEmail("Dear2") & " " & rsEmail("firstName2") & " " & rsEmail("LastName2")%> ����� ���">
 325				</form>
 326			</span>
 327			<%end if%>
 328		</td>
 329	</tr>
 330	</TABLE>
 331<%
 332mySQL="select count(*) as id from (select Return_date,Return_time from OrderTraceLog where [Order]=" & order & " and Return_date is not null group by Return_date,return_time) as s"
 333set rs = Conn.Execute(mySQL)
 334if not rs.eof then 
 335	if CInt(rs("id"))>1 then 
 336		mySQL="select * from OrderTraceLog where id in (select min(id) as id from OrderTraceLog where [Order]=" & order & " and Return_date is not null group by Return_date,return_time)"
 337		set rs = Conn.Execute(mySQL)
 338		response.write "<TABLE cellspacing=0 Style='width:80%;border:2 solid #330066' align=center>"
 339		response.write "<tr bgcolor=white><td>�����</td><td>����</td><td>����� �����</td><td>���� �����</td></tr>"
 340		while not rs.eof
 341			response.write "<tr><td>" & rs("InsertedDate") & "</td><td>" & rs("InsertedTime") & "</td><td>" & rs("Return_date") & "</td><td class='time'>" & rs("return_time") & "</td></tr>"
 342			rs.moveNext
 343		wend
 344		response.write "</table>"
 345		rs.close
 346		set rs=nothing
 347	end if
 348end if
 349%>
 350	<BR>
 351	<BR>
 352<div id='orderProperty' style="direction:rtl;">	
 353
 354	<TABLE class="" border="0" cellspacing="0" cellpadding="2" align="center" style="background-color:#CCCCCC; color:black; direction:RTL; width:700; border: 2 solid black;">
 355	<TR bgcolor="black">
 356		<TD align="left"><FONT COLOR="YELLOW">����:</FONT></TD>
 357		<TD align="right" colspan=3 height="25px">
 358			<span id="customer" style="color:yellow;"><%' after any changes in this span "./Customers.asp" must be revised%>
 359				<span title="���� ����� ������ ����� ���� ����"><a class="aYellow" href='../CRM/AccountInfo.asp?act=show&selectedCustomer=<%=RS1("AccID")%>'><%=RS1("AccID") & " - "& RS1("AccountTitle")%></a></span>.
 360			</span>
 361		</TD>
 362		<td align="left"><font color="yellow">��� �����:</font></td>
 363		<TD><font color="red"><b><%=RS1("order_kind")%></b></font></TD>
 364	</TR>
 365	
 366	<TR bgcolor="black" height=30 style="color:yellow;">
 367		<TD align="left">����� �����:</TD>
 368		<TD align="right"><%=RS1("radif_sefareshat")%></TD>
 369		<TD align="left">�����:</TD>
 370		<TD><span dir="LTR"><%=RS1("order_date")%></span></TD>
 371		<TD align="left">����:</TD>
 372		<TD align="right"><%=RS1("order_time")%></TD>
 373	</TR>
 374	<TR height=30>
 375		<TD align="left">��� ����:</TD>
 376		<TD><%=RS1("company_name")%></TD>
 377		<TD align="left">����� ����� �������:</TD>
 378		<TD align="right" dir=LTR><%=returnDate%></TD>
 379		<TD align="left">���� �����:</TD>
 380		<TD align="right" dir=LTR><%=returnTime%></TD>
 381	</TR>
 382	<TR height=30>
 383		<TD align="left">��� �����:</TD>
 384		<TD><%=RS1("customer_name")%></TD>
 385		<TD align="left">����:</TD>
 386		<TD><%=RS1("telephone")%></TD>
 387		<TD align="left">����� ����� ����:</TD>
 388		<TD align="right" dir=LTR>
 389		<%
 390		if actualReturnDate<>returnDate then 
 391			response.write "<b>" & actualReturnDate & "</b> " 
 392		else
 393			response.write actualReturnDate & " "
 394		end if
 395		if actualReturnTime<> returnTime then 
 396			response.write " <b>" & actualReturnTime & "</b>"
 397		else
 398			response.write " " & actualReturnTime
 399		end if
 400		%>
 401		</TD>
 402	</TR>
 403	<TR height=30>
 404		
 405		<TD align="left">����� ��� ���� ����:</TD>
 406		<TD colspan="3"><%=RS1("order_title")%></TD>
 407		<TD align="left">����� ������:</TD>
 408		<TD><%=RS1("salesperson")%>	</TD>
 409	</TR>
 410	<TR height=30>
 411		<TD align="left">�����:</TD>
 412		<TD><%=RS1("qtty")%></TD>
 413		<TD align="left">����:</TD>
 414		<TD><%=RS1("PaperSize")%></TD>
 415		<TD align="left">����/����:</TD>
 416		<TD><%=RS1("SimplexDuplex")%></TD>
 417	</TR>
 418	<TR height=30>
 419		<TD align="left">�����:</TD>
 420		<TD><%=RS1("marhale")%></TD>
 421		<TD align="left">�����:</TD>
 422		<TD colspan="3"><%=RS1("vazyat")%></TD>
 423	</TR>
 424	<TR height=30>
 425		<TD align="left">���� ��:</TD>
 426		<TD><%=RS1("Price")%></TD>
 427		<TD colspan="4" height="30px">&nbsp;</TD>
 428	</TR>
 429	<!--TR height=30>
 430		<TD colspan="6" align="center"><input type="button" value="�����" onclick="window.location='OrderEdit.asp?e=y&radif=<%=Order %>';"></TD>
 431	</TR-->
 432	</TABLE><BR>
 433
 434<%
 435if (not (IsNull(rs1("property")) or rs1("property")="")) then
 436%>
 437
 438	<div>������ �����</div>
 439
 440<%
 441	set rs=Conn.Execute("select * from OrderTraceTypes where id="&rs1("type"))
 442	set typeProp = server.createobject("MSXML2.DomDocument")
 443	set orderProp = server.createobject("MSXML2.DomDocument")
 444	
 445	orderProp.loadXML(rs1("property"))
 446	typeProp.loadXML(rs("property"))
 447	set rs=nothing
 448sub showKey(key)
 449	oldGroup="---first---"
 450	oldLabel="---first---"
 451	maxID=-1
 452	oldID=-1
 453	rowEmpty=false
 454	for each mykey in orderProp.SelectNodes(key)
 455		id=myKey.GetAttribute("id")
 456		if maxID<id then maxID=id
 457	next
 458	thisRow = "<div class='myRow'>"'<div class='exteraArea' id='" & Replace(key,"/","-") & "-0'>"
 459	for id = 0 to maxID
 460		For Each myKey In orderProp.SelectNodes(key & "[@id='" & id & "']")
 461			thisName = myKey.GetAttribute("name")
 462			set typeKey = typeProp.selectNodes(key & "[@name='" & thisName & "']")(0)
 463			thisType = typeKey.GetAttribute("type") 
 464			thisLabel= typeKey.GetAttribute("label")
 465			thisGroup= typeKey.GetAttribute("group")
 466			if thisType="radio" then 
 467				radioID = CInt(myKey.text)
 468				set typeKey = typeProp.selectNodes(key & "[@name='" & thisName & "']")(radioID - 1)
 469				thisType = typeKey.GetAttribute("type") 
 470				thisLabel= typeKey.GetAttribute("label")
 471				thisGroup= typeKey.GetAttribute("group")
 472			end if
 473			isRow =false
 474			if Replace(key,"/","-")="keys-service-key" then response.write "::--------::" & myKey.text
 475			if thisName<>"" then 
 476				isRow=true
 477				if oldID<>id then thisRow = thisRow & "<div class='exteraArea' id='" & Replace(key,"/","-") & "-" & id & "'>"
 478				if (oldGroup<>thisGroup and oldID=id and oldGroup <> "---first---") then thisRow = thisRow &  "</div><div class='report'>�����:</div>"
 479				if oldGroup<>thisGroup or oldID<>id then 
 480					thisRow = thisRow & "<div class='mySection'>"
 481					if typeKey.GetAttribute("grouplabel")<>"" then thisRow = thisRow & "<b>" & typeKey.GetAttribute("grouplabel") & "</b>"
 482				end if
 483				if oldLabel<>thisLabel and thisType<>"radio" then thisRow = thisRow &  "<label class='myLabel'>" & thisLabel & ": </label>"
 484				
 485				if left(thisType,6)="option" then set myOptions=typeKey
 486				myText=""
 487				select case thisType
 488					case "option"
 489						for each optKey in myOptions.selectNodes("option")
 490							if optKey.text=myKey.text then 
 491								myText = optKey.GetAttribute("label")
 492								exit for
 493							end if
 494						next
 495					case "option-other"
 496						if left(myKey.text,6)="other:" then 
 497							myText = mid(myKey.text,7)
 498						else
 499							for each optKey in myOptions.selectNodes("option")
 500								if optKey.text=myKey.text then 
 501									myText = optKey.GetAttribute("label")
 502									exit for
 503								end if
 504							next
 505						end if
 506						if myText="" then myText = myKey.text
 507					case "check"
 508						if left(myKey.text,2)="on" then myText = "<img src='/images/Checkmark-32.png' width='15px'>"
 509					case "radio"
 510						myText=thisLabel
 511					case "text"
 512						if right(thisName,5)="price" then 
 513							myText = "<div class='price'>" & myKey.text & "</div>"
 514						else
 515							myText = myKey.text
 516						end if
 517					case else
 518						myText = myKey.text
 519				end select
 520				set myOptions=nothing
 521				thisRow = thisRow & "<span class='myProp'>" & myText & "</span>"		
 522			else
 523				if id=0 then 
 524					thisRow=""
 525					rowEmpty=true
 526				end if
 527			end if
 528			oldGroup=thisGroup
 529			oldLabel=thisLabel
 530			oldID=id
 531			if typeKey.GetAttribute("br")="yes" then thisRow = thisRow & "<br><br>"
 532		Next
 533		if isRow then thisRow = thisRow & "</div><div class='report'>�����:</div></div>"
 534	next
 535	'response.write maxID
 536	if not rowEmpty then thisRow = thisRow & "</div>" '"<div id='extreArea" &Replace(key,"/","-")& "'></div>"
 537	response.write thisRow 'prependTo 
 538'	response.write 
 539end sub
 540	oldTmp="---first---"
 541	for each tmp in orderProp.selectNodes("//key")
 542		if oldTmp<>tmp.parentNode.nodeName then 
 543			oldTmp=tmp.parentNode.nodeName
 544			call showKey("/keys/" & oldTmp & "/key")
 545		end if
 546	next
 547end if
 548%>
 549<div class='report'>����� � ������� ����� �������:</div>
 550</div>
 551<br><br>
 552
 553	<table class="CustTable" cellspacing='1' align=center style="width:700; ">
 554		<tr>
 555			<td colspan="2" class="CusTableHeader"><span style="width:450;text-align:center;">������� ��</span><span style="width:100;text-align:left;background-color:red;"><input class="GenButton" type="button" value="����� �������" onclick="window.location = '../home/message.asp?RelatedTable=orders&RelatedID=<%=Order%>&retURL=<%=Server.URLEncode("../order/TraceOrder.asp?act=show&order="&Order)%>';"></span></td>
 556		</tr>
 557<%
 558	mySQL="SELECT * FROM Messages INNER JOIN Users ON Messages.MsgFrom = Users.ID WHERE (Messages.RelatedTable = 'orders') AND (Messages.RelatedID = "& Order & ") ORDER BY Messages.ID DESC"
 559	Set RS = conn.execute(mySQL)
 560	if NOT RS.eof then
 561
 562		tmpCounter=0
 563		Do While NOT RS.eof 
 564			tmpCounter=tmpCounter+1
 565%>
 566			<tr class="<%if (tmpCounter MOD 2) = 1 then response.write "CusTD3" else response.write "CusTD4" %>">
 567				<td>�� <%=RS("RealName")%><br>
 568					<%=RS("MsgDate")%> <BR> <%=RS("MsgTime")%>
 569				</td>
 570				<td dir='RTL'><%=replace(RS("MsgBody"),chr(13),"<br>")%></td>
 571			</tr>
 572<%
 573			RS.moveNext
 574		Loop
 575	else
 576%>
 577		<tr class="CusTD3">
 578			<td colspan="2">���</td>
 579		</tr>
 580<%
 581	end if
 582	RS.close
 583%>
 584	</table><BR>
 585		<%
 586		dim fs
 587		set fs=Server.CreateObject("Scripting.FileSystemObject")
 588		if not fs.FolderExists(orderFolder & order)=true then
 589		  fs.CreateFolder (orderFolder & order)  
 590		end if
 591		set fs=nothing
 592		%>
 593		<a href="<%=orderFolder & order%>">����� ���� �����</a>
 594		
 595	<div style='direction:ltr;float:left;'><!--b>�� ��� ���� ������� ���� ����� ����</b-->
 596	<% ListFolderContents(orderFolder & order) %>
 597	<div>
 598	<TABLE border="0" cellspacing="0" cellpadding="2" align="center" style=" color:black; direction:RTL; width:700; ">
 599	<TR>
 600		<TD valign=top>
 601			<TABLE border="0" cellspacing="0" cellpadding="2" dir="RTL" align="center" width="350" >
 602			<TR bgcolor="black" >
 603				<TD align="right" colspan=2 title="��� ��� ���� ����" onclick="window.location='../shopfloor/manageOrder.asp?radif=<%=order%>'" style='cursor:pointer;'><FONT COLOR="YELLOW">���������� ���� �� �����:</FONT></TD>
 604			</TR>
 605			<%
 606			'Gets Request for services list from DB
 607			'-----------------_SAM EDIT THIS 
 608			set RS3=Conn.Execute ("SELECT InventoryItemRequests.*,InventoryPickuplistItems.pickupListID  FROM InventoryItemRequests left outer join InventoryPickuplistItems on InventoryItemRequests.ID=InventoryPickuplistItems.RequestID WHERE InventoryItemRequests.order_ID="& Order )
 609			%>
 610				<%
 611				Do while not RS3.eof
 612				%>
 613				<TR bgcolor="#CCCCCC" title="<% 
 614					Comment = RS3("Comment")
 615					if Comment<>"-" then
 616						response.write "�����: " & Comment
 617					else
 618						response.write "����� �����"
 619					End If
 620				%>">
 621					<TD align="right" valign=top><FONT COLOR="black">
 622					<INPUT TYPE="checkbox" NAME="outReq" VALUE="<%=RS3("id")%>" <%
 623					if RS3("status") = "new" then
 624						response.write " checked disabled "
 625					else 
 626						response.write " disabled "
 627					End If
 628					%>>
 629					<%
 630					if (not isNull(RS3("pickupListID"))) then 
 631						response.write "<a href='../inventory/default.asp?ed="&RS3("pickupListID")&"'>"
 632					end if
 633				%>
 634					<%=RS3("ItemName")%>  
 635					<%
 636					if RS3("CustomerHaveInvItem")  then
 637						response.write "<small><b style='color:red'> ������ </b></small>" 
 638					end if 
 639					%>
 640					<small dir=ltr>(�����: <%=RS3("qtty")%> <%=RS3("unit")%> - �����: <span dir=ltr><%=RS3("ReqDate")%></span>)</small>
 641				<%
 642					if (not isNull(RS3("pickupListID"))) then 
 643						response.write "</a>"
 644					end if
 645				%>
 646					</font></td>
 647					<td align=left width=5%><%
 648					if RS3("status") = "del" then
 649						response.write "<b><small>��� ���</b></small>"
 650					End If
 651					%></td>
 652				</tr>
 653				<% 
 654				RS3.moveNext
 655				Loop
 656				%>
 657			</TABLE>
 658		</TD>
 659
 660		<TD  valign=top>
 661			<TABLE border="0" cellspacing="0" cellpadding="2" dir="RTL" align="center" width="350" >
 662			<TR bgcolor="black" >
 663				<TD align="right" colspan=2 title="��� ��� ���� ����" onclick="window.location='../shopfloor/manageOrder.asp?radif=<%=order%>'" style='cursor:pointer;'><FONT COLOR="YELLOW">���������� ���� ����� � ����:</FONT></TD>
 664			</TR>
 665			<%
 666			'Gets Request for services list from DB
 667			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="& Order & " )")
 668			%>
 669				
 670				<%
 671				Do while not RS3.eof
 672				%>
 673				<TR bgcolor="#CCCCCC" title="<% 
 674					Comment = RS3("Comment")
 675					if Comment<>"-" then
 676						response.write "�����: " & Comment
 677					else
 678						response.write "����� �����"
 679					End If
 680				%>">
 681					<TD align="right" valign=top <%if isnull(rs3("ord_ID")) then response.write " title='����� ���� ���� ����� ����!' "%>><FONT COLOR="black">
 682						<INPUT TYPE="checkbox" NAME="outReq" VALUE="<%=RS3("id")%>" <%
 683					if RS3("status") = "new" then
 684						response.write " checked disabled "
 685					else 
 686						response.write " disabled "
 687					End If
 688					%>>
 689					<%
 690					if (not isNull(RS3("Ord_ID"))) then 
 691						response.write "<a href='../purchase/outServiceTrace.asp?od="&RS3("Ord_ID")&"'>"
 692					end if
 693					%>
 694					<%=RS3("typeName")%>  <small >(�����: <%=RS3("qtty")%>� ����: <%=RS3("thisPrice")%> - �����: <span dir=ltr><%=RS3("ReqDate")%></span>)</small>
 695					<%
 696					if (not isNull(RS3("Ord_ID"))) then 
 697						response.write "</a>"
 698					end if
 699					%>				
 700					</font></td>
 701					<td align=left width=5%><%
 702					if RS3("status") = "del" then
 703						response.write "<b><small>��� ���</b></small>"
 704					End If
 705					%>
 706					</td>
 707				</tr>
 708				<% 
 709				RS3.moveNext
 710				Loop
 711				%>
 712			</TABLE>
 713		</TD>
 714	</TR>
 715	</TABLE><BR>
 716	<TABLE border="0" cellspacing="0" cellpadding="2" align="center" style=" color:black; direction:RTL; width:700; ">
 717	<tr bgcolor="black">
 718		<td align="center" colspan="7" style="color:yellow;padding:3px 0 8px 0;">�����ʝ��� ����� ��� ���� ��� �����:</td>
 719	</tr>
 720	<tr bgcolor="black" style="color:yellow;">
 721		<td>����</td>
 722		<td>������</td>
 723		<td>������</td>
 724		<td>�����</td>
 725		<td>����</td>
 726		<td>���</td>
 727		<td>��� �����</td>
 728	</tr>
 729	<%
 730function floor(x)
 731	dim temp	
 732	temp = Round(x)
 733	if temp > x then
 734	    temp = temp - 1
 735	end if
 736	floor = temp
 737end function
 738function ceil(x)
 739	dim temp	
 740	temp = Round(x)
 741	if temp < x then
 742	    temp = temp + 1
 743	end if
 744	ceil = temp
 745end function
 746	mySQL="select costs.description,isnull(DATEDIFF(mi,costs.start_time,costs.end_time),0) as theTime,end_counter - start_counter as theCount, cost_operation_type.name as operationName, cost_drivers.name as driverName, cost_centers.name as centerName, users.RealName from costs inner join cost_operation_type on costs.operation_type=cost_operation_type.id inner join cost_drivers on cost_operation_type.driver_id=cost_drivers.id inner join cost_centers on cost_drivers.cost_center_id=cost_centers.id inner join Users on costs.user_id=users.ID where [order]=" & order
 747	set rs=Conn.Execute(mySQL)
 748	while not rs.eof
 749%>
 750	<tr bgcolor="#CCCCCC">
 751		<td><%=rs("centerName")%></td>
 752		<td><%=rs("driverName")%></td>
 753		<td><%=rs("operationName")%></td>
 754		<td><%=rs("theCount")%></td>
 755		<td><%=floor(cint(rs("theTime"))/60) & ":" & cint(rs("theTime")) mod 60%></td>
 756		<td><%=rs("description")%></td>
 757		<td><%=rs("realName")%></td>
 758	</tr>
 759<%		
 760		rs.moveNext
 761	wend
 762	rs.close
 763	%>
 764	</table>
 765	<!------------------------------------------------------SAM----------------------------------------------------------->
 766
 767<%
 768end if
 769elseif request("act")="advancedSearch" then
 770'------  Advanced Search 
 771%>
 772<!--#include File="../include_JS_InputMasks.asp"-->
 773<%
 774	'Server.ScriptTimeout = 3600
 775	tmpTime=time
 776	tmpTime=Hour(tmpTime)&":"&Minute(tmpTime)
 777	if instr(tmpTime,":")<3 then tmpTime="0" & tmpTime
 778	if len(tmpTime)<5 then tmpTime=Left(tmpTime,3) & "0" & Right(tmpTime,1)
 779
 780	if request("resultsCount")="" OR not isnumeric(request("resultsCount")) then
 781		resultsCount = 50
 782	else
 783		resultsCount = cint(request("resultsCount"))
 784	end if
 785
 786%>
 787	<hr>
 788	<TABLE border="4" cellspacing="0" cellpadding="0" width="700" align="center" bordercolor="#555599">
 789	<FORM METHOD=POST ACTION="TraceOrder.asp?act=advancedSearch" onSubmit="return checkValidation();">
 790	<TR><TD>
 791		<TABLE border="0" cellspacing="0" cellpadding="1" dir="RTL" width="100%" bgcolor="white">
 792		<TR bgcolor="#EEEEEE">
 793			<TD><INPUT TYPE="checkbox" NAME="check_sefaresh" onclick="check_sefaresh_Click()" checked></TD>
 794			<TD>����� �����</TD>
 795			<TD><INPUT TYPE="text" NAME="az_sefaresh" dir="LTR" value="<%=request.form("az_sefaresh")%>" size="8" maxlength="6" onKeyPress="return maskNumber(this);"></TD>
 796			<TD>��</TD>
 797			<TD><INPUT TYPE="text" NAME="ta_sefaresh" dir="LTR" value="<%=request.form("ta_sefaresh")%>" size="8" maxlength="6" onKeyPress="return maskNumber(this);" ></TD>
 798			<td rowspan="12" style="width:1px" bgcolor="#555599"></td>
 799			<TD><INPUT TYPE="checkbox" NAME="check_kind" onclick="check_kind_Click()" checked></TD>
 800			<TD>��� �����</TD>
 801			<TD colspan="3"><SELECT NAME="order_kind_box" style='font-family: tahoma,arial ; font-size: 8pt; font-weight: bold; width: 140px'>
 802				<OPTION value="����" <%if request.form("order_kind_box")="����" then response.write "selected" %> >����</option>
 803				<OPTION value="�������" <%if request.form("order_kind_box")="�������" then response.write "selected" %> >�������</option>
 804				<OPTION value="���� � ����" <%if request.form("order_kind_box")="���� � ����" then response.write "selected" %> >���� � ����</option>
 805				<OPTION value="�����" <%if request.form("order_kind_box")="�����" then response.write "selected" %> >�����</option>
 806				<OPTION value="�����" <%if request.form("order_kind_box")="�����" then response.write "selected" %> >�����</option>
 807				<OPTION value="����" <%if request.form("order_kind_box")="����" then response.write "selected" %> >����</option>
 808				<OPTION value="����" <%if request.form("order_kind_box")="����" then response.write "selected" %> >����</option>
 809				<OPTION value="�����" <%if request.form("order_kind_box")="�����" then response.write "selected" %> >�����</option>
 810				<OPTION value="������" <%if request.form("order_kind_box")="������" then response.write "selected" %> >������</option>
 811			</SELECT></TD>
 812		</TR>
 813		<TR bgcolor="#555599">
 814			<td colspan="11" style="height:2px"></td>
 815		</TR>
 816		<TR>
 817			<TD>
 818				<INPUT TYPE="checkbox" NAME="check_tarikh_sefaresh" onclick="check_tarikh_sefaresh_Click()" checked>
 819			</TD>
 820			<TD>����� �����</TD>
 821			<TD>
 822				<INPUT TYPE="text" NAME="az_tarikh_sefaresh" dir="LTR" value="<%=request("az_tarikh_sefaresh")%>" size="10" onKeyPress="return maskDate(this);" onBlur="if(acceptDate(this))document.all.ta_tarikh_sefaresh.value=this.value;" maxlength="10">
 823			</TD>
 824			<TD>��</TD>
 825			<TD>
 826				<INPUT TYPE="text" NAME="ta_tarikh_sefaresh" dir="LTR" value="<%=request("ta_tarikh_sefaresh")%>" size="10" onKeyPress="return maskDate(this);" onblur="acceptDate(this)" maxlength="10">
 827			</TD>
 828			<TD>
 829				<INPUT TYPE="checkbox" NAME="check_marhale" onclick="check_marhale_Click()" checked>
 830			</TD>
 831			<TD>�����</TD>
 832			<TD>
 833				<SELECT NAME="marhale_box" style='font-family: tahoma,arial ; font-size: 8pt; font-weight: bold; width: 140px'>
 834					<%
 835					set RS_STEP=Conn.Execute ("SELECT * FROM OrderTraceSteps WHERE (IsActive=1)")
 836					Do while not RS_STEP.eof	
 837					%>
 838						<OPTION value="<%=RS_STEP("ID")%>" <%if cint(request.form("marhale_box"))=cint(RS_STEP("ID")) then response.write "selected" %> ><%=RS_STEP("name")%></option>
 839						<%
 840						RS_STEP.moveNext
 841					loop
 842					RS_STEP.close
 843					%>
 844				</SELECT>
 845			</TD>
 846			<TD>
 847				<span id="marhale_not_check_label" style='font-weight:bold;color:red'>�����</span>
 848			</TD>
 849			<TD>
 850				<INPUT TYPE="checkbox" NAME="marhale_not_check" onclick="marhale_not_check_Click();" checked>
 851			</TD>
 852		</TR>
 853		<TR bgcolor="#555599">
 854			<td colspan="11" style="height:2px"></td>
 855		</TR>
 856		<TR bgcolor="#EEEEEE">
 857			<TD>
 858				<INPUT TYPE="checkbox" NAME="check_tarikh_tahvil" onclick="check_tarikh_tahvil_Click()" checked>
 859			</TD>
 860			<TD>����� ����� ����</TD>
 861			<TD>
 862				<INPUT TYPE="text" NAME="az_tarikh_tahvil" dir="LTR" value="<%=request.form("az_tarikh_tahvil")%>" size="10" onblur="acceptDate(this)" maxlength="10" onKeyPress="return maskDate(this);">
 863			</TD>
 864			<TD>��</TD>
 865			<TD>
 866				<INPUT TYPE="text" NAME="ta_tarikh_tahvil" dir="LTR" value="<%=request.form("ta_tarikh_tahvil")%>" onblur="acceptDate(this)" maxlength="10" size="10" onKeyPress="return maskDate(this);">
 867			</TD>
 868			<TD>
 869				<INPUT TYPE="checkbox" NAME="check_vazyat" onclick="check_vazyat_Click()" checked>
 870			</TD>
 871			<TD>�����</TD>
 872			<TD>
 873				<SELECT NAME="vazyat_box" style='font-family: tahoma,arial ; font-size: 8pt; font-weight: bold; width: 140px'>
 874				<%
 875				set RS_STATUS=Conn.Execute ("SELECT * FROM OrderTraceStatus WHERE (IsActive=1)")
 876				Do while not RS_STATUS.eof	
 877				%>
 878					<OPTION value="<%=RS_STATUS("ID")%>" <%if cint(request.form("vazyat_box"))=cint(RS_STATUS("ID")) then response.write "selected" %> ><%=RS_STATUS("Name")%></option>
 879					<%
 880					RS_STATUS.moveNext
 881				loop
 882				%>
 883				</SELECT>
 884			</TD>
 885			<TD>
 886				<span id="vazyat_not_check_label" style='font-weight:bold;color:red'>�����</span>
 887			</TD>
 888			<TD>
 889				<INPUT TYPE="checkbox" NAME="vazyat_not_check" onclick="vazyat_not_check_Click();" checked>
 890			</TD>
 891		</TR>
 892		<TR bgcolor="#EEEEEE">
 893			<TD>
 894				<INPUT TYPE="checkbox" NAME="check_tarikh_gharar" onclick="check_tarikh_gharar_Click()" checked>
 895			</TD>
 896			<TD>����� ����� �������</TD>
 897			<TD>
 898				<INPUT TYPE="text" NAME="az_tarikh_gharar" dir="LTR" value="<%=request.form("az_tarikh_gharar")%>" size="10" onblur="acceptDate(this)" maxlength="10" onKeyPress="return maskDate(this);">
 899			</TD>
 900			<TD>��</TD>
 901			<TD>
 902				<INPUT TYPE="text" NAME="ta_tarikh_gharar" dir="LTR" value="<%=request.form("ta_tarikh_gharar")%>" onblur="acceptDate(this)" maxlength="10" size="10" onKeyPress="return maskDate(this);">
 903			</TD>
 904			
 905			
 906			</TD>
 907			<TD>
 908				<INPUT TYPE="checkbox" NAME="check_closed" onclick="check_closed_Click()" checked>
 909			</TD>
 910			<TD colspan="4">
 911				<span id="check_closed_label" style='color:black;'>��� ����� ��� ���</span>
 912			</TD>
 913		</TR>
 914		<TR bgcolor="#555599">
 915			<td colspan="11" style="height:2px"></td>
 916		</TR>
 917		<TR>
 918			<TD colspan="5">
 919				<input type="checkbox" name="returnIsNull" onclick="check_returnisnull_Click()" checked>
 920				<span id="check_returnisnull_label" style='color:black;'>����� ����� ������� �����</span>
 921			</td>
 922			<TD><INPUT TYPE="checkbox" NAME="check_salesperson" onclick="check_salesperson_Click()" checked></TD>
 923			<TD>����� ������</TD>
 924			<TD colspan="3">
 925			<SELECT NAME="salesperson_box" style='font-family: tahoma,arial ; font-size: 8pt; font-weight: bold; width: 140px'>
 926<%				set RSV=Conn.Execute ("SELECT RealName FROM Users WHERE Display=1 ORDER BY RealName") 
 927				Do while not RSV.eof
 928%>
 929					<option value="<%=RSV("RealName")%>" <%if RSV("RealName")=request.form("salesperson_box") then response.write " selected "%> ><%=RSV("RealName")%></option>
 930<%
 931				RSV.moveNext
 932				Loop
 933				RSV.close
 934%>
 935			</SELECT></TD>
 936		</TR>
 937		<TR bgcolor="#555599">
 938			<td colspan="11" style="height:2px"></td>
 939		</TR>
 940		<TR bgcolor="#EEEEEE">
 941			<TD><INPUT TYPE="checkbox" NAME="check_company_name" onclick="check_company_name_Click()" checked></TD>
 942			<TD>��� ����</TD>
 943			<TD colspan="3"><INPUT TYPE="text" NAME="company_name_box" value="<%=request.form("company_name_box")%>"></TD>
 944			<TD><INPUT TYPE="checkbox" NAME="check_telephone" onclick="check_telephone_Click()" checked></TD>
 945			<TD>����</TD>
 946			<TD colspan="3"><INPUT TYPE="text" NAME="telephone_box" value="<%=request.form("telephone_box")%>"></TD>
 947		</TR>
 948		<TR bgcolor="#555599">
 949			<td colspan="11" style="height:2px"></td>
 950		</TR>
 951		<TR>
 952			<TD><INPUT TYPE="checkbox" NAME="check_customer_name" onclick="check_customer_name_Click()" checked></TD>
 953			<TD>��� �����</TD>
 954			<TD colspan="3"><INPUT TYPE="text" NAME="customer_name_box" value="<%=request.form("customer_name_box")%>"></TD>
 955			<TD><INPUT TYPE="checkbox" NAME="check_order_title" onclick="check_order_title_Click()" checked></TD>
 956			<TD>����� �����</TD>
 957			<TD colspan="3"><INPUT TYPE="text" NAME="order_title_box" value="<%=request.form("order_title_box")%>"></TD>
 958		</TR>
 959		<TR bgcolor="#555599">
 960			<td colspan="11" style="height:2px"></td>
 961		</TR>
 962		<TR bgcolor="#AAAAEE">
 963			<td colspan="11" style="height:30px">
 964			<TABLE align="center" width="50%">
 965			<TR>
 966				<TD><INPUT TYPE="submit" Name="Submit" Value="�����" style="font-family:tahoma,arial; font-size:10pt;width:100px;"></TD>
 967				<TD align="left"><INPUT TYPE="button" Name="Cancel" Value="��� ��" style="font-family:tahoma,arial; font-size:10pt;width:100px;" onclick="window.location='TraceOrder.asp?act=advancedSearch';"></TD>
 968			</TR>
 969			<TR>
 970				<TD align="left">����� �����:</TD>
 971				<TD>&nbsp;<INPUT TYPE="Text" Name="resultsCount" value="<%=resultsCount%>" maxlength="4" size="4" onKeyPress="return maskNumber(this);"></TD>
 972			</TR>
 973			</TABLE>
 974			</td>
 975		</TR>
 976		</TABLE>
 977	</TD></TR>
 978	</FORM>
 979	</TABLE>
 980	<hr>
 981	<SCRIPT LANGUAGE='JavaScript'>
 982	<!--
 983	function check_sefaresh_Click(){
 984		if ( document.all.check_sefaresh.checked ) {
 985			document.all.az_sefaresh.style.visibility = "visible";
 986			document.all.ta_sefaresh.style.visibility = "visible";
 987			document.all.az_sefaresh.focus();
 988		}
 989		else{
 990			document.all.az_sefaresh.style.visibility = "hidden";
 991			document.all.ta_sefaresh.style.visibility = "hidden";
 992		}
 993	}
 994
 995	function check_tarikh_sefaresh_Click(){
 996		if ( document.all.check_tarikh_sefaresh.checked ) {
 997			document.all.az_tarikh_sefaresh.style.visibility = "visible";
 998			document.all.ta_tarikh_sefaresh.style.visibility = "visible";
 999			document.all.az_tarikh_sefaresh.focus();
1000		}
1001		else{
1002			document.all.az_tarikh_sefaresh.style.visibility = "hidden";
1003			document.all.ta_tarikh_sefaresh.style.visibility = "hidden";
1004		}
1005	}
1006
1007	function check_tarikh_tahvil_Click(){
1008		if ( document.all.check_tarikh_tahvil.checked ) {
1009			document.all.az_tarikh_tahvil.style.visibility = "visible";
1010			document.all.ta_tarikh_tahvil.style.visibility = "visible";
1011			document.all.az_tarikh_tahvil.focus();
1012		}
1013		else{
1014			document.all.az_tarikh_tahvil.style.visibility = "hidden";
1015			document.all.ta_tarikh_tahvil.style.visibility = "hidden";
1016		}
1017	}
1018	
1019	function check_tarikh_gharar_Click(){
1020		if ( document.all.check_tarikh_gharar.checked ) {
1021			document.all.az_tarikh_gharar.style.visibility = "visible";
1022			document.all.ta_tarikh_gharar.style.visibility = "visible";
1023			document.all.az_tarikh_gharar.focus();
1024		}
1025		else{
1026			document.all.az_tarikh_gharar.style.visibility = "hidden";
1027			document.all.ta_tarikh_gharar.style.visibility = "hidden";
1028		}
1029	}
1030	
1031	function check_company_name_Click(){
1032		if (document.all.check_company_name.checked) {
1033			document.all.company_name_box.style.visibility = "visible";
1034			document.all.company_name_box.focus();
1035		}
1036		else{
1037			document.all.company_name_box.style.visibility = "hidden";
1038		}
1039	}
1040
1041	function check_customer_name_Click(){
1042		if (document.all.check_customer_name.checked) {
1043			document.all.customer_name_box.style.visibility = "visible";
1044			document.all.customer_name_box.focus();
1045		}
1046		else{
1047			document.all.customer_name_box.style.visibility = "hidden";
1048		}
1049	}
1050
1051	function check_kind_Click(){
1052		if (document.all.check_kind.checked) {
1053			document.all.order_kind_box.style.visibility = "visible";
1054			document.all.order_kind_box.focus();
1055		}
1056		else{
1057			document.all.order_kind_box.style.visibility = "hidden";
1058		}
1059	}
1060
1061	function check_marhale_Click(){
1062		if (document.all.check_marhale.checked) {
1063			document.all.marhale_box.style.visibility = "visible";
1064			document.all.marhale_box.focus();
1065			document.all.marhale_not_check.style.visibility = "visible";
1066			marhale_not_check_Click();	
1067		}
1068		else{
1069			document.all.marhale_box.style.visibility = "hidden";
1070			document.all.marhale_not_check.style.visibility = "hidden";
1071			document.all.marhale_not_check_label.style.color='#BBBBBB'
1072		}
1073	}
1074
1075	function check_vazyat_Click(){
1076		if (document.all.check_vazyat.checked) {
1077			document.all.vazyat_box.style.visibility = "visible";
1078			document.all.vazyat_box.focus();
1079			document.all.vazyat_not_check.style.visibility = "visible";
1080			vazyat_not_check_Click();
1081		}
1082		else{
1083			document.all.vazyat_box.style.visibility = "hidden";
1084			document.all.vazyat_not_check.style.visibility = "hidden";
1085			document.all.vazyat_not_check_label.style.color='#BBBBBB'
1086		}
1087	}
1088
1089	function check_salesperson_Click(){
1090		if (document.all.check_salesperson.checked) {
1091			document.all.salesperson_box.style.visibility = "visible";
1092			document.all.salesperson_box.focus();
1093		}
1094		else{
1095			document.all.salesperson_box.style.visibility = "hidden";
1096		}
1097	}
1098
1099	function check_telephone_Click(){
1100		if (document.all.check_telephone.checked) {
1101			document.all.telephone_box.style.visibility = "visible";
1102			document.all.telephone_box.focus();
1103		}
1104		else{
1105			document.all.telephone_box.style.visibility = "hidden";
1106		}
1107	}
1108
1109	function check_order_title_Click(){
1110		if (document.all.check_order_title.checked) {
1111			document.all.order_title_box.style.visibility = "visible";
1112			document.all.order_title_box.focus();
1113		}
1114		else{
1115			document.all.order_title_box.style.visibility = "hidden";
1116		}
1117	}
1118
1119	function marhale_not_check_Click(){
1120		if (document.all.marhale_not_check.checked) {
1121			document.all.marhale_not_check_label.style.color='red'
1122		}
1123		else{
1124			document.all.marhale_not_check_label.style.color='#BBBBBB'
1125		}
1126	}
1127
1128
1129	function vazyat_not_check_Click(){
1130		if (document.all.vazyat_not_check.checked) {
1131			document.all.vazyat_not_check_label.style.color='red'
1132		}
1133		else{
1134			document.all.vazyat_not_check_label.style.color='#BBBBBB'
1135		}
1136	}
1137
1138	function check_closed_Click(){
1139		if (document.all.check_closed.checked) {
1140			document.all.check_closed_label.style.color='black'
1141		}
1142		else{
1143			document.all.check_closed_label.style.color='#BBBBBB'
1144		}
1145	}
1146	function check_returnisnull_Click(){
1147		if (document.all.returnIsNull.checked) {
1148			document.all.check_returnisnull_label.style.color='black'
1149		}
1150		else{
1151			document.all.check_returnisnull_label.style.color='#BBBBBB'
1152		}
1153	}
1154	
1155
1156	function Form_Load(){
1157	<%
1158	maybeAND = ""
1159	myCriteria = ""
1160	If request.form("check_sefaresh") = "on" Then
1161		if request.form("az_sefaresh") <> "" then
1162			myCriteria = myCriteria & maybeAND & "radif_sefareshat >= " & request.form("az_sefaresh")
1163			maybeAND=" AND "
1164		End If
1165		if request.form("ta_sefaresh") <> "" then
1166			myCriteria = myCriteria & maybeAND & "radif_sefareshat <= " & request.form("ta_sefaresh")
1167			maybeAND=" AND "
1168		End If
1169		If (request.form("az_sefaresh") = "") AND (request.form("ta_sefaresh") = "") then
1170			response.write "document.all.check_sefaresh.checked = false;" & vbCrLf
1171			response.write "document.all.az_sefaresh.style.visibility = 'hidden';" & vbCrLf
1172			response.write "document.all.ta_sefaresh.style.visibility = 'hidden';" & vbCrLf
1173		End If
1174	Else
1175		response.write "document.all.check_sefaresh.checked = false;" & vbCrLf
1176		response.write "document.all.az_sefaresh.style.visibility = 'hidden';" & vbCrLf
1177		response.write "document.all.ta_sefaresh.style.visibility = 'hidden';" & vbCrLf
1178
1179	End If
1180
1181	If request("check_tarikh_sefaresh") = "on" Then
1182		if request("az_tarikh_sefaresh") <> "" then
1183			myCriteria = myCriteria & maybeAND & "order_date >= '" & request("az_tarikh_sefaresh") & "'"
1184			maybeAND=" AND "
1185		End If
1186		if request("ta_tarikh_sefaresh") <> "" then
1187			myCriteria = myCriteria & maybeAND & "order_date <= '" & request("ta_tarikh_sefaresh") & "'"
1188			maybeAND=" AND "
1189		End If 
1190		If (request("az_tarikh_sefaresh") = "") AND (request("ta_tarikh_sefaresh") = "") then
1191			response.write "document.all.check_tarikh_sefaresh.checked = false;" & vbCrLf
1192			response.write "document.all.az_tarikh_sefaresh.style.visibility = 'hidden';" & vbCrLf
1193			response.write "document.all.ta_tarikh_sefaresh.style.visibility = 'hidden';" & vbCrLf
1194		End If
1195	Else
1196		response.write "document.all.check_tarikh_sefaresh.checked = false;" & vbCrLf
1197		response.write "document.all.az_tarikh_sefaresh.style.visibility = 'hidden';" & vbCrLf
1198		response.write "document.all.ta_tarikh_sefaresh.style.visibility = 'hidden';" & vbCrLf
1199	End If
1200
1201	If request.form("check_tarikh_tahvil") = "on" Then
1202		if request.form("az_tarikh_tahvil") <> "" then
1203
1204			myCriteria = myCriteria & maybeAND & "orders_trace.return_date >= '" & request.form("az_tarikh_tahvil") & "'"
1205			maybeAND=" AND "
1206		End If
1207		if request.form("ta_tarikh_tahvil") <> "" then
1208			myCriteria = myCriteria & maybeAND & "orders_trace.return_date <= '" & request.form("ta_tarikh_tahvil") & "'"
1209			maybeAND=" AND "
1210		End If
1211		If (request.form("az_tarikh_tahvil") = "") AND (request.form("ta_tarikh_tahvil") = "") then
1212			respons…

Large files files are truncated, but you can click here to view the full file