-
Notifications
You must be signed in to change notification settings - Fork 0
/
reciept.php
157 lines (143 loc) · 6.45 KB
/
reciept.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
<?php
include_once 'functions/authentication.php';
include_once 'functions/connection.php';
$id = $_GET['id'];
$sql = "SELECT p.*, b.* FROM `payments` p INNER JOIN `boarders` b ON p.boarder = b.id WHERE p.id = :id";
$stmt = $db->prepare($sql);
$stmt->bindParam(':id', $id);
$stmt->execute();
$result = $stmt->fetch();
$boarder = $result['fullname'];
$total = $result['total'];
$amount = $result['amount'];
$change = $amount - $total ;
function getRentalReciept(){
global $db;
global $id;
$sql = "SELECT p.*, b.* FROM `payments` p INNER JOIN `boarders` b ON p.boarder = b.id WHERE p.id = :id";
$stmt = $db->prepare($sql);
$stmt->bindParam(':id', $id);
$stmt->execute();
$result = $stmt->fetchAll();
foreach($result as $row){
?>
<tr class="font-monospace">
<td class="font-monospace text-start mt-0 mb-0" style="font-size: 10px;"><?= $row['fullname']?></td>
<th class="font-monospace text-center mt-0 mb-0" style="font-size: 10px;">Room #<?= $row['room'].' - '.$row['type']?></th>
<th class="font-monospace text-center mt-0 mb-0" style="font-size: 10px;">₱<?= number_format($row['total'], 2)?></th>
<td class="font-monospace text-end mt-0 mb-0" style="font-size: 10px;">₱<?= number_format($row['amount'], 2)?></td>
</tr>
<?php
}
}
?>
<!DOCTYPE html>
<html data-bs-theme="light" lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
<title>BHRMS</title>
<meta name="description" content="BHRMS - Boarding House Rental Management System">
<link rel="stylesheet" href="assets/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Nunito:200,200i,300,300i,400,400i,600,600i,700,700i,800,800i,900,900i&display=swap">
</head>
<!-- <body class="mx-5" onload=""> -->
<body class="mx-5" onload="printPageAndRedirect()">
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th class="font-monospace text-center" style="color: var(--bs-gray-900);font-size: 13px;">
BHRMS - Boarding House Rental Management System<br>
<span style="font-weight: normal !important;">Street Unknown, Pagadian City</span><br>
<span style="font-weight: normal !important;">Phone (+63) 000-000-000</span><br>
<span style="font-weight: normal !important;">Date: <?php echo date('Y-m-d')?></span><br>
</th>
</tr>
</thead>
<tbody>
<tr></tr>
<tr></tr>
</tbody>
</table>
</div>
<div class="table-responsive">
<table class="table table-borderless">
<thead>
<tr>
<th class="font-monospace text-center" style="font-size: 15px;">Rental Reciept</th>
</tr>
</thead>
<tbody class="font-monospace">
<tr class="font-monospace"></tr>
<tr class="font-monospace"></tr>
</tbody>
</table>
</div>
<div class="table-responsive font-monospace">
<table class="table table-borderless">
<thead class="font-monospace">
<tr class="font-monospace">
<th class="font-monospace" style="font-size: 15px;"><span style="font-weight: normal !important;">BOARDER: <strong><?php echo $boarder; ?></strong></span></th>
<th class="font-monospace text-end" style="font-size: 15px;"></th>
<th class="font-monospace text-end" style="font-size: 15px;"></th>
<th class="font-monospace text-end" style="font-size: 15px;">INVOICE #<?php echo $_GET['id'] ?></th>
</tr>
</thead>
<tbody class="font-monospace">
</tbody>
</table>
</div>
<div class="table-responsive font-monospace">
<table class="table table-borderless">
<thead class="font-monospace">
<tr class="font-monospace">
<th class="font-monospace text-start" style="font-size: 15px;"><span><strong>BOARDER</strong></span></th>
<th class="font-monospace text-center" style="font-size: 15px;"><span><strong>ROOM</strong></span></th>
<th class="font-monospace text-center" style="font-size: 15px;"><span><strong>PRICE</strong></span></th>
<th class="font-monospace text-end" style="font-size: 15px;"><span><strong>AMOUNT</strong></span></th>
</tr>
</thead>
<tbody class="font-monospace">
<?php getRentalReciept() ?>
</tbody>
</table>
</div>
<div class="table-responsive">
<table class="table">
<thead class="font-monospace">
<tr class="font-monospace">
<th class="font-monospace text-end"><strong>TOTAL</strong> <strong>₱<?php echo number_format($total, 2); ?></strong><br><strong>CHANGE</strong> <strong>₱<?php echo number_format($change, 2); ?></strong></th>
</tr>
</thead>
<tbody>
<tr></tr>
</tbody>
</table>
</div>
<script src="assets/js/jquery.min.js"></script>
<script src="assets/bootstrap/js/bootstrap.min.js"></script>
<script src="assets/js/jquery.dataTables.min.js"></script>
<script src="assets/js/dataTables.bootstrap5.min.js"></script>
<script src="assets/js/dataTables.buttons.min.js"></script>
<script src="assets/js/jszip.min.js"></script>
<script src="assets/js/pdfmake.min.js"></script>
<script src="assets/js/vfs_fonts.js"></script>
<script src="assets/js/buttons.html5.min.js"></script>
<script src="assets/js/buttons.print.min.js"></script>
<script src="assets/js/listTable.js"></script>
<script src="assets/js/theme.js"></script>
<script>
$(document) .ready(function() {
} );
function printPageAndRedirect() {
setTimeout(function() {
window.setTimeout(function() {
window.print();
window.location.href = 'rentals.php';
}, 500);
}, 500);
}
</script>
</body>
</html>