/beta/Inquiry/include_SelectClosedOrdersByOrder.asp

http://github.com/khaneh/Orders · ASP · 105 lines · 91 code · 4 blank · 10 comment · 8 complexity · 50a0c8f5b90655ea0fafc7e8a55f0039 MD5 · raw file

  1. <%
  2. ' This Include File Needs Following Variables to have values:
  3. '
  4. ' SO_Action (the Action of the submit button onclick)
  5. ' SO_Order (one Order ID )
  6. ' SO_StepText (e.g. ' : ')
  7. '
  8. '
  9. %>
  10. <div dir='rtl'><B><%=SO_StepText%></B>
  11. </div><br>
  12. <!-- -->
  13. <%
  14. SO_mySQL="SELECT Orders.Customer, Accounts.AccountTitle FROM Orders INNER JOIN Accounts ON Orders.Customer = Accounts.ID WHERE (Orders.ID = '"& SO_Order & "')"
  15. Set SO_RS1 = conn.Execute(SO_mySQL)
  16. if (SO_RS1.eof) then
  17. response.redirect "?errmsg=" & Server.URLEncode(" ")
  18. else
  19. SO_Customer=SO_RS1("Customer")
  20. SO_AccountTitle=SO_RS1("AccountTitle")
  21. end if
  22. ' SO_mySQL="SELECT * From Orders WHERE (Customer='"& SO_Customer & "') ORDER BY ID"
  23. ' SO_mySQL="SELECT Orders.ID, Orders.CreatedDate FROM Orders LEFT OUTER JOIN InvoiceOrderRelations ON Orders.ID = InvoiceOrderRelations.[Order] WHERE (InvoiceOrderRelations.Invoice IS NOT NULL) AND (Orders.Customer = '"& SO_Customer & "') ORDER BY Orders.ID"
  24. ' Changed By Kid 82/09/16
  25. SO_mySQL="SELECT * From Orders WHERE (Customer='"& SO_Customer & "') AND (Closed=1) ORDER BY ID"
  26. Set SO_RS1 = conn.Execute(SO_mySQL)
  27. %>
  28. <br>
  29. <TABLE class="RcpTable" align="center" border="1" cellspacing="1" cellpadding="5" dir="RTL">
  30. <tr bgcolor='#DDDDEE'>
  31. <td align='center' colspan="3"> <br>'<%=SO_AccountTitle%>'<br> </td>
  32. </tr>
  33. <tr bgcolor='#C3C3FF'>
  34. <td align='center' width="30"> <input type="checkbox" disabled checked> </td>
  35. <td align='center' width="70"> </td>
  36. <td align='center' width="80"> </td>
  37. </tr>
  38. <% SO_tempCounter=0
  39. SO_Orderfound=false
  40. while Not (SO_RS1.EOF)
  41. SO_tempCounter=SO_tempCounter+1
  42. if (SO_tempCounter Mod 2 = 1)then
  43. SO_tempColor="#FFFFFF"
  44. else
  45. SO_tempColor="#DDDDEE"
  46. end if
  47. SO_tmpOrderID=SO_RS1("ID")
  48. %> <tr bgcolor='<%=SO_tempColor%>'>
  49. <td align='center'><input type="checkbox" name="selectedOrders" value="<%=SO_tmpOrderID%>" <%if clng(SO_tmpOrderID)=clng(SO_Order) then SO_Orderfound=true : response.write "checked"%>>&nbsp;</td>
  50. <td dir='ltr' align='center'><%=Link2Trace(SO_tmpOrderID)%>&nbsp;</td>
  51. <td dir='ltr' align='center'><%=SO_RS1("CreatedDate")%>&nbsp;</td>
  52. </tr>
  53. <% SO_RS1.movenext
  54. wend
  55. SO_RS1.close
  56. if (SO_tempCounter=0) then ' Not Found ANY order%>
  57. <tr>
  58. <td align='center' colspan="4">
  59. <table class="RcpTable" align='center' cellpadding='5'><tr><td bgcolor='#FFCCCC' dir='rtl' align='center'> <br></td></tr></table>
  60. </td>
  61. </tr>
  62. <% end if
  63. SO_mySQL="SELECT Invoices.Approved, Invoices.Issued, Invoices.ID FROM InvoiceOrderRelations INNER JOIN Invoices ON InvoiceOrderRelations.Invoice = Invoices.ID WHERE (InvoiceOrderRelations.[Order] = '" & SO_Order & "') AND (Invoices.Voided = 0)"
  64. Set SO_RS1 = conn.Execute(SO_mySQL)
  65. if not(SO_RS1.eof) then
  66. SO_FoundInvoice=SO_RS1("ID")
  67. if SO_RS1("Issued") then
  68. SO_tpDesc="<B> </B>"
  69. SO_tmpColor="#FF6666"
  70. elseif SO_RS1("Approved") then
  71. SO_tpDesc="<B> </B>"
  72. SO_tmpColor="Yellow"
  73. else
  74. SO_tpDesc="<B> </B>"
  75. SO_tmpColor="#FFFFBB"
  76. end if
  77. %>
  78. <tr>
  79. <td align='center' colspan="4">
  80. <table class="RcpTable" align='center' cellpadding='5' style="border:2 solid #333366">
  81. <tr><td bgcolor='<%=SO_tmpColor%>' dir='rtl' align='center'>
  82. !<br> <%=SO_tpDesc%> <br>
  83. <A HREF="AccountReport.asp?act=showInvoice&invoice=<%=SO_FoundInvoice%>"> (<%=SO_FoundInvoice%>)</A>
  84. </td>
  85. </tr>
  86. </table>
  87. </td>
  88. </tr>
  89. <% end if
  90. %>
  91. <tr bgcolor='#C3C3FF'>
  92. <td align='center' colspan="4"><input name="SO_SelectButton" class="GenButton" type="submit" value="" onclick="<%=SO_Action%>" >&nbsp;<input name="selectedCustomer" type="hidden" value="<%=SO_Customer%>"></td>
  93. </tr>
  94. </TABLE>
  95. <SCRIPT LANGUAGE="JavaScript">
  96. <!--
  97. if (! window.dialogArguments){// if this is NOT a modal window
  98. document.all.SO_SelectButton.focus();
  99. }
  100. //-->
  101. </SCRIPT>