<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>MDC-Display-CustomerInvoiceView-By-Date PHP Page</title>
		<style type="text/css">
			h1 {text-align: center; color: blue}
			h2 {font-family: Ariel, sans-serif; text-align: left; color: blue}
			p.footer {text-align: center}
			table.output {font-family: Ariel, sans-serif}
		</style>
	</head>
	<body>
	<?php
		// Get connection
		$DSN = "MDC";
    	$User = "MDC-User";
    	$Password = "MDC-User+password";
    
    	$Conn = odbc_connect($DSN, $User, $Password);	
	
		// Test connection
		if (!$Conn)
			{
				exit ("ODBC Connection Failed: " . $Conn);
			}
		// Create short variable names
		$AsOfDate = $_POST["AsOfDate"];
		
		// Create SQL statement
		$SQL = "SELECT * FROM CustomerInvoiceView ";
		$SQL .= "WHERE DateIn = '$AsOfDate' ";
		$SQL .= "OR DateIn > '$AsOfDate'";
			
		// Execute SQL statement
		$RecordSet = odbc_exec($Conn, $SQL);
		
		// Test existence of recordset
    	if (!$RecordSet)
    		{
    			exit ("SQL Statement Error: " . $SQL);
    		}
	?>
		<!--  Page Headers -->
		<h1>
			The Marcia's Dry Cleaning CustomerInvoiceView
		</h1>
		<hr />
		<h2>
			CustomerInvoiceView
		</h2>
	<?php
		
		// Table headers
		echo "<table class='output' border='1'
				<tr>
					<th>LastName</th>
					<th>FirstName</th>
					<th>Phone</th>
					<th>InvoiceNumber</th>
					<th>DateIn</th>
					<th>DateOut</th>
					<th>Total</th>
					<th>Status</th>
				</tr>";
		
		//Table data
		while($RecordSetRow = odbc_fetch_array($RecordSet))
			{
				echo "<tr>";
					echo "<td>" . $RecordSetRow['LastName'] . "</td>";
					echo "<td>" . $RecordSetRow['FirstName'] . "</td>";
					echo "<td>" . $RecordSetRow['Phone'] . "</td>";
					echo "<td>" . $RecordSetRow['InvoiceNumber'] . "</td>";
					echo "<td>" . $RecordSetRow['DateIn'] . "</td>";
					echo "<td>" . $RecordSetRow['DateOut'] . "</td>";
					echo "<td>" . $RecordSetRow['Total'] . "</td>";
					echo "<td>" . $RecordSetRow['Status'] . "</td>";
				echo "</tr>";
			}
		echo "</table>";
		
		// Close connection
		odbc_close($Conn);
	?>
		<br />
		<hr />
		<p class="footer">
			<a href="../MDC/index.html">
				Return to the Marcia's Dry Cleaning Home Page
			</a>
		</p>
		<hr />
    </body>
 </html>
		
