@@ -13,7 +13,7 @@ function user_logs(){
13
13
foreach ($ results as $ row ) {
14
14
?>
15
15
<tr>
16
- <td><?php echo $ row ['id ' ]; ?> </td>
16
+ <td># <?php echo $ row ['id ' ]; ?> </td>
17
17
<td><?php echo $ row ['type ' ] ?> </td>
18
18
<td><?php echo $ row ['logs ' ] ?> </td>
19
19
<td><?php echo $ row ['created_at ' ] ?> </td>
@@ -37,7 +37,7 @@ function customer_list(){
37
37
<td><?php echo $ row ['address ' ] ?> </td>
38
38
<td><?php echo $ row ['created_at ' ] ?> </td>
39
39
<td class="text-center">
40
- <a data-bss-tooltip="" class="mx-1" href="profile.php?id= <?php echo $ row [ ' id ' ] ?> " title="Here you can see the customer transactions."><i class="far fa-eye text-primary" style="font-size: 20px;"></i></a>
40
+
41
41
<a data-bs-toggle="modal" data-bss-tooltip="" class="mx-1" href="#" data-bs-target="#update" data-id="<?php echo $ row ['id ' ]?> " data-fullname="<?php echo $ row ['fullname ' ]?> " data-address="<?php echo $ row ['address ' ]?> " data-phone="<?php echo $ row ['phone ' ]?> " title="Here you can update the customer Information."><i class="far fa-edit text-warning" style="font-size: 20px;"></i></a>
42
42
<a data-bs-toggle="modal" data-bss-tooltip="" class="mx-1" href="#" data-bs-target="#remove" data-id="<?php echo $ row ['id ' ]?> " title="Here you can remove the customer."><i class="far fa-trash-alt text-danger" style="font-size: 20px;"></i></a>
43
43
</td>
@@ -124,23 +124,25 @@ function cottage_available_list($start, $end, $type){
124
124
if (!$ rental ) {
125
125
?>
126
126
<div class="col-xl-4">
127
- <div class="card"><img class="card-img-top w-100 d-block fit-cover" style="height: 200px;" src="functions/<?php echo $ cottage ['picture ' ]; ?> ">
127
+ <div class="card">
128
+ <img class="card-img-top w-100 d-block fit-cover" style="height: 200px;" src="functions/<?php echo $ cottage ['picture ' ]; ?> ">
128
129
<div class="card-body p-4">
129
130
<p class="text-primary card-text mb-0">Cottage ID: <?php echo $ cottage ['id ' ]; ?> </p>
130
131
<h4 class="card-title mb-4"><?php echo $ cottage ['type ' ]; ?> </h4>
131
132
<p>Price Day: ₱<?php echo number_format ($ cottage ['priceDay ' ], 2 ); ?> </p>
132
133
<p>Price Night: ₱<?php echo number_format ($ cottage ['priceNight ' ], 2 ); ?> </p>
133
134
<div class="container mb-4">
134
135
<div class="row">
135
- <div class="col">
136
- <form action="" method="post">
137
- <button class="btn btn-primary mx-1" href="#add" type="button" data-bs-target="#add" data-bs-toggle="modal"
138
- data-id="<?php echo $ cottage ['id ' ]; ?> "
139
- data-type="<?php echo $ cottage ['type ' ]; ?> "
140
- data-start="<?php echo $ _GET ['start ' ]; ?> "
141
- data-end="<?php echo $ _GET ['end ' ]; ?> "
142
- >Add Cottage</button>
143
- </form>
136
+ <div class="col">
137
+ <form action="" method="post">
138
+ <button class="btn btn-primary mx-1" href="#add" type="button" data-bs-target="#add" data-bs-toggle="modal"
139
+ data-id="<?php echo $ cottage ['id ' ]; ?> "
140
+ data-type="<?php echo $ cottage ['type ' ]; ?> "
141
+ data-start="<?php echo $ _GET ['start ' ]; ?> "
142
+ data-end="<?php echo $ _GET ['end ' ]; ?> "
143
+ >Add Cottage</button>
144
+ </form>
145
+ </div>
144
146
</div>
145
147
</div>
146
148
</div>
@@ -179,11 +181,10 @@ function transaction_list(){
179
181
foreach ($ results as $ row ) {
180
182
?>
181
183
<tr>
182
- <td><img class="rounded-circle me-2" width="30" height="30" src="assets/img/icon.png"> <?php echo $ row ['cottage_name ' ]; ?> </td>
184
+ <td><img class="rounded-circle me-2" width="30" height="30" src="assets/img/icon.png"># <?php echo $ row ['cottage_name ' ]; ?> </td>
183
185
<td><?php echo $ row ['start_datetime ' ]; ?> </td>
184
186
<td><?php echo $ row ['end_datetime ' ]; ?> </td>
185
187
<td><?php echo $ row ['type ' ]; ?> </td>
186
- <td><?php echo $ row ['created_at ' ]; ?> </td>
187
188
<td class="text-center">
188
189
<a class="mx-1" href="#" data-bs-target="#update" data-id="<?php echo $ row ['id ' ]?> " data-type="<?php echo $ row ['type ' ]?> " data-start="<?php echo $ row ['start_datetime ' ]?> " data-end="<?php echo $ row ['end_datetime ' ]?> " data-bs-toggle="modal"><i class="fas fa-user-edit fs-4 text-warning"></i></a>
189
190
<a class="mx-1" href="#" data-bs-target="#remove" data-id="<?php echo $ row ['id ' ]?> " data-bs-toggle="modal"><i class="fas fa-trash-alt fs-4 text-danger"></i></a>
@@ -262,7 +263,7 @@ function activity_logs(){
262
263
foreach ($ results as $ row ) {
263
264
?>
264
265
<tr>
265
- <td><?php echo $ row ['id ' ]; ?> </td>
266
+ <td># <?php echo $ row ['id ' ]; ?> </td>
266
267
<td><?php echo $ row ['type ' ] ?> </td>
267
268
<td><?php echo $ row ['logs ' ] ?> </td>
268
269
<td><?php echo $ row ['created_at ' ] ?> </td>
@@ -277,6 +278,8 @@ function sales_report(){
277
278
r.type AS rental_type,
278
279
c.name AS cottage_name,
279
280
r.created_at AS created_at,
281
+ r.start_datetime AS startdate,
282
+ r.end_datetime AS enddate,
280
283
t.payment_status AS payment_status,
281
284
CASE
282
285
WHEN r.type = 'day' THEN c.priceDay
@@ -285,17 +288,20 @@ function sales_report(){
285
288
END AS cottage_price
286
289
FROM rentals r
287
290
JOIN cottages c ON r.cottage_id = c.id
288
- JOIN `transactions` t ON r.transact_id = t.id; " ;
291
+ JOIN `transactions` t ON r.transact_id = t.id
292
+ WHERE status = 'Proceed'; " ;
289
293
$ stmt = $ db ->prepare ($ sql );
290
294
$ stmt ->execute ();
291
295
$ results = $ stmt ->fetchAll ();
292
296
293
297
foreach ($ results as $ row ) {
294
298
?>
295
299
<tr>
296
- <td class="sorting_1"><img class="rounded-circle me-2" width="30" height="30" src="assets/img/icon.png"><?php echo $ row ['cottage_name ' ]?> </td>
300
+ <td class="sorting_1"><img class="rounded-circle me-2" width="30" height="30" src="assets/img/icon.png"># <?php echo $ row ['cottage_name ' ]?> </td>
297
301
<td><?php echo $ row ['cottage_price ' ]?> </td>
298
302
<td><?php echo $ row ['rental_type ' ]?> </td>
303
+ <td><?php echo $ row ['startdate ' ]?> </td>
304
+ <td><?php echo $ row ['enddate ' ]?> </td>
299
305
<td><?php echo $ row ['payment_status ' ]?> </td>
300
306
<td><?php echo $ row ['created_at ' ]?> </td>
301
307
</tr>
@@ -309,9 +315,13 @@ function rentals_list(){
309
315
$ sql = "SELECT r.id AS rental_id,
310
316
r.type AS rental_type,
311
317
c.name AS cottage_name,
318
+ r.start_datetime AS startdate,
319
+ r.end_datetime AS enddate,
312
320
r.created_at AS created_at,
321
+ r.amount AS amount,
313
322
t.payment_status AS payment_status,
314
323
t.id AS transaction_id,
324
+ u.fullname AS customer_name,
315
325
CASE
316
326
WHEN r.type = 'day' THEN c.priceDay
317
327
WHEN r.type = 'night' THEN c.priceNight
@@ -320,21 +330,35 @@ function rentals_list(){
320
330
FROM rentals r
321
331
JOIN cottages c ON r.cottage_id = c.id
322
332
JOIN `transactions` t ON r.transact_id = t.id
323
- WHERE t.payment_status = 'UNPAID'; " ;
333
+ JOIN `customers` u ON t.customer_id = u.id
334
+ WHERE t.payment_status = 'UNPAID' OR t.payment_status = 'PARTIALLY PAID'; " ;
324
335
$ stmt = $ db ->prepare ($ sql );
325
336
$ stmt ->execute ();
326
337
$ results = $ stmt ->fetchAll ();
327
338
328
339
foreach ($ results as $ row ) {
340
+ $ balance = $ row ['amount ' ] - $ row ['cottage_price ' ];
329
341
?>
330
342
<tr>
331
- <td class="sorting_1"><img class="rounded-circle me-2" width="30" height="30" src="assets/img/icon.png"><?php echo $ row ['cottage_name ' ]?> </td>
343
+ <td class="sorting_1"><img class="rounded-circle me-2" width="30" height="30" src="assets/img/icon.png">#<?php echo $ row ['cottage_name ' ]?> </td>
344
+ <td>#<?php echo $ row ['transaction_id ' ]?> </td>
345
+ <td><?php echo $ row ['customer_name ' ]?> </td>
332
346
<td><?php echo $ row ['cottage_price ' ]?> </td>
347
+ <td><?php echo $ balance?> </td>
333
348
<td><?php echo $ row ['rental_type ' ]?> </td>
349
+ <td><?php echo $ row ['startdate ' ]?> </td>
350
+ <td><?php echo $ row ['enddate ' ]?> </td>
334
351
<td><?php echo $ row ['payment_status ' ]?> </td>
335
352
<td><?php echo $ row ['created_at ' ]?> </td>
336
353
<td class="text-center">
337
- <button class="btn btn-info mx-1" href="#" data-bs-target="#paid" data-id="<?php echo $ row ['transaction_id ' ]?> " data-bs-toggle="modal">Mark Paid</button>
354
+ <button class="btn btn-success mx-1" href="#" data-bs-target="#paid" data-id="<?php echo $ row ['transaction_id ' ]?> " data-bs-toggle="modal">Mark Paid</button>
355
+ <?php
356
+ if ($ balance < 0 ){
357
+ ?>
358
+ <button class="btn btn-warning mx-1" href="#" data-bs-target="#partiallypaid" data-id="<?php echo $ row ['rental_id ' ]?> " data-transaction="<?php echo $ row ['transaction_id ' ]?> " data-price="<?php echo $ row ['cottage_price ' ]?> " data-bs-toggle="modal">Mark Partially Paid</button>
359
+ <?php
360
+ }
361
+ ?>
338
362
<button class="btn btn-danger mx-1" href="#" data-bs-target="#cancel" data-id="<?php echo $ row ['transaction_id ' ]?> " data-bs-toggle="modal">Cancel</button>
339
363
</td>
340
364
</tr>
0 commit comments