PageRenderTime 86ms CodeModel.GetById 41ms app.highlight 25ms RepoModel.GetById 1ms app.codeStats 2ms

/beta/order/Inquiry.asp

http://github.com/khaneh/Orders
ASP | 2088 lines | 1850 code | 144 blank | 94 comment | 208 complexity | c083b6c85a1802c3070a0020ba546cc2 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=9
   5if not Auth(2 , 9) then NotAllowdToViewThisPage() '������� 
   6%>
   7<!--#include file="top.asp" -->
   8<!--#include File="../include_farsiDateHandling.asp"-->
   9<!--#include File="../include_UtilFunctions.asp"-->
  10<!--#include File="../include_JS_InputMasks.asp"-->
  11<%
  12'Server.ScriptTimeout = 3600
  13%>
  14<STYLE>
  15	.CustTable {font-family:tahoma; width:80%; border:1 solid black; direction: RTL; background-color:black;}
  16	.CustTable td {padding:5;}
  17	.CustTable a {text-decoration:none;color:#000088}
  18	.CustTable a:hover {text-decoration:underline;}
  19	.CusTableHeader {background-color: #33AACC; text-align: center; font-weight:bold;}
  20	.CusTD1 {background-color: #CCCC66; text-align: left; font-weight:bold;}
  21	.CusTD2 {background-color: #DDDDDD; direction: LTR; text-align: right; font-size:9pt;}
  22	.CusTD3 {background-color: #DDDDDD; direction: LTR; text-align: center; font-size:9pt;}
  23	.CusTD4 {background-color: #CCCC66; direction: LTR; text-align: center; font-size:9pt;}
  24</STYLE>
  25
  26<%
  27'-----------------------------
  28' Trace Quote
  29'-----------------------------
  30if Request.QueryString("act")="" then
  31%>
  32<SCRIPT LANGUAGE='JavaScript'>
  33<!--
  34function checkValidation(){
  35	if (document.all.search_box.value != ''){
  36		return true;
  37	}
  38	else{
  39		document.all.search_box.focus();
  40		return false;
  41	}
  42}
  43//-->
  44</SCRIPT>
  45	<hr>
  46	<TABLE border="4" cellspacing="0" cellpadding="0" width="600" align="center" bordercolor="#555599">
  47	<TR><TD>
  48		<TABLE border="0" cellspacing="0" cellpadding="5" dir="RTL" width="100%">
  49	<!-- Trace Quote -->
  50		<FORM METHOD=POST ACTION="?act=search" onSubmit="return checkValidation();">
  51		<TR bgcolor="#AAAAEE"><TD colspan="4">
  52			<FONT SIZE="" COLOR="#555599" ><B>������ �������:</B></FONT>
  53		</TD></TR>
  54		<TR bgcolor="#AAAAEE">
  55			<TD>��� ����� �� ���� �� ����� �������:</TD>
  56			<TD><INPUT TYPE="text" NAME="search_box" value="<%=request.form("search_box")%>"></TD>
  57			<TD><INPUT TYPE="submit" NAME="SubmitB" Value="�����" style="font-family:tahoma,arial; font-size:10pt;width:100px;"></TD>
  58			<TD align="left"><% if Auth(2 , 5) then %><A HREF="?act=advancedSearch">������ �������</A><% End If %></TD>
  59		</TR>
  60		</FORM>
  61		</TABLE>
  62	</TD></TR>
  63	<TR><TD>
  64		<TABLE border="0" cellspacing="0" cellpadding="5" dir="RTL" width="100%">
  65	<!-- Input Quote -->
  66		<FORM METHOD=POST ACTION="?act=quoteInpCustSearch" onsubmit="if (document.all.CustomerNameSearchBox.value=='') return false;">
  67			<TR bgcolor="#AAAAEE">
  68				<TD>
  69					<FONT SIZE="" COLOR="#555599" ><B>���� ������� ����:</B></FONT>
  70				</TD>
  71			</TR>
  72			<TR bgcolor="#AAAAEE">
  73				<TD>��� ��� : ����� ���� ��� ���� &nbsp;
  74					<INPUT TYPE="text" NAME="CustomerNameSearchBox">&nbsp;
  75					<INPUT TYPE="submit" value="�����"><br>
  76
  77			<SCRIPT LANGUAGE="JavaScript">
  78				document.all.CustomerNameSearchBox.focus();
  79			</SCRIPT>
  80				</TD>
  81			</TR>
  82		</FORM>
  83		</TABLE>
  84	</TD></TR>
  85	</TABLE>
  86	<script language="JavaScript">
  87		document.all.search_box.focus();
  88	</script>
  89	<hr>
  90<%
  91	'
  92elseif Request.QueryString("act")="search" then
  93%>
  94	<hr>
  95	<TABLE border="4" cellspacing="0" cellpadding="0" width="600" align="center" bordercolor="#555599">
  96	<FORM METHOD=POST ACTION="?act=search" onSubmit="return checkValidation();">
  97	<TR><TD>
  98		<TABLE border="0" cellspacing="0" cellpadding="5" dir="RTL" width="100%">
  99		<TR bgcolor="#AAAAEE">
 100			<TD>��� ����� �� ���� �� ����� �������:</TD>
 101			<TD><INPUT TYPE="text" NAME="search_box" value="<%=request.form("search_box")%>"></TD>
 102			<TD><INPUT TYPE="submit" NAME="SubmitB" Value="�����" style="font-family:tahoma,arial; font-size:10pt;width:100px;"></TD>
 103			<TD align="left"><A HREF="?act=advancedSearch">������ �������</A></TD>
 104		</TR>
 105		</TABLE>
 106	</TD></TR>
 107	</FORM>
 108	</TABLE> 
 109	<script language="JavaScript">
 110	<!--
 111		document.all.search_box.focus();
 112	//-->
 113	</script>
 114	<hr>
 115<%
 116	
 117	search=request("search_box")
 118	if search="" then
 119		'By Default show Open Quotes of Current User
 120		myCriteria= "Quotes.CreatedBy = " & session("ID")
 121	elseif isNumeric(search) then
 122		search=clng(search)
 123		myCriteria= "Quotes.ID = '"& search & "'"
 124	else
 125		search=sqlSafe(search)
 126		myCriteria= "REPLACE([company_name], ' ', '') LIKE REPLACE(N'%"& search & "%', ' ', '') OR REPLACE([customer_name], ' ', '') LIKE REPLACE(N'%"& search & "%', ' ', '')"
 127	End If
 128
 129	mySQL=	"SELECT Quotes.*, OrderTraceStatus.Name AS StatusName, OrderTraceStatus.Icon , Invoices.ID AS InvoiceID, Invoices.Approved, Invoices.Voided, Invoices.Issued "&_ 
 130			" FROM Quotes INNER JOIN "&_ 
 131			" OrderTraceStatus ON OrderTraceStatus.ID = Quotes.status LEFT OUTER JOIN "&_ 
 132			" Invoices INNER JOIN "&_ 
 133			" InvoiceQuoteRelations ON Invoices.ID = InvoiceQuoteRelations.Invoice ON Quotes.ID = InvoiceQuoteRelations.Quote "&_ 
 134			" WHERE ("& myCriteria & ")  "&_ 
 135			" ORDER BY Quotes.order_date DESC, Quotes.ID DESC "
 136
 137	set RS1=Conn.Execute (mySQL)
 138	if not RS1.eof then
 139		tmpCounter=0
 140%>
 141	<div align="center" dir="LTR" >
 142	<table border="1" cellspacing="0" cellpadding="2" dir="RTL"  borderColor="#555588" >
 143		<TR valign=top bgcolor="#CCCCFF">
 144			<TD width="41"># �������</TD>
 145			<TD width="65">����� �������<br>����� ������</TD>
 146			<TD width="130">��� ���� - �����</TD>
 147			<TD width="110">����� ���</TD>
 148			<TD width="36">���</TD>
 149			<TD width="76">�����</TD>
 150			<TD width="56">������� ������</TD>
 151			<TD width="40">������</TD>
 152		</TR>
 153<%		Do while not RS1.eof
 154
 155		if isnull(RS1("InvoiceID")) then
 156			InvoiceStatus="<span style='color:red;'><b>�����</b></span>"
 157		else
 158			if RS1("Voided") then
 159				style="style='color:Red' Title='���� ���'"
 160			elseif RS1("Issued") then
 161				style="style='color:Red' Title='���� ���'"
 162			elseif RS1("Approved") then
 163				style="style='color:Green' Title='����� ���'"
 164			else
 165				style="style='color:#3399FF' Title='����� ����'"
 166			end if
 167			InvoiceStatus="<A " & style & " HREF='../AR/AccountReport.asp?act=showInvoice&invoice=" & RS1("InvoiceID")& "' Target='_blank'>" & RS1("InvoiceID") & "</A>"
 168		end if
 169			
 170		tmpCounter = tmpCounter + 1
 171		if tmpCounter mod 2 = 1 then
 172			tmpColor="#FFFFFF"
 173		Else
 174			tmpColor="#EEEEEE"
 175		End If 
 176%>
 177		<TR valign=top bgcolor="<%=tmpColor%>">
 178			<TD width="40" DIR="LTR"><A HREF="?act=show&quote=<%=RS1("ID")%>" target="_blank"><%=RS1("ID")%></A></TD>
 179			<TD width="65" DIR="LTR"><%=RS1("order_date")%><br><%=RS1("return_date") & " ("& RS1("return_time") & ")"%></TD>
 180			<TD width="130"><%=RS1("company_name")%><br><span style='color:gray'><%=RS1("customer_name")%></span><br>����:(<%=RS1("telephone")%>)&nbsp;</TD>
 181			<TD width="80"><%=RS1("order_title")%>&nbsp;</TD>
 182			<TD width="40"><%=RS1("order_kind")%></TD>
 183			<TD width="85"><%=RS1("marhale")%></TD>
 184			<TD width="50"><%=RS1("salesperson")%>&nbsp;</TD>
 185			<TD width="30"><%=InvoiceStatus%>&nbsp;</TD>
 186		</TR>
 187		<TR bgcolor="#FFFFFF">
 188			<TD colspan="10" style="height:10px"></TD>
 189		</TR>
 190<%			RS1.moveNext
 191		Loop
 192%>		<TR bgcolor="#ccccFF">
 193			<TD colspan="10">����� ����� �����: <%=tmpCounter%></TD>
 194		</TR>
 195	</TABLE>
 196	</div>
 197	<HR>
 198<%	
 199	elseif request("search_box")<>"" Then
 200	
 201%>	<TABLE border="1" cellspacing="0" cellpadding="0" dir="RTL" align="center" width="600">
 202		<TR bgcolor="#FFFFDD">
 203			<TD align="center" style="height:40px;font-size:12pt;font-weight:bold;color:red;padding:5px;">��� ������� ���� ������ ����<br>
 204			(�� ���� ������ ��� �� ���� ��� � �� ���� ���� �����)<br><br>
 205			���� ������� �� <A HREF="?act=show&quote=<%=request("search_box")%>" style="color:blue;">����� � �����</A> ������ ����.</TD>
 206		</TR>
 207	</TABLE>
 208<%	
 209	End If
 210'----------------------------------------------------------------------------------------------------------
 211elseif Request.QueryString("act")="approve" then 
 212	 if isnumeric(request("quote")) then
 213		quote=request("quote")
 214		set rs = Conn.Execute("select * form Quotes where id=" & quote)
 215		If RS1.EOF then
 216			response.write "<BR><BR><BR><BR><CENTER>����� ������� ����� ����</CENTER>"
 217			response.end
 218		End If
 219		msg=""
 220		if IsNull(rs("qtty")) then msg="���ǎ �� ��� ����<br>"
 221		if IsNull(rs("paperZise") or rs("paperZise")="") then msg=msg &"���� �� ��� ����<br>"
 222		if IsNull(rs("property") or rs("property")="") then msg=msg & "������ �� ��� ����<br>"
 223		set typeProp = server.createobject("MSXML2.DomDocument")
 224		set orderProp = server.createobject("MSXML2.DomDocument")
 225		orderProp.loadXML(rs("property"))
 226		orderType= rs("type")
 227		set rs=Conn.Execute("select * from OrderTraceTypes where id="&orderType)
 228		typeProp.loadXML(rs("property"))
 229		set rs=nothing
 230		oldTmp="---first---"
 231		for each tmp in orderProp.selectNodes("//key")
 232			if oldTmp <> tmp.parentNode.nodeName then 
 233				oldTmp = tmp.parentNode.nodeName
 234				key = "/keys/" & oldTmp & "/key"
 235				oldGroup="---first---"
 236				oldLabel="---first---"
 237				maxID=-1
 238				oldID=-1
 239				rowEmpty=false
 240				for each mykey in orderProp.SelectNodes(key)
 241					id=myKey.GetAttribute("id")
 242					if maxID<id then maxID=id
 243				next
 244				for id = 0 to maxID
 245					For Each myKey In orderProp.SelectNodes(key & "[@id='" & id & "']")
 246						thisName = myKey.GetAttribute("name")
 247						set typeKey = typeProp.selectNodes(key & "[@name='" & thisName & "']")(0)
 248						thisType = typeKey.GetAttribute("type") 
 249						thisLabel= typeKey.GetAttribute("label")
 250						thisGroup= typeKey.GetAttribute("group")
 251						thisItem = typeKey.GetAttribute("item")
 252						if thisName="description" then thisDesc = myKey.text
 253						
 254						isRow =false
 255						if thisName<>"" then
 256							isRow=true
 257							'if ((oldGroup<>thisGroup or oldID<>id) and oldGroup <> "---first---") then
 258							if oldGroup<>thisGroup or oldID<>id then 
 259								'if typeKey.GetAttribute("grouplabel")<>"" 
 260								a=2
 261							end if
 262							'if oldLabel<>thisLabel and thisType<>"radio" then
 263							
 264						end if
 265						'desc= 
 266						
 267						oldGroup=thisGroup
 268						oldLabel=thisLabel
 269						oldID=id
 270					next
 271				next
 272			end if
 273		next
 274		'Conn.Execute("update Quotes set qApproved=1 where id=" & quote)
 275	end if
 276	'response.redirect "?act=show&quote=" & quote
 277elseif Request.QueryString("act")="show" then
 278  if isnumeric(request("quote")) then
 279	quote=request("quote")
 280	'mySQL="SELECT Accounts.ID AS AccID, Accounts.AccountTitle, Quotes.* FROM Accounts INNER JOIN Quotes ON Accounts.ID = Quotes.Customer WHERE (Quotes.ID='"& quote & "')"
 281
 282	mySQL=	"SELECT Quotes.*, Accounts.ID AS AccID, Accounts.AccountTitle, "&_ 
 283			"Invoices.ID AS InvoiceID, Invoices.Approved, Invoices.Voided, Invoices.Issued "&_ 
 284			"FROM Quotes INNER JOIN "&_ 
 285			"Accounts ON Accounts.ID = Quotes.Customer LEFT OUTER JOIN "&_ 
 286			"InvoiceQuoteRelations INNER JOIN "&_ 
 287			"Invoices ON InvoiceQuoteRelations.Invoice = Invoices.ID ON InvoiceQuoteRelations.Quote = Quotes.ID "&_ 
 288			"WHERE (Quotes.ID='"& quote & "')"
 289'response.write mySQL
 290	set RS1=conn.execute (mySQL)
 291	If RS1.EOF then
 292		response.write "<BR><BR><BR><BR><CENTER>����� ������� ����� ����</CENTER>"
 293		response.end
 294	End If
 295
 296	If RS1("Step")=4 then
 297		stamp="<div style='border:2 dashed red;width:150px; text-align:center; padding: 10px;color:red;font-size:15pt;font-weight:bold;'>�� ���</div>"
 298	End If
 299
 300%>
 301	<table border="0" cellpadding="0" cellspacing="0" align="center">
 302		<tr height="10">
 303			<td colspan=2></td>
 304		</tr>
 305		<tr height="10">
 306			<td width="150"></td>
 307			<td valign="top"><div style='position:absolute;'><%=stamp%></div></td>
 308		</tr>
 309		<tr height="20">
 310			<td colspan=2></td>
 311		</tr>
 312	</table>
 313
 314	<CENTER>
 315	<%if not CBool(rs1("qApproved")) then%> 
 316		<input type="button" value="������" Class="GenButton" onclick="window.location='?act=editQuote&quote=<%=quote%>';">&nbsp;
 317		<input title="�� ���� ����ϡ ��ԝ���� �� ���� ������ ����� ����� ��." type="button" value="�����" Class="GenButton" onclick="window.location='?act=approve&quote=<%=quote%>';">&nbsp;
 318	<%else%>
 319		<% If RS1("Step")<>5 Then %>
 320			<input type="button" value="����� �� �����" Class="GenButton" onclick="window.location='?act=convertToOrder&quote=<%=quote%>';">
 321		<% Else %>
 322			<font color="red">&nbsp; (<b>����� �� ����� ���</b>)</font>
 323		<% End If %>
 324	<%end if%>
 325	<input type="button" value="߁� �������" Class="GenButton" onclick="window.location='?act=copy&quote=<%=quote%>';">
 326		<%' 	ReportLogRow = PrepareReport ("OrderForm.rpt", "Order_ID", quote, "/beta/dialog_printManager.asp?act=Fin") %>
 327		<!--INPUT TYPE="button" value=" �ǁ " Class="GenButton" style="border:1 solid blue;" onclick="printThisReport(this,<% 'ReportLogRow%>);"-->
 328	<% If isnull(RS1("InvoiceID")) Then %>
 329		<input type="button" value="��� ���� ����" Class="GenButton" onclick="window.location='../AR/InvoiceInput.asp?act=getInvoice&selectedCustomer=<%=RS1("AccID")%>&selectedQuotes=<%=quote%>';">
 330	<% Else %>
 331		<input type="button" value="��� ���� ���� (<%=RS1("InvoiceID")%>)" Class="GenButton" style="color:#3399FF;" onclick="window.location='../AR/AccountReport.asp?act=showInvoice&invoice=<%=RS1("InvoiceID")%>';">
 332	<% End If %>
 333
 334	
 335	</CENTER>
 336	
 337	<BR>
 338	<TABLE class="" cellspacing="0" cellpadding="2" align="center" style="background-color:#CCCCCC; color:black; direction:RTL; width:700; border: 2 solid #555599;">
 339		<TR bgcolor="#555599">
 340			<TD align="left"><FONT COLOR="YELLOW">����:</FONT></TD>
 341			<TD align="right" colspan=5 height="25px">
 342				<span id="customer" style="color:yellow;"><%' after any changes in this span "./Customers.asp" must be revised%>
 343					<span><%=RS1("AccID") & " - "& RS1("AccountTitle")%></span>.
 344				</span>
 345			</TD>
 346		</TR>
 347		
 348		<TR bgcolor="#555599" height=30 style="color:yellow;">
 349			<TD align="left">����� �������:</TD>
 350			<TD align="right"><%=RS1("ID")%></TD>
 351			<TD align="left">�����:</TD>
 352			<TD><span dir="LTR"><%=RS1("order_date")%></span></TD>
 353			<TD align="left">����:</TD>
 354			<TD align="right"><%=RS1("order_time")%></TD>
 355		</TR>
 356		<TR height=30>
 357			<TD align="left">��� ����:</TD>
 358			<TD><%=RS1("company_name")%></TD>
 359			<TD align="left">���� ������:</TD>
 360			<TD align="right" dir=LTR><%=RS1("return_date")%></TD>
 361			<TD align="left">���� ������:</TD>
 362			<TD align="right" dir=LTR><%=RS1("return_time")%></TD>
 363		</TR>
 364		<TR height=30>
 365			<TD align="left">��� �����:</TD>
 366			<TD><%=RS1("customer_name")%></TD>
 367			<TD align="left">��� �������:</TD>
 368			<TD><%=RS1("order_kind")%></TD>
 369			<TD align="left">������� ������:</TD>
 370			<TD><%=RS1("salesperson")%>	</TD>
 371		</TR>
 372		<TR height=30>
 373			<TD align="left">����:</TD>
 374			<TD><%=RS1("telephone")%></TD>
 375			<TD align="left">����� ��� ���� ����:</TD>
 376			<TD colspan="3"><%=RS1("order_title")%></TD>
 377		</TR>
 378	
 379		<TR height=30>
 380			<td align="left">�����:</td>
 381			<td><%=rs1("qtty")%></td>
 382			<TD align="left">����:</TD>
 383			<TD><%=RS1("PaperSize")%></TD>
 384			<TD align="left">���� �����:</TD>
 385			<TD>
 386			<%if RS1("productionDuration") = 0 then 
 387				response.write "<font color=red>�������</font>" 
 388			else
 389				response.write RS1("productionDuration") & " ���"
 390			end if %>
 391			
 392			</TD>
 393		</TR>
 394		<TR height=30>
 395			<TD align="left">�����:</TD>
 396			<TD colspan="3"><%=RS1("marhale")%></TD>
 397			<TD align="left">���� ��:</TD>
 398			<TD><span class="price"><%=RS1("Price")%></span></TD>
 399		</TR>
 400		<TR height=30>
 401			<TD align="left" valign="top" colspan="3">������� �����:</TD>
 402			<TD colspan="3">
 403			<%if not IsNull(RS1("Notes")) then response.write replace(RS1("Notes"),chr(13),"<br>")%>
 404			</TD>
 405		</TR>
 406	</TABLE>
 407<%
 408set rs = conn.Execute("select *,users.RealName from QuoteLogs inner join Users on QuoteLogs.LastUpdatedBy=users.ID where QuoteLogs.QuoteID=" & quote & " and QuoteLogs.ID in (select min(id) from QuoteLogs group by QuoteID,productionDuration)")
 409if not rs.eof then 
 410%>
 411	<TABLE class="" cellspacing="0" cellpadding="2" align="center" style="background-color:#CCCCCC; color:black; direction:RTL; width:700; border: 2 solid #555599;">
 412	<tr bgcolor="#555599" height=30 style="color:yellow;">
 413		<td>�����</td>
 414		<td>����</td>
 415		<td>���� �����</td>
 416		<td>����</td>
 417	</tr>
 418<%
 419	while not rs.eof 
 420		response.write "<tr><td>" & rs("LastUpdatedDate") & "</td><td>" & rs("LastUpdatedTime") & "</td><td>" 
 421		if CInt(rs("productionDuration"))=0 then 
 422			response.write "<font color=red>�������</font>"
 423		else
 424			response.write  rs("productionDuration") & " ���"
 425		end if
 426		response.write  "</td><td>" & rs("RealName") & "</td></tr>"
 427		rs.moveNext
 428	wend
 429%>	
 430	<tr>
 431	
 432	</tr>
 433	</table>
 434<%
 435end if
 436%>
 437	<BR>
 438	<%
 439if (not (IsNull(rs1("property")) or rs1("property")="")) then
 440%>
 441	<div>������ �������</div>
 442
 443<%
 444	set rs=Conn.Execute("select * from OrderTraceTypes where id="&rs1("type"))
 445	set typeProp = server.createobject("MSXML2.DomDocument")
 446	set orderProp = server.createobject("MSXML2.DomDocument")
 447	
 448	orderProp.loadXML(rs1("property"))
 449	typeProp.loadXML(rs("property"))
 450	set rs=nothing
 451sub showKey(key)
 452	oldGroup="---first---"
 453	oldLabel="---first---"
 454	maxID=-1
 455	oldID=-1
 456	rowEmpty=false
 457	for each mykey in orderProp.SelectNodes(key)
 458		id=myKey.GetAttribute("id")
 459		if maxID<id then maxID=id
 460	next
 461	thisRow = "<div class='myRow'>"'<div class='exteraArea' id='" & Replace(key,"/","-") & "-0'>"
 462	for id = 0 to maxID
 463		For Each myKey In orderProp.SelectNodes(key & "[@id='" & id & "']")
 464			thisName = myKey.GetAttribute("name")
 465			set typeKey = typeProp.selectNodes(key & "[@name='" & thisName & "']")(0)
 466			thisType = typeKey.GetAttribute("type") 
 467			thisLabel= typeKey.GetAttribute("label")
 468			thisGroup= typeKey.GetAttribute("group")
 469			if thisType="radio" then 
 470				radioID = CInt(myKey.text)
 471				set typeKey = typeProp.selectNodes(key & "[@name='" & thisName & "']")(radioID - 1)
 472				thisType = typeKey.GetAttribute("type") 
 473				thisLabel= typeKey.GetAttribute("label")
 474				thisGroup= typeKey.GetAttribute("group")
 475			end if
 476			isRow =false
 477			if Replace(key,"/","-")="keys-service-key" then response.write "::--------::" & myKey.text
 478			if thisName<>"" then 
 479				isRow=true
 480				if oldID<>id then thisRow = thisRow & "<div class='exteraArea' id='" & Replace(key,"/","-") & "-" & id & "'>"
 481				if (oldGroup<>thisGroup and oldID=id and oldGroup <> "---first---") then thisRow = thisRow &  "</div>"
 482				if oldGroup<>thisGroup or oldID<>id then 
 483					thisRow = thisRow & "<div class='mySection'>"
 484					if typeKey.GetAttribute("grouplabel")<>"" then thisRow = thisRow & "<b>" & typeKey.GetAttribute("grouplabel") & "</b>"
 485				end if
 486				if oldLabel<>thisLabel and thisType<>"radio" then thisRow = thisRow &  "<label class='myLabel'>" & thisLabel & ": </label>"
 487				
 488				if left(thisType,6)="option" then set myOptions=typeKey
 489				myText=""
 490				select case thisType
 491					case "option"
 492						for each optKey in myOptions.selectNodes("option")
 493							if optKey.text=myKey.text then 
 494								myText = optKey.GetAttribute("label")
 495								exit for
 496							end if
 497						next
 498					case "option-other"
 499						if left(myKey.text,6)="other:" then 
 500							myText = mid(myKey.text,7)
 501						else
 502							for each optKey in myOptions.selectNodes("option")
 503								if optKey.text=myKey.text then 
 504									myText = optKey.GetAttribute("label")
 505									exit for
 506								end if
 507							next
 508						end if
 509						if myText="" then myText = myKey.text
 510					case "check"
 511						if left(myKey.text,2)="on" then myText = "<img src='/images/Checkmark-32.png' width='15px'>"
 512					case "radio"
 513						myText=thisLabel
 514					case else
 515						myText = myKey.text
 516				end select
 517				set myOptions=nothing
 518				thisRow = thisRow & "<span class='myProp'>" & myText & "</span>"		
 519			else
 520				if id=0 then 
 521					thisRow=""
 522					rowEmpty=true
 523				end if
 524			end if
 525			oldGroup=thisGroup
 526			oldLabel=thisLabel
 527			oldID=id
 528			if typeKey.GetAttribute("br")="yes" then thisRow = thisRow & "<br><br>"
 529		Next
 530		if isRow then thisRow = thisRow & "</div></div>"
 531	next
 532	'response.write maxID
 533	if not rowEmpty then thisRow = thisRow & "</div>" '"<div id='extreArea" &Replace(key,"/","-")& "'></div>"
 534	response.write thisRow 'prependTo 
 535'	response.write 
 536end sub
 537	oldTmp="---first---"
 538	for each tmp in orderProp.selectNodes("//key")
 539		if oldTmp<>tmp.parentNode.nodeName then 
 540			oldTmp=tmp.parentNode.nodeName
 541			call showKey("/keys/" & oldTmp & "/key")
 542		end if
 543	next
 544' 	call showKey("/keys/printing/key")
 545' 	call showKey("keys/binding/key")
 546' 	call showKey("keys/service/key")
 547' 	call showKey("keys/delivery/key")
 548	
 549end if
 550%>
 551<br><br>
 552	<table class="CustTable" cellspacing='1' align=center style="width:700; ">
 553		<tr>
 554			<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=quotes&RelatedID=<%=quote%>&retURL=<%=Server.URLEncode("../order/Inquiry.asp?act=show&quote="&quote)%>';"></span></td>
 555		</tr>
 556<%
 557	mySQL="SELECT * FROM Messages INNER JOIN Users ON Messages.MsgFrom = Users.ID WHERE (Messages.RelatedTable = 'quotes') AND (Messages.RelatedID = "& quote & ") ORDER BY Messages.ID DESC"
 558	Set RS = conn.execute(mySQL)
 559	if NOT RS.eof then
 560
 561		tmpCounter=0
 562		Do While NOT RS.eof 
 563			tmpCounter=tmpCounter+1
 564%>
 565			<tr class="<%if (tmpCounter MOD 2) = 1 then response.write "CusTD3" else response.write "CusTD4" %>">
 566				<td>�� <%=RS("RealName")%><br>
 567					<%=RS("MsgDate")%> <BR> <%=RS("MsgTime")%>
 568				</td>
 569				<td dir='RTL'><%=replace(RS("MsgBody"),chr(13),"<br>")%></td>
 570			</tr>
 571<%
 572			RS.moveNext
 573		Loop
 574	else
 575%>
 576		<tr class="CusTD3">
 577			<td colspan="2">���</td>
 578		</tr>
 579<%
 580	end if
 581	RS.close
 582%>
 583	</table><BR>
 584
 585<%
 586  end if
 587elseif Request.QueryString("act")="advancedSearch" then
 588'------  Advanced Search 
 589%>
 590<!--#include File="../include_JS_InputMasks.asp"-->
 591<%
 592	'Server.ScriptTimeout = 3600
 593	tmpTime=time
 594	tmpTime=Hour(tmpTime)&":"&Minute(tmpTime)
 595	if instr(tmpTime,":")<3 then tmpTime="0" & tmpTime
 596	if len(tmpTime)<5 then tmpTime=Left(tmpTime,3) & "0" & Right(tmpTime,1)
 597
 598	if request("resultsCount")="" OR not isnumeric(request("resultsCount")) then
 599		resultsCount = 50
 600	else
 601		resultsCount = cint(request("resultsCount"))
 602	end if
 603
 604%>
 605	<hr>
 606	<TABLE border="4" cellspacing="0" cellpadding="0" width="700" align="center" bordercolor="#555599">
 607	<FORM METHOD=POST ACTION="?act=advancedSearch" onSubmit="return checkValidation();">
 608	<TR><TD>
 609		<TABLE border="0" cellspacing="0" cellpadding="1" dir="RTL" width="100%" bgcolor="white">
 610		<TR bgcolor="#EEEEEE">
 611			<TD><INPUT TYPE="checkbox" NAME="check_sefaresh" onclick="check_sefaresh_Click()" checked></TD>
 612			<TD>����� �������</TD>
 613			<TD><INPUT TYPE="text" NAME="az_sefaresh" dir="LTR" value="<%=request.form("az_sefaresh")%>" size="8" maxlength="6" onKeyPress="return maskNumber(this);"></TD>
 614			<TD>��</TD>
 615			<TD><INPUT TYPE="text" NAME="ta_sefaresh" dir="LTR" value="<%=request.form("ta_sefaresh")%>" size="8" maxlength="6" onKeyPress="return maskNumber(this);" ></TD>
 616			<td rowspan="12" style="width:1px" bgcolor="#555599"></td>
 617			<TD><INPUT TYPE="checkbox" NAME="check_kind" onclick="check_kind_Click()" checked></TD>
 618			<TD>��� �������</TD>
 619			<TD colspan="3"><SELECT NAME="order_kind_box" style='font-family: tahoma,arial ; font-size: 8pt; font-weight: bold; width: 140px'>
 620				<OPTION value="����" <%if request.form("order_kind_box")="����" then response.write "selected" %> >����</option>
 621				<OPTION value="�������" <%if request.form("order_kind_box")="�������" then response.write "selected" %> >�������</option>
 622				<OPTION value="���� � ����" <%if request.form("order_kind_box")="���� � ����" then response.write "selected" %> >���� � ����</option>
 623				<OPTION value="�����" <%if request.form("order_kind_box")="�����" then response.write "selected" %> >�����</option>
 624				<OPTION value="�����" <%if request.form("order_kind_box")="�����" then response.write "selected" %> >�����</option>
 625				<OPTION value="����" <%if request.form("order_kind_box")="����" then response.write "selected" %> >����</option>
 626				<OPTION value="����" <%if request.form("order_kind_box")="����" then response.write "selected" %> >����</option>
 627				<OPTION value="�����" <%if request.form("order_kind_box")="�����" then response.write "selected" %> >�����</option>
 628				<OPTION value="������" <%if request.form("order_kind_box")="������" then response.write "selected" %> >������</option>
 629			</SELECT></TD>
 630		</TR>
 631		<TR bgcolor="#555599">
 632			<td colspan="11" style="height:2px"></td>
 633		</TR>
 634		<TR>
 635			<TD>
 636				<INPUT TYPE="checkbox" NAME="check_tarikh_sefaresh" onclick="check_tarikh_sefaresh_Click()" checked>
 637			</TD>
 638			<TD>����� �������</TD>
 639			<TD>
 640				<INPUT TYPE="text" NAME="az_tarikh_sefaresh" dir="LTR" value="<%=request.form("az_tarikh_sefaresh")%>" size="10" onKeyPress="return maskDate(this);" onBlur="if(acceptDate(this))document.all.ta_tarikh_sefaresh.value=this.value;" maxlength="10">
 641			</TD>
 642			<TD>��</TD>
 643			<TD>
 644				<INPUT TYPE="text" NAME="ta_tarikh_sefaresh" dir="LTR" value="<%=request.form("ta_tarikh_sefaresh")%>" size="10" onKeyPress="return maskDate(this);" onblur="acceptDate(this)" maxlength="10">
 645			</TD>
 646			<TD>
 647				<INPUT TYPE="checkbox" NAME="check_marhale" onclick="check_marhale_Click()" checked>
 648			</TD>
 649			<TD>�����</TD>
 650			<TD>
 651				<SELECT NAME="marhale_box" style='font-family: tahoma,arial ; font-size: 8pt; font-weight: bold; width: 140px'>
 652					<%
 653					set RS_STEP=Conn.Execute ("SELECT * FROM QuoteSteps WHERE (IsActive=1)")
 654					Do while not RS_STEP.eof	
 655					%>
 656						<OPTION value="<%=RS_STEP("ID")%>" <%if cint(request("marhale_box"))=cint(RS_STEP("ID")) then response.write "selected" %> ><%=RS_STEP("name")%></option>
 657						<%
 658						RS_STEP.moveNext
 659					loop
 660					RS_STEP.close
 661					%>
 662				</SELECT>
 663			</TD>
 664			<TD>
 665				<span id="marhale_not_check_label" style='font-weight:bold;color:red'>�����</span>
 666			</TD>
 667			<TD>
 668				<INPUT TYPE="checkbox" NAME="marhale_not_check" onclick="marhale_not_check_Click();" checked>
 669			</TD>
 670		</TR>
 671		<TR bgcolor="#555599">
 672			<td colspan="11" style="height:2px"></td>
 673		</TR>
 674		<TR bgcolor="#EEEEEE">
 675			<TD>
 676				<INPUT TYPE="checkbox" NAME="check_tarikh_tahvil" onclick="check_tarikh_tahvil_Click()" checked>
 677			</TD>
 678			<TD>����� ������</TD>
 679			<TD>
 680				<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);">
 681			</TD>
 682			<TD>��</TD>
 683			<TD>
 684				<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);">
 685			</TD>
 686			<td colspan="5"></td>
 687			
 688		</TR>
 689		<TR bgcolor="#EEEEEE">
 690			<TD colspan="5">&nbsp;</TD>
 691			<TD>
 692				<INPUT TYPE="checkbox" NAME="check_closed" onclick="check_closed_Click()" checked>
 693			</TD>
 694			<TD colspan="4">
 695				<span id="check_closed_label" style='color:black;'>��� ������� ��� ���</span>
 696			</TD>
 697		</TR>
 698		<TR bgcolor="#555599">
 699			<td colspan="11" style="height:2px"></td>
 700		</TR>
 701		<TR>
 702			<TD colspan="5">&nbsp;</TD>
 703			<TD>
 704				<INPUT TYPE="checkbox" NAME="check_salesperson" onclick="check_salesperson_Click()" checked>
 705			</TD>
 706			<TD>������� ������</TD>
 707			<TD colspan="3">
 708				<SELECT NAME="salesperson_box" style='font-family: tahoma,arial ; font-size: 8pt; font-weight: bold; width: 140px'>
 709<%				set RSV=Conn.Execute ("SELECT RealName,id FROM Users WHERE Display=1 ORDER BY RealName") 
 710				Do while not RSV.eof
 711%>
 712					<option value="<%=RSV("RealName")%>" 
 713						<%
 714						if request.form("salesperson_box")="" then 
 715							if RSV("id")=session("id") then response.write " selected "
 716						else
 717							if RSV("RealName")=request.form("salesperson_box") then response.write " selected "
 718						end if
 719						%> >
 720						<%=RSV("RealName")%>
 721					</option>
 722<%
 723				RSV.moveNext
 724				Loop
 725				RSV.close
 726%>
 727				</SELECT>
 728			</TD>
 729		</TR>
 730		<TR bgcolor="#555599">
 731			<td colspan="11" style="height:2px"></td>
 732		</TR>
 733		<TR bgcolor="#EEEEEE">
 734			<TD>
 735				<INPUT TYPE="checkbox" NAME="check_company_name" onclick="check_company_name_Click()" checked>
 736			</TD>
 737			<TD>��� ����</TD>
 738			<TD colspan="3">
 739				<INPUT TYPE="text" NAME="company_name_box" value="<%=request.form("company_name_box")%>">
 740			</TD>
 741			<TD>
 742				<INPUT TYPE="checkbox" NAME="check_telephone" onclick="check_telephone_Click()" checked>
 743			</TD>
 744			<TD>����</TD>
 745			<TD colspan="3">
 746				<INPUT TYPE="text" NAME="telephone_box" value="<%=request.form("telephone_box")%>">
 747			</TD>
 748		</TR>
 749		<TR bgcolor="#555599">
 750			<td colspan="11" style="height:2px"></td>
 751		</TR>
 752		<TR>
 753			<TD>
 754				<INPUT TYPE="checkbox" NAME="check_customer_name" onclick="check_customer_name_Click()" checked>
 755			</TD>
 756			<TD>��� �����</TD>
 757			<TD colspan="3">
 758				<INPUT TYPE="text" NAME="customer_name_box" value="<%=request.form("customer_name_box")%>">
 759			</TD>
 760			<TD>
 761				<INPUT TYPE="checkbox" NAME="check_order_title" onclick="check_order_title_Click()" checked>
 762			</TD>
 763			<TD>����� �������</TD>
 764			<TD colspan="3">
 765				<INPUT TYPE="text" NAME="order_title_box" value="<%=request.form("order_title_box")%>">
 766			</TD>
 767		</TR>
 768		<TR bgcolor="#555599">
 769			<td colspan="11" style="height:2px"></td>
 770		</TR>
 771		<TR bgcolor="#AAAAEE">
 772			<td colspan="11" style="height:30px">
 773			<TABLE align="center" width="50%">
 774			<TR>
 775				<TD><INPUT TYPE="submit" Name="Submit" Value="�����" style="font-family:tahoma,arial; font-size:10pt;width:100px;"></TD>
 776				<TD align="left"><INPUT TYPE="button" Name="Cancel" Value="��� ��" style="font-family:tahoma,arial; font-size:10pt;width:100px;" onclick="window.location='?act=advancedSearch';"></TD>
 777			</TR>
 778			<TR>
 779				<TD align="left">����� �����:</TD>
 780				<TD>&nbsp;<INPUT TYPE="Text" Name="resultsCount" value="<%=resultsCount%>" maxlength="4" size="4" onKeyPress="return maskNumber(this);"></TD>
 781			</TR>
 782			</TABLE>
 783			</td>
 784		</TR>
 785		</TABLE>
 786	</TD></TR>
 787	</FORM>
 788	</TABLE>
 789	<hr>
 790	<SCRIPT LANGUAGE='JavaScript'>
 791	<!--
 792	function check_sefaresh_Click(){
 793		if ( document.all.check_sefaresh.checked ) {
 794			document.all.az_sefaresh.style.visibility = "visible";
 795			document.all.ta_sefaresh.style.visibility = "visible";
 796			document.all.az_sefaresh.focus();
 797		}
 798		else{
 799			document.all.az_sefaresh.style.visibility = "hidden";
 800			document.all.ta_sefaresh.style.visibility = "hidden";
 801		}
 802	}
 803
 804	function check_tarikh_sefaresh_Click(){
 805		if ( document.all.check_tarikh_sefaresh.checked ) {
 806			document.all.az_tarikh_sefaresh.style.visibility = "visible";
 807			document.all.ta_tarikh_sefaresh.style.visibility = "visible";
 808			document.all.az_tarikh_sefaresh.focus();
 809		}
 810		else{
 811			document.all.az_tarikh_sefaresh.style.visibility = "hidden";
 812			document.all.ta_tarikh_sefaresh.style.visibility = "hidden";
 813		}
 814	}
 815
 816	function check_tarikh_tahvil_Click(){
 817		if ( document.all.check_tarikh_tahvil.checked ) {
 818			document.all.az_tarikh_tahvil.style.visibility = "visible";
 819			document.all.ta_tarikh_tahvil.style.visibility = "visible";
 820			document.all.az_tarikh_tahvil.focus();
 821		}
 822		else{
 823			document.all.az_tarikh_tahvil.style.visibility = "hidden";
 824			document.all.ta_tarikh_tahvil.style.visibility = "hidden";
 825		}
 826	}
 827
 828	function check_company_name_Click(){
 829		if (document.all.check_company_name.checked) {
 830			document.all.company_name_box.style.visibility = "visible";
 831			document.all.company_name_box.focus();
 832		}
 833		else{
 834			document.all.company_name_box.style.visibility = "hidden";
 835		}
 836	}
 837
 838	function check_customer_name_Click(){
 839		if (document.all.check_customer_name.checked) {
 840			document.all.customer_name_box.style.visibility = "visible";
 841			document.all.customer_name_box.focus();
 842		}
 843		else{
 844			document.all.customer_name_box.style.visibility = "hidden";
 845		}
 846	}
 847
 848	function check_kind_Click(){
 849		if (document.all.check_kind.checked) {
 850			document.all.order_kind_box.style.visibility = "visible";
 851			document.all.order_kind_box.focus();
 852		}
 853		else{
 854			document.all.order_kind_box.style.visibility = "hidden";
 855		}
 856	}
 857
 858	function check_marhale_Click(){
 859		if (document.all.check_marhale.checked) {
 860			document.all.marhale_box.style.visibility = "visible";
 861			document.all.marhale_box.focus();
 862			document.all.marhale_not_check.style.visibility = "visible";
 863			marhale_not_check_Click();	
 864		}
 865		else{
 866			document.all.marhale_box.style.visibility = "hidden";
 867			document.all.marhale_not_check.style.visibility = "hidden";
 868			document.all.marhale_not_check_label.style.color='#BBBBBB'
 869		}
 870	}
 871
 872	function check_salesperson_Click(){
 873		if (document.all.check_salesperson.checked) {
 874			document.all.salesperson_box.style.visibility = "visible";
 875			document.all.salesperson_box.focus();
 876		}
 877		else{
 878			document.all.salesperson_box.style.visibility = "hidden";
 879		}
 880	}
 881
 882	function check_telephone_Click(){
 883		if (document.all.check_telephone.checked) {
 884			document.all.telephone_box.style.visibility = "visible";
 885			document.all.telephone_box.focus();
 886		}
 887		else{
 888			document.all.telephone_box.style.visibility = "hidden";
 889		}
 890	}
 891
 892	function check_order_title_Click(){
 893		if (document.all.check_order_title.checked) {
 894			document.all.order_title_box.style.visibility = "visible";
 895			document.all.order_title_box.focus();
 896		}
 897		else{
 898			document.all.order_title_box.style.visibility = "hidden";
 899		}
 900	}
 901
 902	function marhale_not_check_Click(){
 903		if (document.all.marhale_not_check.checked) {
 904			document.all.marhale_not_check_label.style.color='red'
 905		}
 906		else{
 907			document.all.marhale_not_check_label.style.color='#BBBBBB'
 908		}
 909	}
 910
 911
 912	function vazyat_not_check_Click(){
 913		if (document.all.vazyat_not_check.checked) {
 914			document.all.vazyat_not_check_label.style.color='red'
 915		}
 916		else{
 917			document.all.vazyat_not_check_label.style.color='#BBBBBB'
 918		}
 919	}
 920
 921	function check_closed_Click(){
 922		if (document.all.check_closed.checked) {
 923			document.all.check_closed_label.style.color='black'
 924		}
 925		else{
 926			document.all.check_closed_label.style.color='#BBBBBB'
 927		}
 928	}
 929
 930
 931	function Form_Load(){
 932	<%
 933	maybeAND = ""
 934	myCriteria = ""
 935	If request.form("check_sefaresh") = "on" Then
 936		if request.form("az_sefaresh") <> "" then
 937			myCriteria = myCriteria & maybeAND & " Quotes.ID >= " & request.form("az_sefaresh")
 938			maybeAND=" AND "
 939		End If
 940		if request.form("ta_sefaresh") <> "" then
 941			myCriteria = myCriteria & maybeAND & " Quotes.ID <= " & request.form("ta_sefaresh")
 942			maybeAND=" AND "
 943		End If
 944		If (request.form("az_sefaresh") = "") AND (request.form("ta_sefaresh") = "") then
 945			response.write "document.all.check_sefaresh.checked = false;" & vbCrLf
 946			response.write "document.all.az_sefaresh.style.visibility = 'hidden';" & vbCrLf
 947			response.write "document.all.ta_sefaresh.style.visibility = 'hidden';" & vbCrLf
 948		End If
 949	Else
 950		response.write "document.all.check_sefaresh.checked = false;" & vbCrLf
 951		response.write "document.all.az_sefaresh.style.visibility = 'hidden';" & vbCrLf
 952		response.write "document.all.ta_sefaresh.style.visibility = 'hidden';" & vbCrLf
 953
 954	End If
 955
 956	If request.form("check_tarikh_sefaresh") = "on" Then
 957		if request.form("az_tarikh_sefaresh") <> "" then
 958			myCriteria = myCriteria & maybeAND & "order_date >= '" & request.form("az_tarikh_sefaresh") & "'"
 959			maybeAND=" AND "
 960		End If
 961		if request.form("ta_tarikh_sefaresh") <> "" then
 962			myCriteria = myCriteria & maybeAND & "order_date <= '" & request.form("ta_tarikh_sefaresh") & "'"
 963			maybeAND=" AND "
 964		End If 
 965		If (request.form("az_tarikh_sefaresh") = "") AND (request.form("ta_tarikh_sefaresh") = "") then
 966			response.write "document.all.check_tarikh_sefaresh.checked = false;" & vbCrLf
 967			response.write "document.all.az_tarikh_sefaresh.style.visibility = 'hidden';" & vbCrLf
 968			response.write "document.all.ta_tarikh_sefaresh.style.visibility = 'hidden';" & vbCrLf
 969		End If
 970	Else
 971		response.write "document.all.check_tarikh_sefaresh.checked = false;" & vbCrLf
 972		response.write "document.all.az_tarikh_sefaresh.style.visibility = 'hidden';" & vbCrLf
 973		response.write "document.all.ta_tarikh_sefaresh.style.visibility = 'hidden';" & vbCrLf
 974	End If
 975
 976	If request.form("check_tarikh_tahvil") = "on" Then
 977		if request.form("az_tarikh_tahvil") <> "" then
 978
 979			myCriteria = myCriteria & maybeAND & "return_date >= '" & request.form("az_tarikh_tahvil") & "'"
 980			maybeAND=" AND "
 981		End If
 982		if request.form("ta_tarikh_tahvil") <> "" then
 983			myCriteria = myCriteria & maybeAND & "return_date <= '" & request.form("ta_tarikh_tahvil") & "'"
 984			maybeAND=" AND "
 985		End If
 986		If (request.form("az_tarikh_tahvil") = "") AND (request.form("ta_tarikh_tahvil") = "") then
 987			response.write "document.all.check_tarikh_tahvil.checked = false;" & vbCrLf
 988			response.write "document.all.az_tarikh_tahvil.style.visibility = 'hidden';" & vbCrLf
 989			response.write "document.all.ta_tarikh_tahvil.style.visibility = 'hidden';" & vbCrLf
 990		End If
 991	Else
 992		response.write "document.all.check_tarikh_tahvil.checked = false;" & vbCrLf
 993		response.write "document.all.az_tarikh_tahvil.style.visibility = 'hidden';" & vbCrLf
 994		response.write "document.all.ta_tarikh_tahvil.style.visibility = 'hidden';" & vbCrLf
 995	End If
 996
 997	If (request.form("check_company_name") = "on" AND request.form("company_name_box") <> "" ) then
 998		myCriteria = myCriteria & maybeAND & "company_name Like N'%" & request.form("company_name_box") &"%'"
 999		maybeAND=" AND "
1000	Else
1001		response.write "document.all.check_company_name.checked = false;" & vbCrLf
1002		response.write "document.all.company_name_box.style.visibility = 'hidden';" & vbCrLf
1003	End If
1004
1005	If (request.form("check_customer_name") = "on" AND request.form("customer_name_box") <> "")then
1006		myCriteria = myCriteria & maybeAND & "customer_name Like N'%" & request.form("customer_name_box") &"%'"
1007		maybeAND=" AND "
1008	Else
1009		response.write "document.all.check_customer_name.checked = false;" & vbCrLf
1010		response.write "document.all.customer_name_box.style.visibility = 'hidden';" & vbCrLf
1011	End If
1012
1013	If request.form("check_kind") = "on" then
1014		myCriteria = myCriteria & maybeAND & "order_kind = N'" & request.form("order_kind_box") & "'"
1015		maybeAND=" AND "
1016	Else
1017		response.write "document.all.check_kind.checked = false;" & vbCrLf
1018		response.write "document.all.order_kind_box.style.visibility = 'hidden';" & vbCrLf
1019	End If
1020
1021	If request("check_marhale") = "on" then
1022		If request("marhale_not_check") = "on" then
1023			myCriteria = myCriteria & maybeAND & "NOT(step = " & request("marhale_box") & ")"
1024		Else
1025			myCriteria = myCriteria & maybeAND & "step = " & request("marhale_box") 
1026			response.write "document.all.marhale_not_check.checked = false;" & vbCrLf
1027			response.write "document.all.marhale_not_check_label.style.color='#BBBBBB';"& vbCrLf
1028		End If
1029		maybeAND=" AND "
1030	Else
1031		response.write "document.all.check_marhale.checked = false;" & vbCrLf
1032		response.write "document.all.marhale_box.style.visibility = 'hidden';" & vbCrLf
1033		response.write "document.all.marhale_not_check.style.visibility = 'hidden';" & vbCrLf
1034		response.write "document.all.marhale_not_check_label.style.color='#BBBBBB';"& vbCrLf
1035	End If
1036
1037	If request.form("check_salesperson") = "on" then
1038		myCriteria = myCriteria & maybeAND & "salesperson = N'" & request.form("salesperson_box") & "'"
1039		maybeAND=" AND "
1040	Else
1041		response.write "document.all.check_salesperson.checked = false;" & vbCrLf
1042		response.write "document.all.salesperson_box.style.visibility = 'hidden';" & vbCrLf
1043	End If
1044
1045	If (request.form("check_order_title") = "on" AND request.form("order_title_box") <> "")then
1046		myCriteria = myCriteria & maybeAND & "order_title Like N'%" & request.form("order_title_box") &"%'"
1047		maybeAND=" AND "
1048	Else
1049		response.write "document.all.check_order_title.checked = false;" & vbCrLf
1050		response.write "document.all.order_title_box.style.visibility = 'hidden';" & vbCrLf
1051	End If
1052
1053	If (request.form("check_telephone") = "on" AND request.form("telephone_box") <> "")then
1054		myCriteria = myCriteria & maybeAND & "telephone Like N'%" & request.form("telephone_box") &"%'"
1055		maybeAND=" AND "
1056	Else
1057		response.write "document.all.check_telephone.checked = false;" & vbCrLf
1058		response.write "document.all.telephone_box.style.visibility = 'hidden';" & vbCrLf
1059	End If
1060
1061	If request("check_closed") = "on" then
1062		myCriteria = myCriteria & maybeAND & "Quotes.Closed=0"
1063	Else
1064		If request("Submit")="�����" then
1065			response.write "document.all.check_closed.checked = false;" & vbCrLf
1066			response.write "document.all.check_closed_label.style.color='#BBBBBB';" & vbCrLf
1067		End If
1068	End If
1069
1070	%>
1071	}
1072	function checkValidation(){
1073		return true;
1074	}
1075
1076	Form_Load();
1077
1078	//-->
1079	</SCRIPT>
1080<%
1081	if request("Submit")="�����" then
1082		IF maybeAND <> " AND " THEN
1083			response.write "Nothing !!!!!!!!!!"
1084		ELSE
1085
1086			mySQL=	"SELECT Quotes.*, OrderTraceStatus.Name AS StatusName, OrderTraceStatus.Icon , Invoices.ID AS InvoiceID, Invoices.Approved, Invoices.Voided, Invoices.Issued, DRV_invoice.price "&_ 
1087					" FROM Quotes INNER JOIN "&_ 
1088					" OrderTraceStatus ON OrderTraceStatus.ID = Quotes.status LEFT OUTER JOIN "&_ 
1089					" Invoices INNER JOIN "&_ 
1090					" InvoiceQuoteRelations ON Invoices.ID = InvoiceQuoteRelations.Invoice ON Quotes.ID = InvoiceQuoteRelations.Quote "&_ 
1091					" left outer join (select Invoice,SUM(InvoiceLines.Price +InvoiceLines.Vat - InvoiceLines.Discount -InvoiceLines.Reverse) as price from InvoiceLines inner join Invoices on invoiceLines.invoice=invoices.id where invoices.voided=0 group by Invoice) DRV_invoice on Invoices.ID=DRV_invoice.Invoice "&_
1092					" WHERE ("& myCriteria & ")  "&_ 
1093					" ORDER BY Quotes.order_date DESC, Quotes.ID DESC "
1094
1095'			mySQL=	"SELECT Quotes.*, OrderTraceStatus.Name AS StatusName, OrderTraceStatus.Icon "&_
1096'					" FROM Quotes JOIN OrderTraceStatus ON OrderTraceStatus.ID = Quotes.status "&_
1097'					" WHERE ("& myCriteria & ") ORDER BY order_date DESC, Quotes.ID DESC"
1098'
1099'response.write mySQL
1100			set RS1=Conn.Execute (mySQL)
1101			if not RS1.eof then
1102				tmpCounter=0
1103%>
1104			<div align="center" dir="LTR">
1105			<TABLE border="1" cellspacing="0" cellpadding="1" dir="RTL" borderColor="#555588">
1106				<TR bgcolor="#CCCCFF">
1107					<TD width="41"># �������</TD>
1108					<TD width="46">����� �������</TD>
1109					<TD width="56">������ ��</TD>
1110					<TD width="116">��� ����</TD>
1111					<TD width="106">��� �����</TD>
1112					<TD >����� ���</TD>
1113					<TD width="36">���</TD>
1114					<TD width="46">�����</TD>
1115					<TD width="36">������� ������</TD>
1116					<TD width="40">������</TD>
1117					<td width="50">����</td>
1118				</TR>
1119<%				Do while not RS1.eof and tmpCounter < resultsCount
1120				tmpCounter = tmpCounter + 1
1121				if tmpCounter mod 2 = 1 then
1122					tmpColor="#FFFFFF"
1123				Else
1124					tmpColor="#DDDDDD"
1125				End If
1126
1127				if RS1("Closed") then
1128					tmpStyle="background-color:#FFCCCC;"
1129				else
1130					tmpStyle=""
1131				End If
1132				
1133				if isnull(RS1("InvoiceID")) then
1134					InvoiceStatus="<span style='color:red;'><b>�����</b></span>"
1135				else
1136					if RS1("Voided") then
1137						style="style='color:Red' Title='���� ���'"
1138					elseif RS1("Issued") then
1139						style="style='color:Red' Title='���� ���'"
1140					elseif RS1("Approved") then
1141						style="style='color:Green' Title='����� ���'"
1142					else
1143						style="style='color:#3399FF' Title='����� ����'"
1144					end if
1145					InvoiceStatus="<A " & style & " HREF='../AR/AccountReport.asp?act=showInvoice&invoice=" & RS1("InvoiceID")& "' Target='_blank'>" & RS1("InvoiceID") & "</A>"
1146				end if
1147
1148%>
1149				<TR bgcolor="<%=tmpColor%>" title="<%=RS1("StatusName")%>">
1150					<TD DIR="LTR"><A HREF="?act=show&quote=<%=RS1("ID")%>" target="_blank"><%=RS1("ID")%></A></TD>
1151					<TD DIR="LTR"><%=RS1("order_date")%></TD>
1152					<TD DIR="LTR"><%=RS1("return_date") & " ("& RS1("return_time") & ")"%></TD>
1153					<TD ><%=RS1("company_name") & "<br>����:("& RS1("telephone")& ")"%>&nbsp;</TD>
1154					<TD ><%=RS1("customer_name")%>&nbsp;</TD>
1155					<TD ><%=RS1("order_title")%>&nbsp;</TD>
1156					<TD ><%=RS1("order_kind")%></TD>
1157					<TD style="<%=tmpStyle%>"><%=RS1("marhale")%></TD>
1158					<TD ><%=RS1("salesperson")%>&nbsp;</TD>
1159					<TD ><%=InvoiceStatus%>&nbsp;</TD>
1160					<td><%if isnull(RS1("price")) then response.write "----" else response.write Separate(RS1("price")) end if %></td>
1161				</TR>
1162				<TR bgcolor="#FFFFFF">
1163					<TD colspan="12" style="height:10px"></TD>
1164				</TR>
1165<%					RS1.moveNext
1166				Loop
1167
1168				if tmpCounter >= resultsCount then
1169%>					<TR bgcolor="#CCCCCC">
1170						<TD align="center" colspan="10" style="padding:15px;font-size:12pt;color:red;cursor:hand;" onclick="document.all.resultsCount.focus();"><B>����� ����� ����� ��� �� <%=resultsCount%> ����� ���.</B></TD>
1171					</TR>
1172<%				else
1173%>					<TR bgcolor="#ccccFF">
1174						<TD colspan="10">����� ����� �����: <%=tmpCounter%></TD>
1175					</TR>
1176<%				end if
1177%>
1178			</TABLE>
1179			</div>
1180			<BR>
1181<%			else
1182%>			<TABLE border="1" cellspacing="0" cellpadding="0" dir="RTL" align="center" width="600">
1183				<TR bgcolor="#FFFFDD">
1184					<TD align="center" style="height:40px;font-size:12pt;font-weight:bold;color:red">��� ����� ������ �� ��� �����.</TD>
1185				</TR>
1186			</TABLE>
1187			<hr>
1188<%			End If
1189		End If
1190	End If
1191' Trace Quote End.
1192'-----------------------------
1193
1194'-----------------------------
1195' Quote Input
1196'-----------------------------
1197elseif Request.QueryString("act")="quoteInpCustSearch" then
1198	if isnumeric(request("CustomerNameSearchBox")) then
1199		conn.close
1200		response.redirect "?act=getQuote&selectedCustomer=" & request("CustomerNameSearchBox")
1201	elseif request("CustomerNameSearchBox") <> "" then
1202		SA_TitleOrName=request("CustomerNameSearchBox")
1203		mySQL="SELECT * FROM Accounts WHERE (REPLACE(AccountTitle, ' ', '') LIKE REPLACE(N'%"& sqlSafe(SA_TitleOrName) & "%', ' ', '') ) ORDER BY AccountTitle"
1204		Set RS1 = conn.Execute(mySQL)
1205
1206		if (RS1.eof) then 
1207			conn.close
1208			response.redirect "?errmsg=" & Server.URLEncode("���� ����� ���� ���.<br><a href='../CRM/AccountEdit.asp?act=getAccount'>���� ���Ͽ</a>")
1209		end if 
1210
1211		SA_TitleOrName=request("CustomerNameSearchBox")
1212		SA_Action="return true;"
1213		SA_SearchAgainURL="Inquiry.asp"
1214		SA_StepText="��� ��� : ������ ����"
1215%>
1216<br>
1217<FORM METHOD=POST ACTION="?act=getType">
1218	<!--#include File="../AR/include_SelectAccount.asp"-->
1219</FORM>
1220<%
1221	end if
1222elseif Request.QueryString("act")="getType" then 
1223	customerID=request("selectedCustomer")
1224	mySQL="SELECT * FROM Accounts WHERE (ID='"& CustomerID & "')"
1225	Set RS1 = conn.Execute(mySQL)
1226
1227	if (RS1.eof) then 
1228		conn.close
1229		response.redirect "?errmsg=" & Server.URLEncode("���� ����� ���� ���.<br><a href='..//CRM/AccountEdit.asp?act=getAccount'>���� ���Ͽ</a>")
1230	end if 
1231%>
1232		<br>
1233		<div dir='rtl'>
1234			<B>��� ��� : ����� ��� �������</B>
1235		</div>
1236		<form method="post" action="?act=getQuote">
1237			<input name="selectedCustomer" type="hidden" value="<%=customerID%>">
1238			<SELECT NAME="OrderType" style='font-family: tahoma,arial ; font-size: 9pt; font-weight: bold; width: 100px' tabIndex="7">
1239			<OPTION value="-1" style='color:red;'>������ ����</option>
1240<%
1241			Set RS2 = conn.Execute("SELECT [User] as ID, DefaultOrderType FROM UserDefaults WHERE ([User] = "& session("ID") & ") OR (UserDefaults.[User] = 0) ORDER BY ABS(UserDefaults.[User]) DESC")
1242			defaultOrderType=RS2("DefaultOrderType")
1243			RS2.close
1244			Set RS2 = Nothing
1245
1246			set RS_TYPE=Conn.Execute ("SELECT ID, Name FROM OrderTraceTypes WHERE (IsActive=1) ORDER BY ID")
1247			Do while not RS_TYPE.eof	
1248%>
1249				<OPTION value="<%=RS_TYPE("ID")%>" <%if RS_TYPE("ID")=defaultOrderType then response.write "selected"%>><%=RS_TYPE("Name")%></option>
1250<%
1251			RS_TYPE.moveNext
1252			loop
1253			RS_TYPE.close
1254			set RS_TYPE = nothing
1255%>		
1256			</SELECT>
1257			<input type="submit" value="�����">
1258		</form>
1259<%	
1260elseif Request.QueryString("act")="getQuote" then
1261	customerID=request("selectedCustomer")
1262	mySQL="SELECT * FROM Accounts WHERE (ID='"& CustomerID & "')"
1263	Set RS1 = conn.Execute(mySQL)
1264
1265	if (RS1.eof) then 
1266		conn.close
1267		response.redirect "?errmsg=" & Server.URLEncode("���� ����� ���� ���.<br><a href='..//CRM/AccountEdit.asp?act=getAccount'>���� ���Ͽ</a>")
1268	end if 
1269	rs1.close
1270	set rs1=nothing
1271	set rs=Conn.Execute("select * from OrderTraceTypes where id=" & request("orderType"))
1272	if rs.eof then 
1273		conn.close
1274		response.redirect "?errmsg=" & server.urlEncode("��� ����� �� ����� ����")
1275	end if
1276	orderTypeID=rs("id")
1277
1278	rs.close
1279	set rs=nothing
1280	
1281%>
1282	<script type="text/javascript" src="calcOrder.js"></script>
1283	<script type="text/javascript">
1284		function checkValidation() {
1285			if ($('input[name="CustomerName"]').val().replace(/^\s*|\s*$/g,'')==''){
1286				alert("��� ����� �� ���� ����");
1287				$('input[name="CustomerName"]').focus();
1288				//$("input#Submit").prop("disabled",true);
1289				return false;
1290			} else if ($('input[name="SalesPerson"]').val().replace(/^\s*|\s*$/g,'')==''){
1291				alert("������� ������ �� ���� ����");
1292				$('input[name="SalesPerson"]').focus();
1293				//$("input#Submit").prop("disabled",true);
1294				return false;
1295			} else if ($('input[name="ReturnDate"]').val().replace(/^\s*|\s*$/g,'')==''){
1296				alert("���� ������ �� ���� ����");
1297				$('input[name="ReturnDate"]').focus();
1298				//$("input#Submit").prop("disabled",true);
1299				return false;
1300			} else if ($('input[name="ReturnTime"]').val().replace(/^\s*|\s*$/g,'')==''){
1301				alert("���� (����) ������ �� ���� ����");
1302				$('input[name="ReturnTime"]').focus();
1303				//$("input#Submit").prop("disabled",true);
1304				return false;
1305			} else if ($('input[name="OrderTitle"]').val().replace(/^\s*|\s*$/g,'')==''){
1306				alert("����� ��� ���� ���� �� ���� ����");
1307				$('input[name="OrderTitle"]').focus();
1308				//$("input#Submit").prop("disabled",true);
1309				return false;
1310			} else {
1311				return makeOutXML();
1312			} 
1313		}
1314		TransformXmlURL("/service/xml_getOrderProperty.asp?act=getProperty&type=<%=orderTypeID%>","/xsl/orderEditProperty.xsl", function(result){
1315			$("#orderDetails").html(result);	
1316			readyForm();
1317		});
1318		TransformXmlURL("/service/xml_getOrderProperty.asp?act=getNew&isOrder=&typeID=<%=orderTypeID%>&id=<%=CustomerID%>","/xsl/orderEditHeader.xsl", function(result){
1319			$("#orderHeader").html(result);	
1320		});
1321	</script>
1322		
1323
1324	<br>
1325	<div dir='rtl'><B>��� ����� : ����� �������</B>
1326	</div>
1327	<br>
1328<!-- ����� ������� -->
1329	<hr>
1330	<FORM METHOD=POST ACTION="?act=submitQuote" onSubmit="return checkValidation();">
1331		<div id="orderHeader"></div>
1332		<div class="downBtn">
1333			<hr/>
1334			<INPUT TYPE="submit" id='Submit' Name="Submit" Value="�����" style="width:100px;" tabIndex="14">
1335			<INPUT TYPE="button" Name="Cancel" Value="������" style="width:100px;" onClick="window.location='Inquiry.asp';" tabIndex="15">
1336		</div>
1337	</FORM>
1338	<div id='orderDetails'></div>
1339<%
1340	set orderProp=nothing
1341elseif Request.QueryString("act")="submitQuote" then
1342	//-------------------------------------------------------…

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