Pfooter.rsp

From Lianjapedia
Jump to: navigation, search

Name

pfooter.rsp

Description

This Visual FoxPro Server Page (.rsp) is a Page Footer gadget example. See Page Footers for more information.

Code

<%@ Language=VFP %>
<html>
<head>
<style>
table, td, th {
    border: 1px solid black;
}
table {
    border-collapse: collapse;
    width: 100%;
}
td {
    text-align: center;
}
</style>
</head>
<body>
<%
	private m_count = 0
	private m_total = 0
	private m_min = 0
	private m_max = 0
	private m_ordertotal = 0
	private m_linetotal = 0
 
	save recordview
 
	if used("orders") and used("customers")
		select orders
		seek customers.customerid
		scan while customerid = customers.customerid
			++m_count
			select order_details
			seek orders.orderid
			m_ordertotal = 0
			m_linetotal = 0
			scan while orderid = orders.orderid
				m_linetotal = (order_details.unitprice*order_details.quantity) - order_details.discount
				m_ordertotal = m_ordertotal + m_linetotal
			endscan
			if m_min = 0 or m_min > m_ordertotal
				m_min = m_ordertotal
			endif
			if m_max = 0 or m_max < m_ordertotal
				m_max = m_ordertotal
			endif
			m_total = m_total + m_ordertotal
		endscan
	endif
 
	m_min = currency(m_min)
	m_max = currency(m_max)
	m_total = currency(m_total)
 
	restore recordview
 
	text raw 
	<table>
	<tr>
	<th>
    <font color=darkgray>Total Orders</font>
	</th>
	<th>
	<font color=darkgray>Min Order Value</font>
	</th>
	<th>
	<font color=darkgray>Max Order Value</font>
	</th>
	<th>
	<font color=darkgray>Total Order Value</font>
	</th>
	</tr>
	<tr>
	<td>
	<font color=gray>&m_count</font>
	</td>
	<td>
    <font color=gray>&m_min</font>
	</td>
	<td>
    <font color=gray>&m_max</font>
	</td>
	<td>
    <font color=gray>&m_total</font>
	</td>
	</tr>
	</table>
	</body>
	endtext
%>
</body>
</html>