booking/my_points.php

152 lines
10 KiB
PHP
Executable File

<?php
require_once('fixed/config/go_con.php');
access(41);
$google_translate = true;
$today = date("Y-m");
if (!empty($_GET['date'])) {
$today = $_GET['date'];
if (DateTime::createFromFormat('Y-m', $today) == false) {
$today = date("Y-m");
}
}
$Next = date('Y-m', strtotime('+1 month', strtotime($today)));
$Previous = date('Y-m', strtotime('-1 month', strtotime($today)));
?>
<!DOCTYPE html>
<html lang="en" dir="rtl">
<?php require_once('fixed/head/go.php'); ?>
<body class="rtl">
<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">
<!-- Container-fluid starts-->
<div class="container-fluid">
<div class="row">
<div class="col-12">
<div class="card">
<div class="tab-content">
<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>
نقاطي لشهر
<br />
<?= $today ?>
</h4>
</div>
<div class="col-12 col-sm-12 col-md-3 col-lg-4 col-xl-4">
</div>
</div>
<div class="row">
<div class="col-12 col-sm-12 col-md-2 col-lg-3 col-xl-3">
</div>
<div class="col-2 col-sm-2 col-md-1 col-lg-1 col-xl-1">
<a class="btn btn-danger btn-round waves-effect waves-light col-12" href="my_points?date=<?= $Previous ?>" style="padding: 0.375rem 0.75rem;">-</a>
</div>
<div class="col-8 col-sm-8 col-md-6 col-lg-4 col-xl-4">
<input id="Select-date" class="form-control" type="date" value="" style="text-align: center !important;">
</div>
<div class="col-2 col-sm-2 col-md-1 col-lg-1 col-xl-1">
<a class="btn btn-primary btn-round waves-effect waves-light col-12" href="my_points?date=<?= $Next ?>" style="padding: 0.375rem 0.75rem;">+</a>
</div>
<div class="col-12 col-sm-12 col-md-2 col-lg-3 col-xl-3">
</div>
</div>
</div>
<div class="card-body new-user order-list">
<div class="table-responsive">
<table class="table table-bordered text-center">
<thead class="table-primary" style="vertical-align: middle;">
<tr>
<th rowspan="2" scope="col">#</th>
<th rowspan="2" scope="col">التاريخ</th>
<th rowspan="2" scope="col">النقاط</th>
</tr>
</thead>
<tbody>
<?php
if ((strtotime($today)) > strtotime('2022-10-31')) {
$get_book_details_sql = mysqli_query($db,
"SELECT
IFNULL(`bd`.`day_date`,0) AS `day_date`,
IFNULL(SUM(`services`.`point`),0) AS `point`
FROM `book_details` AS `bd`
INNER JOIN `book` ON `bd`.`book_id` = `book`.`id`
INNER JOIN `services` ON `bd`.`services_id` = `services`.`id`
INNER JOIN `emplyee` ON `bd`.`emplyee_id` = `emplyee`.`id`
WHERE `bd`.`day_date` LIKE '$today%'
AND `bd`.`emplyee_id`='$admin_emp_id'
AND `emplyee`.`occupation_id` = 2
AND `bd`.`status_id` IN (14,12,13,15)
AND `bd`.`id` IN (SELECT MAX(`book_details`.`id`) FROM `book_details` WHERE `book_details`.`book_id` = `bd`.`book_id`)
GROUP BY `bd`.`day_date`
ORDER BY `bd`.`day_date`
");
if (mysqli_num_rows($get_book_details_sql) > 0) {
$count = 1;
$total = 0;
while ($get_book_details = mysqli_fetch_assoc($get_book_details_sql)) {
?>
<tr>
<th scope="row"><?=$count?></th>
<td><?=$get_book_details['day_date']?></td>
<td><?=$get_book_details['point']?></td>
</tr>
<?php
$total += $get_book_details['point'];
$count++;
}
?>
<tr>
<td colspan = "2">المجموع</td>
<td><?= $total ?></td>
</tr>
<?php
} else {
?>
<th colspan = "3">لا يتوفر اي معلومات</th>
<?php
}
} else {
?>
<tr>
<th colspan = "3">يرجى مراجعة قسم الحسابات</th>
</tr>
<?php
}
?>
</tbody>
</table>
</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 = 'my_points?date=' + SelectedDate
});
</script>
</body>
</html>