PageRenderTime 58ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/beta/order/Inquiry.asp

http://github.com/khaneh/Orders
ASP | 2088 lines | 1850 code | 144 blank | 94 comment | 208 complexity | c083b6c85a1802c3070a0020ba546cc2 MD5 | raw 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. //-------------------------------------------------------------------------------------------------------------------
  1266. //-------------------------------------------------------------------------------------------------------------------
  1267. //-------------------------------------------------------------------------------------------------------------------
  1268. set rs=Conn.Execute("select * from OrderTraceTypes where id=" & request("orderType"))
  1269. if rs.eof then
  1270. conn.close
  1271. response.redirect "?errmsg=" & server.urlEncode("نوع سفارش را تعيين كنيد")
  1272. end if
  1273. orderTypeID=rs("id")
  1274. orderTypeName=rs("name")
  1275. set orderProp = server.createobject("MSXML2.DomDocument")
  1276. if rs("property")<>"" then
  1277. orderProp.loadXML(rs("property"))
  1278. myXML = fetchKeyValues()
  1279. end if
  1280. rs.close
  1281. set rs=nothing
  1282. response.write "test!"
  1283. function fetchKeyValues()
  1284. 'key="---first---"
  1285. response.write "ddd<br>"
  1286. thisRow="<?xml version=""1.0""?><data>"
  1287. for each row in orderProp.selectNodes("/keys/row")
  1288. rowName = row.GetAttribute("name")
  1289. response.write rowName&"<br>"
  1290. for id=0 to cint(request(rowName & "-maxID"))
  1291. thisRow = thisRow & "<" & rowName & " id=""" & id & """>"
  1292. for each group in row.selectNodes("./group")
  1293. groupName = group.GetAttribute("name")
  1294. for each key in group.selectNodes("./key")
  1295. thisName = key.GetAttribute("name")
  1296. if IsArray(request.form(thisName)) then
  1297. value = request.form(thisName)(id)
  1298. else
  1299. value = request.form(thisName)
  1300. end if
  1301. if value <> "" then
  1302. thisRow = thisRow & "<key name=""" & thisName & """"
  1303. select case key.GetAttribute("type")
  1304. case "check"
  1305. if cint(mid(value,4))=id then thisRow = thisRow & ">" & value & "</key>"
  1306. case else
  1307. if request.form(groupName & "-disBtn")<>"" then
  1308. if cint(trim(split(request.form(thisGroup & "-disBtn"),",")(id)))=id then thisRow = thisRow & ">" & value & "</key>"
  1309. else
  1310. thisRow = thisRow & ">" & value & "</key>"
  1311. end if
  1312. end select
  1313. end if
  1314. next
  1315. next
  1316. thisRow = thisRow & "</" & rowName & ">"
  1317. next
  1318. next
  1319. thisRow = thisRow & "</data>"
  1320. fetchKeyValues = thisRow
  1321. response.write thisRow
  1322. response.end
  1323. end function
  1324. CreationDate=shamsiToday()
  1325. CustomerID=request.form("CustomerID")
  1326. if CustomerID="" OR not isNumeric(CustomerID) then
  1327. conn.close
  1328. response.redirect "?act=getQuote&selectedCustomer=" & CustomerID & "&errMsg=" & Server.URLEncode("خطا در نام مشتري<br>اطلاعات وارد نشد…<BR>")
  1329. end if
  1330. orderType=request.form("OrderType")
  1331. if orderType="" OR not isNumeric(OrderType) then
  1332. conn.close
  1333. response.redirect "?act=getQuote&selectedCustomer=" & CustomerID & "&errMsg=" & Server.URLEncode("خطا در نوع استعلام<br>اطلاعات وارد نشد…<BR>")
  1334. end if
  1335. set RS1=Conn.Execute ("SELECT Name FROM OrderTraceTypes WHERE (ID='"& orderType & "') AND (IsActive=1)")
  1336. if RS1.eof then
  1337. conn.close
  1338. response.redirect "?act=getQuote&selectedCustomer=" & CustomerID & "&errMsg=" & Server.URLEncode("خطا در نوع استعلام<br>اطلاعات وارد نشد…<BR>")
  1339. else
  1340. orderTypeName=RS1("Name")
  1341. end if
  1342. RS1.close
  1343. defaultVaziat = "در جريان" ' 1
  1344. defaultMarhale = "ثبت شده" ' 1
  1345. mySQL="SET NOCOUNT ON;INSERT INTO Quotes (CreatedDate, CreatedBy, Customer, Closed, order_date, order_time, return_date, return_time, company_name, customer_name, telephone, order_title, order_kind, Type, vazyat, marhale, salesperson, status, step, LastUpdatedDate, LastUpdatedTime, LastUpdatedBy, Notes,property,productionDuration, Qtty, price, PaperSize) VALUES ('"&_
  1346. CreationDate & "', '"& session("ID") & "', '"& CustomerID & "', '0', N'"& sqlSafe(request.form("OrderDate")) & "', N'"& sqlSafe(request.form("OrderTime")) & "', N'"& sqlSafe(request.form("ReturnDate")) & "', N'"& sqlSafe(request.form("ReturnTime")) & "', N'"& sqlSafe(request.form("CompanyName")) & "', N'"& sqlSafe(request.form("CustomerName")) & "', N'"& sqlSafe(request.form("Telephone")) & "', N'"& sqlSafe(request.form("OrderTitle")) & "', N'"& orderTypeName & "', '"& orderType & "', N'" & defaultVaziat & "', N'" & defaultMarhale & "', N'"& sqlSafe(request.form("SalesPerson")) & "', 1, 1, N'"& CreationDate & "', N'"& currentTime10() & "', '"& session("ID") & "', N'"& sqlSafe(request.form("Notes")) & "',N'" & myXML & "', " & sqlSafe(request.form("productionDuration")) & "," & sqlSafe(request.form("qtty")) & ",'" & sqlSafe(request.form("totalPrice")) & "', N'" & sqlSafe(request.form("PaperSize")) & "'); SELECT SCOPE_IDENTITY() AS NewQuote;SET NOCOUNT OFF"
  1347. set RS1 = Conn.execute(mySQL)'.NextRecordSet
  1348. QuoteID = RS1 ("NewQuote")
  1349. RS1.close
  1350. conn.close
  1351. 'response.redirect "?act=show&quote=" & QuoteID & "&msg=" & Server.URLEncode("اطلاعات استعلام ثبت شد")
  1352. ' Quote Input End
  1353. '-----------------------------
  1354. '-----------------------------
  1355. ' Quote Edit
  1356. '-----------------------------
  1357. elseif Request.QueryString("act")="editQuote" then
  1358. quote = request("quote")
  1359. if quote <> "" then
  1360. if isNumeric(quote) then
  1361. quote=clng(quote)
  1362. else
  1363. quote=""
  1364. end if
  1365. end if
  1366. If quote="" Then
  1367. response.write "<br><br>"
  1368. call showAlert("شماره استعلام اشتباه است .", CONST_MSG_ERROR )
  1369. response.end
  1370. End If
  1371. mySQL = "SELECT Quotes.*, Accounts.ID AS AccID, Accounts.AccountTitle FROM Quotes INNER JOIN Accounts ON Quotes.Customer = Accounts.ID WHERE (Quotes.ID ='"& quote & "')"
  1372. set RS2=Conn.Execute (mySQL)
  1373. if RS2.eof then
  1374. response.write "<br><br>"
  1375. call showAlert("شماره استعلام اشتباه است .", CONST_MSG_ERROR )
  1376. response.end
  1377. else
  1378. CustomerID=RS2("AccID")
  1379. end if
  1380. if RS2("salesperson")<>session("csrName") then
  1381. response.write "<br>"
  1382. call showAlert("استعلام گيرنده اين استعلام شما نيستيد..<BR>قبل از ويرايش با استعلام گيرنده هماهنگ كنيد.", CONST_MSG_ALERT )
  1383. end if
  1384. relatedApprovedInvoiceID = 0
  1385. ' mySQL="SELECT Invoices.Issued, Invoices.Approved, Invoices.ApprovedBy, Invoices.ID FROM InvoiceOrderRelations INNER JOIN Invoices ON InvoiceOrderRelations.Invoice = Invoices.ID WHERE (InvoiceOrderRelations.[Order] = '" & quote & "') AND (Invoices.Voided = 0)"
  1386. ' set RS3=Conn.Execute (mySQL)
  1387. ' if not(RS3.eof) then
  1388. ' FoundInvoice=RS3("ID")
  1389. ' if RS3("Issued") then
  1390. ' Conn.Close
  1391. ' response.redirect "../order/TraceOrder.asp?act=show&order=" & quote & "&errMsg=" & Server.URLEncode("يك فاكتور صادر شده مرتبط با با اين استعلام شماره پيدا كرده ايم.(شماره فاكتور: <A HREF='../AR/AccountReport.asp?act=showInvoice&invoice="& FoundInvoice & "' target='_blank'>" & FoundInvoice & "</a>)<BR> لذاست كه امكاني براي تغيير در اين استعلام وجود ندارد.")
  1392. ' elseif RS3("Approved") then
  1393. ' tmpDesc="<B>تاييد شده</B>"
  1394. ' tmpColor="Yellow"
  1395. ' relatedApprovedInvoiceID = RS3("id")
  1396. ' relatedApprovedInvoiceBy = RS3("ApprovedBy")
  1397. ' response.write "<br>"
  1398. ' call showAlert("يك فاكتور <b>تاييد شده</b> با شماره <A HREF='../AR/AccountReport.asp?act=showInvoice&invoice="& FoundInvoice &"' target='_blank'>" & FoundInvoice & "</A> براي اين استعلام وجود دارد <BR>كه با تغيير استعلام توسط شما از حالت تاييد خارج خواهد شد." , CONST_MSG_ALERT )
  1399. ' else
  1400. ' tmpDesc=""
  1401. ' tmpColor="#FFFFBB"
  1402. ' response.write "<br>"
  1403. ' call showAlert("توجه!<br>استعلامي كه شما جستجو كرديد قبلا در يك فاكتور <B>تاييد نشده</B> وجود دارد<br><A HREF='../AR/AccountReport.asp?act=showInvoice&invoice=" & FoundInvoice & "'>نمايش فاكتور مربوطه (" & FoundInvoice & ")</A>", CONST_MSG_INFORM )
  1404. ' end if
  1405. ' end if
  1406. %>
  1407. <style>
  1408. Table { font-size: 8pt;}
  1409. INPUT { font-family:Tahoma,arial; font-size: 8pt;}
  1410. SELECT { font-family:Tahoma,arial; font-size: 8pt;}
  1411. </style>
  1412. <font face="tahoma">
  1413. <input type="hidden" Name='tmpDlgArg' value=''>
  1414. <input type="hidden" Name='tmpDlgTxt' value=''>
  1415. <FORM METHOD=POST ACTION="?act=submitEditQuote" onSubmit="return checkValidation();">
  1416. <INPUT TYPE="hidden" name="relatedApprovedInvoiceBy" value="<%=relatedApprovedInvoiceBy%>">
  1417. <INPUT TYPE="hidden" name="relatedApprovedInvoiceID" value="<%=relatedApprovedInvoiceID%>">
  1418. <br>
  1419. <div align="center">ويرايش استعلام</div>
  1420. <br>
  1421. <TABLE cellspacing="0" cellpadding="2" dir="RTL" width="700" align="center" style="border: 2px solid #555599;">
  1422. <TR bgcolor="#555599">
  1423. <TD align="left"><FONT COLOR="YELLOW">حساب:</FONT></TD>
  1424. <TD align="right" colspan=5 height="25px">
  1425. <span id="customer" style="color:yellow;"><%' after any changes in this span "./Customers.asp" must be revised%>
  1426. <INPUT TYPE="hidden" NAME="customerID" value="<%=customerID%>"><span><%=customerID & " - "& RS2("AccountTitle")%></span>.
  1427. </span>
  1428. <INPUT class="GenButton" TYPE="button" value="تغيير" onClick="selectCustomer();">
  1429. </TD>
  1430. </TR>
  1431. <TR bgcolor="#555599">
  1432. <TD align="left"><FONT COLOR="YELLOW">شماره استعلام:</FONT></TD>
  1433. <TD align="right">
  1434. <!-- quote -->
  1435. <INPUT TYPE="text" disabled maxlength="6" size="5" tabIndex="1" dir="LTR" value="<%=RS2("ID")%>">
  1436. <INPUT TYPE="hidden" NAME="quote" value="<%=RS2("ID")%>">
  1437. </TD>
  1438. <TD align="left"><FONT COLOR="YELLOW">تاريخ:</FONT></TD>
  1439. <TD><TABLE border="0">
  1440. <TR>
  1441. <TD dir="LTR">
  1442. <INPUT disabled TYPE="text" maxlength="10" size="8" value="<%=RS2("order_date")%>">
  1443. <INPUT TYPE="hidden" NAME="OrderDate" value="<%=RS2("order_date")%>">
  1444. </TD>
  1445. <TD dir="RTL"><FONT COLOR="YELLOW"><%="؟شنبه"%></FONT></TD>
  1446. </TR>
  1447. </TABLE></TD>
  1448. <TD align="left"><FONT COLOR="YELLOW">ساعت:</FONT></TD>
  1449. <TD align="right">
  1450. <INPUT disabled TYPE="text" maxlength="5" size="3" dir="LTR" value="<%=RS2("order_time")%>">
  1451. <INPUT TYPE="hidden" NAME="OrderTime" value="<%=RS2("order_time")%>"></TD>
  1452. </TR>
  1453. <TR bgcolor="#CCCCCC">
  1454. <TD align="left">نام شركت:</TD>
  1455. <TD align="right">
  1456. <!-- CompanyName -->
  1457. <INPUT TYPE="text" NAME="CompanyName" maxlength="50" size="25" tabIndex="2" value="<%=RS2("company_name")%>"></TD>
  1458. <TD align="left">موعد اعتبار:</TD>
  1459. <TD><TABLE border="0">
  1460. <TR>
  1461. <TD dir="LTR"><INPUT TYPE="text" NAME="ReturnDate" onblur="acceptDate(this)" maxlength="10" size="8" tabIndex="5" onKeyPress="return maskDate(this);" value="<%=RS2("return_date")%>"></TD>
  1462. <TD dir="RTL">(?شنبه)</TD>
  1463. </TR>
  1464. </TABLE></TD>
  1465. <TD align="left">ساعت اعتبار:</TD>
  1466. <TD align="right"><INPUT TYPE="text" NAME="ReturnTime" maxlength="6" size="3" tabIndex="6" dir="LTR" onKeyPress="return maskTime(this);" value="<%=RS2("return_time")%>"></TD>
  1467. </TR>
  1468. <TR bgcolor="#CCCCCC">
  1469. <TD align="left">نام مشتري:</TD>
  1470. <TD align="right">
  1471. <!-- CustomerName -->
  1472. <INPUT TYPE="text" NAME="CustomerName" maxlength="50" size="25" tabIndex="3" value="<%=RS2("customer_name")%>"></TD>
  1473. <TD align="left">نوع استعلام:</TD>
  1474. <TD>
  1475. <SELECT NAME="OrderType" style='font-family: tahoma,arial ; font-size: 9pt; font-weight: bold; width: 100px' tabIndex="7" onchange="alert('توجه داشته باشيد كه تغيير نوع سفارش باعث اختلال در جزئيات سفارش خواهد شد. آيا مسوليت آنرا مي‌پذيريد؟');">
  1476. <%
  1477. thisOrderType=RS2("Type")
  1478. set RS_TYPE=Conn.Execute ("SELECT ID, Name FROM OrderTraceTypes WHERE (IsActive=1) ORDER BY ID")
  1479. Do while not RS_TYPE.eof
  1480. %>
  1481. <OPTION value="<%=RS_TYPE("ID")%>" <%if thisOrderType=RS_TYPE("ID") then response.write "selected" %> ><%=RS_TYPE("Name")%></option>
  1482. <%
  1483. RS_TYPE.moveNext
  1484. loop
  1485. RS_TYPE.close
  1486. set RS_TYPE = nothing
  1487. %>
  1488. </SELECT></TD>
  1489. <TD align="left">استعلام گيرنده:</TD>
  1490. <TD><INPUT NAME="SalesPerson" Type="TEXT"value="<%=RS2("salesperson")%>" style='font-family: tahoma,arial ; font-size: 8pt; font-weight: bold; width: 100px' tabIndex="88" readonly>
  1491. </TD>
  1492. </TR>
  1493. <TR bgcolor="#CCCCCC">
  1494. <TD align="left">تلفن:</TD>
  1495. <TD align="right">
  1496. <!-- Telephone -->
  1497. <INPUT TYPE="text" NAME="Telephone" maxlength="50" size="25" tabIndex="4" value="<%=RS2("telephone")%>"></TD>
  1498. <TD align="left">عنوان كار داخل فايل:</TD>
  1499. <TD align="right" colspan="3"><INPUT TYPE="text" NAME="OrderTitle" maxlength="255" size="50" tabIndex="9" value="<%=RS2("order_title")%>"></TD>
  1500. </TR>
  1501. <TR bgcolor="#CCCCCC">
  1502. <td align="left">تيراژ:</td>
  1503. <td>
  1504. <input type="text" name="qtty" value="<%=rs2("qtty")%>" tabindex="9">
  1505. </td>
  1506. <td align="left">سايز:</td>
  1507. <td>
  1508. <input type="text" value="<%=rs2("paperSize")%>" name="paperSize" tabIndex="14">
  1509. </td>
  1510. <td align="left">قيمت كل:</td>
  1511. <td >
  1512. <input type="text" value="<%=rs2("price")%>" name="totalPrice" id='totalPrice' style="background-color:#FED;border-width:0;" <%if rs2("property")<>"" then response.write " readonly='readonly'"%>>
  1513. </td>
  1514. </TR>
  1515. <TR bgcolor="#CCCCCC">
  1516. <td>تخمين زمان توليد:</td>
  1517. <td>
  1518. <input name="productionDuration" type="text" size="2" value="<%=RS2("productionDuration")%>">
  1519. <span>روز</span><br>
  1520. <small>(صفر به معني معلوم نبودن زمان است)</small>
  1521. </td>
  1522. <TD align="left">توضيحات بيشتر:</TD>
  1523. <TD align="right" colspan="3"><TEXTAREA NAME="Notes" tabIndex="10" style="width:100%"><%=RS2("Notes")%></TEXTAREA></TD>
  1524. </TR>
  1525. <tr bgcolor="#CCCCCC">
  1526. <TD align="left">مرحله:</TD>
  1527. <TD>
  1528. <SELECT NAME="Marhale" style='font-family: tahoma,arial ; font-size: 8pt; font-weight: bold; width: 140px' tabIndex="13" >
  1529. <%
  1530. set RS_STEP=Conn.Execute ("SELECT * FROM QuoteSteps WHERE (IsActive=1)")
  1531. Do while not RS_STEP.eof
  1532. %>
  1533. <OPTION value="<%=RS_STEP("ID")%>" <%if RS2("step")=RS_STEP("ID") then response.write "selected" %> ><%=RS_STEP("name")%></option>
  1534. <%
  1535. RS_STEP.moveNext
  1536. loop
  1537. RS_STEP.close
  1538. set RS_STEP = nothing
  1539. %>
  1540. </SELECT>
  1541. </TD>
  1542. <td colspan="4"></td>
  1543. </tr>
  1544. <tr bgcolor="#CCCCCC">
  1545. <td colspan="6">
  1546. <script type="text/javascript" src="/js/jquery-1.7.min.js"></script>
  1547. <script type="text/javascript" src="calcOrder.js"></script>
  1548. <div>جزئيات استعلام</div>
  1549. <div>
  1550. <br>براي محاسبه خودكار قيمت‌ها بايد روي پارامترهاي هر سطر برويد و آنرا تغيير دهيد و يا آن سلول را ترك نماييد.
  1551. <br>همچنين ميتوانيد قيمت خود را وارد نماييد اما در صورتي كه دوباره يكي از پارامترهاي مربوطه رو تغيير بديد دوباره قيمت محاسبه خواهد شد.
  1552. <br>محاسبه برخي از قيمت‌ها از روي پارامترهاي ساير خطوط خواهد بود. مثلا تيراژ در ماشين، تيراژي خواهد بود كه در سلفون و يو وي و ورني محاسبه ميشود. و در صورتي كه تيراژ ماشين رو عوض كنيم بايد سلولهاي مربوط به اين آيتمها رو ترك كنيم تا دوباره قيمت‌شون محاسبه بشه
  1553. </div>
  1554. <%
  1555. set rs=Conn.Execute("select * from OrderTraceTypes where id="&rs2("type"))
  1556. set typeProp = server.createobject("MSXML2.DomDocument")
  1557. set orderProp = server.createobject("MSXML2.DomDocument")
  1558. if rs2("property")<>"" then orderProp.loadXML(rs2("property"))
  1559. if rs("property")<>"" then typeProp.loadXML(rs("property"))
  1560. set rs=nothing
  1561. ' for each item in typeProp.SelectNodes("//key")
  1562. ' response.write item.parentNode.nodeName & ": " & item.xml & "<br>"
  1563. ' next
  1564. ' response.end
  1565. sub showKeyEdit(key)
  1566. 'key="/keys/printing/key"
  1567. oldGroup="---first---"
  1568. oldLabel="---first---"
  1569. thisRow = "<div class='myRow'>"
  1570. maxID=0
  1571. oldID=0
  1572. for each mykey in orderProp.SelectNodes(key)
  1573. id=myKey.GetAttribute("id")
  1574. if maxID<id then maxID=id
  1575. next
  1576. thisRow = thisRow & "<input type='hidden' value='" & maxID & "' id='" & Replace(key,"/","-") & "-maxID'>"
  1577. ' response.write "<div class='myRow'><div class='exteraArea' id='" & Replace(key,"/","-") & "-0'>"
  1578. for id = 0 to maxID
  1579. thisRow = thisRow & "<div class='exteraArea' id='" & Replace(key,"/","-") & "-" & id & "'>"
  1580. ' thisRow = thisRow & "<img title='حذف اين خط' src='/images/cancelled.gif' onclick='$(this).parent().remove();'>"
  1581. For Each myKey In typeProp.SelectNodes(key)
  1582. thisType = myKey.GetAttribute("type")
  1583. thisName = myKey.GetAttribute("name")
  1584. thisLabel= myKey.GetAttribute("label")
  1585. thisGroup= myKey.GetAttribute("group")
  1586. hasValue=false
  1587. set thisValue= orderProp.SelectNodes(key & "[@id='" & id & "' and @name='" & thisName & "']")
  1588. if thisValue.length>0 then hasValue=true
  1589. ' response.write hasValue & "<br>"
  1590. if (oldGroup<>thisGroup and oldID=id and oldGroup <> "---first---") then thisRow = thisRow & "</div>"
  1591. if oldGroup<>thisGroup or oldID<>id then
  1592. thisRow = thisRow & "<div class='mySection' groupName='" & thisGroup & "'>"
  1593. if myKey.GetAttribute("disable")="1" then
  1594. thisRow = thisRow & "<input type='checkbox' value='" & id & "' name='" & thisGroup & "-disBtn' onclick='disGroup(this);"
  1595. if myKey.GetAttribute("blur")="yes" then thisRow = thisRow & " calc_" & myKey.GetAttribute("group") & "(this);"
  1596. thisRow = thisRow & "'"
  1597. if hasValue then
  1598. thisRow = thisRow & " checked='checked'"
  1599. disText=""
  1600. else
  1601. disText=" disabled='disabled' "
  1602. end if
  1603. thisRow = thisRow & ">"
  1604. else
  1605. disText=""
  1606. end if
  1607. end if
  1608. if oldLabel<>thisLabel then thisRow = thisRow & "<label class='myLabel'>" & thisLabel & "</label>"
  1609. select case thisType
  1610. case "option"
  1611. thisRow = thisRow & "<select " & disText & " class='myInput' name='" & thisName & "'"
  1612. if myKey.GetAttribute("blur")="yes" then thisRow = thisRow & " onchange='calc_" & myKey.GetAttribute("group") & "(this);' "
  1613. thisRow = thisRow & ">"
  1614. for each myOption in myKey.getElementsByTagName("option")
  1615. thisRow = thisRow & "<option value='" & myOption.text & "'"
  1616. if hasValue then
  1617. if thisValue(0).text=myOption.text then thisRow = thisRow & " selected='selected' "
  1618. end if
  1619. if myOption.GetAttribute("price")<>"" then
  1620. thisRow = thisRow & " price='" & myOption.GetAttribute("price") & "' "
  1621. end if
  1622. thisRow = thisRow & ">" & myOption.GetAttribute("label") & "</option>"
  1623. next
  1624. thisRow = thisRow & "</select>"
  1625. case "option-other"
  1626. thisRow = thisRow & "<select " & disText & " class='myInput' name='" & thisName & "' onchange='checkOther(this);"
  1627. if myKey.GetAttribute("blur")="yes" then thisRow = thisRow & " calc_" & myKey.GetAttribute("group") & "(this);"
  1628. thisRow = thisRow & "'"
  1629. thisRow = thisRow & ">"
  1630. for each myOption in myKey.getElementsByTagName("option")
  1631. thisRow = thisRow & "<option value='" & myOption.text & "'"
  1632. if hasValue then
  1633. if thisValue(0).text=myOption.text then thisRow = thisRow & " selected='selected' "
  1634. end if
  1635. if myOption.GetAttribute("price")<>"" then
  1636. thisRow = thisRow & " price='" & myOption.GetAttribute("price") & "' "
  1637. end if
  1638. thisRow = thisRow & ">" & myOption.GetAttribute("label") & "</option>"
  1639. next
  1640. if hasValue then
  1641. if left(thisValue(0).text,6)="other:" then
  1642. thisRow = thisRow & "<option value='" & thisValue(0).text & "' selected='selected'>" & mid(thisValue(0).text,7) & "</option></select>"
  1643. else
  1644. thisRow = thisRow & "<option value='-1'>ساير</option></select>"
  1645. end if
  1646. else
  1647. thisRow = thisRow & "<option value='-1'>ساير</option></select>"
  1648. end if
  1649. thisRow = thisRow & "<input type='text' name='" & thisName & "-addValue' onblur='addOther(this);'>"
  1650. case "text"
  1651. thisRow = thisRow & "<input " & disText & " type='text' class='myInput' size='" & myKey.text & "' name='" & thisName & "' "
  1652. if myKey.GetAttribute("readonly")="yes" then thisRow =thisRow & " readonly='readonly' "
  1653. if hasValue then
  1654. thisRow = thisRow & "value='" & thisValue(0).text & "'"
  1655. else
  1656. if myKey.GetAttribute("default")<>"" then thisRow = thisRow & "value='" & myKey.GetAttribute("default") & "'"
  1657. end if
  1658. if myKey.GetAttribute("blur")="yes" then thisRow = thisRow & " onblur='calc_" & myKey.GetAttribute("group") & "(this);' "
  1659. thisRow = thisRow & ">"
  1660. case "textarea"
  1661. thisRow = thisRow & "<textarea name='" & thisName & "' style='width:600px;' cols='" & myKey.text & "'>"
  1662. if hasValue then thisRow = thisRow & thisValue(0).text
  1663. thisRow = thisRow & "</textarea>"
  1664. case "check"
  1665. thisRow = thisRow & "<input type='checkbox' value='on-" & id & "' name='" & thisName & "' "
  1666. if hasValue then
  1667. if left(thisValue(0).text,2)="on" then thisRow = thisRow & "checked='checked'"
  1668. else
  1669. if myKey.text="checked" then thisRow = thisRow & "checked='checked'"
  1670. end if
  1671. if myKey.GetAttribute("blur")="yes" then thisRow = thisRow & " onclick='calc_" & myKey.GetAttribute("group") & "(this);' "
  1672. if IsNumeric(myKey.GetAttribute("price")) then
  1673. thisRow = thisRow & " price='" & myKey.GetAttribute("price") & "' "
  1674. end if
  1675. thisRow = thisRow & ">"
  1676. case "radio":
  1677. 'response.write hasValue
  1678. thisRow = thisRow & "<input " & disText & " type='radio' value='" & myKey.text & "' name='" & thisName & "'"
  1679. if hasValue then
  1680. if myKey.text = thisValue(0).text then thisRow = thisRow & " checked='checked' "
  1681. else
  1682. if myKey.GetAttribute("default")="yes" then thisRow = thisRow & " checked='checked' "
  1683. end if
  1684. if myKey.GetAttribute("blur")="yes" then thisRow = thisRow & " onchange='calc_" & myKey.GetAttribute("group") & "(this);' "
  1685. thisRow = thisRow & ">"
  1686. case "service":
  1687. thisRow = thisRow & "<select " & disText & "class='myInput' name='" & thisName & "'"
  1688. if myKey.GetAttribute("blur")="yes" then thisRow = thisRow & " onchange='calc_" & myKey.GetAttribute("group") & "(this);' "
  1689. thisRow = thisRow & ">"
  1690. set rs = Conn.Execute("select * from outServices")
  1691. while not rs.eof
  1692. thisRow = thisRow & "<option value='" & rs(id) & "'"
  1693. if hasValue then
  1694. if thisValue(0).text=myOption.text then thisRow = thisRow & " selected='selected' "
  1695. end if
  1696. thisRow = thisRow & ">" & rs("name") & "</option>"
  1697. rs.moveNext
  1698. wend
  1699. thisRow = thisRow & "</select>"
  1700. end select
  1701. if myKey.GetAttribute("force")="yes" then thisRow = thisRow & "<span style='color:red;margin:0 0 0 2px;padding:0;'>*</span>"
  1702. oldGroup=thisGroup
  1703. oldLabel=thisLabel
  1704. oldID=id
  1705. if myKey.GetAttribute("br")="yes" then thisRow = thisRow & "<br>"
  1706. Next
  1707. thisRow = thisRow & "</div></div>"
  1708. next
  1709. thisRow = thisRow & "<div id='extreArea" &Replace(key,"/","-")& "'></div>"
  1710. response.write thisRow 'prependTo
  1711. response.write "<div class='btn'><img title='اضافه' src='/images/Plus-32.png' width='20px' onclick='cloneRow(""" & key & """);'><img title='حذف آخرين خط' src='/images/cancelled.gif' onclick='removeRow(""" & key & """);'></div></div>"
  1712. end sub
  1713. oldTmp="---first---"
  1714. for each tmp in typeProp.selectNodes("//key")
  1715. if oldTmp<>tmp.parentNode.nodeName then
  1716. oldTmp=tmp.parentNode.nodeName
  1717. call showKeyEdit("/keys/" & oldTmp & "/key")
  1718. end if
  1719. next
  1720. ' call showKeyEdit("/keys/printing/key")
  1721. ' call showKeyEdit("keys/binding/key")
  1722. ' call showKeyEdit("keys/service/key")
  1723. ' call showKeyEdit("keys/delivery/key")
  1724. %>
  1725. </td>
  1726. </tr>
  1727. <TR bgcolor="#CCCCCC">
  1728. <TD colspan="6">
  1729. <TABLE align="center" width="50%" border="0">
  1730. <TR>
  1731. <TD><INPUT TYPE="submit" Name="Submit" tabIndex="16" Value="تاييد" onFocus="noNextField=true;" onBlur="noNextField=false;" style="width:100px;"></TD>
  1732. <TD>&nbsp;</TD>
  1733. <TD align="left"><INPUT TYPE="button" Name="Cancel" tabIndex="17" Value="انصراف" style="width:100px;" onClick="window.location='Inquiry.asp?act=show&quote=<%=quote%>';"></TD>
  1734. </TR>
  1735. </TABLE>
  1736. </TD>
  1737. </TR>
  1738. </FORM>
  1739. <SCRIPT LANGUAGE="JavaScript">
  1740. <!--
  1741. document.all.CompanyName.focus();
  1742. var noNextField = false;
  1743. function documentKeyDown() {
  1744. var theKey = event.keyCode;
  1745. var o = window.event.srcElement;
  1746. if (theKey == 9) {
  1747. if (noNextField) // Don't Move
  1748. if(event.shiftKey){
  1749. noNextField=false;
  1750. event.keyCode=9
  1751. }
  1752. else
  1753. return false;
  1754. else { // send focus to next box
  1755. if (false){
  1756. }
  1757. else if(o.name == 'quote'){
  1758. // quote
  1759. if (o.value.length<5){
  1760. return false;
  1761. }
  1762. }
  1763. else if(o.name == 'ReturnTime'){
  1764. // Return Time
  1765. var soutput = o.value;
  1766. var len = o.value.length;
  1767. if (len==0){
  1768. return true;
  1769. }
  1770. else if (len==3){
  1771. soutput = soutput + '00'
  1772. o.value = soutput;
  1773. }
  1774. else if (len==4){
  1775. var tempString =soutput.charAt(len-1);
  1776. soutput = soutput.substring(0,len-1) + '0' + tempString
  1777. o.value = soutput;
  1778. }
  1779. else if(len!=5)
  1780. return false;
  1781. }
  1782. event.keyCode=9
  1783. return true;
  1784. }
  1785. }
  1786. }
  1787. document.onkeydown = documentKeyDown;
  1788. function checkValidation(){
  1789. return true;
  1790. }
  1791. function selectCustomer(){
  1792. document.all.tmpDlgArg.value="#"
  1793. document.all.tmpDlgTxt.value="نام حسابي را كه مي خواهيد جستجو كنيد وارد كنيد:"
  1794. window.showModalDialog('../dialog_GenInput.asp',document.all.tmpDlgTxt,'dialogHeight:200px; dialogWidth:440px; dialogTop:; dialogLeft:; edge:None; center:Yes; help:No; resizable:No; status:No;');
  1795. if (document.all.tmpDlgTxt.value !="") {
  1796. window.showModalDialog('../AR/dialog_SelectAccount.asp?act=select&search='+escape(document.all.tmpDlgTxt.value), document.all.tmpDlgArg, 'dialogWidth:780px; dialogHeight:500px; dialogTop:; dialogLeft:; edge:Raised; center:Yes; help:No; resizable:Yes; status:No;');
  1797. if (document.all.tmpDlgArg.value!="#"){
  1798. Arguments=document.all.tmpDlgArg.value.split("#")
  1799. theSpan=document.getElementById("customer");
  1800. theSpan.getElementsByTagName("input")[0].value=Arguments[0];
  1801. theSpan.getElementsByTagName("span")[0].innerText=Arguments[0]+" - "+Arguments[1];
  1802. }
  1803. }
  1804. }
  1805. //-->
  1806. </SCRIPT>
  1807. </TABLE>
  1808. <br>
  1809. </font>
  1810. <%
  1811. elseif Request.QueryString("act")="submitEditQuote" then
  1812. quote = request("quote")
  1813. if quote <> "" then
  1814. if isNumeric(quote) then
  1815. quote=clng(quote)
  1816. else
  1817. quote=""
  1818. end if
  1819. end if
  1820. If quote="" Then
  1821. response.write "<br><br>"
  1822. call showAlert("شماره استعلام اشتباه است .", CONST_MSG_ERROR )
  1823. response.end
  1824. End If
  1825. orderType=request.form("OrderType")
  1826. if orderType="" OR not isNumeric(OrderType) then
  1827. conn.close
  1828. response.redirect "?errMsg=" & Server.URLEncode("خطا در نوع استعلام<br>اطلاعات وارد نشد…<BR>")
  1829. else
  1830. set RS1=Conn.Execute ("SELECT Name FROM OrderTraceTypes WHERE (ID='"& orderType & "') AND (IsActive=1)")
  1831. if RS1.eof then
  1832. conn.close
  1833. response.redirect "?errMsg=" & Server.URLEncode("خطا در نوع استعلام<br>اطلاعات وارد نشد…<BR>")
  1834. else
  1835. orderTypeName=RS1("Name")
  1836. end if
  1837. RS1.close
  1838. end if
  1839. 'set RS1=Conn.Execute ("SELECT Name FROM OrderTraceStatus WHERE (IsActive=1) and ID = " & request.form("Vazyat"))
  1840. 'statusName = RS1("name")
  1841. set rs=Conn.Execute("select * from OrderTraceTypes where id=" & request("orderType"))
  1842. if rs.eof then
  1843. conn.close
  1844. response.redirect "?errmsg=" & server.urlEncode("نوع سفارش را تعيين كنيد")
  1845. end if
  1846. orderTypeID=rs("id")
  1847. orderTypeName=rs("name")
  1848. set orderProp = server.createobject("MSXML2.DomDocument")
  1849. if rs("property")<>"" then
  1850. orderProp.loadXML(rs("property"))
  1851. myXML = fetchKeyValues()
  1852. end if
  1853. rs.close
  1854. set rs=nothing
  1855. set RS1=Conn.Execute ("SELECT Name FROM QuoteSteps WHERE (IsActive=1) and ID = " & request.form("Marhale"))
  1856. stepName = RS1("name")
  1857. set RS3=Conn.Execute ("SELECT * FROM Quotes WHERE (ID = "& quote & ")")
  1858. OrderDate = sqlSafe(request.form("OrderDate"))
  1859. OrderTime = sqlSafe(request.form("OrderTime"))
  1860. ReturnDate = sqlSafe(request.form("ReturnDate"))
  1861. ReturnTime = sqlSafe(request.form("ReturnTime"))
  1862. CompanyName = sqlSafe(request.form("CompanyName"))
  1863. CustomerName = sqlSafe(request.form("CustomerName"))
  1864. Telephone = sqlSafe(request.form("Telephone"))
  1865. OrderTitle = sqlSafe(request.form("OrderTitle"))
  1866. 'Vazyat = sqlSafe(request.form("Vazyat"))
  1867. Marhale = sqlSafe(request.form("Marhale"))
  1868. SalesPerson = sqlSafe(request.form("SalesPerson"))
  1869. ' Qtty = sqlSafe(request.form("Qtty"))
  1870. Size = sqlSafe(request.form("Size"))
  1871. ' SimplexDuplex = sqlSafe(request.form("SimplexDuplex"))
  1872. Price = sqlSafe(request.form("totalPrice"))
  1873. Notes = sqlSafe(request.form("Notes"))
  1874. productionDuration = sqlSafe(request.form("productionDuration"))
  1875. mySql="UPDATE Quotes SET Customer='"& request.form("CustomerID") & "', order_date= N'"& OrderDate & "', order_time= N'"& OrderTime & "', return_date= N'"& ReturnDate & "', return_time= N'"& ReturnTime & "', company_name= N'"& CompanyName & "', customer_name= N'"& CustomerName & "', telephone= N'"& Telephone & "', order_title= N'"& OrderTitle & "', order_kind= N'"& orderTypeName & "', Type= '"& orderType & "', step= "& Marhale & ", marhale= N'"& stepName & "', salesperson= N'"& SalesPerson & "' , LastUpdatedDate=N'"& shamsitoday() & "' , LastUpdatedTime=N'"& currentTime10() & "', LastUpdatedBy=N'"& session("ID")& "', Notes= N'"& Notes & "', property=N'" & myXML & "', paperSize= N'"& Size & "', Price= N'"& Price & "', productionDuration = " & productionDuration & " WHERE (ID = N'"& quote & "')"
  1876. ', qtty= N'"& Qtty & "', paperSize= N'"& Size & "', SimplexDuplex= N'"& SimplexDuplex & "', Price= N'"& Price & "'
  1877. conn.Execute mySql
  1878. response.write quote &" UPDATED<br>"
  1879. response.write "<A HREF='orderEdit.asp'>Back</A>"
  1880. ' if request.form("Marhale")="10" then
  1881. ' call InformCSRorderIsReady(quote , RS3("CreatedBy"))
  1882. ' end if
  1883. ' if not request.form("relatedApprovedInvoiceID")="0" then
  1884. ' call UnApproveInvoice(request.form("relatedApprovedInvoiceID") , request.form("relatedApprovedInvoiceBy"))
  1885. ' end if
  1886. conn.close
  1887. response.redirect "?act=show&quote=" & quote & "&msg=" & Server.URLEncode("اطلاعات استعلام به روز شد")
  1888. elseif Request.QueryString("act")="convertToOrder" then
  1889. If isnumeric(request("quote")) then
  1890. quote=request("quote")
  1891. mySQL="SELECT Quotes.Customer FROM Quotes WHERE (Quotes.ID='"& quote & "')"
  1892. set RS1=conn.execute (mySQL)
  1893. If RS1.EOF then
  1894. response.write "<BR><BR><BR><BR><CENTER>شماره استعلام معتبر نيست</CENTER>"
  1895. conn.close
  1896. response.end
  1897. End If
  1898. CustomerID = RS1("Customer")
  1899. RS1.close
  1900. set rs = Conn.Execute("select * from accounts where id=" & CustomerID)
  1901. if rs.eof then
  1902. conn.close
  1903. response.write "<BR><BR><BR><BR><CENTER>خطاي عجيب شماره مشتري‌ معتبر نيست!</CENTER>"
  1904. response.end
  1905. end if
  1906. if (cdbl(rs("arBalance"))+cdbl(rs("creditLimit")) < 0) then
  1907. conn.close
  1908. response.redirect "?errmsg=" & Server.URLEncode("بدهي اين حساب از ميزان اعتبار آن بيشتر شده،<br> لطفا با سرپرست فروش هماهنگ كنيد.<br><a href='../CRM/AccountInfo.asp?act=show&selectedCustomer=" & CustomerID & "'>نمايش حساب</a>")
  1909. end if
  1910. rs.close
  1911. set rs = nothing
  1912. CreationDate = shamsiToday()
  1913. OrderTime = Left(currentTime10(),5)
  1914. ' create order for the same customer
  1915. mySQL="INSERT INTO Orders (CreatedDate, CreatedBy, Customer) VALUES ('"& CreationDate & "', '"& session("ID") & "', '"& CustomerID & "');SELECT @@Identity AS NewOrder"
  1916. set RS1 = Conn.execute(mySQL).NextRecordSet
  1917. OrderID = RS1("NewOrder")
  1918. RS1.close
  1919. ' create orders_trace row and copy info from quote
  1920. mySQL= "INSERT INTO orders_trace (radif_sefareshat, order_date, order_time, company_name, customer_name, telephone, order_title, order_kind, Type, vazyat, marhale, salesperson, status, step, LastUpdatedDate, LastUpdatedTime, LastUpdatedBy, property) "&_
  1921. "SELECT '" & OrderID & "', N'"& CreationDate & "', N'"& OrderTime & "', company_name, customer_name, telephone, order_title, order_kind, Type, N'در جريان', N'در صف شروع', salesperson, 1, 1, N'"& CreationDate & "', N'"& currentTime10() & "', '"& session("ID") & "',property FROM Quotes WHERE ID='" & quote & "'; "
  1922. conn.Execute(mySQL)
  1923. ' relate invoices to the new order
  1924. mySQL= "INSERT INTO InvoiceOrderRelations ([Invoice], [Order]) SELECT [Invoice], '" & OrderID & "' AS [Order] FROM InvoiceQuoteRelations WHERE Quote = '" & quote & "';"
  1925. conn.Execute(mySQL)
  1926. ' remove relation to previous quote
  1927. mySQL= "DELETE FROM InvoiceQuoteRelations WHERE Quote = '" & quote & "';"
  1928. conn.Execute(mySQL)
  1929. 'close the quote
  1930. mySQL= "UPDATE Quotes SET Closed = 1, step = 5, marhale = 'تبديل به سفارش شده' WHERE [ID] = '" & quote & "';"
  1931. conn.Execute(mySQL)
  1932. ' keeping the relation
  1933. mySQL= "INSERT INTO QuoteOrderRelations ([QuoteId], [OrderId]) VALUES ('" & quote & "' , '" & OrderID & "');"
  1934. conn.Execute(mySQL)
  1935. conn.close
  1936. response.redirect "../order/TraceOrder.asp?act=show&order=" & OrderID & "&msg=" & Server.URLEncode("استعلام به سفارش كپي شد")
  1937. End If
  1938. response.write "<br><br>"
  1939. call showAlert("شماره استعلام اشتباه است .", CONST_MSG_ERROR )
  1940. response.end
  1941. end if
  1942. 'Conn.Close
  1943. %>
  1944. <!--#include file="tah.asp" -->