PageRenderTime 7ms CodeModel.GetById 1ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/beta/AR/include_SelectOrdersByOrder.asp

http://github.com/khaneh/Orders
ASP | 113 lines | 96 code | 7 blank | 10 comment | 9 complexity | 37c95cb59f6cd70efcd0aad9eb9c8128 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	
 15	SO_mySQL="SELECT Orders.Customer, Accounts.AccountTitle FROM Orders INNER JOIN Accounts ON Orders.Customer = Accounts.ID WHERE (Orders.ID = '"& SO_Order & "')"
 16	Set SO_RS1 = conn.Execute(SO_mySQL)
 17	if (SO_RS1.eof) then
 18		response.redirect "?errmsg=" & Server.URLEncode("���� ������ ���� �����")
 19	else
 20		SO_Customer=SO_RS1("Customer")
 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	SO_mySQL="SELECT * From Orders WHERE (Customer='"& SO_Customer & "') AND (Closed=0) ORDER BY ID"
 28	Set SO_RS1 = conn.Execute(SO_mySQL)
 29%>
 30	<br>
 31	<TABLE class="RcpTable" align="center" border="1" cellspacing="1" cellpadding="5" dir="RTL">
 32		<tr bgcolor='#DDDDEE'>
 33			<td align='center' colspan="3">����� ��� ����� �� <br>'<%=SO_AccountTitle%>'<br>�� ���� ������ ���� ���</td>
 34		</tr>
 35		<tr bgcolor='#C3C3FF'>
 36			<td align='center' width="30"> <input type="checkbox" disabled checked> </td>
 37			<td align='center' width="70"> ����� ������</td>
 38			<td align='center' width="80"> ����� </td>
 39		</tr>
 40<%	SO_tempCounter=0
 41	SO_Orderfound=false
 42	while Not (SO_RS1.EOF)
 43		SO_tempCounter=SO_tempCounter+1
 44		if (SO_tempCounter Mod 2 = 1)then
 45			SO_tempColor="#FFFFFF"
 46		else
 47			SO_tempColor="#DDDDEE"
 48		end if
 49		SO_tmpOrderID=SO_RS1("ID")
 50%>		<tr bgcolor='<%=SO_tempColor%>'>
 51			<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>
 52			<td dir='ltr' align='center'><%=Link2Trace(SO_tmpOrderID)%>&nbsp;</td>
 53			<td dir='ltr' align='center'><%=SO_RS1("CreatedDate")%>&nbsp;</td>
 54		</tr>
 55<%		SO_RS1.movenext
 56	wend
 57	SO_RS1.close
 58	if (SO_tempCounter=0) then 		' Not Found	ANY order%>
 59		<tr>
 60			<td align='center' colspan="4">
 61				<table class="RcpTable" align='center' cellpadding='5'><tr><td bgcolor='#FFCCCC' dir='rtl' align='center'>��� ������ ���� ���<br></td></tr></table>
 62			</td>
 63		</tr>
 64<%	end if
 65
 66	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)"
 67
 68	Set SO_RS1 = conn.Execute(SO_mySQL)
 69	if not(SO_RS1.eof) then 
 70		%><tr>
 71				<td align='center' colspan="4">
 72					<table class="RcpTable" align='center' cellpadding='5' style="border:2 solid #333366">
 73					<%
 74		do while not(SO_RS1.eof)
 75			SO_FoundInvoice=SO_RS1("ID")
 76			if SO_RS1("Issued") then 
 77				SO_tpDesc="<B>���� ���</B>"
 78				SO_tmpColor="#FF6666"
 79			elseif SO_RS1("Approved") then 
 80				SO_tpDesc="<B>����� ���</B>"
 81				SO_tmpColor="Yellow"
 82			else
 83				SO_tpDesc="<B>����� ����</B>"
 84				SO_tmpColor="#FFFFBB"
 85			end if
 86	%>
 87			
 88					<tr><td bgcolor='<%=SO_tmpColor%>' dir='rtl' align='center'>
 89						����!<br>������ �� ��� ����� ����� ���� �� �� ������ <%=SO_tpDesc%> ���� ����<br>
 90						<A HREF="AccountReport.asp?act=showInvoice&invoice=<%=SO_FoundInvoice%>">����� ������ ������ (<%=SO_FoundInvoice%>)</A>
 91						</td>
 92					</tr>
 93					
 94		
 95<%	SO_RS1.movenext
 96		loop
 97		%></table>
 98				</td>
 99			</tr>
100			<%
101	end if
102%>
103		<tr bgcolor='#C3C3FF'>
104			<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>
105		</tr>
106	</TABLE>
107	<SCRIPT LANGUAGE="JavaScript">
108	<!--
109	if (! window.dialogArguments){// if this is NOT a modal window
110		document.all.SO_SelectButton.focus();
111	}
112	//-->
113	</SCRIPT>