2025-03-24 19:02:58 +03:00

152 lines
5.4 KiB
PHP

<?php
require_once('fixed/config/go_con.php');
$data = [];
$get_invoices_sql = mysqli_query(
$db,
"SELECT
`bd`.`day_date`,
`bd`.`day_time`,
`book`.`date_time`,
`user`.`name` AS `user_book`,
`user_inv`.`name` AS `inv_user`,
`tretment`.`name` AS `tr_name`,
`tretment`.`number`
FROM `invoices_has_book`
INNER JOIN `invoices` ON `invoices_has_book`.`invoices_id` = `invoices`.`id`
INNER JOIN `book` ON `invoices_has_book`.`book_id` = `book`.`id`
INNER JOIN `book_details` AS `bd` ON `bd`.`book_id` = `book`.`id`
INNER JOIN `tretment` ON `book`.`tretment_id` = `tretment`.`id`
INNER JOIN `user` ON `book`.`user_id` = `user`.`id`
INNER JOIN `user` AS `user_inv` ON `invoices`.`user_id` = `user_inv`.`id`
INNER JOIN (
SELECT `book_id`, MAX(`id`) AS `max_id`
FROM `book_details`
GROUP BY `book_id`
) `t1_max`
ON `bd`.`book_id` = `t1_max`.`book_id` AND `bd`.`id` = `t1_max`.`max_id`
WHERE `invoices`.`user_id`= 246 OR `user`.`id`= 246
ORDER BY `bd`.`day_time`, `bd`.`date_time`
"
);
if (mysqli_num_rows($get_invoices_sql) > 0) {
while ($get_invoices = mysqli_fetch_assoc($get_invoices_sql)) {
array_push($data, $get_invoices);
}
}
?>
<!DOCTYPE html>
<html lang="en" dir="rtl">
<?php require_once('fixed/head/go.php'); ?>
<body class="rtl">
<style>
tr {
border-color: #bfbbbb !important;
}
.table-bordered td,
.table-bordered th {
border-color: #bfbbbb !important;
}
</style>
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/@mdi/font@6.5.95/css/materialdesignicons.min.css">
<?php require_once('fixed/loader/go.php'); ?>
<!-- page-wrapper Start-->
<div class="page-wrapper" id="pageWrapper">
<?php require_once('fixed/header/go.php'); ?>
<!-- Page Body Start-->
<div class="page-body-wrapper">
<?php require_once('fixed/sidebar/go.php'); ?>
<div class="page-body">
<div class="container-fluid">
<div class="row">
<div class="col-12 col-sm-12 col-md-12 col-lg-12 col-xl-12">
<div class="card">
<div class="card-body new-user order-list text-center">
<div class="row">
<div class="col-12 col-sm-12 col-md-3 col-lg-4 col-xl-4">
</div>
<div class="page-title mb-3 col-12 col-sm-12 col-md-6 col-lg-4 col-xl-4">
<i class="mdi mdi-monitor mr-2">
</i>
<h4>
5465466
</h4>
</div>
<div class="col-12 col-sm-12 col-md-3 col-lg-4 col-xl-4">
</div>
</div>
</div>
<div class="tab-content">
<div class="tab-pane p-3 active" id="tab<?= $tabs ?>" role="tabpanel">
<div class="card-body new-user order-list">
<div class="table-responsive">
<table class="table table-bordered text-center" style="vertical-align: middle;">
<thead class="table-primary" style="vertical-align: middle;">
<tr>
<th scope="col">#</th>
<th scope="col">اسم العميلة</th>
<th scope="col">رقم الجوال</th>
<th scope="col">تاريخ الزيارة</th>
<th scope="col">وقت الزيارة</th>
<th scope="col">تاريخ الحجز</th>
<th scope="col">حجز بواسطة</th>
<th scope="col">تفعل بواسطة</th>
</tr>
</thead>
<tbody>
<?php
$count = 1;
foreach ($data as $key => $value) {
?>
<tr>
<td><?=$count?></td>
<td><?=$data[$key]['tr_name']?></td>
<td><?=$data[$key]['number']?></td>
<td><?=$data[$key]['day_date']?></td>
<td><?=$data[$key]['day_time']?></td>
<td><?=$data[$key]['date_time']?></td>
<td><?=$data[$key]['user_book']?></td>
<td><?=$data[$key]['inv_user']?></td>
</tr>
<?php
$count++;
}
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php require_once('fixed/footer/go.php'); ?>
</div>
</div>
<?php require_once('fixed/js/go.php'); ?>
<script>
$("#Select-date").change(function () {
var SelectedDate = $(this).val();
window.location = 'custom_reports?s=47&b=<?= $branch_id ?>&date=' + SelectedDate
});
</script>
</body>
</html>