<!DOCTYPE html>
<html lang="en">
<head>
  <title>Sample PHP Database Application</title>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha.5/css/bootstrap.min.css">
	<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
	<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha.5/js/bootstrap.min.js"></script>
</head>
<body>

  <?php

  echo "<br>";
  
  function kassastand($from, $where, $header = true)
  {
	  
	 global $con;
	mysql_select_db(SQL_REPORT_DB, $con);
	  
	  $sql = "SELECT 
				FORMAT(SUM(stueck*PRICESELL),2,'de_DE') as vk_netto,
				FORMAT(SUM(stueck*ROUND(PRICESELL+PRICESELL*tax_rate,2)),2,'de_DE') as vk_brutto
			FROM 
				`abgeschlossener_bon_produkte` 
			WHERE 
				tax_rate = '0.2000';";
				
	  $result = mysql_query($sql_ab);
			
		echo "<div class='container'>";
			echo "<div class='row-fluid'>";
			
				echo "<div class='col-xs-6'>";
				echo "<div class='table-responsive'>";
				
					echo "<table class='table table-hover table-inverse'>";
					
					echo "<tr>";
					echo "<th>ID</th>";
					echo "<th>Name</th>";
					echo "<th>Salary</th>";
					echo "</tr>";
			  
					if ($result->num_rows > 0) {
						// output data of each row
						while($row = $result->fetch_assoc()) {
								
							echo "<tr>";
							echo "<td>Umsatz</td>";
							echo "<td>" . $row["vk_netto"] . "</td>";
							echo "<td>" . $row["vk_betto"] . "</td>";
							echo "</tr>";			
						}
					} else {
						echo "0 results";
					}
					
					echo "</table>";
					
					
					$sql = "SELECT 
								FORMAT(SUM(stueck*PRICESELL),2,'de_DE') as vk_netto,
								FORMAT(SUM(stueck*ROUND(PRICESELL+PRICESELL*tax_rate,2)),2,'de_DE') as vk_brutto
							FROM 
								`abgeschlossener_bon_produkte` 
							WHERE 
								tax_rate = '0.1000';";
					$result = $link->query($sql);
					
					
					echo "<table class='table table-hover table-inverse'>";
					
					
					if ($result->num_rows > 0) {
						// output data of each row
						while($row = $result->fetch_assoc()) {
								
							echo "<tr>";
							echo "<td>Umsatz</td>";
							echo "<td>" . $row["vk_netto"] . "</td>";
							echo "<td>" . $row["vk_betto"] . "</td>";
							echo "</tr>";		
						}
					} else {
						echo "0 results";
					}
					
					echo "</table>";

				echo "</div>";
				echo "</div>";

				/*
				 * second table
				 */
				$sql = "SELECT 
					FORMAT(SUM(stueck*PRICESELL),2,'de_DE') as vk_netto,
					FORMAT(SUM(stueck*ROUND(PRICESELL+PRICESELL*tax_rate,2)),2,'de_DE') as vk_brutto
				FROM 
					`abgeschlossener_bon_produkte` 
				WHERE 
					tax_rate = '0.1000';";
				$result = $link->query($sql);
					
				echo "<div class='col-xs-6'>";
				echo "<div class='table-responsive'>";
				
					echo "<table class='table table-hover table-inverse'>";
					
					
					if ($result->num_rows > 0) {
						// output data of each row
						while($row = $result->fetch_assoc()) {
								
							echo "<tr>";
							echo "<td>Umsatz</td>";
							echo "<td>" . $row["vk_netto"] . "</td>";
							echo "<td>" . $row["vk_betto"] . "</td>";
							echo "</tr>";				
						}
					} else {
						echo "0 results";
					}
					echo "</table>";

				echo "</div>";
				echo "</div>";

				
			echo "</div>";

			
			/*
			 * second row
			 */
		
			$sql = "SELECT building, room_number, time_slot_id FROM section";
			$result = $link->query($sql);
		
			echo "<div class='row-fluid'>";
			
				echo "<div class='col-xs-6'>";
				echo "<div class='table-responsive'>";
				
					echo "<table class='table table-hover table-inverse'>";
					
					echo "<tr>";
					echo "<th>building</th>";
					echo "<th>room_number</th>";
					echo "<th>time_slot_id</th>";
					echo "</tr>";
				
					if ($result->num_rows > 0) {
						// output data of each row
						while($row = $result->fetch_assoc()) {
								
							echo "<tr>";
							echo "<td>" . $row["building"] . "</td>";
							echo "<td>" . $row["room_number"] . "</td>";
							echo "<td>" . $row["time_slot_id"] . "</td>";
							echo "</tr>";			
						}
					} else {
						echo "0 results";
					}
				
					echo "</table>";
				
				echo "</div>";
				echo "</div>";

				
				/*
				 * second table
				 */
				$sql = "SELECT 
					FORMAT(SUM(stueck*PRICESELL),2,'de_DE') as vk_netto,
					FORMAT(SUM(stueck*ROUND(PRICESELL+PRICESELL*tax_rate,2)),2,'de_DE') as vk_brutto
				FROM 
					`abgeschlossener_bon_produkte` 
				WHERE 
					tax_rate = '0.0000';";
				$result = $link->query($sql);
					
		
				echo "<div class='col-xs-6'>";
				echo "<div class='table-responsive'>";
				
					echo "<table class='table table-hover table-inverse'>";
					
					echo "<tr>";
					echo "<th>Course ID</th>";
					echo "<th>Prerequite ID</th>";
					echo "</tr>";
					
					if ($result->num_rows > 0) {
						// output data of each row
						while($row = $result->fetch_assoc()) {
								
							echo "<tr>";
							echo "<td>" . $row["course_id"] . "</td>";
							echo "<td>" . $row["prereq_id"] . "</td>";
							echo "</tr>";			
						}
					} else {
						echo "0 results";
					}
				
					echo "</table>";

				echo "</div>";
				echo "</div>";

			echo "</div>";
			
		echo "</div>";

	  // Close connection
	  mysqli_close($link);
  }
  ?>


</body>
</html>