/beta/purchase/outServiceTrace.asp

http://github.com/khaneh/Orders · ASP · 666 lines · 571 code · 47 blank · 48 comment · 89 complexity · c1a6b21ea4d6ba6fb6128f542146ff3b MD5 · raw file

  1. <%@LANGUAGE="VBSCRIPT" CODEPAGE="1256"%><%
  2. 'Response.Buffer = False
  3. 'Purchase (4)
  4. PageTitle=" "
  5. SubmenuItem=4
  6. if not Auth(4 , 4) then NotAllowdToViewThisPage()
  7. 'OutService Page Trace
  8. 'By Alix - Last changed: 81/01/13
  9. 'By Alix - Last changed: 83/12/06 - Enable changing related order (job) of this purchase order
  10. %>
  11. <!--#include file="top.asp" -->
  12. <!--#include File="../include_farsiDateHandling.asp"-->
  13. <!--#include File="../include_JS_InputMasks.asp"-->
  14. <!--#include File="../include_UtilFunctions.asp"-->
  15. <SCRIPT LANGUAGE="JavaScript">
  16. <!--
  17. function edit_order_id(reqID) {
  18. tmp = document.getElementById("orderID_span").innerText
  19. document.getElementById("orderID_span").innerHTML="<INPUT id='orderID_edit_field' style='border:0pt; width:40pt' Type='text' value='"+tmp+"'> <input type='hidden' id='ireqID' value='"+reqID+"'>"
  20. document.getElementById("orderID_edit_field").select()
  21. document.getElementById("dokme_sabt").innerHTML=' &nbsp;<A HREF="javascript:xmlsend(\'RelatedOrder\',\'ireqID\',\'orderID_edit_field\')">[]</A>'
  22. }
  23. function edit_purchase_price(reqID) {
  24. tmp = document.getElementById("purchase_price").innerText;
  25. document.getElementById("purchase_price").innerHTML="<input id='purchase_price_value' style='border:0pt; width:40pt' Type='text' value='"+tmp+"'> <input type='hidden' id='purchaseID' value='"+reqID+"'>";
  26. document.getElementById("purchase_price_value").select();
  27. document.getElementById("purchase_price_submit").innerHTML=" &nbsp;<A HREF='javascript:xmlsend(\"PurchasePrice\",\"purchaseID\",\"purchase_price_value\")'>[]</A>";
  28. }
  29. function xmlsend(myFile,myID,myValue) {
  30. url = "/beta/purchase/XMLchange" + myFile + ".asp?value=" + document.getElementById(myValue).value + "&id="+ document.getElementById(myID).value;
  31. if (window.XMLHttpRequest) {
  32. var xmldoc=new XMLHttpRequest();
  33. } else if (window.ActiveXObject) {
  34. var xmldoc = new ActiveXObject("Microsoft.XMLHTTP");
  35. }
  36. //objHTTP.open('GET',url,false)
  37. //objHTTP.send()
  38. //tmpStr = unescape(objHTTP.responseText)
  39. document.getElementsByTagName('body')[0].style.cursor = 'wait';
  40. url = url + "&<%=currentTime10()%>";
  41. xmldoc.open('GET',url,false);
  42. xmldoc.setRequestHeader("Cache-Control","no-cache");
  43. try {xmldoc.send(valval);} catch (e) {xmldoc.send();}
  44. {
  45. //alert(xmldoc.status);
  46. if (xmldoc.readyState==4)
  47. {
  48. document.getElementsByTagName('body')[0].style.cursor = 'auto';
  49. returnobj = xmldoc.responseText;
  50. }
  51. if (returnobj=="ok")
  52. {
  53. document.getElementById("orderID_span").innerHTML="<a href='../shopfloor/manageOrder.asp?radif="+document.getElementById(myID).value+"'>"+document.getElementById(myID).value+"</a>";
  54. document.getElementById("dokme_sabt").innerHTML="";
  55. //alert(returnobj)
  56. //document.getElementById()
  57. } else {alert(" ")};
  58. };
  59. }
  60. //-->
  61. </SCRIPT>
  62. <%
  63. if request("act")="search" then
  64. %>
  65. <br>
  66. <FORM METHOD=POST ACTION="?act=select" onsubmit="if (document.all.search.value=='') return false;">
  67. <div dir='rtl'><B> : </B>
  68. <INPUT TYPE="text" NAME="search">&nbsp;
  69. <INPUT TYPE="submit" value=""><br>
  70. <input type="hidden" name="id" value="<%=request("id")%>"
  71. </div>
  72. </FORM>
  73. <SCRIPT type="text/javascript">
  74. document.all.search.focus();
  75. </SCRIPT>
  76. <%
  77. response.end
  78. elseif request("act")="select" then
  79. if request("search") <> "" then
  80. SA_TitleOrName=request("search")
  81. SA_Action="return true;"
  82. 'SA_Action="return selectOperations();"
  83. SA_SearchAgainURL="voucherInput.asp"
  84. SA_StepText="" '" : "
  85. SA_ActName = "select"
  86. SA_SearchBox ="search"
  87. SA_IsVendor = 1
  88. %>
  89. <FORM METHOD=POST ACTION="?act=check">
  90. <input type="hidden" name="id" value="<%=request("id")%>">
  91. <!--#include File="../AR/include_SelectAccount.asp"-->
  92. </FORM>
  93. <%
  94. response.end
  95. end if
  96. elseif request("act")="check" then
  97. PurchaseOrderID=request("id")
  98. vendorID=request("selectedCustomer")
  99. set rs = Conn.Execute("select * from PurchaseOrders where id=" & PurchaseOrderID)
  100. oldVendorID = rs("vendor_ID")
  101. PurchaseOrder = rs("typeName") & "(" & rs("comment") & ")"
  102. set rs= Conn.Execute("select * from accounts where id=" & oldVendorID)
  103. oldAccountTitle = rs("accountTitle") & "(" & rs("id") & ")"
  104. set rs= Conn.Execute("select * from accounts where id=" & vendorID)
  105. newAccountTitle = rs("accountTitle") & "(" & rs("id") & ")"
  106. %>
  107. <br>
  108. <span> </span><b><%=PurchaseOrder%></b><br>
  109. <span> : </span><%=oldAccountTitle%><br>
  110. <span> : </span><B><%=newAccountTitle%></B>
  111. <span> Ͽ</span><br><br>
  112. <form method=post action="?act=change">
  113. <input type="hidden" name="PurchaseOrderID" value="<%=PurchaseOrderID%>">
  114. <input type="hidden" name="vendorID" value="<%=vendorID%>">
  115. <input type="submit" name="ok" value="">
  116. <input type="button" value="" onclick="window.location='?od=<%=PurchaseOrderID%>';"/>
  117. </form>
  118. <%
  119. response.end
  120. elseif request("act")="change" then
  121. Conn.Execute ("update PurchaseOrders set vendor_ID=" & request("vendorID") & " where id=" & request("PurchaseOrderID"))
  122. response.redirect "?od=" & request("PurchaseOrderID")
  123. end if
  124. '-----------------------------------------------------------------------------------------------------
  125. '-------------------------------------------------------------------- Remove Relation to Inventory Log
  126. '---------------------------------------------------------------------------------------84-10-18-Alix-
  127. if request("removeRelation")="yes" then
  128. invLogID = request("invLogID")
  129. ordID = request("ordID")
  130. newComment = "( " & ordID & " " & shamsitoday() & " " & session("CSRName") & ")"
  131. Conn.Execute ("update InventoryLog set relatedID=-1, comments = comments + N'" & newComment & "' where id=" &invLogID & "")
  132. response.write "<br>"
  133. alertMsg = " " & ordID & " " & invLogID & " " & shamsitoday() & " "
  134. 'call showAlert( alertMsg , CONST_MSG_INFORM)
  135. response.redirect "outServiceTrace.asp?od=" & ordID & "&msg=" & alertMsg
  136. end if
  137. '-----------------------------------------------------------------------------------------------------
  138. '------------------------------------------------------------------ Show an Out Service Order's detail
  139. '-----------------------------------------------------------------------------------------------------
  140. if request("od")<>"" then
  141. ordID=request("od")
  142. set RSOD=Conn.Execute ("SELECT * FROM purchaseOrders WHERE id = "& ordID )
  143. if not RSOD.eof then
  144. VendorID=RSOD("Vendor_ID")
  145. comment=RSOD("comment")
  146. otypeName=RSOD("TypeName")
  147. TypeID=RSOD("TypeID")
  148. Price=RSOD("Price")
  149. status=RSOD("status")
  150. printed=RSOD("printed")
  151. qtty=RSOD("qtty")
  152. HasVoucher=RSOD("HasVoucher")
  153. %><br>
  154. <center><h2> </h2>
  155. : <%=ordID%>
  156. </center>
  157. <TABLE dir=rtl align=center width=680>
  158. <TR bgcolor="#CCCCCC">
  159. <TD width=50%>
  160. <li> : <%=otypeName%><br>
  161. <li>: <%
  162. if auth(4,7) then
  163. %>
  164. <span id='purchase_price'><%=price%></span>
  165. <span id='purchase_price_submit'>
  166. &nbsp;<A HREF="javascript:edit_purchase_price(<%=ordID%>)">[]</A>
  167. </span>
  168. <%
  169. else
  170. response.write Price
  171. end if
  172. %>
  173. <br>
  174. <li>: <%=qtty%><br>
  175. <li>: <%=comment%><br>
  176. <li>: <%=status%><br>
  177. <%
  178. '===================================================
  179. ' show voucher, if exists
  180. '===================================================
  181. set RSV=Conn.Execute ("SELECT Vouchers.verified, Vouchers.id, Vouchers.paid FROM Vouchers INNER JOIN VoucherLines ON Vouchers.id = VoucherLines.Voucher_ID WHERE (VoucherLines.RelatedPurchaseOrderID = "& ordID & ") AND voided=0")
  182. if not RSV.eof then
  183. response.write "<hR>"
  184. 'linkto = "verify"
  185. 'if not RSV("verified")=0 and RSV("paid")=0 then
  186. ' linkto = "payment"
  187. 'end if
  188. response.write " "
  189. response.write "<A target='_blank' HREF='../AP/AccountReport.asp?act=showVoucher&voucher="& RSV("ID") & "'> " & RSV("ID") & " </A>"
  190. response.write " "
  191. if RSV("verified")=0 then
  192. response.write " "
  193. isPaid = 0
  194. else
  195. response.write " "
  196. isPaid = 1
  197. end if
  198. response.write " "
  199. if RSV("paid")=0 then
  200. response.write " "
  201. isPaid = 0
  202. else
  203. response.write " "
  204. isPaid = 1
  205. end if
  206. response.write " . <br>"
  207. if Not HasVoucher then
  208. response.write "<BR> !"
  209. response.write "<BR><BR> "
  210. end if
  211. else
  212. if HasVoucher then
  213. response.write "<BR><HR> ! . ."
  214. response.write "<BR><BR> "
  215. end if
  216. end if
  217. %>
  218. </TD>
  219. <TD width=50%>
  220. <%
  221. set RSOD=Conn.Execute ("SELECT * FROM Accounts WHERE ID = "& VendorID )
  222. if not RSOD.eof then ' 4,8
  223. %>
  224. <li><%=RSOD("accounttitle")%> <a href="CRM/AccountInfo.asp?act=show&selectedCustomer=<%=VendorID%>">(<%=VendorID%>)</a>
  225. <%
  226. if not HasVoucher then
  227. if auth(4,8) then
  228. %>
  229. <a href="?act=search&id=<%=ordID%>">[]</a>
  230. <%
  231. end if
  232. end if
  233. %>
  234. <br>
  235. <li> : <%=RSOD("firstName1")%> <%=RSOD("lastName1")%><br>
  236. <li> : <%=RSOD("companyName")%><br>
  237. <li>: <%=RSOD("city1")%> - <%=RSOD("Address1")%> -<BR> Tel: <%=RSOD("tel1")%> - Fax: <%=RSOD("fax1")%> - Email: <%=RSOD("email1")%><br><br>
  238. <% ReportLogRow = PrepareReport ("purchaseOrder.rpt", "Pord_ID", ordID, "/beta/dialog_printManager.asp?act=Fin") %>
  239. <INPUT TYPE="button" value=" ǁ ѐ " style="height:25px; border:2 solid <%=SelectedMenuColor%>; width:100%; cursor:hand; background-Color:'white'; " onMouseOver="this.style.borderColor='white';" onMouseOut="this.style.borderColor='<%=SelectedMenuColor%>';" onclick="printThisReport(this,<%=ReportLogRow%>);">
  240. <%
  241. else
  242. response.write "<li> : <br>"
  243. end if
  244. %>
  245. </TD>
  246. </TR>
  247. <TR>
  248. <TD>
  249. <%
  250. set RSOD=Conn.Execute ("SELECT purchaseOrderStatus.*,users.realName FROM purchaseOrderStatus left outer join users on purchaseOrderStatus.user_id=users.id WHERE Ord_ID = "& ordID )
  251. 'response.write "SELECT * FROM purchaseOrderStatus WHERE Ord_ID = "& ordID
  252. Do while not RSOD.eof
  253. %>
  254. <span dir=ltr><%=RSOD("StatusDate")%></span>
  255. <span dir=ltr>(<%=RSOD("StatusTime")%>)</span> : <%=RSOD("StatusDetail")%>
  256. <%if not IsNull(RSOD("realName")) then %>
  257. <small style="color:#44F;">(<%=RSOD("realName")%>)</small>
  258. <%end if%>
  259. <br>
  260. <%
  261. RSOD.moveNext
  262. Loop
  263. %>
  264. </TD>
  265. <TD>
  266. <FORM METHOD=POST ACTION="?">
  267. <INPUT TYPE="hidden" name="ordID" value="<%=ordID%>">
  268. :<br>
  269. <INPUT TYPE="radio" NAME="st" value="1" <% if status="OK" and isPaid=1 then %> disabled <% else %> checked <% end if %>>
  270. <SELECT NAME="stdet1" onfocus="document.all.st[0].checked='true'" <% if status="OK" and isPaid=1 then %> disabled <% end if %>>
  271. <option <% if status="OUT" then%>selected<% end if %> value="11"> </option>
  272. <option <% if status="RETURN" then%>selected<% end if %> value="12"> Ґ</option>
  273. <option <% if status="CANCEL" then%>selected<% end if %> value="13"> </option>
  274. <option <% if status="OK" then%>selected<% end if %> value="20"> </option>
  275. <option <% if status="Unknown" then%>selected<% end if %> value="14"></option>
  276. </SELECT><br>
  277. <INPUT TYPE="radio" NAME="st" value="2"><INPUT TYPE="text" NAME="stdet12" onfocus="document.all.st[1].checked='true'"><br>
  278. <INPUT TYPE="text" NAME="stDate" value="<%=shamsiToday()%>" dir=ltr onblur="acceptDate(this);" onKeyPress="return maskDate(this);" ><br>
  279. <center>
  280. <INPUT TYPE="submit" Name="Submit" Value=" " style="width:100px;" tabIndex="14">
  281. </center>
  282. </FORM>
  283. </TD>
  284. </TR>
  285. <TR >
  286. <TD colspan=2>
  287. <!------------------------------------------------------------>
  288. <%
  289. set RSS=Conn.Execute ("SELECT InventoryLog.comments, InventoryLog.CreatedBy, InventoryLog.owner, InventoryLog.logDate, InventoryLog.Qtty, InventoryLog.RelatedID, InventoryLog.ItemID, InventoryLog.ID, InventoryItems.OldItemID, InventoryItems.Name, InventoryItems.Unit, Users.RealName FROM InventoryLog INNER JOIN InventoryItems ON InventoryLog.ItemID = InventoryItems.ID INNER JOIN Users ON InventoryLog.CreatedBy = Users.ID WHERE InventoryLog.IsInput=1 and InventoryLog.Voided=0 and (InventoryLog.RelatedID = "& ordID & ")")
  290. if not RSS.EOF then
  291. %>
  292. <TABLE dir=rtl align=center width=600>
  293. <TR bgcolor="eeeeee" >
  294. <TD colspan=7><H4> </H4></TD>
  295. </TR>
  296. <TR bgcolor="eeeeee" >
  297. <TD><!A HREF="default.asp?s=1"><SMALL> </SMALL></A></TD>
  298. <TD><!A HREF="default.asp?s=1"><SMALL> </SMALL></A></TD>
  299. <TD><!A HREF="default.asp?s=2"><SMALL> </SMALL></A></TD>
  300. <TD><!A HREF="default.asp?s=3"><SMALL> </SMALL></A></TD>
  301. <TD><!A HREF="default.asp?s=5"><SMALL> </SMALL></A></TD>
  302. <TD><!A HREF="default.asp?s=6"><SMALL> </SMALL></A></TD>
  303. <TD><!A HREF="default.asp?s=7"><SMALL></SMALL></A></TD>
  304. </TR>
  305. <%
  306. tmpCounter=0
  307. Do while not RSS.eof
  308. tmpCounter = tmpCounter + 1
  309. if tmpCounter mod 2 = 1 then
  310. tmpColor="#FFFFFF"
  311. tmpColor2="#FFFFBB"
  312. Else
  313. tmpColor="#DDDDDD"
  314. tmpColor2="#EEEEBB"
  315. End if
  316. %>
  317. <TR bgcolor="<%=tmpColor%>" title="<%=RSS("comments")%>">
  318. <TD align=center><a onclick="return confirm(' Ͽ')" href="?removeRelation=yes&invLogID=<%=RSS("ID")%>&ordID=<%=ordID%>">X</a></TD>
  319. <TD><INPUT TYPE="hidden" name="id" value="<%=RSS("ID")%>"><%=RSS("OldItemID")%></TD>
  320. <TD><!A HREF="default.asp?itemDetail=<%=RSS("ID")%>"><%=RSS("Name")%></A></TD>
  321. <TD><%=RSS("Qtty")%>&nbsp;<%=RSS("Unit")%></TD>
  322. <TD><span dir=ltr><%=RSS("logDate")%></span></TD>
  323. <TD><% if RSS("RelatedID")= "-1" then
  324. response.write ""
  325. else
  326. response.write RSS("RelatedID")
  327. end if %></TD>
  328. <TD><%=RSS("RealName")%></TD>
  329. </TR>
  330. <%
  331. RSS.moveNext
  332. Loop
  333. %>
  334. </TABLE><br>
  335. <% end if %>
  336. <!------------------------------------------------------------>
  337. <TABLE width=100% bgcolor="#CCCCCC">
  338. <TR><TD COLSPAN=5><CENTER><B> </B></CENTER><hr></TD></TR>
  339. <tr>
  340. <TD> </TD>
  341. <TD> </TD>
  342. <TD> </TD>
  343. <TD> </TD>
  344. <TD width=8%> </TD>
  345. </tr>
  346. <TR><TD COLSPAN=5><hr></TD></TR>
  347. <%
  348. set RSOD=Conn.Execute ("SELECT * FROM purchaseRequestOrderRelations WHERE Ord_ID = "& OrdID )
  349. Do while not RSOD.eof
  350. set RSX=Conn.Execute ("SELECT * FROM purchaseRequests WHERE id = "& RSOD("req_ID") )
  351. %>
  352. <tr>
  353. <TD><%=RSX("typeName")%></TD>
  354. <TD><span dir=ltr><%=RSX("ReqDate")%></span></TD>
  355. <TD><%=RSX("price")%></TD>
  356. <TD><% if RSX("orderID")=-1 then%><% else %><span id="orderID_span"><a href="../order/order.asp?act=show&id=<%=RSX("orderID")%>"><%=RSX("orderID")%></a></span><% if Auth(4 , 6) then %><span id="dokme_sabt"> &nbsp;<A HREF="javascript:edit_order_id(<%=RSX("id")%>)">[]</A></span><% end if %><% end if %></TD>
  357. <TD width=8%><%=RSOD("PercentOfAll")%></TD>
  358. </tr>
  359. <%
  360. RSOD.moveNext
  361. loop %>
  362. </TD>
  363. </TR>
  364. </TABLE>
  365. <%
  366. end if
  367. 'response.redirect "?radif=" & request("r")
  368. RSOD.close
  369. response.end
  370. end if
  371. '-----------------------------------------------------------------------------------------------------
  372. '---------------------------------------------------------------- change status of an OutService Order
  373. '-----------------------------------------------------------------------------------------------------
  374. if request.form("Submit")=" " then
  375. ordID = request.form("ordID")
  376. st = request.form("st")
  377. stDate = request.form("stDate")
  378. hasUnpaidVoucher = "no"
  379. if st=1 then
  380. stid=request.form("stdet1")
  381. if stid="11" then
  382. stdetl=" "
  383. orderStatus = "OUT"
  384. elseif stid="12" then
  385. stdetl=" Ґ"
  386. orderStatus = "RETURN"
  387. elseif stid="13" then
  388. stdetl=" "
  389. orderStatus = "CANCEL"
  390. elseif stid="20" then
  391. stdetl=" "
  392. orderStatus = "OK"
  393. elseif stid="14" then
  394. stdetl=" "
  395. orderStatus = "Unknown"
  396. end if
  397. else
  398. stdetl=request.form("stdet12")
  399. stid=3
  400. orderStatus = "NOT CHANGED"
  401. end if
  402. conn.Execute ("INSERT INTO purchaseOrderStatus (Ord_ID, statusTime, statusDate, statusCode, StatusDetail,user_id) VALUES ("& OrdID & ", '"& currentTime10() & "', '"& stDate & "', "& stid & ", N'"& stdetl & "' ," & session("ID") & ")")
  403. if NOT orderStatus = "NOT CHANGED" then
  404. Conn.Execute ("update purchaseOrders SET status = '"& orderStatus & "' where id = "& OrdID )
  405. end if
  406. if orderStatus = "OK" then
  407. '===================================================
  408. ' check to see if exists
  409. '===================================================
  410. set RSV=Conn.Execute ("SELECT Vouchers.* FROM Vouchers INNER JOIN VoucherLines ON Vouchers.id = VoucherLines.Voucher_ID WHERE (VoucherLines.RelatedPurchaseOrderID = "& ordID & ")")
  411. if not RSV.eof then
  412. if RSV("paid")=0 then
  413. VoucherID = RSV("ID")
  414. VendorID = RSV("VendorID")
  415. TotalPrice = RSV("TotalPrice")
  416. hasUnpaidVoucher = "yes"
  417. '---------------------------------------------------------------------------------------------------
  418. '------ Next line has been Commented by Alix - 82-02-18
  419. '------ Routine changed: Account will be updated when Voucher verified. (only in AP/Verify.asp page)
  420. '---------------------------------------------------------------------------------------------------
  421. 'Conn.Execute ("UPDATE Accounts SET APBalance=APBalance+"& TotalPrice & " WHERE (ID = "& VendorID & ")")
  422. else
  423. response.write "<BR><BR>"
  424. response.write "! . "
  425. response.write "<BR><BR>"
  426. response.write " !"
  427. end if
  428. end if
  429. '===================================================
  430. end if
  431. response.redirect "?od=" & ordID
  432. end if
  433. '-----------------------------------------------------------------------------------------------------
  434. '------------------------------------------------------------------------------------------------ Main
  435. '-----------------------------------------------------------------------------------------------------
  436. 'Gets all Request for services list from DB
  437. set RST=Conn.Execute ("SELECT count(*) as CNT FROM purchaseOrders WHERE (Status = 'NEW')")
  438. C1 = RST("CNT")
  439. set RST=Conn.Execute ("SELECT count(*) as CNT FROM purchaseOrders WHERE (Status = 'OUT')")
  440. C2 = RST("CNT")
  441. set RST=Conn.Execute ("SELECT count(*) as CNT FROM purchaseOrders WHERE (Status = 'RETURN')")
  442. C3 = RST("CNT")
  443. eventDate = sqlSafe(request("eventDate"))
  444. %>
  445. <br><br>
  446. <CENTER>
  447. <FORM METHOD=POST ACTION="">
  448. : <INPUT TYPE="text" NAME="od" size=6><INPUT TYPE="submit" value=" ">
  449. </FORM>
  450. </CENTER>
  451. <br><TABLE dir=rtl align=center width=600 class=t8pt>
  452. <TR bgcolor="eeeeee">
  453. <TD align=center bgcolor=ffffff><B> </B></TD>
  454. <TD align=center><A HREF="?lstOrd=NEW"><IMG SRC="../images/folder<% if C1=0 then %>0<% else%>1<% end if %>.gif" BORDER=0><br> </A>(<%=C1%>)</TD>
  455. <TD align=center><A HREF="?lstOrd=OUT"><IMG SRC="../images/folder<% if C2=0 then %>0<% else%>1<% end if %>.gif" BORDER=0><br> </A>(<%=C2%>)</TD>
  456. <TD align=center><A HREF="?lstOrd=RETURN"><IMG SRC="../images/folder<% if C3=0 then %>0<% else%>1<% end if %>.gif" BORDER=0><br>ѐ </A>(<%=C3%>)</TD>
  457. <TD align=center><A HREF="?lstOrd=CANCEL"><IMG SRC="../images/folder2.gif" BORDER=0 alt=""><br> </A></TD>
  458. <TD align=center><A HREF="?lstOrd=OK"><IMG SRC="../images/folder2.gif" BORDER=0 alt=""><br> </A></TD>
  459. <TD align=center><A HREF="?lstOrd=Unknown"><IMG SRC="../images/folder2.gif" BORDER=0 alt=""><br> </A></TD>
  460. </TR>
  461. <TR bgcolor="eeeeee">
  462. <FORM METHOD=POST ACTION="?act=showEvents">
  463. <TD align=center bgcolor=ffffff><B> </B></TD>
  464. <TD align=right valign=bottom colspan=6 >
  465. <INPUT dir="LTR" TYPE="text" NAME="eventDate" maxlength="10" size="10" onblur="acceptDate(this)" onKeyPress="return maskDate(this);" value="<%=eventDate%>">
  466. <INPUT TYPE="submit" Value="" class="genButton">
  467. </TD>
  468. </FORM>
  469. </TR>
  470. </TABLE><br>
  471. <%
  472. sortBy=request("s")
  473. if sortBy="2" then
  474. sB="PurchaseOrders.typeName"
  475. elseif sortBy="3" then
  476. sB="PurchaseOrders.OrdDate"
  477. elseif sortBy="4" then
  478. sB="PurchaseOrders.price"
  479. elseif sortBy="5" then
  480. sB="PurchaseOrders.Qtty"
  481. else
  482. sB="PurchaseOrders.id DESC"
  483. end if
  484. if request("act") = "showEvents" then
  485. 'mySQL="SELECT * FROM PurchaseOrderStatus INNER JOIN PurchaseOrders ON PurchaseOrderStatus.Ord_ID = PurchaseOrders.ID WHERE (PurchaseOrderStatus.StatusDate = '"& eventDate & "') ORDER BY PurchaseOrderStatus.Ord_ID DESC, PurchaseOrderStatus.StatusTime DESC"
  486. mySQL="SELECT * FROM PurchaseOrderStatus INNER JOIN PurchaseOrders ON PurchaseOrderStatus.Ord_ID = PurchaseOrders.ID WHERE (PurchaseOrderStatus.StatusDate = '"& eventDate & "') ORDER BY PurchaseOrderStatus.Ord_ID DESC, PurchaseOrderStatus.ID DESC"
  487. set RSS=Conn.Execute (mySQL)
  488. %><br>
  489. <TABLE dir=rtl align=center width=600>
  490. <TR bgcolor="eeeeee" >
  491. <TD align=center colspan=6><B> </B></TD>
  492. </TR>
  493. <TR bgcolor="eeeeee" height=20>
  494. <TD><SMALL></SMALL></TD>
  495. <TD width=200><SMALL> </SMALL></TD>
  496. <TD><SMALL> </SMALL></TD>
  497. <TD width=200><SMALL></SMALL></TD>
  498. <TD><SMALL></SMALL></TD>
  499. <TD><SMALL></SMALL></TD>
  500. </TR>
  501. <%
  502. tmpCounter=0
  503. Do while not RSS.eof
  504. if not tmpid = RSS("id") then
  505. tmpCounter = tmpCounter + 1
  506. end if
  507. if tmpCounter mod 2 = 1 then
  508. tmpColor="#FFFFFF"
  509. tmpColor2="#FFFFBB"
  510. Else
  511. tmpColor="#DDDDDD"
  512. tmpColor2="#EEEEBB"
  513. End if
  514. tmpid = RSS("id")
  515. %>
  516. <TR bgcolor="<%=tmpColor%>" height=20 title="<%
  517. Comment = RSS("Comment")
  518. if Comment<>"-" then
  519. response.write ": " & Comment
  520. else
  521. response.write " "
  522. end if
  523. %>">
  524. <TD><%=RSS("id")%></TD>
  525. <TD><A HREF="?od=<%=RSS("id")%>" target="_blank"><%=RSS("TypeName")%></A></TD>
  526. <TD><span dir=ltr><%=RSS("OrdDate")%></span></TD>
  527. <TD><%=RSS("StatusDetail")%></TD>
  528. <TD><%=RSS("price")%></TD>
  529. <TD><%=RSS("qtty")%></TD>
  530. <%
  531. RSS.moveNext
  532. Loop
  533. %>
  534. </TABLE><br>
  535. </body></html>
  536. <%
  537. response.end
  538. end if
  539. if request("lstOrd") = "" then
  540. response.end
  541. end if
  542. '-----------------------------------------------------------------------------------------------------
  543. '------------------------------------------------------------------------------ List OutService Orders
  544. '---------------------------------------------------------------------- (NEW, OUT, RETURN, CANCEL, OK)
  545. '-----------------------------------------------------------------------------------------------------
  546. '-----------------------------------------------------------------------------------------------------
  547. ' OK or cancel Orders
  548. '-----------------------------------------------------------------------------------------------------
  549. '======================== old query (changed 82-10-15 by ALix) =======================================
  550. 'SELECT PurchaseOrders.*, PurchaseRequests.Order_ID AS Order_ID, Invoices.Approved AS Approved, Invoices.Issued AS Issued FROM PurchaseRequests FULL OUTER JOIN Invoices FULL OUTER JOIN InvoiceOrderRelations ON Invoices.ID = InvoiceOrderRelations.Invoice ON PurchaseRequests.Order_ID = InvoiceOrderRelations.[Order] FULL OUTER JOIN PurchaseOrders LEFT OUTER JOIN PurchaseRequestOrderRelations ON PurchaseOrders.ID = PurchaseRequestOrderRelations.Ord_ID ON PurchaseRequests.ID = PurchaseRequestOrderRelations.Req_ID where ISNULL(Invoices.voided,0)=0 and (PurchaseOrders.Status =
  551. if request("lstOrd") <> "" then
  552. lstOrd = request("lstOrd")
  553. set RSS=Conn.Execute ("SELECT top 100 dbo.PurchaseOrders.*, dbo.PurchaseRequests.OrderID, ISNULL(DERIVEDTBL.Approved2, 0) AS Approved, ISNULL(DERIVEDTBL.Issued2, 0) AS Issued, DERIVEDTBL.id AS invoice_ID FROM dbo.PurchaseRequests FULL OUTER JOIN (SELECT Invoices.id, isnull(Invoices.Approved, 0) AS Approved2, isnull(Invoices.Issued, 0) AS Issued2 FROM dbo.Invoices WHERE isnull(Invoices.voided, 0) = 0 and (isnull(Invoices.Approved, 0) = 1 OR isnull(Invoices.Issued, 0) = 1)) DERIVEDTBL INNER JOIN dbo.InvoiceOrderRelations ON DERIVEDTBL.id = dbo.InvoiceOrderRelations.Invoice ON dbo.PurchaseRequests.OrderID = dbo.InvoiceOrderRelations.[Order] FULL OUTER JOIN dbo.PurchaseOrders LEFT OUTER JOIN dbo.PurchaseRequestOrderRelations ON dbo.PurchaseOrders.ID = dbo.PurchaseRequestOrderRelations.Ord_ID ON dbo.PurchaseRequests.ID = dbo.PurchaseRequestOrderRelations.Req_ID WHERE (dbo.PurchaseOrders.Status = '"& lstOrd & "') order by " & sB)
  554. %><br>
  555. <TABLE dir=rtl align=center width=600>
  556. <TR bgcolor="eeeeee" >
  557. <TD align=center colspan=6><B> (<%=lstOrd%>)</B></TD>
  558. </TR>
  559. <TR bgcolor="eeeeee" height=20>
  560. <TD><A HREF="?lstOrd=<%=lstOrd%>&s=1"><SMALL></SMALL></A></TD>
  561. <TD><A HREF="?lstOrd=<%=lstOrd%>&s=2"><SMALL> </SMALL></A></TD>
  562. <TD><A HREF="?lstOrd=<%=lstOrd%>&s=3"><SMALL> </SMALL></A></TD>
  563. <TD align=center><A HREF="?lstOrd=<%=lstOrd%>&s=3"><SMALL> </SMALL></A></TD>
  564. <TD><A HREF="?lstOrd=<%=lstOrd%>&s=4"><SMALL></SMALL></A></TD>
  565. <TD><A HREF="?lstOrd=<%=lstOrd%>&s=5"><SMALL></SMALL></A></TD>
  566. </TR>
  567. <%
  568. tmpCounter=0
  569. Do while not RSS.eof
  570. if not tmpid = RSS("id") then
  571. tmpCounter = tmpCounter + 1
  572. end if
  573. if tmpCounter mod 2 = 1 then
  574. tmpColor="#FFFFFF"
  575. tmpColor2="#FFFFBB"
  576. Else
  577. tmpColor="#DDDDDD"
  578. tmpColor2="#EEEEBB"
  579. End if
  580. tmpid = RSS("id")
  581. %>
  582. <TR bgcolor="<%=tmpColor%>" height=20 title="<%
  583. Comment = RSS("Comment")
  584. if Comment<>"-" then
  585. response.write ": " & Comment
  586. else
  587. response.write " "
  588. end if
  589. %>">
  590. <TD><%=RSS("id")%></TD>
  591. <TD><A HREF="?od=<%=RSS("id")%>"><%=RSS("TypeName")%></A></TD>
  592. <TD><span dir=ltr><%=RSS("OrdDate")%></span></TD>
  593. <TD align=center><%
  594. if RSS("orderID") = "-1" then
  595. response.write "-"
  596. else
  597. response.write "<A target='_blank' HREF='../shopfloor/manageOrder.asp?radif=" & RSS("orderID") & "'>" & RSS("orderID") & "</a>"
  598. if RSS("Approved") then
  599. response.write "<br>" & " "
  600. end if
  601. if RSS("Issued") then
  602. response.write "<br>" & " "
  603. end if
  604. end if
  605. %></TD>
  606. <TD><%=RSS("price")%></TD>
  607. <TD><%=RSS("qtty")%></TD>
  608. <%
  609. RSS.moveNext
  610. Loop
  611. %>
  612. </TABLE><br>
  613. </body></html>
  614. <%
  615. response.end
  616. end if
  617. Conn.Close
  618. %>
  619. <!--#include file="tah.asp" -->