/beta/AR/dialog_invoiceItems.asp

http://github.com/khaneh/Orders · ASP · 110 lines · 104 code · 6 blank · 0 comment · 11 complexity · 95ba858a0182611d401e25624605f6e1 MD5 · raw file

  1. <%@LANGUAGE="VBSCRIPT" CODEPAGE="1256"%>
  2. <!--#include file="../config.asp" -->
  3. <HTML>
  4. <HEAD>
  5. <meta http-equiv="Content-Type" content="text/html; charset=windows-1256">
  6. <meta http-equiv="Content-Language" content="fa">
  7. <style>
  8. Table { font-size: 9pt;}
  9. Input { font-family:tahoma; font-size: 9pt;}
  10. </style>
  11. <TITLE> </TITLE>
  12. </HEAD>
  13. <BODY>
  14. <font face="tahoma">
  15. <%
  16. name=request("name")&""
  17. if IsNumeric(name) then
  18. if cint(name)>-100 then mySQL="select InvoiceItems.* from InvoiceItems inner join InvoiceItemCategoryRelations on InvoiceItemCategoryRelations.InvoiceItem = invoiceItems.ID where InvoiceItems.Enabled=1 and InvoiceItemCategoryRelations.InvoiceItemCategory=" & name
  19. else
  20. mySQL="SELECT * From InvoiceItems WHERE ((REPLACE([Name], ' ', '') LIKE REPLACE(N'%"& sqlSafe(name) & "%', ' ', ''))) AND (Enabled=1) ORDER BY [id]"
  21. end if
  22. Set RS1 = conn.Execute(mySQL)
  23. if (RS1.eof) then %>
  24. <br><br><br><hr>
  25. <table align='center'>
  26. <tr><td bgcolor='#FFCCCC' dir='rtl' align='center'> </td>
  27. </tr>
  28. </table>
  29. <hr>
  30. <% else
  31. %>
  32. <TABLE ID="InvoiceItems" border="1" width="100%" cellspacing="1" cellpadding="5" dir="RTL">
  33. <tr bgcolor='#C3C3FF'>
  34. <td align='center' width="5%"> <input type="radio" disabled> </td>
  35. <td align='center' width="15%"> </td>
  36. <td align='center'> </td>
  37. <td align='center'>-</td>
  38. <td align='center'></td>
  39. <td align='center'></td>
  40. </tr>
  41. <% tempCounter=0
  42. while Not (RS1.EOF)
  43. tempCounter=tempCounter+1
  44. if (tempCounter Mod 2 = 1)then
  45. tempColor="#FFFFFF"
  46. else
  47. tempColor="#DDDDEE"
  48. end if
  49. %> <tr bgcolor='<%=tempColor%>'>
  50. <td align='center'><input type="radio" name="selectedItem" value="<%=RS1("ID")%>" onclick="selectItem(this)">&nbsp;</td>
  51. <td dir='ltr'><%=RS1("ID") %>&nbsp;</td>
  52. <td><%=RS1("Name")%>&nbsp;</td>
  53. <td><%=RS1("type")%></td>
  54. <td><%=RS1("fee")%></td>
  55. <td><%if RS1("hasVat") then response.write "" else response.write ""%></td>
  56. </tr>
  57. <% RS1.movenext
  58. wend
  59. %>
  60. <tr bgcolor='#C3C3FF'>
  61. <td align='center' colspan="3"><input type="submit" style="font-family:Tahoma" value="" onclick="selectAndClose();">&nbsp;</td>
  62. </tr>
  63. </TABLE>
  64. <BR>
  65. <HR>
  66. <BR>
  67. <% end if
  68. conn.Close
  69. %>
  70. </font>
  71. </BODY>
  72. </HTML>
  73. <script language="JavaScript">
  74. <!--
  75. var Arguments = new Array(4)
  76. function selectItem(src){
  77. rowNo=src.parentNode.parentNode.rowIndex;
  78. // thePrice=document.getElementsByName("selectedItem")[rowNo-1].value
  79. myRow=document.getElementById("InvoiceItems").getElementsByTagName("tr")[rowNo];
  80. Arguments[0]=myRow.getElementsByTagName("td")[1].innerText;// ID
  81. Arguments[1]=myRow.getElementsByTagName("td")[2].innerText;// Name
  82. Arguments[2]=myRow.getElementsByTagName("td")[3].innerText;// type
  83. Arguments[3]=myRow.getElementsByTagName("td")[4].innerText;// fee
  84. Arguments[4]=myRow.getElementsByTagName("td")[5].innerText;// hasVat
  85. }
  86. function selectAndClose(){
  87. myString=Arguments.join("#");
  88. window.dialogArguments.value=myString
  89. window.close();
  90. }
  91. function documentKeyDown() {
  92. var theKey = event.keyCode;
  93. if (theKey == 27) {
  94. window.close();
  95. }
  96. }
  97. document.onkeydown = documentKeyDown;
  98. radio1=document.getElementsByName("selectedItem")[0];
  99. if (radio1){
  100. radio1.checked=true;
  101. selectItem(radio1);
  102. }
  103. //-->
  104. </script>