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