/beta/order/orderEdit.asp

http://github.com/khaneh/Orders · ASP · 753 lines · 671 code · 52 blank · 30 comment · 100 complexity · 30089d6bca3eef7b48f1673cb6dea4d6 MD5 · raw file

  1. <%@LANGUAGE="VBSCRIPT" CODEPAGE="1256"%><%
  2. 'Order (2)
  3. PageTitle=" "
  4. SubmenuItem=2
  5. if not Auth(2 , 2) then NotAllowdToViewThisPage()
  6. %>
  7. <!--#include file="top.asp" -->
  8. <!--#include File="../include_farsiDateHandling.asp"-->
  9. <!--#include File="../include_JS_InputMasks.asp"-->
  10. <style>
  11. .mySection{border: 1px #F90 dashed;margin: 15px 10px 0 15px;}
  12. .myRow{border: 2px #F05 dashed;margin: 10px 0 10px 0;padding: 0 3px 5px 0;}
  13. .exteraArea{border: 1px #33F dotted;margin: 5px 0 0 5px;padding: 0 3px 5px 0;}
  14. .myLabel {margin: 10px 10px 0 5px;white-space: nowrap;}
  15. .myProp {font-weight: bold;color: #40F; margin: 0 3px 0 3px;}
  16. .myInput {margin: 5px 0 5px 0;}
  17. div.btn label{background-color:yellow;color: blue;padding: 3px 30px 3px 30px;cursor: pointer;}
  18. div.btn{margin: -5px 250px 0px 5px;}
  19. div.btn img{margin: 0px 20px -5px 0;cursor: pointer;}
  20. </style>
  21. <%
  22. '-----------------------------------------------------------------------------------------------------
  23. '----------------------------------------------------------------------------------- Order Search Form
  24. '-----------------------------------------------------------------------------------------------------
  25. radif = request("radif")
  26. if radif <> "" then
  27. if isNumeric(radif) then
  28. radif=clng(radif)
  29. ' if radif=0 then radif=""
  30. else
  31. response.write "<br><br>"
  32. call showAlert(" .", CONST_MSG_ERROR )
  33. radif=""
  34. end if
  35. end if
  36. if radif="" then
  37. %>
  38. <br><br>
  39. <FORM METHOD=POST ACTION="?e=y">
  40. <TABLE border="0" cellspacing="0" cellpadding="2" dir="RTL" align="center" style="font-family:Tahoma,arial; font-size: 8pt;">
  41. <TR>
  42. <TD> :</TD>
  43. <TD><INPUT Name="Radif" TYPE="text" maxlength="6" size="5" tabIndex="1" dir="LTR"></TD>
  44. <TD><INPUT TYPE="submit" Name="Submit" Value="" style="width:100px;font-family:Tahoma,arial; font-size: 8pt;"></TD>
  45. </TR>
  46. </TABLE>
  47. </FORM>
  48. <SCRIPT LANGUAGE="JavaScript">
  49. <!--
  50. document.all.Radif.focus();
  51. //-->
  52. </script>
  53. <%
  54. response.end
  55. end if
  56. '-----------------------------------------------------------------------------------------------------
  57. '-------------------------------------------------------------------------- Submit Changes In An Order
  58. '-----------------------------------------------------------------------------------------------------
  59. if request.form("Submit")="" AND radif<>"" then
  60. orderType=request.form("OrderType")
  61. if orderType="" OR not isNumeric(OrderType) then
  62. conn.close
  63. response.redirect "?errMsg=" & Server.URLEncode(" <br> υ<BR>")
  64. else
  65. set RS1=Conn.Execute ("SELECT Name FROM OrderTraceTypes WHERE (ID='"& orderType & "') AND (IsActive=1)")
  66. if RS1.eof then
  67. conn.close
  68. response.redirect "?errMsg=" & Server.URLEncode(" <br> υ<BR>")
  69. else
  70. orderTypeName=RS1("Name")
  71. end if
  72. RS1.close
  73. end if
  74. set RS1=Conn.Execute ("SELECT Name FROM OrderTraceStatus WHERE (IsActive=1) and ID = " & request.form("Vazyat"))
  75. statusName = RS1("name")
  76. set RS1=Conn.Execute ("SELECT Name FROM OrderTraceSteps WHERE (IsActive=1) and ID = " & request.form("Marhale"))
  77. stepName = RS1("name")
  78. set RS3=Conn.Execute ("SELECT * FROM Orders WHERE (ID = "& radif & ")")
  79. '--------------------------------------------------------------------------------------------------
  80. '--------------------------------------------------------------------------------------------------
  81. '--------------------------------------------------------------------------------------------------
  82. set rs=Conn.Execute("select * from OrderTraceTypes where id=" & request("orderType"))
  83. if rs.eof then
  84. conn.close
  85. response.redirect "?errmsg=" & server.urlEncode(" ")
  86. end if
  87. orderTypeID=rs("id")
  88. orderTypeName=rs("name")
  89. set orderProp = server.createobject("MSXML2.DomDocument")
  90. if rs("property")<>"" then
  91. orderProp.loadXML(rs("property"))
  92. myXML = fetchKeyValues()
  93. end if
  94. rs.close
  95. set rs=nothing
  96. function fetchKeyValues()
  97. key="---first---"
  98. thisRow="<?xml version=""1.0""?><keys>"
  99. for each tmp in orderProp.selectNodes("//key")
  100. if key<>tmp.parentNode.nodeName then
  101. key=tmp.parentNode.nodeName
  102. thisRow = thisRow & "<" & key & ">"
  103. hasValue=0
  104. For Each myKey In orderProp.SelectNodes("/keys/" & key & "/key")
  105. thisName = myKey.GetAttribute("name")
  106. thisGroup= myKey.GetAttribute("group")
  107. id=0
  108. ' response.write oldName& "<br>"
  109. if thisName<>oldName then
  110. for each value in request.form(thisName)
  111. if value <> "" then
  112. thisRow = thisRow & "<key name=""" & thisName & """ id="""
  113. select case myKey.GetAttribute("type")
  114. case "check"
  115. thisRow = thisRow & mid(value,4)
  116. case else
  117. if request.form(thisGroup & "-disBtn")<>"" then
  118. 'response.write (thisGroup & "-" & id & "<br>")
  119. thisRow = thisRow & trim(split(request.form(thisGroup & "-disBtn"),",")(id))
  120. else
  121. thisRow = thisRow & id
  122. end if
  123. end select
  124. thisRow = thisRow & """>" & value & "</key>"
  125. hasValue=hasValue +1
  126. end if
  127. id=id+1
  128. next
  129. end if
  130. oldName = thisName
  131. Next
  132. if hasValue>0 then
  133. thisRow = thisRow & "</" & key & ">"
  134. else
  135. thisRow = Replace(thisRow,"<" & key & ">","")
  136. end if
  137. end if
  138. Next
  139. thisRow = thisRow & "</keys>"
  140. fetchKeyValues = thisRow
  141. 'response.write thisRow
  142. 'response.end
  143. end function
  144. OrderDate = sqlSafe(request.form("OrderDate"))
  145. OrderTime = sqlSafe(request.form("OrderTime"))
  146. ReturnDate = "null"
  147. ReturnTime = "null"
  148. CompanyName = sqlSafe(request.form("CompanyName"))
  149. CustomerName = sqlSafe(request.form("CustomerName"))
  150. Telephone = sqlSafe(request.form("Telephone"))
  151. OrderTitle = sqlSafe(request.form("OrderTitle"))
  152. Vazyat = sqlSafe(request.form("Vazyat"))
  153. Marhale = sqlSafe(request.form("Marhale"))
  154. SalesPerson = sqlSafe(request.form("SalesPerson"))
  155. Qtty = sqlSafe(request.form("Qtty"))
  156. Size = sqlSafe(request.form("paperSize"))
  157. SimplexDuplex = sqlSafe(request.form("SimplexDuplex"))
  158. Price = sqlSafe(request.form("totalPrice"))
  159. if request.form("ReturnDate")<>"" then ReturnDate = "'" & sqlSafe(request.form("ReturnDate")) & "'"
  160. if request.form("ReturnTime")<>"" then ReturnTime = "'" & sqlSafe(request.form("ReturnTime")) & "'"
  161. mySQL="select users.id,users.RealName,orders_trace.order_title,orders_trace.customer_name, orders_trace.company_name from orders_trace inner join orderTraceStepAnnonce on orders_trace.step=orderTraceStepAnnonce.stepID inner join Users on orderTraceStepAnnonce.userID=users.ID where orders_trace.radif_sefareshat=" & radif
  162. set rs=Conn.Execute(mySQL)
  163. while not rs.eof
  164. msgFrom=session("id")
  165. msgTo=rs("id")
  166. msgTitle = " "
  167. msgBody = " " & rs("order_title") & " " & rs("customer_name") & " (" & rs("company_name") & ") "
  168. RelatedTable = "orders"
  169. relatedID = radif
  170. replyTo = "null"
  171. IsReply = 0
  172. urgent = 1
  173. MsgDate = shamsiToday()
  174. MsgTime = currentTime10()
  175. msgType = 0
  176. MySQL = "INSERT INTO Messages (MsgFrom, MsgTo, MsgTime, MsgDate, IsRead, MsgTitle, MsgBody, replyTo, IsReply, relatedID, RelatedTable, urgent, type) VALUES ( "& MsgFrom & ", "& MsgTo & ", N'"& MsgTime & "', N'"& MsgDate & "', 0, N'"& MsgTitle & "', N'"& MsgBody & "', "& replyTo & ", "& IsReply & ", '"& relatedID & "', '"& RelatedTable & "', "& urgent & ", " & msgType & ")"
  177. conn.Execute MySQL
  178. rs.moveNext
  179. wend
  180. rs.close
  181. set rs=nothing
  182. mySql="UPDATE orders_trace SET order_date= N'"& OrderDate & "', order_time= N'"& OrderTime & "', return_date= "& ReturnDate & ", return_time= "& ReturnTime & ", company_name= N'"& CompanyName & "', customer_name= N'"& CustomerName & "', telephone= N'"& Telephone & "', order_title= N'"& OrderTitle & "', order_kind= N'"& orderTypeName & "', Type= '"& orderType & "', vazyat= N'"& statusName & "', status= "& Vazyat & ", step= "& Marhale & ", marhale= N'"& stepName & "', salesperson= N'"& SalesPerson & "', qtty= N'"& Qtty & "', paperSize= N'"& Size & "', SimplexDuplex= N'"& SimplexDuplex & "', Price= N'"& Price & "' , LastUpdatedDate=N'"& shamsitoday() & "' , LastUpdatedTime=N'"& currentTime10() & "', LastUpdatedBy=N'"& session("ID")& "', property=N'" & myXML & "' WHERE (radif_sefareshat= N'"& radif & "')"
  183. conn.Execute mySql
  184. response.write radif &" UPDATED<br>"
  185. response.write "<A HREF='orderEdit.asp'>Back</A>"
  186. if RS3("Customer") <> request.form("CustomerID") then
  187. mySql="UPDATE Orders SET Customer='"& request.form("CustomerID") & "' WHERE (ID= N'"& radif & "')"
  188. conn.Execute mySql
  189. end if
  190. if request.form("Marhale")="10" then
  191. call InformCSRorderIsReady(radif , RS3("CreatedBy"))
  192. end if
  193. if not request.form("relatedApprovedInvoiceID")="0" then
  194. call UnApproveInvoice(request.form("relatedApprovedInvoiceID") , request.form("relatedApprovedInvoiceBy"))
  195. end if
  196. response.redirect "../order/TraceOrder.asp?act=show&order=" & radif
  197. end if
  198. '-----------------------------------------------------------------------------------------------------
  199. '---------------------------------------------------------------------- View And Edit Order's Details
  200. '-----------------------------------------------------------------------------------------------------
  201. set RS2=Conn.Execute ("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='"& radif & "')")
  202. if RS2.eof then %>
  203. <FORM METHOD=POST ACTION="?"><BR><BR>
  204. <TABLE border="0" cellspacing="0" cellpadding="2" dir="RTL" align="center" style="font-family:Tahoma,arial; font-size: 8pt;">
  205. <TR>
  206. <TD> :</TD>
  207. <TD><INPUT Name="Radif" TYPE="text" maxlength="6" size="6" tabIndex="1" dir="LTR"></TD>
  208. <TD><INPUT TYPE="submit" Name="Submit" Value="" style="width:100px;font-family:Tahoma,arial; font-size: 8pt;"></TD>
  209. </TR>
  210. </TABLE>
  211. </FORM>
  212. <br>
  213. <%
  214. call showAlert(" .", CONST_MSG_ERROR )
  215. response.end
  216. else
  217. CustomerID=RS2("AccID")
  218. end if
  219. if RS2("salesperson")<>session("csrName") then
  220. response.write "<br>"
  221. call showAlert(" ..<BR> .", CONST_MSG_ALERT )
  222. end if
  223. %>
  224. <style>
  225. Table { font-size: 8pt;}
  226. INPUT { font-family:Tahoma,arial; font-size: 8pt;}
  227. SELECT { font-family:Tahoma,arial; font-size: 8pt;}
  228. </style>
  229. <font face="tahoma">
  230. <%
  231. 'mySQL="SELECT Invoices.id, Invoices.ApprovedBy FROM Orders LEFT OUTER JOIN Invoices INNER JOIN InvoiceOrderRelations ON Invoices.ID = InvoiceOrderRelations.Invoice ON Orders.ID = InvoiceOrderRelations.[Order] WHERE (ISNULL(Invoices.approved, 0) = 1) AND (Orders.ID ='"& request("radif") & "')"
  232. 'Changed By kid 820903
  233. relatedApprovedInvoiceID = 0
  234. mySQL="SELECT Invoices.Issued, Invoices.Approved, Invoices.ApprovedBy, Invoices.ID FROM InvoiceOrderRelations INNER JOIN Invoices ON InvoiceOrderRelations.Invoice = Invoices.ID WHERE (InvoiceOrderRelations.[Order] = '" & radif & "') AND (Invoices.Voided = 0)"
  235. set RS3=Conn.Execute (mySQL)
  236. if not(RS3.eof) then
  237. FoundInvoice=RS3("ID")
  238. if RS3("Issued") then
  239. Conn.Close
  240. response.redirect "../order/TraceOrder.asp?act=show&order=" & radif & "&errMsg=" & Server.URLEncode(" .( : <A HREF='../AR/AccountReport.asp?act=showInvoice&invoice="& FoundInvoice & "' target='_blank'>" & FoundInvoice & "</a>)<BR> .")
  241. elseif RS3("Approved") then
  242. tmpDesc="<B> </B>"
  243. tmpColor="Yellow"
  244. relatedApprovedInvoiceID = RS3("id")
  245. relatedApprovedInvoiceBy = RS3("ApprovedBy")
  246. response.write "<br>"
  247. call showAlert(" <b> </b> <A HREF='../AR/AccountReport.asp?act=showInvoice&invoice="& FoundInvoice &"' target='_blank'>" & FoundInvoice & "</A> <BR> ." , CONST_MSG_ALERT )
  248. else
  249. tmpDesc=""
  250. tmpColor="#FFFFBB"
  251. response.write "<br>"
  252. ' call showAlert("!<br> <B> </B> <br><A HREF='../AR/InvoiceEdit.asp?act=editInvoice&invoice=" & FoundInvoice & "'> (" & FoundInvoice & ")</A>", CONST_MSG_INFORM )
  253. call showAlert("!<br> <B> </B> <br><A HREF='../AR/AccountReport.asp?act=showInvoice&invoice=" & FoundInvoice & "'> (" & FoundInvoice & ")</A>", CONST_MSG_INFORM )
  254. end if
  255. end if
  256. %>
  257. <input type="hidden" Name='tmpDlgArg' value=''>
  258. <input type="hidden" Name='tmpDlgTxt' value=''>
  259. <FORM METHOD=POST ACTION="?" onSubmit="return checkValidation();">
  260. <INPUT TYPE="hidden" name="relatedApprovedInvoiceBy" value="<%=relatedApprovedInvoiceBy%>">
  261. <INPUT TYPE="hidden" name="relatedApprovedInvoiceID" value="<%=relatedApprovedInvoiceID%>">
  262. <br>
  263. <TABLE border="0" cellspacing="0" cellpadding="2" dir="RTL" width="700" align="center">
  264. <TR bgcolor="black">
  265. <TD align="left"><FONT COLOR="YELLOW">:</FONT></TD>
  266. <TD align="right" colspan=3 height="25px">
  267. <span id="customer" style="color:yellow;"><%' after any changes in this span "./Customers.asp" must be revised%>
  268. <INPUT TYPE="hidden" NAME="customerID" value="<%=customerID%>"><span><%=customerID & " - "& RS2("AccountTitle")%></span>.
  269. </span>
  270. <INPUT class="GenButton" TYPE="button" value="" onClick="selectCustomer();">
  271. </TD>
  272. <TD align="left" ><FONT COLOR="YELLOW"> :</FONT></TD>
  273. <TD>
  274. <SELECT NAME="OrderType" tabindex="25" style='font-family: tahoma,arial ; font-size: 9pt; font-weight: bold; width: 100px' onchange="alert(' . 흁Ͽ');">
  275. <%
  276. thisOrderType=RS2("Type")
  277. set RS_TYPE=Conn.Execute ("SELECT ID, Name FROM OrderTraceTypes WHERE (IsActive=1) ORDER BY ID")
  278. Do while not RS_TYPE.eof
  279. %>
  280. <OPTION value="<%=RS_TYPE("ID")%>" <%if thisOrderType=RS_TYPE("ID") then response.write "selected" %> ><%=RS_TYPE("Name")%></option>
  281. <%
  282. RS_TYPE.moveNext
  283. loop
  284. RS_TYPE.close
  285. set RS_TYPE = nothing
  286. %>
  287. </SELECT></TD>
  288. </TR>
  289. <TR bgcolor="black">
  290. <TD align="left"><FONT COLOR="YELLOW"> :</FONT></TD>
  291. <TD align="right">
  292. <!-- Radif -->
  293. <INPUT TYPE="text" disabled maxlength="6" size="5" dir="LTR" value="<%=RS2("radif_sefareshat")%>">
  294. <INPUT TYPE="hidden" NAME="Radif" value="<%=RS2("radif_sefareshat")%>">
  295. </TD>
  296. <TD align="left"><FONT COLOR="YELLOW">:</FONT></TD>
  297. <TD><TABLE border="0">
  298. <TR>
  299. <TD dir="LTR">
  300. <INPUT disabled TYPE="text" maxlength="10" size="8" value="<%=RS2("order_date")%>">
  301. <INPUT TYPE="hidden" NAME="OrderDate" value="<%=RS2("order_date")%>">
  302. </TD>
  303. <TD dir="RTL"><FONT COLOR="YELLOW"><%=""%></FONT></TD>
  304. </TR>
  305. </TABLE></TD>
  306. <TD align="left"><FONT COLOR="YELLOW">:</FONT></TD>
  307. <TD align="right">
  308. <INPUT disabled TYPE="text" maxlength="5" size="3" dir="LTR" value="<%=RS2("order_time")%>" tabindex="24">
  309. <INPUT TYPE="hidden" NAME="OrderTime" value="<%=RS2("order_time")%>"></TD>
  310. </TR>
  311. <TR bgcolor="#CCCCCC">
  312. <TD align="left"> :</TD>
  313. <TD align="right">
  314. <!-- CompanyName -->
  315. <INPUT TYPE="text" NAME="CompanyName" maxlength="50" size="25" tabIndex="1" value="<%=RS2("company_name")%>"></TD>
  316. <TD align="left"> :</TD>
  317. <TD>
  318. <TABLE border="0">
  319. <TR>
  320. <TD dir="LTR">
  321. <INPUT TYPE="text" NAME="ReturnDate" onblur="acceptDate(this)" maxlength="10" size="8" tabindex="4" onKeyPress="return maskDate(this);" value="<%=RS2("return_date")%>">
  322. </TD>
  323. <TD dir="RTL">(?)</TD>
  324. </TR>
  325. </TABLE>
  326. </TD>
  327. <TD align="left"> :</TD>
  328. <TD align="right">
  329. <INPUT TYPE="text" NAME="ReturnTime" maxlength="6" size="3" dir="LTR" onKeyPress="return maskTime(this);" tabindex="5" value="<%=RS2("return_time")%>">
  330. </TD>
  331. </TR>
  332. <TR bgcolor="#CCCCCC">
  333. <TD align="left"> :</TD>
  334. <TD align="right">
  335. <!-- CustomerName -->
  336. <INPUT TYPE="text" NAME="CustomerName" maxlength="50" size="25" tabIndex="2" value="<%=RS2("customer_name")%>">
  337. </TD>
  338. <TD align="left">:</TD>
  339. <TD align="right">
  340. <!-- Telephone -->
  341. <INPUT TYPE="text" NAME="Telephone" maxlength="50" size="25" tabIndex="3" value="<%=RS2("telephone")%>">
  342. </TD>
  343. <TD></TD>
  344. <TD></TD>
  345. </TR>
  346. <TR bgcolor="#CCCCCC">
  347. <TD align="left"> :</TD>
  348. <TD align="right" colspan="3">
  349. <INPUT TYPE="text" NAME="OrderTitle" maxlength="255" size="50" tabIndex="6" value="<%=RS2("order_title")%>">
  350. </TD>
  351. <TD align="left"> :</TD>
  352. <TD>
  353. <INPUT NAME="SalesPerson" Type="TEXT"value="<%=RS2("salesperson")%>" style='font-family: tahoma,arial ; font-size: 8pt; font-weight: bold; width: 100px' tabIndex="888" readonly>
  354. </TD>
  355. </TR>
  356. <TR bgcolor="#CCCCCC">
  357. <TD align="left">:</TD>
  358. <TD>
  359. <SELECT NAME="Marhale" style='font-family: tahoma,arial ; font-size: 8pt; font-weight: bold; width: 140px' tabindex="20" >
  360. <%
  361. set RS_STEP=Conn.Execute ("SELECT * FROM OrderTraceSteps WHERE (IsActive=1)")
  362. Do while not RS_STEP.eof
  363. %>
  364. <OPTION value="<%=RS_STEP("ID")%>" <%if RS2("step")=RS_STEP("ID") then response.write "selected" %> ><%=RS_STEP("name")%></option>
  365. <%
  366. RS_STEP.moveNext
  367. loop
  368. RS_STEP.close
  369. set RS_STEP = nothing
  370. %>
  371. </SELECT>
  372. </TD>
  373. <TD align="left">:</TD>
  374. <TD colspan="3">
  375. <SELECT NAME="Vazyat" style='font-family: tahoma,arial ; font-size: 8pt; font-weight: bold; width: 100px' tabindex="21" >
  376. <%
  377. set RS_STATUS=Conn.Execute ("SELECT * FROM OrderTraceStatus WHERE (IsActive=1)")
  378. Do while not RS_STATUS.eof
  379. %>
  380. <OPTION value="<%=RS_STATUS("ID")%>" <%if RS2("status")=RS_STATUS("ID") then response.write "selected" %> ><%=RS_STATUS("Name")%></option>
  381. <%
  382. RS_STATUS.moveNext
  383. loop
  384. RS_STATUS.close
  385. set RS_STATUS = nothing
  386. %>
  387. </SELECT>
  388. </TD>
  389. </TR>
  390. <tr bgcolor="#CCCCCC">
  391. <td align="left">:</td>
  392. <td>
  393. <input type="text" value="<%=rs2("paperSize")%>" name="paperSize" tabIndex='7'>
  394. </td>
  395. <td align="left">ǎ:</td>
  396. <td>
  397. <input type="text" name="qtty" value="<%=rs2("qtty")%>" tabindex="8">
  398. </td>
  399. <%
  400. set rs=Conn.Execute("select * from OrderTraceTypes where id="&rs2("type"))
  401. if rs("property")<>"" then
  402. hasProperty=true
  403. end if
  404. %>
  405. <td align="left"> :</td>
  406. <td>
  407. <input type="text" value="<%=rs2("price")%>" name="totalPrice" id='totalPrice' tabindex="8" style="background-color:#FED;border-width:0;" <%if hasProperty then response.write " readonly='readonly' "%>>
  408. </td>
  409. </tr>
  410. <tr bgcolor="#CCCCCC">
  411. <td colspan="6">
  412. <script type="text/javascript" src="/js/jquery-1.7.min.js"></script>
  413. <script type="text/javascript" src="/js/jalaliCalendar.js"></script>
  414. <script type="text/javascript" src="/js/jquery.dateFormat-1.0.js"></script>
  415. <script type="text/javascript" src="calcOrder.js"></script>
  416. <%
  417. if hasProperty then
  418. %>
  419. <div> </div>
  420. <div>
  421. <br> ʝ .
  422. <br> .
  423. <br> ʝ . ǎ ǎ . ǎ ʝ
  424. </div>
  425. <%
  426. end if
  427. set typeProp = server.createobject("MSXML2.DomDocument")
  428. set orderProp = server.createobject("MSXML2.DomDocument")
  429. if rs2("property")<>"" then orderProp.loadXML(rs2("property"))
  430. if rs("property")<>"" then typeProp.loadXML(rs("property"))
  431. set rs=nothing
  432. ' for each item in typeProp.SelectNodes("//key")
  433. ' response.write item.parentNode.nodeName & ": " & item.xml & "<br>"
  434. ' next
  435. ' response.end
  436. sub showKeyEdit(key)
  437. 'key="/keys/printing/key"
  438. oldGroup="---first---"
  439. oldLabel="---first---"
  440. thisRow = "<div class='myRow'>"
  441. maxID=0
  442. oldID=0
  443. for each mykey in orderProp.SelectNodes(key)
  444. id=myKey.GetAttribute("id")
  445. if maxID<id then maxID=id
  446. next
  447. thisRow = thisRow & "<input type='hidden' value='" & maxID & "' id='" & Replace(key,"/","-") & "-maxID'>"
  448. ' response.write "<div class='myRow'><div class='exteraArea' id='" & Replace(key,"/","-") & "-0'>"
  449. for id = 0 to maxID
  450. thisRow = thisRow & "<div class='exteraArea' id='" & Replace(key,"/","-") & "-" & id & "'>"
  451. ' thisRow = thisRow & "<img title=' ' src='/images/cancelled.gif' onclick='$(this).parent().remove();'>"
  452. For Each myKey In typeProp.SelectNodes(key)
  453. thisType = myKey.GetAttribute("type")
  454. thisName = myKey.GetAttribute("name")
  455. thisLabel= myKey.GetAttribute("label")
  456. thisGroup= myKey.GetAttribute("group")
  457. hasValue=false
  458. set thisValue= orderProp.SelectNodes(key & "[@id='" & id & "' and @name='" & thisName & "']")
  459. if thisValue.length>0 then hasValue=true
  460. ' response.write hasValue & "<br>"
  461. if (oldGroup<>thisGroup and oldID=id and oldGroup <> "---first---") then thisRow = thisRow & "</div>"
  462. if oldGroup<>thisGroup or oldID<>id then
  463. thisRow = thisRow & "<div class='mySection' groupName='" & thisGroup & "'>"
  464. if myKey.GetAttribute("disable")="1" then
  465. thisRow = thisRow & "<input type='checkbox' value='" & id & "' name='" & thisGroup & "-disBtn' onclick='disGroup(this);"
  466. if myKey.GetAttribute("blur")="yes" then thisRow = thisRow & " calc_" & myKey.GetAttribute("group") & "(this);"
  467. thisRow = thisRow & "'"
  468. if hasValue then
  469. thisRow = thisRow & " checked='checked'"
  470. disText=""
  471. else
  472. hasGroupValue = false
  473. for each grpItem in typeProp.SelectNodes(key & "[@group='" & thisGroup & "']")
  474. set grpValue = orderProp.SelectNodes(key & "[@id='" & id & "' and @name='" & grpItem.GetAttribute("name") & "']")
  475. if grpValue.length > 0 then hasGroupValue = true
  476. next
  477. set grpValue = nothing
  478. if hasGroupValue then
  479. thisRow = thisRow & " checked='checked'"
  480. disText=""
  481. else
  482. disText=" disabled='disabled' "
  483. end if
  484. end if
  485. thisRow = thisRow & ">"
  486. else
  487. disText=""
  488. end if
  489. end if
  490. if oldLabel<>thisLabel then thisRow = thisRow & "<label class='myLabel'>" & thisLabel & "</label>"
  491. select case thisType
  492. case "option"
  493. thisRow = thisRow & "<select " & disText & " class='myInput' name='" & thisName & "'"
  494. if myKey.GetAttribute("blur")="yes" then thisRow = thisRow & " onchange='calc_" & myKey.GetAttribute("group") & "(this);' "
  495. thisRow = thisRow & ">"
  496. for each myOption in myKey.getElementsByTagName("option")
  497. thisRow = thisRow & "<option value='" & myOption.text & "'"
  498. if hasValue then
  499. if thisValue(0).text=myOption.text then thisRow = thisRow & " selected='selected' "
  500. end if
  501. if myOption.GetAttribute("price")<>"" then
  502. thisRow = thisRow & " price='" & myOption.GetAttribute("price") & "' "
  503. end if
  504. thisRow = thisRow & ">" & myOption.GetAttribute("label") & "</option>"
  505. next
  506. thisRow = thisRow & "</select>"
  507. case "option-other"
  508. thisRow = thisRow & "<select " & disText & " class='myInput' name='" & thisName & "' onchange='checkOther(this);"
  509. if myKey.GetAttribute("blur")="yes" then thisRow = thisRow & " calc_" & myKey.GetAttribute("group") & "(this);"
  510. thisRow = thisRow & "'"
  511. thisRow = thisRow & ">"
  512. for each myOption in myKey.getElementsByTagName("option")
  513. thisRow = thisRow & "<option value='" & myOption.text & "'"
  514. if hasValue then
  515. if thisValue(0).text=myOption.text then thisRow = thisRow & " selected='selected' "
  516. end if
  517. if myOption.GetAttribute("price")<>"" then
  518. thisRow = thisRow & " price='" & myOption.GetAttribute("price") & "' "
  519. end if
  520. thisRow = thisRow & ">" & myOption.GetAttribute("label") & "</option>"
  521. next
  522. if hasValue then
  523. if left(thisValue(0).text,6)="other:" then
  524. thisRow = thisRow & "<option value='" & thisValue(0).text & "' selected='selected'>" & mid(thisValue(0).text,7) & "</option></select>"
  525. else
  526. thisRow = thisRow & "<option value='-1'></option></select>"
  527. end if
  528. else
  529. thisRow = thisRow & "<option value='-1'></option></select>"
  530. end if
  531. thisRow = thisRow & "<input type='text' name='" & thisName & "-addValue' onblur='addOther(this);'>"
  532. case "text"
  533. thisRow = thisRow & "<input " & disText & " type='text' class='myInput' size='" & myKey.text & "' name='" & thisName & "' "
  534. if myKey.GetAttribute("readonly")="yes" then thisRow =thisRow & " readonly='readonly' "
  535. if hasValue then
  536. thisRow = thisRow & "value='" & thisValue(0).text & "'"
  537. else
  538. if myKey.GetAttribute("default")<>"" then thisRow = thisRow & "value='" & myKey.GetAttribute("default") & "'"
  539. end if
  540. if myKey.GetAttribute("blur")="yes" then thisRow = thisRow & " onblur='calc_" & myKey.GetAttribute("group") & "(this);' "
  541. thisRow = thisRow & ">"
  542. case "textarea"
  543. thisRow = thisRow & "<textarea name='" & thisName & "' style='width:600px;' cols='" & myKey.text & "'>"
  544. if hasValue then thisRow = thisRow & thisValue(0).text
  545. thisRow = thisRow & "</textarea>"
  546. case "check"
  547. thisRow = thisRow & "<input type='checkbox' value='on-" & id & "' name='" & thisName & "' "
  548. if hasValue then
  549. if left(thisValue(0).text,2)="on" then thisRow = thisRow & "checked='checked'"
  550. else
  551. if myKey.text="checked" then thisRow = thisRow & "checked='checked'"
  552. end if
  553. if myKey.GetAttribute("blur")="yes" then thisRow = thisRow & " onclick='calc_" & myKey.GetAttribute("group") & "(this);' "
  554. if IsNumeric(myKey.GetAttribute("price")) then
  555. thisRow = thisRow & " price='" & myKey.GetAttribute("price") & "' "
  556. end if
  557. thisRow = thisRow & ">"
  558. case "radio":
  559. 'response.write hasValue
  560. thisRow = thisRow & "<input " & disText & " type='radio' value='" & myKey.text & "' name='" & thisName & "'"
  561. if hasValue then
  562. if myKey.text = thisValue(0).text then thisRow = thisRow & " checked='checked' "
  563. else
  564. if myKey.GetAttribute("default")="yes" then thisRow = thisRow & " checked='checked' "
  565. end if
  566. if myKey.GetAttribute("blur")="yes" then thisRow = thisRow & " onchange='calc_" & myKey.GetAttribute("group") & "(this);' "
  567. thisRow = thisRow & ">"
  568. end select
  569. if myKey.GetAttribute("force")="yes" then thisRow = thisRow & "<span style='color:red;margin:0 0 0 2px;padding:0;'>*</span>"
  570. oldGroup=thisGroup
  571. oldLabel=thisLabel
  572. oldID=id
  573. if myKey.GetAttribute("br")="yes" then thisRow = thisRow & "<br>"
  574. Next
  575. thisRow = thisRow & "</div></div>"
  576. next
  577. thisRow = thisRow & "<div id='extreArea" &Replace(key,"/","-")& "'></div>"
  578. response.write thisRow 'prependTo
  579. 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>"
  580. end sub
  581. oldTmp="---first---"
  582. for each tmp in typeProp.selectNodes("//key")
  583. if oldTmp<>tmp.parentNode.nodeName then
  584. oldTmp=tmp.parentNode.nodeName
  585. call showKeyEdit("/keys/" & oldTmp & "/key")
  586. end if
  587. next
  588. %>
  589. </td>
  590. </tr>
  591. <TR bgcolor="#CCCCCC">
  592. <TD colspan="6">
  593. <TABLE align="center" width="50%" border="0">
  594. <TR>
  595. <TD><INPUT TYPE="submit" Name="Submit" tabIndex="16" Value="" onFocus="noNextField=true;" onBlur="noNextField=false;" style="width:100px;"></TD>
  596. <TD>&nbsp;</TD>
  597. <TD align="left"><INPUT TYPE="button" Name="Cancel" tabIndex="17" Value="" style="width:100px;" onClick="window.location='orderEdit.asp';"></TD>
  598. </TR>
  599. </TABLE>
  600. <BR>
  601. <TABLE cellspacing=0 width=80% align=center>
  602. <TR bgcolor=white>
  603. <TD></TD>
  604. <TD></TD>
  605. <TD></TD>
  606. <TD></TD>
  607. <TD> </TD>
  608. </TR>
  609. <%
  610. set RS_STEP=Conn.Execute ("SELECT OrderTraceLog.*, Users.RealName FROM OrderTraceLog INNER JOIN Users ON OrderTraceLog.InsertedBy = Users.ID WHERE (OrderTraceLog.[Order] = "& radif & ") order by OrderTraceLog.ID")
  611. Do while not RS_STEP.eof
  612. %>
  613. <TR>
  614. <TD style="border-bottom: solid 1pt black" dir=ltr align=right><%=RS_STEP("InsertedDate")%> </TD>
  615. <TD style="border-bottom: solid 1pt black" dir=ltr align=right>(<%=RS_STEP("InsertedTime")%>)</TD>
  616. <TD style="border-bottom: solid 1pt black"><%=RS_STEP("StepText")%></TD>
  617. <TD style="border-bottom: solid 1pt black"><%=RS_STEP("StatusText")%></TD>
  618. <TD style="border-bottom: solid 1pt black"><%=RS_STEP("RealName")%></TD>
  619. </TR>
  620. <%
  621. RS_STEP.moveNext
  622. loop
  623. RS_STEP.close
  624. set RS_STEP = nothing
  625. %>
  626. </TABLE>
  627. </TD>
  628. </TR>
  629. </FORM>
  630. <SCRIPT LANGUAGE="JavaScript">
  631. <!--
  632. document.all.CompanyName.focus();
  633. var noNextField = false;
  634. function documentKeyDown() {
  635. var theKey = event.keyCode;
  636. var o = window.event.srcElement;
  637. if (theKey == 9) {
  638. if (noNextField) // Don't Move
  639. if(event.shiftKey){
  640. noNextField=false;
  641. event.keyCode=9
  642. }
  643. else
  644. return false;
  645. else { // send focus to next box
  646. if (false){
  647. }
  648. else if(o.name == 'Radif'){
  649. // Radif
  650. if (o.value.length<5){
  651. return false;
  652. }
  653. }
  654. else if(o.name == 'ReturnTime'){
  655. // Return Time
  656. var soutput = o.value;
  657. var len = o.value.length;
  658. if (len==0){
  659. return true;
  660. }
  661. else if (len==3){
  662. soutput = soutput + '00'
  663. o.value = soutput;
  664. }
  665. else if (len==4){
  666. var tempString =soutput.charAt(len-1);
  667. soutput = soutput.substring(0,len-1) + '0' + tempString
  668. o.value = soutput;
  669. }
  670. else if(len!=5)
  671. return false;
  672. }
  673. event.keyCode=9
  674. return true;
  675. }
  676. }
  677. }
  678. document.onkeydown = documentKeyDown;
  679. function checkValidation(){
  680. return true;
  681. }
  682. function selectCustomer(){
  683. document.all.tmpDlgArg.value="#"
  684. document.all.tmpDlgTxt.value=" :"
  685. window.showModalDialog('../dialog_GenInput.asp',document.all.tmpDlgTxt,'dialogHeight:200px; dialogWidth:440px; dialogTop:; dialogLeft:; edge:None; center:Yes; help:No; resizable:No; status:No;');
  686. if (document.all.tmpDlgTxt.value !="") {
  687. 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;');
  688. if (document.all.tmpDlgArg.value!="#"){
  689. Arguments=document.all.tmpDlgArg.value.split("#")
  690. theSpan=document.getElementById("customer");
  691. theSpan.getElementsByTagName("input")[0].value=Arguments[0];
  692. theSpan.getElementsByTagName("span")[0].innerText=Arguments[0]+" - "+Arguments[1];
  693. }
  694. }
  695. }
  696. //-->
  697. </SCRIPT>
  698. </TABLE>
  699. <br>
  700. </font>
  701. <!--#include file="tah.asp" -->