File: /home/bigisxfd/public_html/cowork/print.php
<?php
require_once("databaseconnect.php");
date_default_timezone_set('Asia/Singapore');
$memberId = isset($_GET['memberid']) ? $_GET['memberid'] : 0;
$bookingId = $_GET['bookingId'];
$name = $_GET['name'];
$in = $_GET['in'];
$out = $_GET['out'];
// Fetch data from the database
$query = "SELECT * FROM Orders WHERE memberid = $memberId ORDER BY orderid DESC";
$result = $conn->query($query);
if ($result->num_rows > 0) {
$row = $result->fetch_assoc();
// Replace with your date formatting logic
$date = (new DateTime())->format('Y-m-d');
// Replace with your currency symbol
$currencySymbol = '₱';
?>
<style>
@media print {
/* Hide the print button in print mode */
.print-button {
display: none;
}
}
/* Add Calibri font family to the div and pre elements */
div, pre {
font-family: 'Calibri', sans-serif;
font-size: 1.2em; /* Increase font size by 20% */
}
</style>
<div style="width: 300px; margin: auto; padding: 00px;">
<center>
<img src="https://bigideas.yuuinnovations.com/wp-content/uploads/2023/07/big-ideas.png" width="250px"/>
<p><b>Big Ideas Cowork</b><br>3rd floor Jomafer Building <br>Dolores, San Fernando<br>0917 134 1749</p>
</center>
<?php
// Output the receipt
echo '<pre>';
echo "Date: $date\n";
// Check if bookingid is set before displaying it
echo "Booking ID: $bookingId\n";
echo "Name: $name\n <hr>";
// Output each item from the items column
$items = explode("\n", $row['items']);
foreach ($items as $item) {
echo "$item\n";
}
$total = $row['amount'];
$paymentStatus = $row['payment_status'];
echo "Total: {$currencySymbol}{$total}\n";
if ($paymentStatus == 0) {
echo "Balance: {$currencySymbol}{$total} (Unpaid)\n";
}
echo '</pre>';
?>
<hr>
<pre style="font-size: 1em;">TIME IN: <?php echo $in; ?><br>TIME OUT: <?php echo $out; ?>
</pre>
<hr>
<center>
<b>WIFI NAME:</b><br> BIGIDEAS5g<br><br>
<b>WIFI PASSWORD:</b><br> Bigidea$1234
</center>
<hr>
DRINK INCLUSION ( If applicable)<br>
Drink #1: __________________<br> Time Served:<br>
Drink #2: __________________<br> Time Served:<br>
<hr>
Thank you for choosing BIG ideas and wishing you a Productive Day!
</div>
<center>
<button class="print-button" onclick="printPage()">Print</button>
<script>
function printPage() {
window.print(); // This will trigger the browser's print functionality
}
</script>
</center>
<?php
} else {
echo "No orders found for member ID: $memberId";
}
$conn->close();
?>