229 lines
17 KiB
PHP
229 lines
17 KiB
PHP
<?php
|
|
require_once ('fixed/config/go_con.php');
|
|
access(62);
|
|
|
|
$today = date("Y-m");
|
|
if (!empty($_GET['date'])) {
|
|
$today = $_GET['date'];
|
|
if (DateTime::createFromFormat('Y-m', $today) == false) {
|
|
$today = date("Y-m");
|
|
}
|
|
}
|
|
|
|
|
|
$emp_id = mysqli_real_escape_string($db, $_GET['id']);
|
|
if (!empty($emp_id)) {
|
|
if (!is_numeric($emp_id)) {
|
|
$emp_id = 0;
|
|
}
|
|
}
|
|
|
|
$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="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="emp_bath_points_d?id=<?= $emp_id ?>&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="emp_bath_points_d?id=<?= $emp_id ?>&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="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" style="vertical-align: middle;">
|
|
<tr>
|
|
<th rowspan="2" scope="col">#</th>
|
|
<th rowspan="2" scope="col">اسم العميل</th>
|
|
<th rowspan="2" scope="col">رقم العميل</th>
|
|
<th rowspan="2" scope="col">تاريخ الحجز</th>
|
|
<th rowspan="2" scope="col">وقت الحجز</th>
|
|
<th rowspan="2" scope="col">الخدمة</th>
|
|
<th rowspan="2" scope="col">سعر الخدمة الاساسي</th>
|
|
<th rowspan="2" scope="col">المبلغ</th>
|
|
<th rowspan="2" scope="col">النقاط</th>
|
|
<th rowspan="2" scope="col">x 15</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php
|
|
$total = 0;
|
|
$serv_p = 0;
|
|
$inv_price = 0;
|
|
$get_book_details_sql = mysqli_query(
|
|
$db,
|
|
"SELECT
|
|
`invoices`.`price`,
|
|
`bd`.`day_date`,
|
|
`bd`.`day_time`,
|
|
`bd`.`book_id`,
|
|
`services`.`id` AS `serv_id`,
|
|
`services`.`name`,
|
|
`services`.`price` AS `serv_p`,
|
|
`services`.`point`,
|
|
`tretment`.`name` AS `tr_name`,
|
|
`tretment`.`number`,
|
|
IFNULL(
|
|
(SELECT
|
|
SUM(`invoices_discount_details`.`discount`)
|
|
FROM `invoices_discount_details`
|
|
LEFT JOIN `invoices_discount` ON `invoices_discount_details`.`invoices_discount_id` = `invoices_discount`.`id`
|
|
LEFT JOIN `invoices_details` ON `invoices_discount`.`invoices_details_id` = `invoices_details`.`id`
|
|
WHERE `invoices_details`.`invoices_id` = `invoices`.`id`
|
|
AND `invoices_discount_details`.`services_id` = `services`.`id`
|
|
AND `invoices_discount_details`.`id` IN (SELECT
|
|
`invoices_discount_details`.`id`
|
|
FROM `invoices_discount_details`
|
|
LEFT JOIN `invoices_discount` ON `invoices_discount_details`.`invoices_discount_id` = `invoices_discount`.`id`
|
|
LEFT JOIN `invoices_details` ON `invoices_discount`.`invoices_details_id` = `invoices_details`.`id`
|
|
WHERE `invoices_details`.`invoices_id` = `invoices`.`id`
|
|
AND `invoices_discount_details`.`services_id` = `services`.`id`
|
|
GROUP BY `invoices_discount_details`.`reason`
|
|
)
|
|
)
|
|
,0) AS `desc`
|
|
|
|
FROM `book_details` AS `bd`
|
|
|
|
INNER JOIN `book` ON `bd`.`book_id` = `book`.`id`
|
|
INNER JOIN `invoices_has_book` ON `invoices_has_book`.`book_id` = `book`.`id`
|
|
INNER JOIN `invoices` ON `invoices_has_book`.`invoices_id` = `invoices`.`id`
|
|
INNER JOIN `tretment` ON `book`.`tretment_id` = `tretment`.`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`='$emp_id'
|
|
AND `emplyee`.`occupation_id` = 3
|
|
AND `bd`.`status_id` IN (6,8,12,13,14,15)
|
|
AND `bd`.`id` IN (SELECT MAX(`book_details`.`id`) FROM `book_details` GROUP BY `book_details`.`book_id`)
|
|
|
|
ORDER BY `bd`.`day_date`, `bd`.`day_time`
|
|
"
|
|
);
|
|
$count = 1;
|
|
while ($get_book_details = mysqli_fetch_assoc($get_book_details_sql)) {
|
|
if ($get_book_details['serv_id'] == 0) {
|
|
$book_id_for_bundle = $get_book_details['book_id'];
|
|
$bundle_s = mysqli_query($db, "SELECT
|
|
`services`.`name`,
|
|
(`services`.`price`*`bundle_services_has_services`.`how_many`) AS `price`
|
|
|
|
FROM `bundle_services_has_services`
|
|
INNER JOIN `services` ON `services`.`id` = `bundle_services_has_services`.`services_id`
|
|
WHERE `bundle_services_has_services`.`bundle_services_id` = (SELECT `bundle_services_id` FROM `book_details_has_bundle_services` WHERE `book_details_id` = (SELECT MIN(`id`) FROM `book_details` WHERE `book_id` = $book_id_for_bundle AND `status_id` = 4))
|
|
");
|
|
if (mysqli_num_rows($bundle_s) > 0) {
|
|
while ($bundle_s_row = mysqli_fetch_assoc($bundle_s)) {
|
|
$get_book_details['serv_p'] += $bundle_s_row['price'];
|
|
}
|
|
}
|
|
}
|
|
?>
|
|
<tr>
|
|
<th scope="row"><?= $count ?></th>
|
|
<td><?= $get_book_details['tr_name'] ?></td>
|
|
<td><?= $get_book_details['number'] ?></td>
|
|
<td><?= $get_book_details['day_date'] ?></td>
|
|
<td><?= $get_book_details['day_time'] ?></td>
|
|
<td><?= $get_book_details['name'] ?></td>
|
|
<td><?= round($get_book_details['serv_p'], 2) ?></td>
|
|
<td><?= round((round($get_book_details['serv_p'], 2) - round($get_book_details['desc'], 2)) + ((round($get_book_details['serv_p'], 2) - round($get_book_details['desc'], 2)) * 15 / 100), 2) ?>
|
|
</td>
|
|
<td><?= $get_book_details['point'] ?></td>
|
|
<td><?= $get_book_details['point'] * 15 ?></td>
|
|
</tr>
|
|
<?php
|
|
$inv_price += round((round($get_book_details['serv_p'], 2) - round($get_book_details['desc'], 2)) + ((round($get_book_details['serv_p'], 2) - round($get_book_details['desc'], 2)) * 15 / 100), 2);
|
|
$serv_p += round($get_book_details['serv_p'], 2);
|
|
$total += $get_book_details['point'];
|
|
$count++;
|
|
}
|
|
?>
|
|
<tr>
|
|
<td colspan="6">المجموع</td>
|
|
<td><?= $serv_p ?></td>
|
|
<td><?= $inv_price ?></td>
|
|
<td><?= $total ?></td>
|
|
<td><?= $total * 15 ?></td>
|
|
</tr>
|
|
</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 = 'emp_bath_points_d?id=<?= $emp_id ?>&date=' + SelectedDate
|
|
});
|
|
</script>
|
|
</body>
|
|
|
|
</html>
|