/beta/order/orderInput.asp

http://github.com/khaneh/Orders · ASP · 554 lines · 496 code · 22 blank · 36 comment · 70 complexity · 0593b8153523c8e3b6c8f2b943f5d890 MD5 · raw file

  1. <%@LANGUAGE="VBSCRIPT" CODEPAGE="1256"%><%
  2. 'Order (2)
  3. PageTitle=" "
  4. SubmenuItem=1
  5. if not Auth(2 , 1) then NotAllowdToViewThisPage()
  6. 'Copy from old trace/orderTraceInput.asp
  7. %>
  8. <!--#include file="top.asp" -->
  9. <!--#include File="../include_farsiDateHandling.asp"-->
  10. <!--#include File="../include_JS_InputMasks.asp"-->
  11. <style >
  12. .mySection{border: 1px #F90 dashed;margin: 15px 10px 0 15px;}
  13. .myRow{border: 2px #F05 dashed;margin: 10px 0 10px 0;padding: 0 3px 5px 0;}
  14. .exteraArea{border: 1px #33F dotted;margin: 5px 0 0 5px;padding: 0 3px 5px 0;}
  15. .myLabel {margin: 0 3px 0 0;white-space: nowrap;}
  16. .myProp {font-weight: bold;color: #40F; margin: 0 3px 0 3px;}
  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. if request("act")="submitsearch" then
  23. if isnumeric(request("CustomerNameSearchBox")) then
  24. conn.close
  25. response.redirect "?act=getorder&selectedCustomer=" & request("CustomerNameSearchBox")
  26. elseif request("CustomerNameSearchBox") <> "" then
  27. SA_TitleOrName=request("CustomerNameSearchBox")
  28. mySQL="SELECT * FROM Accounts WHERE (REPLACE(AccountTitle, ' ', '') LIKE REPLACE(N'%"& sqlSafe(SA_TitleOrName) & "%', ' ', '') ) ORDER BY AccountTitle"
  29. Set RS1 = conn.Execute(mySQL)
  30. if (RS1.eof) then
  31. conn.close
  32. response.redirect "?errmsg=" & Server.URLEncode(" .<br><a href='../CRM/AccountEdit.asp?act=getAccount'> Ͽ</a>")
  33. end if
  34. SA_TitleOrName=request("CustomerNameSearchBox")
  35. SA_Action="return true;"
  36. SA_SearchAgainURL="OrderInput.asp"
  37. SA_StepText=" : "
  38. %>
  39. <br>
  40. <FORM METHOD=POST ACTION="?act=getType">
  41. <!--#include File="../AR/include_SelectAccount.asp"-->
  42. </FORM>
  43. <%
  44. end if
  45. elseif Request.QueryString("act")="getType" then
  46. customerID=request("selectedCustomer")
  47. mySQL="SELECT * FROM Accounts WHERE (ID='"& CustomerID & "')"
  48. Set RS1 = conn.Execute(mySQL)
  49. if (RS1.eof) then
  50. conn.close
  51. response.redirect "?errmsg=" & Server.URLEncode(" .<br><a href='../CRM/AccountEdit.asp?act=getAccount'> Ͽ</a>")
  52. end if
  53. 'if (cdbl(rs1("arBalance"))+cdbl(rs1("apBalance"))+cdbl(rs1("aoBalance"))+cdbl(rs1("creditLimit")) < 0) then
  54. if (cdbl(rs1("arBalance"))+cdbl(rs1("creditLimit")) < 0) then
  55. conn.close
  56. response.redirect "?errmsg=" & Server.URLEncode(" <br> с .<br><a href='../CRM/AccountInfo.asp?act=show&selectedCustomer=" & CustomerID & "'> </a>")
  57. end if
  58. %>
  59. <br>
  60. <div dir='rtl'>
  61. <B> : </B>
  62. </div>
  63. <form method="post" action="?act=getorder">
  64. <input name="selectedCustomer" type="hidden" value="<%=customerID%>">
  65. <SELECT NAME="OrderType" style='font-family: tahoma,arial ; font-size: 9pt; font-weight: bold; width: 100px' tabIndex="7">
  66. <OPTION value="-1" style='color:red;'> </option>
  67. <%
  68. 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")
  69. defaultOrderType=RS2("DefaultOrderType")
  70. RS2.close
  71. Set RS2 = Nothing
  72. set RS_TYPE=Conn.Execute ("SELECT ID, Name FROM OrderTraceTypes WHERE (IsActive=1) ORDER BY ID")
  73. Do while not RS_TYPE.eof
  74. %>
  75. <OPTION value="<%=RS_TYPE("ID")%>" <%if RS_TYPE("ID")=defaultOrderType then response.write "selected"%>><%=RS_TYPE("Name")%></option>
  76. <%
  77. RS_TYPE.moveNext
  78. loop
  79. RS_TYPE.close
  80. set RS_TYPE = nothing
  81. %>
  82. </SELECT>
  83. <input type="submit" value="">
  84. </form>
  85. <%
  86. elseif request("act")="getorder" then
  87. customerID=request("selectedCustomer")
  88. mySQL="SELECT * FROM Accounts WHERE (ID='"& CustomerID & "')"
  89. Set RS1 = conn.Execute(mySQL)
  90. if (RS1.eof) then
  91. conn.close
  92. response.redirect "?errmsg=" & Server.URLEncode(" .<br><a href='..//CRM/AccountEdit.asp?act=getAccount'> Ͽ</a>")
  93. end if
  94. AccountNo=RS1("ID")
  95. AccountTitle=RS1("AccountTitle")
  96. companyName=RS1("CompanyName")
  97. customerName=RS1("Dear1")& " " & RS1("FirstName1")& " " & RS1("LastName1")
  98. Tel=RS1("Tel1")
  99. set rs=Conn.Execute("select * from OrderTraceTypes where id=" & request("orderType"))
  100. if rs.eof then
  101. conn.close
  102. response.redirect "?errmsg=" & server.urlEncode(" ")
  103. end if
  104. orderTypeID=rs("id")
  105. orderTypeName=rs("name")
  106. set orderProp = server.createobject("MSXML2.DomDocument")
  107. hasProperty=false
  108. if rs("property")<>"" then
  109. orderProp.loadXML(rs("property"))
  110. hasProperty=true
  111. end if
  112. rs.close
  113. set rs=nothing
  114. creationDate=shamsiToday()
  115. creationTime=time
  116. creationTime=Hour(creationTime)&":"&Minute(creationTime)
  117. if instr(creationTime,":")<3 then creationTime="0" & creationTime
  118. if len(creationTime)<5 then creationTime=Left(creationTime,3) & "0" & Right(creationTime,1)
  119. %>
  120. <br>
  121. <div dir='rtl'><B> : </B>
  122. </div>
  123. <br>
  124. <!-- -->
  125. <hr>
  126. <TABLE border="0" cellspacing="0" cellpadding="2" dir="RTL" width="700" align="center">
  127. <FORM METHOD=POST ACTION="?act=submitorder" onSubmit="return checkValidation();">
  128. <TR bgcolor="black">
  129. <TD align="left"><FONT COLOR="YELLOW">:</FONT></TD>
  130. <TD align="right" colspan=3 height="25px">
  131. <FONT COLOR="YELLOW"><%=customerID & " - "& AccountTitle%></FONT>
  132. <INPUT TYPE="hidden" NAME="customerID" value="<%=customerID%>">
  133. </TD>
  134. <td align="left"><font color="yellow"> :</font></td>
  135. <td>
  136. <font color="red"><b><%=orderTypeName%></b></font>
  137. <input type="hidden" name="orderType" value="<%=orderTypeID%>">
  138. </td>
  139. </TR>
  140. <TR bgcolor="black">
  141. <TD align="left"><FONT COLOR="YELLOW"> :</FONT></TD>
  142. <TD align="right">
  143. <!-- Radif -->
  144. <INPUT disabled TYPE="text" NAME="Radif" maxlength="6" size="8" tabIndex="1" dir="LTR" value="######">
  145. </TD>
  146. <TD align="left"><FONT COLOR="YELLOW">:</FONT></TD>
  147. <TD><TABLE border="0">
  148. <TR>
  149. <TD dir="LTR">
  150. <INPUT disabled TYPE="text" maxlength="10" size="10" value="<%=CreationDate%>">
  151. <INPUT TYPE="hidden" NAME="OrderDate" value="<%=CreationDate%>">
  152. </TD>
  153. <TD dir="RTL"><FONT COLOR="YELLOW"><%=weekdayname(weekday(date))%></FONT></TD>
  154. </TR>
  155. </TABLE></TD>
  156. <TD align="left"><FONT COLOR="YELLOW">:</FONT></TD>
  157. <TD align="right">
  158. <INPUT disabled TYPE="text" maxlength="5" size="3" dir="LTR" value="<%=creationTime%>">
  159. <INPUT TYPE="hidden" NAME="OrderTime" value="<%=creationTime%>"></TD>
  160. </TR>
  161. <TR bgcolor="#CCCCCC">
  162. <TD align="left"> :</TD>
  163. <TD align="right">
  164. <!-- CompanyName -->
  165. <INPUT TYPE="text" NAME="CompanyName" maxlength="50" size="25" tabIndex="2" value="<%=companyName%>">
  166. </TD>
  167. <TD></TD>
  168. <TD align="left">
  169. <span> !</span>
  170. <input name="returnDateNull" type="checkbox">
  171. </td>
  172. <TD title=" Ρ !" align="left"> :</TD>
  173. <TD>
  174. <TABLE border="0">
  175. <TR>
  176. <TD dir="LTR">
  177. <INPUT TYPE="text" NAME="ReturnDate" onblur="acceptDate(this)" maxlength="10" size="10" >
  178. </TD>
  179. <TD dir="RTL">(?)</TD>
  180. </TR>
  181. </TABLE>
  182. </TD>
  183. </TR>
  184. <TR bgcolor="#CCCCCC">
  185. <TD align="left"> :</TD>
  186. <TD align="right">
  187. <!-- CustomerName -->
  188. <INPUT TYPE="text" NAME="CustomerName" maxlength="50" size="25" tabIndex="3" value="<%=customerName%>">
  189. </TD>
  190. <TD align="left">:</TD>
  191. <TD align="right">
  192. <!-- Telephone -->
  193. <INPUT TYPE="text" NAME="Telephone" maxlength="50" size="25" tabIndex="4" value="<%=Tel%>">
  194. </TD>
  195. <TD align="left"> :</TD>
  196. <TD align="right">
  197. <INPUT TYPE="text" NAME="ReturnTime" maxlength="5" size="3" dir="LTR" onKeyPress="return maskTime(this);" >
  198. </TD>
  199. </TR>
  200. <TR bgcolor="#CCCCCC">
  201. <td align="left">:</td>
  202. <td>
  203. <input type="text" name="paperSize" tabindex="6">
  204. </td>
  205. <td align="left">ǎ:</td>
  206. <td>
  207. <input type="text" name="qtty" tabindex="7">
  208. </td>
  209. <td align="left"> :</td>
  210. <td colspan="3">
  211. <input type="text" name="totalPrice" id='totalPrice' style="background-color:#FED;border-width:0;" <%if hasProperty then response.write " readonly='readonly' "%> tabindex="8">
  212. </td>
  213. </TR>
  214. <TR bgcolor="#CCCCCC">
  215. <TD align="left"> :</TD>
  216. <TD align="right" colspan="3">
  217. <INPUT TYPE="text" NAME="OrderTitle" maxlength="255" size="50" tabIndex="9">
  218. </TD>
  219. <TD align="left"> :</TD>
  220. <TD>
  221. <INPUT Type="Text" readonly NAME="SalesPerson" value="<%=CSRName%>" style='font-family: tahoma,arial ; font-size: 9pt; font-weight: bold; width: 100px' tabIndex="888">
  222. </TD>
  223. </TR>
  224. <TR bgcolor="#CCCCCC">
  225. <TD colspan="6" height="30px">&nbsp;</TD>
  226. </TR>
  227. <tr bgcolor="#CCCCCC">
  228. <td colspan="6">
  229. <%
  230. if hasProperty then
  231. sub fetchKeys(key)
  232. oldGroup="---first---"
  233. oldLabel="---first---"
  234. thisRow="<div class='myRow'>"
  235. thisRow = thisRow & "<input type='hidden' value='0' id='" & Replace(key,"/","-") & "-maxID'>"
  236. thisRow = thisRow & "<div class='exteraArea' id='" & Replace(key,"/","-") & "-0'>"
  237. ' thisRow = thisRow & "<img title=' ' src='/images/cancelled.gif' onclick='$(""#" & Replace(key,"/","-") & "-0"").remove();'>"
  238. ' thisRow = thisRow & "<img title=' ' src='/images/cancelled.gif' onclick='$(this).parent().remove();'>"
  239. For Each myKey In orderProp.SelectNodes(key)
  240. thisType = myKey.GetAttribute("type")
  241. thisName = myKey.GetAttribute("name")
  242. thisLabel= myKey.GetAttribute("label")
  243. thisGroup= myKey.GetAttribute("group")
  244. 'response.write thisName & ": " & thisLabel &"(" &thisType& ")" & "<br>"
  245. if (oldGroup<>thisGroup and oldGroup <> "---first---") then thisRow = thisRow & "</div>"
  246. if oldGroup<>thisGroup then
  247. thisRow = thisRow & "<div class='mySection' groupName='" & thisGroup & "'>"
  248. if myKey.GetAttribute("disable")="1" then
  249. thisRow = thisRow & "<input type='checkbox' value='0' name='" & thisGroup & "-disBtn' onclick='disGroup(this);"
  250. if myKey.GetAttribute("blur")="yes" then thisRow = thisRow & " calc_" & myKey.GetAttribute("group") & "(this);"
  251. thisRow = thisRow & "'>"
  252. disText=" disabled='disabled' "
  253. else
  254. disText=""
  255. end if
  256. end if
  257. if oldLabel<>thisLabel then thisRow = thisRow & "<label class='myLabel'>" & thisLabel & "</label>"
  258. select case thisType
  259. case "option"
  260. thisRow = thisRow & "<select " & disText & " style='margin:0;padding:0;' name='" & thisName & "'"
  261. if myKey.GetAttribute("blur")="yes" then thisRow = thisRow & " onchange='calc_" & myKey.GetAttribute("group") & "(this);' "
  262. thisRow = thisRow & ">"
  263. for each myOption in myKey.getElementsByTagName("option")
  264. thisRow = thisRow & "<option value='" & myOption.text & "'"
  265. if myOption.GetAttribute("price")<>"" then
  266. thisRow = thisRow & " price='" & myOption.GetAttribute("price") & "' "
  267. end if
  268. thisRow = thisRow &">" & myOption.GetAttribute("label") & "</option>"
  269. next
  270. thisRow = thisRow & "</select>"
  271. case "option-other"
  272. thisRow = thisRow & "<select " & disText & " style='margin:0;padding:0;' name='" & thisName & "' onchange='checkOther(this);"
  273. if myKey.GetAttribute("blur")="yes" then thisRow = thisRow & " calc_" & myKey.GetAttribute("group") & "(this);"
  274. thisRow = thisRow & "'>"
  275. for each myOption in myKey.getElementsByTagName("option")
  276. thisRow = thisRow & "<option value='" & myOption.text & "'"
  277. if myOption.GetAttribute("price")<>"" then
  278. thisRow = thisRow & " price='" & myOption.GetAttribute("price") & "' "
  279. end if
  280. thisRow = thisRow & ">" & myOption.GetAttribute("label") & "</option>"
  281. next
  282. thisRow = thisRow & "<option value='-1'></option></select>"
  283. thisRow = thisRow & "<input type='text' name='" &thisName & "-addValue' onblur='addOther(this);'>"
  284. case "text"
  285. thisRow = thisRow & "<input " & disText & " type='text' class='myInput' size='" & myKey.text & "' name='" & thisName & "' "
  286. if myKey.GetAttribute("readonly")="yes" then thisRow =thisRow & " readonly='readonly' "
  287. if myKey.GetAttribute("default")<>"" then thisRow = thisRow & "value='" & myKey.GetAttribute("default") & "'"
  288. if myKey.GetAttribute("blur")="yes" then thisRow = thisRow & " onblur='calc_" & myKey.GetAttribute("group") & "(this);' "
  289. thisRow = thisRow & ">"
  290. case "text area"
  291. thisRow = thisRow & "<textarea name='" & thisName & "' style='width:600px;' cols='" & myKey.text & "'></textarea>"
  292. case "check"
  293. thisRow = thisRow & "<input type='checkbox' value='on-0' name='" & thisName & "' "
  294. if myKey.text="checked" then thisRow = thisRow & "checked='checked'"
  295. if myKey.GetAttribute("blur")="yes" then thisRow = thisRow & " onclick='calc_" & myKey.GetAttribute("group") & "(this);' "
  296. if IsNumeric(myKey.GetAttribute("price")) then thisRow = thisRow & " price='" & myKey.GetAttribute("price") & "' "
  297. thisRow = thisRow & ">"
  298. case "radio":
  299. thisRow = thisRow & "<input " & disText & " type='radio' value='" & myKey.text & "' name='" & thisName & "'"
  300. if myKey.GetAttribute("default")="yes" then thisRow = thisRow & " checked='checked' "
  301. if myKey.GetAttribute("blur")="yes" then thisRow = thisRow & " onchange='calc_" & myKey.GetAttribute("group") & "(this);' "
  302. thisRow = thisRow & ">"
  303. end select
  304. if myKey.GetAttribute("force")="yes" then thisRow = thisRow & "<span style='color:red;margin:0 0 0 2px;padding:0;'>*</span>"
  305. oldGroup=thisGroup
  306. oldLabel=thisLabel
  307. if myKey.GetAttribute("br")="yes" then thisRow = thisRow & "<br>"
  308. Next
  309. thisRow = thisRow & "</div></div><div id='extreArea" &Replace(key,"/","-")& "'></div>"
  310. response.write thisRow 'prependTo
  311. 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>"
  312. end sub
  313. oldTmp="---first---"
  314. for each tmp in orderProp.selectNodes("//key")
  315. if oldTmp<>tmp.parentNode.nodeName then
  316. oldTmp=tmp.parentNode.nodeName
  317. call fetchKeys("/keys/" & oldTmp & "/key")
  318. end if
  319. next
  320. ' call fetchKeys("/keys/printing/key")
  321. ' call fetchKeys("keys/binding/key")
  322. ' call fetchKeys("keys/service/key")
  323. ' call fetchKeys("keys/delivery/key")
  324. end if
  325. %>
  326. </td>
  327. </tr>
  328. <TR bgcolor="#CCCCCC">
  329. <TD colspan="6">
  330. <TABLE align="center" width="50%" border="0">
  331. <TR>
  332. <TD><INPUT TYPE="submit" Name="Submit" Value="" style="width:100px;" tabIndex="14"></TD>
  333. <TD><INPUT TYPE="hidden" NAME="Price" maxlength="10" size="9" dir="LTR" tabIndex="13" value="">&nbsp;</TD>
  334. <TD align="left"><INPUT TYPE="button" Name="Cancel" Value="" style="width:100px;" onClick="window.location='OrderInput.asp';" tabIndex="15"></TD>
  335. </TR>
  336. </TABLE>
  337. </TD>
  338. </TR>
  339. </FORM>
  340. </TABLE>
  341. <script type="text/javascript" src="/js/jquery-1.7.min.js"></script>
  342. <script type="text/javascript" src="calcOrder.js"></script>
  343. <SCRIPT LANGUAGE="JavaScript">
  344. <!--
  345. function checkValidation(){
  346. //TRIM : str = str.replace(/^\s*|\s*$/g,"");
  347. if(document.all.CustomerName.value.replace(/^\s*|\s*$/g,'') == ''){
  348. alert(" ")
  349. document.all.CustomerName.focus();
  350. return false;
  351. }
  352. else if(document.all.SalesPerson.value.replace(/^\s*|\s*$/g,"") == ''){
  353. alert(" ")
  354. document.all.SalesPerson.focus();
  355. return false;
  356. }
  357. else if(document.all.ReturnDate.value.replace(/^\s*|\s*$/g,'') == '' && !document.all.returnDateNull.checked){
  358. alert(" ")
  359. document.all.ReturnDate.focus();
  360. return false;
  361. }
  362. else if(document.all.ReturnTime.value.replace(/^\s*|\s*$/g,'') == '' && !document.all.returnDateNull.checked){
  363. alert(" () ")
  364. document.all.ReturnTime.focus();
  365. return false;
  366. }
  367. else if(document.all.OrderTitle.value.replace(/^\s*|\s*$/g,'') == ''){
  368. alert(" ")
  369. document.all.OrderTitle.focus();
  370. return false;
  371. }
  372. else if(document.all.paperSize.value.replace(/^\s*|\s*$/g,'') == ''){
  373. alert(" ")
  374. document.all.paperSize.focus();
  375. return false;
  376. }
  377. else if(document.all.qtty.value.replace(/^\s*|\s*$/g,'') == ''){
  378. alert("ǎ ")
  379. document.all.qtty.focus();
  380. return false;
  381. }
  382. else{
  383. document.all.Submit.disabled=true;
  384. return true;
  385. }
  386. }
  387. document.all.CompanyName.focus();
  388. //-->
  389. </SCRIPT>
  390. <%elseif request("act")="submitorder" then
  391. CreationDate=shamsiToday()
  392. CustomerID=request.form("CustomerID")
  393. if CustomerID="" OR not isNumeric(CustomerID) then
  394. conn.close
  395. response.redirect "?act=getorder&selectedCustomer=" & CustomerID & "&errMsg=" & Server.URLEncode(" <br> ...<BR>")
  396. end if
  397. ' TraceID=request.form("radif")
  398. '
  399. ' if TraceID="" OR not isNumeric(TraceID) then
  400. ' conn.close
  401. ' response.redirect "?act=getorder&selectedCustomer=" & CustomerID & "&errMsg=" & Server.URLEncode(" <br> ...<BR>")
  402. ' end if
  403. '
  404. ' set RS1=Conn.Execute ("SELECT * FROM Orders WHERE (ID='"& TraceID & "')")
  405. ' if not RS1.eof then
  406. ' conn.close
  407. ' response.redirect "?act=getorder&selectedCustomer=" & CustomerID & "&errMsg=" & Server.URLEncode(" <br> ...<BR>")
  408. ' end if
  409. ' RS1.close
  410. orderType=request.form("OrderType")
  411. if orderType="" OR not isNumeric(OrderType) then
  412. conn.close
  413. response.redirect "?act=getorder&selectedCustomer=" & CustomerID & "&errMsg=" & Server.URLEncode(" <br> ...<BR>")
  414. end if
  415. set rs=Conn.Execute("select * from OrderTraceTypes where id=" & orderType)
  416. if rs.eof then
  417. conn.close
  418. response.redirect "?errmsg=" & server.urlEncode(" ")
  419. end if
  420. set RS1=Conn.Execute ("SELECT Name FROM OrderTraceTypes WHERE (ID='"& orderType & "') AND (IsActive=1)")
  421. if RS1.eof then
  422. conn.close
  423. response.redirect "?act=getorder&selectedCustomer=" & CustomerID & "&errMsg=" & Server.URLEncode(" <br> ...<BR>")
  424. else
  425. orderTypeName=RS1("Name")
  426. end if
  427. RS1.close
  428. '----------------------------------------------------------------------------
  429. '----------------------------------------------------------------------------
  430. '----------------------------------------------------------------------------
  431. orderTypeID=rs("id")
  432. orderTypeName=rs("name")
  433. set orderProp = server.createobject("MSXML2.DomDocument")
  434. if rs("property")<>"" then
  435. orderProp.loadXML(rs("property"))
  436. myXML = fetchKeyValues()
  437. end if
  438. rs.close
  439. set rs=nothing
  440. function fetchKeyValues()
  441. key="---first---"
  442. thisRow="<?xml version=""1.0""?><keys>"
  443. for each tmp in orderProp.selectNodes("//key")
  444. if key<>tmp.parentNode.nodeName then
  445. key=tmp.parentNode.nodeName
  446. thisRow = thisRow & "<" & key & ">"
  447. hasValue=0
  448. For Each myKey In orderProp.SelectNodes("/keys/" & key & "/key")
  449. thisName = myKey.GetAttribute("name")
  450. thisGroup= myKey.GetAttribute("group")
  451. id=0
  452. ' response.write oldName& "<br>"
  453. if thisName<>oldName then
  454. for each value in request.form(thisName)
  455. if value <> "" then
  456. thisRow = thisRow & "<key name=""" & thisName & """ id="""
  457. select case myKey.GetAttribute("type")
  458. case "check"
  459. thisRow = thisRow & mid(value,4)
  460. case else
  461. if request.form(thisGroup & "-disBtn")<>"" then
  462. thisRow = thisRow & trim(split(request.form(thisGroup & "-disBtn"),",")(id))
  463. else
  464. thisRow = thisRow & id
  465. end if
  466. end select
  467. thisRow = thisRow & """>" & value & "</key>"
  468. hasValue=hasValue +1
  469. end if
  470. id=id+1
  471. next
  472. end if
  473. oldName = thisName
  474. Next
  475. if hasValue>0 then
  476. thisRow = thisRow & "</" & key & ">"
  477. else
  478. thisRow = Replace(thisRow,"<" & key & ">","")
  479. end if
  480. end if
  481. Next
  482. thisRow = thisRow & "</keys>"
  483. fetchKeyValues = thisRow
  484. 'response.write thisRow
  485. 'response.end
  486. end function
  487. mySQL="INSERT INTO Orders (CreatedDate, CreatedBy, Customer) VALUES ('"& CreationDate & "', '"& session("ID") & "', '"& CustomerID & "');SELECT @@Identity AS NewOrder"
  488. set RS1 = Conn.execute(mySQL).NextRecordSet
  489. OrderID = RS1 ("NewOrder")
  490. RS1.close
  491. '--------------------------------SAM-----------------------------------------
  492. 'dim fs,f
  493. 'set fs = Server.CreateObject("Scripting.FileSystemObject")
  494. 'set f = fs.CreateFolder("d:\OrdersStorage\" & cstr(OrderID))
  495. 'set f = nothing
  496. 'set fs = nothing
  497. '----------------------------------------------------------------------------
  498. qtty = 0
  499. if IsNumeric(request.form("qtty")) then
  500. qtty = cdbl(request.form("qtty"))
  501. end if
  502. ReturnDate = "null"
  503. ReturnTime = "null"
  504. if request.form("actualReturn_date")<>"" then actualReturn_date = "'" & request.form("actualReturn_date") & "'"
  505. if request.form("ReturnDate")<>"" then ReturnDate = "'" & request.form("ReturnDate") & "'"
  506. if request.form("ReturnDate")<>"" then ReturnTime = "'" & request.form("ReturnTime") & "'"
  507. mySQL="INSERT INTO orders_trace (radif_sefareshat, 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,property,qtty,paperSize,price) VALUES ('"&_
  508. OrderID & "', N'"& sqlSafe(request.form("OrderDate")) & "', "& ReturnTime & ", "& 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' ', N' ', N'"& sqlSafe(request.form("SalesPerson")) & "', 1, 1, N'"& CreationDate & "', N'"& currentTime10() & "', "& session("ID") & " ,N'" & myXML& "'," & qtty & ",'" & request.form("paperSize") & "','" & request.form("totalPrice") & "')"
  509. response.write mySQL
  510. conn.Execute(mySQL)
  511. conn.close
  512. response.redirect "../order/TraceOrder.asp?act=show&order=" & OrderID & "&msg=" & Server.URLEncode(" ")
  513. else%>
  514. <!-- -->
  515. <br>
  516. <FORM METHOD=POST ACTION="?act=submitsearch" onsubmit="if (document.all.CustomerNameSearchBox.value=='') return false;">
  517. <div dir='rtl'><B> : </B>
  518. <INPUT TYPE="text" NAME="CustomerNameSearchBox">&nbsp;
  519. <INPUT TYPE="submit" value=""><br>
  520. </div>
  521. </FORM>
  522. <SCRIPT LANGUAGE="JavaScript">
  523. <!--
  524. document.all.CustomerNameSearchBox.focus();
  525. //-->
  526. </SCRIPT>
  527. <%
  528. end if
  529. conn.Close
  530. %>
  531. </font>
  532. <!--#include file="tah.asp" -->