Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="he">
- <?php $thisPage="DataIntegration" ?>
- <head>
- <meta charset="utf-8">
- <link rel="stylesheet" type="text/css" href="style.css"/>
- <title>Scheduling_profs</title>
- </head>
- <body>
- <div id="wrapper">
- <div id="headerBar">
- <?php include("menu.php"); ?> <!-- insert the menu -->
- </div> <!-- #header -->
- <div id="content">
- <h2>הצגת נתונים</h2>
- <div class="inner" align="right">
- <?php header('Content-Type: text/html; charset=utf-8');
- echo "<table class='special' align='right';>";
- echo "<tr>
- <th>שם המתפלל</th>
- <th>שם הפעולה</th>
- <th>שם הפרשה</th>
- <th>תאריך</th>
- <th>סכום</th>
- </tr>";
- $customer_id = $_REQUEST['output'];
- $operation_id = $_REQUEST['output1'];
- $date = $_REQUEST['date'];
- $thora = $_REQUEST['thora'];
- $servername = "localhost";
- $username = "root";
- $password = "";
- $dbname = "synagogue";
- try
- {
- $conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password, array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
- // set character name
- $conn->query("SET NAMES 'utf8'");
- }
- catch(PDOException $e)
- {
- echo "Error: " . $e->getMessage();
- }
- /* echo $customer_id. "<br>";
- echo $operation_id. "<br>";
- echo $_REQUEST['btn_submit']. "<br>";
- echo $thora. "<br>"; */
- switch ($_REQUEST['btn_submit'])
- {
- case "Button 1": // מתפלל
- if($customer_id == ""){}
- else
- {
- $sth = $conn->query("SELECT data_integration_table.date, data_integration_table.thora, data_integration_table.amount, customer_table.first_name, customer_table.last_name, operation_table.operation_name, sum(data_integration_table.amount) AS 'TotalAmount' FROM data_integration_table
- INNER JOIN customer_table ON data_integration_table.customer_id = customer_table.customer_id
- INNER JOIN operation_table ON data_integration_table.operation_id = operation_table.operation_id WHERE customer_table.customer_id = $customer_id");
- $sth->setFetchMode(PDO::FETCH_BOTH);// Mode par défaut (tableau)
- while($row = $sth->fetch())
- {
- echo "</tr>";
- echo "<td>", $row['first_name'], ' ', $row['last_name'],"</td>";
- echo "<td>", $row['operation_name'], "</td>";
- echo "<td>", $row['thora'], "</td>";
- echo "<td>", $row['date'], "</td>";
- echo "<td>", $row['amount'], '₪', "</td>";
- echo "</tr>";
- $totalsum = $row['TotalAmount'];
- }
- $sth->closeCursor();
- }
- break;
- case "Button 2": // פעולה
- if($operation_id == ""){}
- else
- {
- $sth = $conn->query("SELECT data_integration_table.date, data_integration_table.thora, data_integration_table.amount, customer_table.first_name, customer_table.last_name, operation_table.operation_name, sum(data_integration_table.amount) AS 'TotalAmount' FROM data_integration_table
- INNER JOIN customer_table ON data_integration_table.customer_id = customer_table.customer_id
- INNER JOIN operation_table ON data_integration_table.operation_id = operation_table.operation_id WHERE operation_table.operation_id = $operation_id");
- $sth->setFetchMode(PDO::FETCH_BOTH);// Mode par défaut (tableau)
- while($row = $sth->fetch())
- {
- echo "</tr>";
- echo "<td>", $row['first_name'], ' ', $row['last_name'],"</td>";
- echo "<td>", $row['operation_name'], "</td>";
- echo "<td>", $row['thora'], "</td>";
- echo "<td>", $row['date'], "</td>";
- echo "<td>", $row['amount'], '₪', "</td>";
- echo "</tr>";
- $totalsum = $row['TotalAmount'];
- }
- $sth->closeCursor();
- }
- break;
- case "Button 3": // תורה
- if ($thora == ""){} // check for empty box
- else
- {
- $sth = $conn->query("SELECT data_integration_table.date, data_integration_table.thora, data_integration_table.amount, customer_table.first_name, customer_table.last_name, operation_table.operation_name, sum(data_integration_table.amount) AS 'TotalAmount' FROM data_integration_table
- INNER JOIN customer_table ON data_integration_table.customer_id = customer_table.customer_id
- INNER JOIN operation_table ON data_integration_table.operation_id = operation_table.operation_id WHERE data_integration_table.thora = '$thora'");
- $sth->setFetchMode(PDO::FETCH_BOTH);// Mode par défaut (tableau)
- while($row = $sth->fetch())
- {
- echo "</tr>";
- echo "<td>", $row['first_name'], ' ', $row['last_name'],"</td>";
- echo "<td>", $row['operation_name'], "</td>";
- echo "<td>", $row['thora'], "</td>";
- echo "<td>", $row['date'], "</td>";
- echo "<td>", $row['amount'], '₪', "</td>";
- echo "</tr>";
- $totalsum = $row['TotalAmount'];
- }
- $sth->closeCursor();
- }
- break;
- case "Button 4": //הצג הכל
- $sth = $conn->query("SELECT data_integration_table.date, data_integration_table.thora, data_integration_table.amount, customer_table.first_name, customer_table.last_name, operation_table.operation_name, sum(data_integration_table.amount) AS 'TotalAmount' FROM data_integration_table
- INNER JOIN customer_table ON data_integration_table.customer_id = customer_table.customer_id
- INNER JOIN operation_table ON data_integration_table.operation_id = operation_table.operation_id");
- $sth->setFetchMode(PDO::FETCH_BOTH);// Mode par défaut (tableau)
- while($row = $sth->fetch())
- {
- echo "</tr>";
- echo "<td>", $row['first_name'], ' ', $row['last_name'],"</td>";
- echo "<td>", $row['operation_name'], "</td>";
- echo "<td>", $row['thora'], "</td>";
- echo "<td>", $row['date'], "</td>";
- echo "<td>", $row['amount'], '₪', "</td>";
- echo "</tr>";
- $totalsum = $row['TotalAmount'];
- }
- // $totalsum = $row['TotalAmount'];
- $sth->closeCursor();
- break;
- } // Closw Switch
- echo "</table>";
- echo "<table>";
- echo "<tr class='noborder'>
- <td></td>
- <td></td>
- <td></td>
- <th>סך הכל</th>
- <th>", $totalsum, '₪', "</th>
- </tr>
- </table>";
- $conn = null;
- ?>
- </div><!-- #innner -->
- </div><!-- #content -->
- <!-- #footer -->
- <footer>
- <?php include("footer.php"); ?> <!-- insert the footer -->
- </footer><!-- #footer -->
- </body>
- </html>
Add Comment
Please, Sign In to add comment