PageRenderTime 56ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 1ms

/beta/order/TraceOrder.asp

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