/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 are truncated click here to view the full file

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