257 lines
20 KiB
PHP
Executable File
257 lines
20 KiB
PHP
Executable File
<?php
|
|
require_once('fixed/config/go_con.php');
|
|
access(76); // chsnge
|
|
|
|
$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)));
|
|
|
|
$branch_id = $_GET['b'];
|
|
if (!empty($_GET['b'])) {
|
|
$branch_id = $_GET['b'];
|
|
if (!is_numeric($branch_id)) {
|
|
$branch_id = 1;
|
|
}
|
|
} else {
|
|
$branch_id = 1;
|
|
}
|
|
$branch_sql = '='.$branch_id;
|
|
if ($branch_id == 1) {
|
|
$branch_sql = '<>'.$branch_id;
|
|
}
|
|
|
|
$data = array();
|
|
$get_book_details_sql = mysqli_query($db,
|
|
"SELECT count(`invoices`.`id`) AS `total` FROM `invoices` WHERE `invoices`.`id` IN (SELECT
|
|
`invoices`.`id`
|
|
FROM `invoices_discount_details_has_db_tables`
|
|
INNER JOIN `invoices_discount_details` ON `invoices_discount_details_has_db_tables`.`invoices_discount_details_id` = `invoices_discount_details`.`id`
|
|
INNER JOIN `invoices_discount` ON `invoices_discount`.`id` = `invoices_discount_details`.`invoices_discount_id`
|
|
INNER JOIN `invoices_details` ON `invoices_details`.`id` = `invoices_discount`.`invoices_details_id`
|
|
INNER JOIN `invoices` ON `invoices_details`.`invoices_id` = `invoices`.`id`
|
|
INNER JOIN `invoices_has_book` ON `invoices_has_book`.`invoices_id` = `invoices_details`.`invoices_id`
|
|
INNER JOIN `book` ON `invoices_has_book`.`book_id` = `book`.`id`
|
|
INNER JOIN `tretment` ON `book`.`tretment_id` = `tretment`.`id`
|
|
WHERE `invoices_discount_details_has_db_tables`.`db_tables_id` = 2 AND `invoices_discount_details_has_db_tables`.`db_tables_id_to_id` IN (12,13,14)
|
|
AND `invoices`.`date_time` LIKE '$today%'
|
|
AND `invoices_details`.`branch_id` $branch_sql
|
|
GROUP BY `invoices`.`id`)
|
|
");
|
|
|
|
$get_book_details = mysqli_fetch_assoc($get_book_details_sql);
|
|
$data['all'] = $get_book_details['total'];
|
|
|
|
$get_book_has_how_to_hear_sql = mysqli_query($db,
|
|
"SELECT `how_to_hear`.`id`, `how_to_hear`.`name`, COUNT(`book_has_how_to_hear`.`book_id`) AS `total`
|
|
|
|
FROM `book_has_how_to_hear`
|
|
INNER JOIN `book_details` AS `dd` ON `book_has_how_to_hear`.`book_id` = `dd`.`book_id`
|
|
INNER JOIN `how_to_hear` ON `book_has_how_to_hear`.`how_to_hear_id` = `how_to_hear`.`id`
|
|
WHERE `book_has_how_to_hear`.`date_time` LIKE '$today%'
|
|
AND `dd`.`id` IN (SELECT MAX(`book_details`.`id`) FROM `book_details` WHERE `book_details`.`book_id` = `dd`.`book_id` GROUP BY `book_details`.`book_id`)
|
|
AND `dd`.`branch_id` $branch_sql
|
|
AND `book_has_how_to_hear`.`book_id` IN (SELECT
|
|
`book`.`id`
|
|
FROM `invoices_discount_details_has_db_tables`
|
|
INNER JOIN `invoices_discount_details` ON `invoices_discount_details_has_db_tables`.`invoices_discount_details_id` = `invoices_discount_details`.`id`
|
|
INNER JOIN `invoices_discount` ON `invoices_discount`.`id` = `invoices_discount_details`.`invoices_discount_id`
|
|
INNER JOIN `invoices_details` ON `invoices_details`.`id` = `invoices_discount`.`invoices_details_id`
|
|
INNER JOIN `invoices` ON `invoices_details`.`invoices_id` = `invoices`.`id`
|
|
INNER JOIN `invoices_has_book` ON `invoices_has_book`.`invoices_id` = `invoices_details`.`invoices_id`
|
|
INNER JOIN `book` ON `invoices_has_book`.`book_id` = `book`.`id`
|
|
INNER JOIN `tretment` ON `book`.`tretment_id` = `tretment`.`id`
|
|
WHERE `invoices_discount_details_has_db_tables`.`db_tables_id` = 2 AND `invoices_discount_details_has_db_tables`.`db_tables_id_to_id` IN (12,13,14)
|
|
AND `invoices`.`date_time` LIKE '$today%'
|
|
AND `invoices_details`.`branch_id` $branch_sql
|
|
GROUP BY `book`.`id`)
|
|
GROUP BY `how_to_hear`.`id`
|
|
");
|
|
|
|
while ($get_book_has_how_to_hear = mysqli_fetch_assoc($get_book_has_how_to_hear_sql)) {
|
|
$data['how_to_hear'][$get_book_has_how_to_hear['id']] = $get_book_has_how_to_hear['total'];
|
|
}
|
|
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html lang="en" dir="rtl">
|
|
<?php require_once('fixed/head/go.php'); ?>
|
|
<body class="rtl">
|
|
<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="container-fluid general-widget">
|
|
<div class="row">
|
|
<div class="col-12 col-sm-12 col-md-12 col-lg-2 col-xl-2">
|
|
<div class="card">
|
|
<div class="card-body new-user order-list profile-nav">
|
|
<div class="nav flex-column nav-pills" id="profile-tab" aria-orientation="vertical">
|
|
<a class="nav-link mb-0" data-toggle="pill" href="#d" aria-selected="false" onclick="window.location='r_30_p_descount_blocks?b=<?=$commercial_register['id']?>&date=<?=$today?>'">يومي</a>
|
|
<a class="nav-link mb-0 active" data-toggle="pill" href="#m" aria-selected="false" onclick="window.location='r_30_p_descount_blocks_m?b=<?=$commercial_register['id']?>&date=<?=$today?>'">شهري</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="card">
|
|
<div class="card-body new-user order-list profile-nav">
|
|
<div class="nav flex-column nav-pills" id="profile-tab" aria-orientation="vertical">
|
|
<?php
|
|
$commercial_register_sql = mysqli_query($db, "SELECT `branch`.`branch_name`, `branch`.`id`
|
|
FROM `commercial_register`
|
|
LEFT JOIN `branch` ON `commercial_register`.`id` = `branch`.`commercial_register_id`"
|
|
);
|
|
while ($commercial_register = mysqli_fetch_assoc($commercial_register_sql)) {
|
|
?>
|
|
<a class="nav-link mb-0 <?php if($branch_id == $commercial_register['id']){echo 'active';}?> ?>" data-toggle="pill" href="#branch-<?=$commercial_register['id']?>" aria-selected="false" onclick="window.location='r_30_p_descount_blocks_m?b=<?=$commercial_register['id']?>&date=<?=$today?>'"><?=$commercial_register['branch_name']?></a>
|
|
<?php
|
|
}
|
|
?>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-12 col-sm-12 col-md-12 col-lg-10 col-xl-10">
|
|
<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>
|
|
المستفيدين من عرض 30%
|
|
<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="r_30_p_descount_blocks_m?date=<?= $Previous ?>&b=<?= $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="r_30_p_descount_blocks_m?date=<?= $Next ?>&b=<?= $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>
|
|
<div class="card-body new-user order-list text-center">
|
|
<div class="col-12 col-sm-12 col-md-12 col-lg-12 col-xl-12 row">
|
|
<div class="col-12 col-sm-12 col-md-12 col-lg-12 col-xl-12">
|
|
<div class="card o-hidden border-0">
|
|
<div class="bg-primary b-r-4 card-body">
|
|
<div class="media static-top-widget">
|
|
<div class="align-self-center text-center"><i data-feather="users"></i>
|
|
</div>
|
|
<div class="media-body"><span class="m-0">عدد العملاء</span>
|
|
<h4 class="mb-0 counter"><?=$data['all']?></h4><i class="icon-bg" data-feather="users"></i>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-12 col-sm-12 col-md-6 col-lg-6 col-xl-6">
|
|
<div class="card o-hidden border-0">
|
|
<div class="b-r-4 card-body" style="background:#f529f3">
|
|
<div class="media static-top-widget">
|
|
<div class="align-self-center text-center"><i data-feather="instagram"></i>
|
|
</div>
|
|
<div class="media-body"><span class="m-0">انستقرام</span>
|
|
<h4 class="mb-0 counter"><?=$data['how_to_hear'][4]?></h4><i class="icon-bg" data-feather="instagram"></i>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-12 col-sm-12 col-md-6 col-lg-6 col-xl-6">
|
|
<div class="card o-hidden border-0">
|
|
<div class="b-r-4 card-body" style="background:#00c4ff">
|
|
<div class="media static-top-widget">
|
|
<div class="align-self-center text-center"><i data-feather="twitter"></i>
|
|
</div>
|
|
<div class="media-body"><span class="m-0">تويتر</span>
|
|
<h4 class="mb-0 counter"><?=$data['how_to_hear'][3]?></h4><i class="icon-bg" data-feather="twitter"></i>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-12 col-sm-12 col-md-6 col-lg-6 col-xl-6">
|
|
<div class="card o-hidden border-0">
|
|
<div class="b-r-4 card-body" style="background:#f2f529">
|
|
<div class="media static-top-widget">
|
|
<div class="align-self-center text-center"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-snapchat" viewBox="0 0 16 16"> <path d="M15.943 11.526c-.111-.303-.323-.465-.564-.599a1.416 1.416 0 0 0-.123-.064l-.219-.111c-.752-.399-1.339-.902-1.746-1.498a3.387 3.387 0 0 1-.3-.531c-.034-.1-.032-.156-.008-.207a.338.338 0 0 1 .097-.1c.129-.086.262-.173.352-.231.162-.104.289-.187.371-.245.309-.216.525-.446.66-.702a1.397 1.397 0 0 0 .069-1.16c-.205-.538-.713-.872-1.329-.872a1.829 1.829 0 0 0-.487.065c.006-.368-.002-.757-.035-1.139-.116-1.344-.587-2.048-1.077-2.61a4.294 4.294 0 0 0-1.095-.881C9.764.216 8.92 0 7.999 0c-.92 0-1.76.216-2.505.641-.412.232-.782.53-1.097.883-.49.562-.96 1.267-1.077 2.61-.033.382-.04.772-.036 1.138a1.83 1.83 0 0 0-.487-.065c-.615 0-1.124.335-1.328.873a1.398 1.398 0 0 0 .067 1.161c.136.256.352.486.66.701.082.058.21.14.371.246l.339.221a.38.38 0 0 1 .109.11c.026.053.027.11-.012.217a3.363 3.363 0 0 1-.295.52c-.398.583-.968 1.077-1.696 1.472-.385.204-.786.34-.955.8-.128.348-.044.743.28 1.075.119.125.257.23.409.31a4.43 4.43 0 0 0 1 .4.66.66 0 0 1 .202.09c.118.104.102.26.259.488.079.118.18.22.296.3.33.229.701.243 1.095.258.355.014.758.03 1.217.18.19.064.389.186.618.328.55.338 1.305.802 2.566.802 1.262 0 2.02-.466 2.576-.806.227-.14.424-.26.609-.321.46-.152.863-.168 1.218-.181.393-.015.764-.03 1.095-.258a1.14 1.14 0 0 0 .336-.368c.114-.192.11-.327.217-.42a.625.625 0 0 1 .19-.087 4.446 4.446 0 0 0 1.014-.404c.16-.087.306-.2.429-.336l.004-.005c.304-.325.38-.709.256-1.047Zm-1.121.602c-.684.378-1.139.337-1.493.565-.3.193-.122.61-.34.76-.269.186-1.061-.012-2.085.326-.845.279-1.384 1.082-2.903 1.082-1.519 0-2.045-.801-2.904-1.084-1.022-.338-1.816-.14-2.084-.325-.218-.15-.041-.568-.341-.761-.354-.228-.809-.187-1.492-.563-.436-.24-.189-.39-.044-.46 2.478-1.199 2.873-3.05 2.89-3.188.022-.166.045-.297-.138-.466-.177-.164-.962-.65-1.18-.802-.36-.252-.52-.503-.402-.812.082-.214.281-.295.49-.295a.93.93 0 0 1 .197.022c.396.086.78.285 1.002.338.027.007.054.01.082.011.118 0 .16-.06.152-.195-.026-.433-.087-1.277-.019-2.066.094-1.084.444-1.622.859-2.097.2-.229 1.137-1.22 2.93-1.22 1.792 0 2.732.987 2.931 1.215.416.475.766 1.013.859 2.098.068.788.009 1.632-.019 2.065-.01.142.034.195.152.195a.35.35 0 0 0 .082-.01c.222-.054.607-.253 1.002-.338a.912.912 0 0 1 .197-.023c.21 0 .409.082.49.295.117.309-.04.56-.401.812-.218.152-1.003.638-1.18.802-.184.169-.16.3-.139.466.018.14.413 1.991 2.89 3.189.147.073.394.222-.041.464Z"/> </svg>
|
|
</div>
|
|
<div class="media-body"><span class="m-0">سناب شات</span>
|
|
<h4 class="mb-0 counter"><?=$data['how_to_hear'][2]?></h4>
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="bi bi-snapchat icon-bg" viewBox="0 0 24 24">
|
|
<path d="M15.943 11.526c-.111-.303-.323-.465-.564-.599a1.416 1.416 0 0 0-.123-.064l-.219-.111c-.752-.399-1.339-.902-1.746-1.498a3.387 3.387 0 0 1-.3-.531c-.034-.1-.032-.156-.008-.207a.338.338 0 0 1 .097-.1c.129-.086.262-.173.352-.231.162-.104.289-.187.371-.245.309-.216.525-.446.66-.702a1.397 1.397 0 0 0 .069-1.16c-.205-.538-.713-.872-1.329-.872a1.829 1.829 0 0 0-.487.065c.006-.368-.002-.757-.035-1.139-.116-1.344-.587-2.048-1.077-2.61a4.294 4.294 0 0 0-1.095-.881C9.764.216 8.92 0 7.999 0c-.92 0-1.76.216-2.505.641-.412.232-.782.53-1.097.883-.49.562-.96 1.267-1.077 2.61-.033.382-.04.772-.036 1.138a1.83 1.83 0 0 0-.487-.065c-.615 0-1.124.335-1.328.873a1.398 1.398 0 0 0 .067 1.161c.136.256.352.486.66.701.082.058.21.14.371.246l.339.221a.38.38 0 0 1 .109.11c.026.053.027.11-.012.217a3.363 3.363 0 0 1-.295.52c-.398.583-.968 1.077-1.696 1.472-.385.204-.786.34-.955.8-.128.348-.044.743.28 1.075.119.125.257.23.409.31a4.43 4.43 0 0 0 1 .4.66.66 0 0 1 .202.09c.118.104.102.26.259.488.079.118.18.22.296.3.33.229.701.243 1.095.258.355.014.758.03 1.217.18.19.064.389.186.618.328.55.338 1.305.802 2.566.802 1.262 0 2.02-.466 2.576-.806.227-.14.424-.26.609-.321.46-.152.863-.168 1.218-.181.393-.015.764-.03 1.095-.258a1.14 1.14 0 0 0 .336-.368c.114-.192.11-.327.217-.42a.625.625 0 0 1 .19-.087 4.446 4.446 0 0 0 1.014-.404c.16-.087.306-.2.429-.336l.004-.005c.304-.325.38-.709.256-1.047Zm-1.121.602c-.684.378-1.139.337-1.493.565-.3.193-.122.61-.34.76-.269.186-1.061-.012-2.085.326-.845.279-1.384 1.082-2.903 1.082-1.519 0-2.045-.801-2.904-1.084-1.022-.338-1.816-.14-2.084-.325-.218-.15-.041-.568-.341-.761-.354-.228-.809-.187-1.492-.563-.436-.24-.189-.39-.044-.46 2.478-1.199 2.873-3.05 2.89-3.188.022-.166.045-.297-.138-.466-.177-.164-.962-.65-1.18-.802-.36-.252-.52-.503-.402-.812.082-.214.281-.295.49-.295a.93.93 0 0 1 .197.022c.396.086.78.285 1.002.338.027.007.054.01.082.011.118 0 .16-.06.152-.195-.026-.433-.087-1.277-.019-2.066.094-1.084.444-1.622.859-2.097.2-.229 1.137-1.22 2.93-1.22 1.792 0 2.732.987 2.931 1.215.416.475.766 1.013.859 2.098.068.788.009 1.632-.019 2.065-.01.142.034.195.152.195a.35.35 0 0 0 .082-.01c.222-.054.607-.253 1.002-.338a.912.912 0 0 1 .197-.023c.21 0 .409.082.49.295.117.309-.04.56-.401.812-.218.152-1.003.638-1.18.802-.184.169-.16.3-.139.466.018.14.413 1.991 2.89 3.189.147.073.394.222-.041.464Z"/>
|
|
</svg>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-12 col-sm-12 col-md-6 col-lg-6 col-xl-6">
|
|
<div class="card o-hidden border-0">
|
|
<div class="b-r-4 card-body" style="background:#29f555">
|
|
<div class="media static-top-widget">
|
|
<div class="align-self-center text-center"><i data-feather="user"></i>
|
|
</div>
|
|
<div class="media-body"><span class="m-0">من الموظف</span>
|
|
<h4 class="mb-0 counter"><?=$data['how_to_hear'][5]?></h4><i class="icon-bg" data-feather="user"></i>
|
|
</div>
|
|
</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'); ?>
|
|
<script>
|
|
$("#Select-date").change(function() {
|
|
var SelectedDate = $(this).val();
|
|
window.location = 'r_30_p_descount_blocks_m?b=<?=$branch_id?>&date=' + SelectedDate
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|