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

/beta/AR/include_SelectOrder.asp

http://github.com/khaneh/Orders
ASP | 76 lines | 58 code | 4 blank | 14 comment | 4 complexity | 22c89d7e33796f47db6e294e16662f34 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_Customer				(AccountTitle or Name to be searched)
 6'		SO_StepText				(e.g. '��� ��� : ������ ����� ��� ������')
 7'
 8'
 9%>
10		<div dir='rtl'><B><%=SO_StepText%></B>
11		</div><br>
12<!-- ������ ����� ��� ������ -->
13<%
14	
15	SO_mySQL="SELECT * From Accounts WHERE (ID='"& SO_Customer & "')"
16	Set SO_RS1 = conn.Execute(SO_mySQL)
17	if (SO_RS1.eof) then
18		response.write "Error ! No such customer"
19		response.end
20	else
21		SO_AccountTitle=SO_RS1("AccountTitle")
22	end if
23
24'	SO_mySQL="SELECT * From Orders WHERE (Customer='"& SO_Customer & "') ORDER BY ID"
25'	SO_mySQL="SELECT Orders.ID, Orders.CreatedDate FROM Orders LEFT OUTER JOIN InvoiceOrderRelations ON Orders.ID = InvoiceOrderRelations.[Order] WHERE (InvoiceOrderRelations.Invoice IS NULL) AND (Orders.Customer = '"& SO_Customer & "') ORDER BY Orders.ID"
26' Changed By Kid 82/08/18 
27'-----------SAM change this
28	'SO_mySQL="SELECT Orders.* From Orders LEFT OUTER JOIN InvoiceOrderRelations ON Orders.ID = InvoiceOrderRelations.[Order] WHERE (Customer='"& SO_Customer & "') AND (Closed=0) GROUP BY Orders.ID, Orders.CreatedDate, Orders.Closed, Orders.Customer, Orders.CreatedBy HAVING COUNT(InvoiceOrderRelations.Invoice) < 1 ORDER BY Orders.ID"
29	'----------SAM change this on 13 Mar 2011
30	'SO_mySQL="SELECT Orders.* From Orders LEFT OUTER JOIN InvoiceOrderRelations ON Orders.ID = InvoiceOrderRelations.[Order] LEFT OUTER JOIN Invoices ON InvoiceOrderRelations.Invoice = Invoices.ID WHERE (Orders.Customer='" & SO_Customer & "') AND (Orders.Closed=0) AND (ISNULL(Invoices.Voided,0) = 0) GROUP BY Orders.ID, Orders.CreatedDate, Orders.Closed, Orders.Customer, Orders.CreatedBy HAVING COUNT(InvoiceOrderRelations.Invoice) < 1 ORDER BY Orders.ID"
31	SO_mySQL="SELECT * From Orders WHERE (Customer='" & SO_Customer & "') AND (isClosed=0) and ID not in (SELECT InvoiceOrderRelations.[Order] FROM InvoiceOrderRelations INNER JOIN Orders ON Orders.ID = InvoiceOrderRelations.[Order] LEFT OUTER JOIN Invoices ON InvoiceOrderRelations.Invoice = Invoices.ID WHERE (ISNULL(Invoices.Voided,0) = 0) AND Orders.Customer='" & SO_Customer & "' GROUP BY InvoiceOrderRelations.[Order] HAVING COUNT(InvoiceOrderRelations.Invoice) > 0) ORDER BY Orders.ID" & thisOrder
32	
33	Set SO_RS1 = conn.Execute(SO_mySQL)
34
35	if (SO_RS1.eof) then 		' Not Found	%>
36		<table class="RcpTable" align='center' cellpadding='5'><tr><td bgcolor='#FFCCCC' dir='rtl' align='center'>��� ������ ���� ���<br></td></tr></table><br>
37<%	else
38%>
39	<br>
40	<TABLE class="RcpTable" align="center" border="1" cellspacing="1" cellpadding="5" dir="RTL">
41		<tr bgcolor='#DDDDEE'>
42			<td align='center' colspan="3">����� ��� ����� �� <br>'<%=SO_AccountTitle%>'<br>�� ���� ������ ���� ���</td>
43		</tr>
44		<tr bgcolor='#C3C3FF'>
45			<td align='center' width="30"> <input type="checkbox" disabled checked> </td>
46			<td align='center' width="70"> ����� ������</td>
47			<td align='center' width="80"> ����� </td>
48		</tr>
49<%		SO_tempCounter=0
50		while Not (SO_RS1.EOF)
51			SO_tempCounter=SO_tempCounter+1
52			if (SO_tempCounter Mod 2 = 1)then
53				SO_tempColor="#FFFFFF"
54			else
55				SO_tempColor="#DDDDEE"
56			end if
57%>				<tr bgcolor='<%=SO_tempColor%>'>
58					<td align='center'><input type="checkbox" name="selectedOrders" value="<%=SO_RS1("ID")%>">&nbsp;</td>
59					<td dir='ltr' align='center'><%=Link2Trace(SO_RS1("ID"))%>&nbsp;</td>
60					<td dir='ltr' align='center'><%=SO_RS1("CreatedDate")%>&nbsp;</td>
61				</tr>
62<%			SO_RS1.movenext
63		wend
64%>
65		<tr bgcolor='#C3C3FF'>
66			<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>
67		</tr>
68	</TABLE>
69	<SCRIPT LANGUAGE="JavaScript">
70	<!--
71	//document.all.SO_SelectButton.focus();
72	//-->
73	</SCRIPT>
74<%
75	end if
76%>