140 lines
7.2 KiB
PHP
Executable File
140 lines
7.2 KiB
PHP
Executable File
<?php
|
|
require_once('fixed/config/go_con.php');
|
|
access(76);
|
|
?>
|
|
|
|
<!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">
|
|
<style>
|
|
a.active {
|
|
background-color: #e6edef;
|
|
}
|
|
h1 {
|
|
background: #24695c;
|
|
padding-right: 10px;
|
|
color: white;
|
|
margin-left: 10px;
|
|
font-weight: bold;
|
|
}
|
|
</style>
|
|
<?php require_once('fixed/loader/go.php'); ?>
|
|
<div class="page-wrapper" id="pageWrapper">
|
|
<?php require_once('fixed/header/go.php'); ?>
|
|
<div class="page-body-wrapper">
|
|
<?php require_once('fixed/sidebar/go.php'); ?>
|
|
<div class="page-body">
|
|
<div class="container-fluid">
|
|
<div class="email-wrap bookmark-wrap">
|
|
<div class="row">
|
|
<div class="col-12 col-sm-12 col-md-12 col-lg-12 col-xl-12">
|
|
<div class="card">
|
|
<div class="tab-content" id="profile-tabContent">
|
|
<div class="tab-pane fade show active" id="all">
|
|
<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/>
|
|
</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 id="employee_data" 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>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php
|
|
$total = 0;
|
|
$get_book_details_sql = mysqli_query($db,
|
|
"SELECT
|
|
`tretment`.`id`,
|
|
`tretment`.`name`,
|
|
`tretment`.`number`,
|
|
SUM((`services`.`price`)+((`services`.`price`*15)/100)) AS `total_pays`,
|
|
COUNT(`book_id`) AS `total_pay_books`
|
|
FROM `tretment`
|
|
LEFT JOIN `book` ON `book`.`tretment_id` = `tretment`.`id`
|
|
LEFT JOIN `book_details` AS `dd` ON `book`.`id` = `dd`.`book_id`
|
|
LEFT JOIN `services` ON `dd`.`services_id` = `services`.`id`
|
|
|
|
WHERE `tretment`.`id` IN (SELECT `tretment_id` FROM `total_points` WHERE `point` > 5000)
|
|
AND `dd`.`id` IN (SELECT MAX(`book_details`.`id`) FROM `book_details` WHERE `book_id` = `dd`.`book_id` GROUP BY `book_details`.`book_id`)
|
|
AND `dd`.`status_id` IN (6,8,12,13,14)
|
|
GROUP BY `tretment`.`id`
|
|
HAVING `total_pay_books` > 5 AND `total_pays` > 5000
|
|
ORDER BY `tretment`.`id` ASC
|
|
");
|
|
|
|
$count = 1;
|
|
while ($get_book_details = mysqli_fetch_assoc($get_book_details_sql)) {
|
|
?>
|
|
<tr>
|
|
<th scope="row"><?=$count?></th>
|
|
<td><?=$get_book_details['name']?></td>
|
|
<td><?=$get_book_details['number']?></td>
|
|
<td><?=$get_book_details['total_pay_books']?></td>
|
|
<td><?=round($get_book_details['total_pays'],2)?></td>
|
|
<td><p>قد يكون المبلغ ليس دقيقا 100% بسبب البيانات السابقة من النظام القديم</p></td>
|
|
</tr>
|
|
<?php
|
|
$count++;
|
|
}
|
|
?>
|
|
</tbody>
|
|
</table>
|
|
<button type="button" id="export_button" class="btn btn-success btn-sm">ملف excel</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</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'); ?>
|
|
<?php require_once('fixed/waiting_ajax/go.php'); ?>
|
|
<script type="text/javascript" src="https://unpkg.com/xlsx@0.15.1/dist/xlsx.full.min.js"></script>
|
|
<script>
|
|
function html_table_to_excel(type) {
|
|
var data = document.getElementById('employee_data');
|
|
var file = XLSX.utils.table_to_book(data, {sheet: "sheet1"});
|
|
XLSX.write(file, { bookType: type, bookSST: true, type: 'base64' });
|
|
XLSX.writeFile(file, 'الماسيين المستحقين.' + type);
|
|
}
|
|
const export_button = document.getElementById('export_button');
|
|
export_button.addEventListener('click', () => {
|
|
html_table_to_excel('xlsx');
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|