/beta/AR/Invoice.asp

http://github.com/khaneh/Orders · ASP · 129 lines · 119 code · 6 blank · 4 comment · 7 complexity · 8fee75ab033f4bc2bb4ff9f6c45ffce5 MD5 · raw file

  1. <%@LANGUAGE="VBSCRIPT" CODEPAGE="1256"%><%
  2. 'AR (6)
  3. PageTitle=" "
  4. SubmenuItem=1
  5. %>
  6. <!--#include file="top.asp" -->
  7. <!--#include File="../include_farsiDateHandling.asp"-->
  8. <!--#include File="../include_JS_InputMasks.asp"-->
  9. <%
  10. function ShowErrorMessage(msg)
  11. response.write "<table align='center' cellpadding='5'><tr><td bgcolor='#FFCCCC' dir='rtl' align='center'> ! <br>"& msg & "<br></td></tr></table><br>"
  12. end function
  13. function Link2Trace(OrderNo)
  14. Link2Trace="<A HREF='../order/TraceOrder.asp?act=show&order="& OrderNo & "' target='_balnk'>"& OrderNo & "</A>"
  15. end function
  16. %>
  17. <style>
  18. Table { font-size: 9pt;}
  19. .InvRowInput { font-family:tahoma; font-size: 9pt; border: none; background-color: #F0F0F0; text-align:right;}
  20. .InvHeadInput { font-family:tahoma; font-size: 9pt; border: none; background-color: #CCCC88; text-align:center;}
  21. .InvRowInput2 { font-family:tahoma; font-size: 9pt; border: none; background-color: #F0FFF0; text-align:right;}
  22. .InvHeadInput2 { font-family:tahoma; font-size: 9pt; border: none; background-color: #AACC77; text-align:center;}
  23. .InvHeadInput3 { font-family:tahoma; font-size: 9pt; border: none; background-color: #F0F0F0; text-align:right;}
  24. .InvGenInput { font-family:tahoma; font-size: 9pt; border: none; }
  25. .InvGenButton { font-family:tahoma; font-size: 9pt; border: 1px solid black; }
  26. </style>
  27. <SCRIPT LANGUAGE="JavaScript">
  28. <!--
  29. var okToProceed=false;
  30. var currentRow=0;
  31. //-->
  32. </SCRIPT>
  33. <%
  34. if request("act")="submitsearch" then
  35. ' response.redirect "AccountReport.asp?act=showInvoice&invoice=" & InvoiceID
  36. if isnumeric(request("invoice")) then
  37. response.redirect "AccountReport.asp?act=showInvoice&invoice=" & request("invoice")
  38. elseif trim(request("query")) = "" then
  39. Conn.close
  40. response.redirect "?errmsg=" & Server.URLEncode(" э !")
  41. end if
  42. if isnumeric(request("query")) then
  43. 'User has entered an ORDER NUMBER
  44. OrderID=clng(request("query"))
  45. mySQL="SELECT InvoiceOrderRelations.Invoice FROM InvoiceOrderRelations INNER JOIN Invoices ON InvoiceOrderRelations.Invoice = Invoices.ID WHERE (InvoiceOrderRelations.[Order] = '"& OrderID & "') AND (Invoices.IsReverse = 0) AND (Invoices.Voided = 0)"
  46. Set rs = Server.CreateObject("ADODB.Recordset")
  47. rs.open mySQL, Conn, 3, 3
  48. if rs.eof then
  49. rs.close
  50. mySQL="SELECT InvoiceOrderRelations.Invoice FROM InvoiceOrderRelations INNER JOIN Invoices ON InvoiceOrderRelations.Invoice = Invoices.ID WHERE (InvoiceOrderRelations.[Order] = '"& OrderID & "') AND (Invoices.IsReverse = 0)"
  51. rs.open mySQL, Conn, 3, 3
  52. if not rs.eof then
  53. InvoiceID=rs("Invoice")
  54. Conn.close
  55. response.redirect "AccountReport.asp?act=showInvoice&invoice=" & InvoiceID
  56. else
  57. Conn.close
  58. response.redirect "?errmsg=" & Server.URLEncode(" .")
  59. end if
  60. else
  61. if rs.RecordCount>1 then
  62. tempWriteAnd=""
  63. invoiceList=" :<br>"
  64. Do While not rs.eof
  65. invoiceList=invoiceList & tempWriteAnd & "<A HREF='AccountReport.asp?act=showInvoice&invoice="& rs("invoice") &"' target='_blank'>" & rs("invoice") & "</A>"
  66. tempWriteAnd=" "
  67. rs.moveNext
  68. Loop
  69. invoiceList=invoiceList & "<br> "
  70. response.write "<br><br>"
  71. call showAlert (invoiceList ,CONST_MSG_ALERT)
  72. else
  73. InvoiceID=rs("Invoice")
  74. Conn.close
  75. response.redirect "AccountReport.asp?act=showInvoice&invoice=" & InvoiceID
  76. end if
  77. end if
  78. else
  79. 'User has entered an ACCOUNT NAME
  80. SA_TitleOrName=request("query")
  81. SA_Action="return true;"
  82. SA_SearchAgainURL="InvoiceInput.asp"
  83. SA_StepText=" : "
  84. %>
  85. <FORM METHOD=POST ACTION="?act=showInvoices">
  86. <!--#include File="include_SelectAccount.asp"-->
  87. </FORM>
  88. <%
  89. end if
  90. elseif request("act")="showInvoices" then
  91. cusID=request("selectedCustomer")
  92. if cusID <> "" and isnumeric(cusID) then
  93. mySQL="SELECT TOP 1 AccountTitle FROM Accounts WHERE (ID = '"& clng(cusID) & "')"
  94. set RS1=Conn.execute(mySQL)
  95. AccountTitle = RS1("AccountTitle")
  96. %>
  97. <br><br>
  98. <!--#include file="include_CustomerInvoices.asp" -->
  99. <%
  100. end if
  101. else
  102. %>
  103. <br>
  104. <br>
  105. <FORM METHOD=POST ACTION="?act=submitsearch">
  106. <div dir='rtl'><B><FONT SIZE="" COLOR="red"> &nbsp; : </FONT><BR> </B>
  107. <INPUT TYPE="text" NAME="query" onfocus="document.getElementsByName('invoice')[0].value='';">&nbsp;
  108. <INPUT class="GenButton" TYPE="submit" Name="submitShow" value="">&nbsp;&nbsp;&nbsp; :
  109. <INPUT style="font-family:Tahoma;width:100px;" TYPE="text" NAME="invoice">&nbsp;
  110. </div>
  111. </FORM>
  112. <!-- -->
  113. <hr width="90%" align="center">
  114. <SCRIPT LANGUAGE="JavaScript">
  115. <!--
  116. document.getElementsByName("query")[0].focus();
  117. //-->
  118. </SCRIPT>
  119. <%
  120. end if
  121. conn.Close
  122. %>
  123. <!--#include file="tah.asp" -->