277 lines
16 KiB
PHP
Executable File
277 lines
16 KiB
PHP
Executable File
<?php
|
|
require_once('fixed/config/go_con.php');
|
|
access(6);
|
|
|
|
$today = date("Y-m-d");
|
|
if (!empty($_GET['date'])) {
|
|
$today = $_GET['date'];
|
|
if (DateTime::createFromFormat('Y-m-d', $today) == false) {
|
|
$today = date("Y-m-d");
|
|
}
|
|
}
|
|
|
|
|
|
$branch_id = $_SESSION['branch'];
|
|
if (!empty($_GET['branch'])) {
|
|
$branch_id = $_GET['branch'];
|
|
if (!is_numeric($branch_id)) {
|
|
$branch_id = $_SESSION['branch'];
|
|
}
|
|
}
|
|
$branch_sql = '`branch_id`='.$branch_id;
|
|
if ($branch_id == 1) {
|
|
$branch_sql = '`branch_id`<>'.$branch_id;
|
|
}
|
|
|
|
|
|
$Next = date('Y-m-d', strtotime('+1 day', strtotime($today)));
|
|
$Previous = date('Y-m-d', strtotime('-1 day', strtotime($today)));
|
|
$Day = date('D', strtotime($today));
|
|
|
|
|
|
function Day_ar()
|
|
{
|
|
global $Day;
|
|
$find = array("Sat", "Sun", "Mon", "Tue", "Wed", "Thu", "Fri");
|
|
$replace = array("السبت", "الأحد", "الإثنين", "الثلاثاء", "الأربعاء", "الخميس", "الجمعة");
|
|
$ar_day_format = $Day;
|
|
$Day_ar = str_replace($find, $replace, $ar_day_format);
|
|
|
|
return $Day_ar;
|
|
}
|
|
|
|
function Today_ar()
|
|
{
|
|
global $today;
|
|
$Today_ar = date('d-m-Y', strtotime($today));
|
|
return $Today_ar;
|
|
}
|
|
|
|
$tabs = $_SESSION['tab'];
|
|
if (empty($tabs)) {
|
|
$tabs = 1;
|
|
}
|
|
$not_eq = "=";
|
|
if ($tabs == 1) {
|
|
$not_eq = "<>";
|
|
}
|
|
|
|
|
|
?>
|
|
<!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="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>
|
|
حجوزات يوم
|
|
<?= Day_ar() ?>
|
|
<br />
|
|
<?= Today_ar() ?>
|
|
</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="book_cancel.php?date=<?= $Previous ?>&branch=<?= $branch_id ?>" 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="book_cancel.php?date=<?= $Next ?>&branch=<?= $branch_id ?>" 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>
|
|
<?php
|
|
$type_of_services_sql = mysqli_query($db, "SELECT `id`, `name`
|
|
FROM `type_of_services`
|
|
WHERE `show_in_table_id` = 2 AND `activation_id` = 2"
|
|
);
|
|
|
|
if (mysqli_num_rows($type_of_services_sql) > 0) {
|
|
?>
|
|
<div class="card-body">
|
|
<ul class="nav nav-pills nav-justified" role="tablist">
|
|
<?php
|
|
if (mysqli_num_rows($type_of_services_sql) > 1) {
|
|
?>
|
|
<li class="nav-item waves-effect waves-light">
|
|
<a class="nav-link <?php if($tabs == 1 ) {echo "active";} ?>" data-toggle="tab" onclick="window.location='work/order/php/tabs.php?num=1'" role="tab" aria-selected="true">الكل</a>
|
|
</li>
|
|
<?php
|
|
}
|
|
?>
|
|
<?php
|
|
while ($type_of_services = mysqli_fetch_assoc($type_of_services_sql)) {
|
|
?>
|
|
<li class="nav-item waves-effect waves-light">
|
|
<a class="nav-link <?php if($tabs == $type_of_services['id'] ) {echo "active";} ?>" data-toggle="tab" onclick="window.location='work/order/php/tabs.php?num=<?=$type_of_services['id']?>'" role="tab" aria-selected="false"><?=$type_of_services['name']?></a>
|
|
</li>
|
|
<?php
|
|
}
|
|
?>
|
|
</ul>
|
|
</div>
|
|
<?php
|
|
}
|
|
?>
|
|
|
|
<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">
|
|
<thead class="table-primary">
|
|
<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
|
|
$get_book_cancel_sql = mysqli_query($db,
|
|
"SELECT
|
|
`book`.`id`,
|
|
`bd`.`day_time`,
|
|
`branch`.`branch_name`,
|
|
`tretment`.`name` AS `tr_name`,
|
|
`tretment`.`number`,
|
|
`services`.`name` AS `serv_name`,
|
|
`emplyee`.`name`,
|
|
`emplyee`.`his_img`,
|
|
`bd`.`date_time`,
|
|
`user`.`name` AS `user_cancel`
|
|
|
|
FROM `book_details` AS `bd`
|
|
|
|
LEFT JOIN `book` ON `bd`.`book_id` = `book`.`id`
|
|
LEFT JOIN `tretment` ON `book`.`tretment_id` = `tretment`.`id`
|
|
LEFT JOIN `user` ON `book`.`user_id` = `user`.`id`
|
|
LEFT JOIN `services` ON `bd`.`services_id` = `services`.`id`
|
|
LEFT JOIN `emplyee` ON `bd`.`emplyee_id` = `emplyee`.`id`
|
|
LEFT JOIN `occupation` ON `emplyee`.`occupation_id` = `occupation`.`id`
|
|
LEFT JOIN `branch` ON `bd`.`branch_id` = `branch`.`id`
|
|
|
|
WHERE `bd`.`day_date`='$today'
|
|
AND `bd`.`status_id` IN (20,21,22,25)
|
|
AND `occupation`.`type_of_services_id` $not_eq $tabs
|
|
AND `bd`.`id` IN (SELECT MAX(`book_details`.`id`) FROM `book_details` WHERE `book_details`.`day_date`='$today' GROUP BY `book_details`.`day_time`)
|
|
ORDER BY `bd`.`day_time`
|
|
");
|
|
|
|
while ($get_book_cancel = mysqli_fetch_assoc($get_book_cancel_sql)) {
|
|
?>
|
|
<tr>
|
|
<th scope="row"><?=$get_book_cancel['id']?></th>
|
|
<td><?=$get_book_cancel['tr_name']?></td>
|
|
<td><?=$get_book_cancel['number']?></td>
|
|
<td><?=$get_book_cancel['day_time']?></td>
|
|
<td><?=$get_book_cancel['serv_name']?></td>
|
|
<td><?=$get_book_cancel['name']?></td>
|
|
<td><?=$get_book_cancel['date_time']?></td>
|
|
<td><?=$get_book_cancel['user_cancel']?></td>
|
|
</tr>
|
|
<?php
|
|
}
|
|
?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!--end card-body-->
|
|
</div>
|
|
<!--end card-->
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- Container-fluid Ends-->
|
|
</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 = 'book_cancel.php?branch=<?= $branch_id ?>&date=' + SelectedDate
|
|
});
|
|
</script>
|
|
|
|
<?php
|
|
$lastid_php_sql = mysqli_query($db, "SELECT MAX(`id`) AS `id` FROM `book_details`;");
|
|
$lastid_php = mysqli_fetch_assoc($lastid_php_sql);
|
|
?>
|
|
<script>
|
|
function refrish() {
|
|
window.location.reload(1);
|
|
}
|
|
|
|
// Check if the entire page is already loaded
|
|
$( document ).ready(function() {
|
|
|
|
// Set the interval for the window refresh
|
|
window.setInterval(function() {
|
|
// get the database information
|
|
getInfo();
|
|
}, 1000); // Check every 30 seconds (60000 milliseconds = 60 seconds = 1 minute)
|
|
|
|
function getInfo() {
|
|
|
|
//make the ajax call
|
|
$.ajax({
|
|
url: 'work/order/ajax/book_ajax.php',
|
|
type: 'POST',
|
|
data: {lastid : <?= json_encode($lastid_php['id']) ?>},
|
|
success: function(data) {
|
|
// If data is available then reflect it to the sales container
|
|
if (data['val'] == 1) {
|
|
refrish();
|
|
}
|
|
console.log(data['val']);
|
|
},
|
|
error: function (request, status, error) {
|
|
//alert(request.responseText + 'يرجى اعادة تحديث الصفحة');
|
|
refrish();
|
|
}
|
|
});
|
|
}
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|