booking/journal_closing.php

304 lines
11 KiB
PHP
Executable File

<?php
require_once ('fixed/config/go_con.php');
$admin_id = 15;
$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");
}
}
$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;
}
$data = array(
'branchs' => array()
);
$get_invoices_sql = mysqli_query(
$db,
"SELECT
`branch`.`branch_name`
FROM `invoices_details_has_how_pay`
INNER JOIN `invoices_details` ON `invoices_details_has_how_pay`.`invoices_details_id` = `invoices_details`.`id`
INNER JOIN `branch` ON `invoices_details`.`branch_id` = `branch`.`id`
WHERE ((`invoices_details_has_how_pay`.`date_time` LIKE '$today%' AND `invoices_details_has_how_pay`.`date_time` >= '$today 03:00:00') OR (`invoices_details_has_how_pay`.`date_time` LIKE '$Next%' AND `invoices_details_has_how_pay`.`date_time` < '$Next 03:00:00'))
AND `invoices_details_has_how_pay`.`user_id` = $admin_id
GROUP BY `invoices_details`.`branch_id`
"
);
if (mysqli_num_rows($get_invoices_sql) > 0) {
while ($get_invoices = mysqli_fetch_assoc($get_invoices_sql)) {
$data['branchs'][$get_invoices['branch_name']] = 0;
}
}
$get_invoices_sql = mysqli_query(
$db,
"SELECT
`branch`.`branch_name`
FROM `bonds_details_has_how_pay`
INNER JOIN `bonds_details` ON `bonds_details_has_how_pay`.`bonds_details_id` = `bonds_details`.`id`
INNER JOIN `user` ON `bonds_details_has_how_pay`.`user_id` = `user`.`id`
INNER JOIN `branch` ON `bonds_details`.`branch_id` = `branch`.`id`
WHERE ((`bonds_details_has_how_pay`.`date_time` LIKE '$today%' AND `bonds_details_has_how_pay`.`date_time` >= '$today 03:00:00') OR (`bonds_details_has_how_pay`.`date_time` LIKE '$Next%' AND `bonds_details_has_how_pay`.`date_time` < '$Next 03:00:00'))
AND `bonds_details_has_how_pay`.`user_id` = $admin_id
GROUP BY `bonds_details`.`branch_id`
"
);
if (mysqli_num_rows($get_invoices_sql) > 0) {
while ($get_invoices = mysqli_fetch_assoc($get_invoices_sql)) {
$data['branchs'][$get_invoices['branch_name']] = 0;
}
}
?>
<!DOCTYPE html>
<html lang="en" dir="rtl">
<?php require_once ('fixed/head/go.php'); ?>
<body class="rtl">
<?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="journal_closing?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="journal_closing?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 class="card-body new-user order-list">
<div class="table-responsive">
<table class="table table-bordered text-center" style="vertical-align: middle;">
<?php
foreach ($data['branchs'] as $key => $value) {
?>
<thead class="table-primary">
<tr>
<th scope="col" colspan="5" style="background:rgb(105 36 36 / 19%) !important">
<?= $key ?>
</th>
</tr>
<?php
?>
<tr>
<th scope="col" colspan="1">المتحصلات</th>
<th style="background-color:#000;" scope="col" colspan="4"></th>
</tr>
<tr>
<th scope="col">نقد</th>
<th scope="col">شبكة</th>
<th scope="col">تحويل</th>
<th scope="col">الاجمالي</th>
<th scope="col">ملاحظات</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<div class="col-12">
<input id="tretment_name" class="form-control clickfun" type="text" required>
</div>
</td>
<td>
<div class="col-12">
<input id="tretment_name" class="form-control clickfun" type="text" required>
</div>
</td>
<td>
<div class="col-12">
<input id="tretment_name" class="form-control clickfun" type="text" required>
</div>
</td>
<td>
<div class="col-12">
<input id="tretment_name" class="form-control clickfun" type="text" disabled>
</div>
</td>
<td>
<div class="col-12">
<input id="tretment_name" class="form-control clickfun" type="text" required>
</div>
</td>
</tr>
<th style="background-color:#000;" scope="col" colspan="5"></th>
</tbody>
<?php
}
?>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Container-fluid Ends-->
</div>
<?php require_once ('fixed/footer/go.php'); ?>
</div>
</div>
<?php require_once ('fixed/js/go.php'); ?>
<script>
// $(function () {
// $("#tretment_offer").change(function () {
// let showUploadImage = $("#tretment_offer").find(":selected").data('upload');
// if (showUploadImage == 2) {
// $("#showUploadImage").show()
// } else {
// $("#showUploadImage").hide()
// }
// });
// });
// $(function () {
// $("#tretment_how_hear").change(function () {
// let value = $(this).val();
// console.log(value);
// if (value == 'frind' || value == 'else') {
// if (value == 'frind') {
// $("#frind").show()
// $("#else").hide()
// }
// if (value == 'else') {
// $("#else").show()
// $("#frind").hide()
// }
// } else {
// $("#frind").hide()
// $("#else").hide()
// }
// });
// });
// click = 0;
// $(function () {
// $("#add_tretment").click(function () {
// add_tretment();
// });
// });
// $('.clickfun').keypress(function (e) {
// var key = e.which;
// if (key == 13) {
// add_tretment();
// }
// });
// function add_tretment() {
// let tretment_name = $("#tretment_name").val();
// if (tretment_name == '') {
// swalfun('حدث خطأ', 'يرجى ادخال اسم العميل', 'error');
// }
// let tretment_number = $("#tretment_number").val();
// if (tretment_number.length !== 9) {
// swalfun('حدث خطأ', 'رقم الجوال يجب أن يتكون من 9 أرقام وبدون 0 في البداية', 'error');
// return false;
// }
// let tretment_age = $("#tretment_age").val();
// if (tretment_age == '' || tretment_age == 0) {
// swalfun('حدث خطأ', 'يرجى ادخال عمر العميل', 'error');
// return false;
// }
// let tretment_offer = $("#tretment_offer").val();
// let tretment_how_hear = $("#tretment_how_hear").val();
// if (tretment_how_hear == 1) {
// swalfun('حدث خطأ', 'يرجى ادخال كيف سمع عنا', 'error');
// return false;
// }
// let location = <?= json_encode($location); ?>; // where go after add
// if (click == 0) {
// click++
// $.post("work/order/ajax/add_tretment_ajax.php", {
// tretment_name,
// tretment_number,
// tretment_age,
// tretment_offer,
// tretment_how_hear,
// location
// }, function (get_tretment) {
// $("#get_tretment").html(get_tretment);
// })
// } else {
// swalfun("يرجى الانتظار", "", "warning");
// }
// };
$("#Select-date").change(function () {
var SelectedDate = $(this).val();
window.location = 'journal_closing?date=' + SelectedDate
});
</script>
</body>
</html>