PageRenderTime 12ms CodeModel.GetById 9ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

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