804 lines
50 KiB
PHP
Executable File
804 lines
50 KiB
PHP
Executable File
<?php
|
|
require_once('fixed/config/go_con.php');
|
|
access(50);
|
|
|
|
$booking_id = mysqli_real_escape_string($db, $_GET['booking_id']);
|
|
|
|
$get_invoices_sql = mysqli_query($db, "SELECT * FROM `invoices_has_book` WHERE `book_id`='$booking_id'");
|
|
if (mysqli_num_rows($get_invoices_sql) > 0) {
|
|
?>
|
|
<script type='text/javascript'>
|
|
window.location.href = 'index.php';
|
|
</script>
|
|
<?php
|
|
}
|
|
|
|
$data = array();
|
|
|
|
$get_services_sql = mysqli_query($db, "SELECT
|
|
`services`.`price`,
|
|
`book_details`.`status_id`,
|
|
`book_details`.`day_date`,
|
|
`book`.`id` AS `book_id`,
|
|
`tretment`.`an_employee_offer_id`,
|
|
`tretment`.`name`,
|
|
`branch`.`id` AS `br_id`,
|
|
`book`.`tretment_id`
|
|
|
|
FROM `book_details`
|
|
LEFT JOIN `services` ON `book_details`.`services_id` = `services`.`id`
|
|
LEFT JOIN `book` ON `book_details`.`book_id` = `book`.`id`
|
|
LEFT JOIN `tretment` ON `book`.`tretment_id` = `tretment`.`id`
|
|
LEFT JOIN `commercial_register` ON `tretment`.`commercial_register_id` = `commercial_register`.`id`
|
|
LEFT JOIN `emplyee` ON `book_details`.`emplyee_id` = `emplyee`.`id`
|
|
LEFT JOIN `branch` ON `emplyee`.`branch_id` = `branch`.`id`
|
|
|
|
WHERE `book_details`.`book_id` = $booking_id
|
|
AND `branch`.`commercial_register_id` = `tretment`.`commercial_register_id`
|
|
ORDER BY `book_details`.`id` DESC LIMIT 1"
|
|
);
|
|
$row_services = mysqli_fetch_assoc($get_services_sql);
|
|
|
|
$day_date = $row_services['day_date'];
|
|
$br_id = $row_services['br_id'];
|
|
$name = $row_services['name'];
|
|
$tretment_id = $row_services['tretment_id'];
|
|
$an_employee_offer_id = $row_services['an_employee_offer_id'];
|
|
$booking_id = $row_services['book_id'];
|
|
|
|
if ($row_services['status_id'] == 6) {
|
|
?>
|
|
<script type='text/javascript'>
|
|
window.location.href = 'index.php';
|
|
</script>
|
|
<?php
|
|
}
|
|
|
|
$price = $row_services['price'];
|
|
$price_vat = 0;
|
|
|
|
if (!empty($vat)) {
|
|
$price_vat = ($price*$vat)/100;
|
|
}
|
|
|
|
|
|
// get discawnds still test
|
|
$get_price_tretment_id = $row_services ['tretment_id'];
|
|
$get_tretment_sql = mysqli_query($db, "SELECT
|
|
`services`.`price`,
|
|
`book_details`.`status_id`,
|
|
`book_details`.`day_date`,
|
|
`book`.`id` AS `book_id`,
|
|
`book`.`tretment_id`
|
|
|
|
FROM `book_details`
|
|
LEFT JOIN `services` ON `book_details`.`services_id` = `services`.`id`
|
|
LEFT JOIN `book` ON `book_details`.`book_id` = `book`.`id`
|
|
WHERE `book_details`.`book_id` = $booking_id
|
|
ORDER BY `book_details`.`id` DESC LIMIT 1"
|
|
);
|
|
$row_tretment = mysqli_fetch_assoc($get_tretment_sql);
|
|
|
|
$Day = date('D', strtotime($today));
|
|
// get discawnds end
|
|
|
|
|
|
$show_price = $price + $price_vat;
|
|
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html lang="en" dir="rtl">
|
|
<?php require_once('fixed/head/go.php'); ?>
|
|
<body class="rtl">
|
|
<style>
|
|
.header-title {
|
|
color: #086367 !important;
|
|
font-weight: bold !important;
|
|
}
|
|
|
|
.form-check, .custom-control {
|
|
padding-right:0px !important;
|
|
}
|
|
|
|
hr {
|
|
border-top: 1px solid rgb(0 0 0 / 40%) !important;
|
|
padding: 0 !important;
|
|
margin: 1rem auto;
|
|
}
|
|
</style>
|
|
<?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">
|
|
<div class="form-group row">
|
|
<div class="col-12 col-sm-12 col-md-12 col-lg-12 col-xl-12">
|
|
<div class="table-responsive">
|
|
<table class="table table-bordered text-center">
|
|
<thead class="table-primary">
|
|
<tr>
|
|
<th scope="col">العميل</th>
|
|
<td style ="background-color: #fff;" colspan="2" scope="col"><?= $name ?></td>
|
|
</tr>
|
|
</thead>
|
|
<thead class="table-primary">
|
|
<tr>
|
|
<th scope="col">#</th>
|
|
<th scope="col">الخدمات</th>
|
|
<th scope="col">السعر</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php
|
|
$get_book_details_sql = mysqli_query($db, "SELECT
|
|
`book`.`id` AS `book_id`,
|
|
`services`.`id`,
|
|
`services`.`name`,
|
|
`services`.`price`
|
|
|
|
FROM `book_details`
|
|
LEFT JOIN `book` ON `book_details`.`book_id` = `book`.`id`
|
|
LEFT JOIN `tretment` ON `book`.`tretment_id` = `tretment`.`id`
|
|
LEFT JOIN `services` ON `book_details`.`services_id` = `services`.`id`
|
|
WHERE `tretment`.`id` = $tretment_id
|
|
AND `book_details`.`day_date` = '$day_date'
|
|
AND `book_details`.`status_id` = '4'
|
|
AND `book_details`.`id` IN (
|
|
SELECT MAX(`book_details`.`id`)
|
|
FROM `book_details`
|
|
WHERE `book_details`.`day_date` = '$day_date'
|
|
GROUP BY `book_details`.`book_id`)"
|
|
);
|
|
|
|
$count = 1;
|
|
$total = 0;
|
|
$total_w_vat = 0;
|
|
$services_ids = array();
|
|
while ($row_book_details = mysqli_fetch_assoc($get_book_details_sql)) {
|
|
array_push($services_ids,
|
|
array(
|
|
'book_id' => $row_book_details['book_id'],
|
|
'id' => $row_book_details['id'],
|
|
'name' => $row_book_details['name'],
|
|
'price' => $row_book_details['price']
|
|
)
|
|
);
|
|
if (!empty($vat)) {
|
|
$price_temp = round($row_book_details['price'] + ($row_book_details['price']*$vat)/100, 2);
|
|
}
|
|
?>
|
|
<tr>
|
|
<td rowspan="1" scope="row"><?=$count?></td>
|
|
<td rowspan="1"><?=$row_book_details['name']?></td>
|
|
<td rowspan="1"><?=$price_temp?></td>
|
|
</tr>
|
|
<?php
|
|
$count++;
|
|
$total += $row_book_details['price'];
|
|
$total_w_vat += $price_temp;
|
|
}
|
|
|
|
//collect data
|
|
$data['serv'] = $services_ids;
|
|
$data['total'] = $total;
|
|
//collect data end
|
|
|
|
$show_price = $total_w_vat;
|
|
?>
|
|
</tbody>
|
|
<thead class="table-primary">
|
|
<tr>
|
|
<th colspan="2" scope="col">المجموع</th>
|
|
<th style ="background-color: #fff;" scope="col"><?=$total_w_vat?></th>
|
|
</tr>
|
|
</thead>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<div class="col-12 col-sm-12 col-md-12 col-lg-12 col-xl-12">
|
|
<div class="table-responsive">
|
|
<table class="table table-bordered text-center">
|
|
<thead class="table-primary">
|
|
<tr>
|
|
<th colspan="5" scope="col">الخصومات</th>
|
|
</tr>
|
|
</thead>
|
|
<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>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php
|
|
|
|
$get_from_to_offers_sql = mysqli_query($db, "SELECT
|
|
`id`,
|
|
`name`,
|
|
`discount`,
|
|
`type_discount_id`,
|
|
`does_discount_enters_id`,
|
|
`from_date_time`,
|
|
`to_date_time`
|
|
FROM `from_to_offers`
|
|
WHERE `branch_id` = $br_id
|
|
AND `to_date_time` >= '$date_time'
|
|
AND `activation_id` = 2
|
|
");
|
|
|
|
$discount_p = 0;
|
|
$discount_style = '';
|
|
$discount_status = array();
|
|
if (mysqli_num_rows($get_from_to_offers_sql) > 0) {
|
|
while ($row_from_to_offers = mysqli_fetch_assoc($get_from_to_offers_sql)) {
|
|
$from_to_offers_id = $row_from_to_offers['id'];
|
|
for ($i=0; $i < count($services_ids); $i++) {
|
|
$services_id_temp = $services_ids[$i]['id'];
|
|
$get_from_to_offers_has_services_sql = mysqli_query($db, "SELECT * FROM `from_to_offers_has_services`
|
|
WHERE `from_to_offers_id` = $from_to_offers_id
|
|
AND `services_id` = $services_id_temp
|
|
");
|
|
|
|
if (mysqli_num_rows($get_from_to_offers_has_services_sql) > 0) {
|
|
switch ($row_from_to_offers['type_discount_id']) {
|
|
case 2:
|
|
$discount_p = $row_from_to_offers['discount'];
|
|
$discount_style = $row_from_to_offers['discount'] . 'ريال';
|
|
break;
|
|
case 3:
|
|
$discount_p = ($row_from_to_offers['discount']/100) * $services_ids[$i]['price'];
|
|
$discount_style = $row_from_to_offers['discount'] . '%';
|
|
break;
|
|
}
|
|
array_push($discount_status,
|
|
array(
|
|
's_id' => $services_id_temp,
|
|
'name' => $row_from_to_offers['name'],
|
|
'discount_style' => $discount_style,
|
|
'discount' => $discount_p,
|
|
's_name' => $services_ids[$i]['name']
|
|
)
|
|
);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
$count_temp_2 = 1;
|
|
$discount_temp = 0;
|
|
$total_discount_w_vat = 0;
|
|
$total_discount = 0;
|
|
if (count($discount_status) == 0) {
|
|
?>
|
|
<tr>
|
|
<td colspan="5" scope="row">لا يتوفر اي خصم للعميل</td>
|
|
</tr>
|
|
<?php
|
|
} else {
|
|
for ($i=0; $i < count($discount_status); $i++) {
|
|
if (!empty($vat)) {
|
|
$discount_temp = round($discount_status[$i]['discount'] + ($discount_status[$i]['discount']*$vat)/100, 2);
|
|
}
|
|
?>
|
|
<tr>
|
|
<td scope="row"><?=$count_temp_2?></td>
|
|
<td scope="row"><?=$discount_status[$i]['s_name']?></td>
|
|
<td scope="row"><?=$discount_status[$i]['discount_style']?></td>
|
|
<td scope="row"><?=$discount_status[$i]['name']?></td>
|
|
<td scope="row"><?=$discount_temp?></td>
|
|
</tr>
|
|
<?php
|
|
$count_temp_2++;
|
|
$total_discount += $discount_status[$i]['discount'];
|
|
$total_discount_w_vat += $discount_temp;
|
|
}
|
|
}
|
|
|
|
$show_price = $show_price - $total_discount_w_vat;
|
|
|
|
//collect data
|
|
$data['total_discount'] = $total_discount;
|
|
$data['discount_status'] = $discount_status;
|
|
//collect data end
|
|
?>
|
|
</tbody>
|
|
<thead class="table-primary">
|
|
<tr>
|
|
<th colspan="4" scope="col">المجموع</th>
|
|
<th style ="background-color: #fff;" scope="col"><?=$total_discount_w_vat?></th>
|
|
</tr>
|
|
</thead>
|
|
</table>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<div class="col-12 col-sm-12 col-md-12 col-lg-12 col-xl-12">
|
|
<h2 class="text-center">
|
|
المبلغ المستحق
|
|
<span style="color:red"> <?= round($show_price, 2) ?> </span>
|
|
ريال
|
|
</h2>
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<div class="col-12 col-sm-12 col-md-3 col-lg-3 col-xl-3">
|
|
<div class="table-responsive">
|
|
<table class="table table-bordered text-center">
|
|
<thead class="table-primary">
|
|
<tr>
|
|
<th colspan="2" scope="col">رصيد الخدمات</th>
|
|
</tr>
|
|
</thead>
|
|
<?php
|
|
$get_tretment_has_service_sql = mysqli_query($db,
|
|
"SELECT `services`.`id`, `services`.`name`, COUNT(`tretment_has_service`.`id`) AS `how_many`
|
|
FROM `tretment_has_service`
|
|
LEFT JOIN `services` ON `tretment_has_service`.`services_id` = `services`.`id`
|
|
|
|
WHERE `tretment_has_service`.`tretment_id` = $tretment_id
|
|
AND `tretment_has_service`.`done_id` = 1
|
|
AND `tretment_has_service`.`activation_id` = 2
|
|
|
|
GROUP BY `services`.`id`"
|
|
);
|
|
$w_serv = array();
|
|
|
|
if (mysqli_num_rows($get_tretment_has_service_sql) > 0) {
|
|
?>
|
|
<thead class="table-primary">
|
|
<tr>
|
|
<th scope="col">الخدمة</th>
|
|
<th scope="col">العدد</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php
|
|
while ($row_tretment_has_service = mysqli_fetch_assoc($get_tretment_has_service_sql)) {
|
|
array_push($w_serv,
|
|
array (
|
|
'id' => $row_tretment_has_service['id'],
|
|
'name' => $row_tretment_has_service['name'],
|
|
'how_many' => $row_tretment_has_service['how_many']
|
|
)
|
|
);
|
|
?>
|
|
<tr>
|
|
<th scope="row"><?=$row_tretment_has_service['name']?></th>
|
|
<th scope="row"><?=$row_tretment_has_service['how_many']?></th>
|
|
</tr>
|
|
<?php
|
|
}
|
|
?>
|
|
</tbody>
|
|
<?php
|
|
} else {
|
|
?>
|
|
<tbody>
|
|
<tr>
|
|
<th colspan="2" scope="row">غير متوفر</th>
|
|
</tr>
|
|
</tbody>
|
|
<?php
|
|
}
|
|
?>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div class="col-12 col-sm-12 col-md-3 col-lg-3 col-xl-3">
|
|
<div class="table-responsive">
|
|
<table class="table table-bordered text-center">
|
|
<thead class="table-primary">
|
|
<tr>
|
|
<th scope="col">رصيد اموال</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<th scope="col">0 ريال</th>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div class="col-12 col-sm-12 col-md-3 col-lg-3 col-xl-3">
|
|
<div class="table-responsive">
|
|
<table class="table table-bordered text-center">
|
|
<thead class="table-primary">
|
|
<tr>
|
|
<th scope="col">رصيد نقاط</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<th scope="col">0 نقطة</th>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div class="col-12 col-sm-12 col-md-3 col-lg-3 col-xl-3">
|
|
<div class="table-responsive">
|
|
<table class="table table-bordered text-center">
|
|
<thead class="table-primary">
|
|
<tr>
|
|
<th colspan="2" scope="col">خدمات مجانية</th>
|
|
</tr>
|
|
</thead>
|
|
<?php
|
|
if (false) {
|
|
?>
|
|
<thead class="table-primary">
|
|
<tr>
|
|
<th scope="col">الخدمة</th>
|
|
<th scope="col">العدد</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<th scope="row">#</th>
|
|
<th scope="row">#</th>
|
|
</tr>
|
|
</tbody>
|
|
<?php
|
|
} else {
|
|
?>
|
|
<tbody>
|
|
<tr>
|
|
<th colspan="2" scope="row">غير متوفر</th>
|
|
</tr>
|
|
</tbody>
|
|
<?php
|
|
}
|
|
?>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="card-body">
|
|
<ul class="nav nav-pills nav-justified" id="pills-tab" role="tablist">
|
|
<li class="nav-item waves-effect waves-light">
|
|
<a class="nav-link" id="w-serv-tab" data-bs-toggle="pill" href="#w-serv" role="tab" aria-controls="w-serv" aria-selected="true">
|
|
رصيد الخدمات
|
|
</a>
|
|
</li>
|
|
<li class="nav-item waves-effect waves-light">
|
|
<a class="nav-link" id="w-money-tab" data-bs-toggle="pill" href="#w-money" role="tab" aria-controls="w-money" aria-selected="false">
|
|
رصيد اموال
|
|
</a>
|
|
</li>
|
|
<li class="nav-item waves-effect waves-light">
|
|
<a class="nav-link" id="w-points-tab" data-bs-toggle="pill" href="#w-points" role="tab" aria-controls="w-points" aria-selected="false">
|
|
رصيد نقاط
|
|
</a>
|
|
</li>
|
|
<li class="nav-item waves-effect waves-light">
|
|
<a class="nav-link" id="w-free-tab" data-bs-toggle="pill" href="#w-free" role="tab" aria-controls="w-free" aria-selected="false">
|
|
خدمات مجانية
|
|
</a>
|
|
</li>
|
|
</ul>
|
|
<div class="tab-content" id="pills-tabContent">
|
|
<div class="tab-pane fade" id="w-serv" role="tabpanel" aria-labelledby="w-serv-tab">
|
|
<?php
|
|
$canUse = array();
|
|
$cantUse = array();
|
|
if (count($w_serv)) {
|
|
for ($i=0; $i < count($w_serv); $i++) {
|
|
for ($u=0; $u < count($services_ids); $u++) {
|
|
if ($w_serv[$i]['id'] == $services_ids[$u]['id']) {
|
|
array_push($canUse, $w_serv[$i]);
|
|
} else {
|
|
array_push($cantUse, $w_serv[$i]);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
?>
|
|
<div class="form-group row">
|
|
<div class="col-12 col-sm-12 col-md-6 col-lg-6 col-xl-6">
|
|
<div class="table-responsive">
|
|
<table class="table table-bordered text-center">
|
|
<thead class="table-primary">
|
|
<tr>
|
|
<th scope="col">يمكن الاستفادة</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php
|
|
if (count($canUse)) {
|
|
for ($i=0; $i < count($canUse); $i++) {
|
|
if ($canUse[$i]['how_many'] > 1) {
|
|
for ($u=0; $u < $canUse[$i]['how_many']; $u++) {
|
|
?>
|
|
<tr>
|
|
<th scope="col">
|
|
<div class="checkbox">
|
|
<input id="t_h_s_<?=$canUse[$i]['id']?>_<?=$u?>" value="<?=$canUse[$i]['id']?>" name="serv_c" type="checkbox">
|
|
<label for="t_h_s_<?=$canUse[$i]['id']?>_<?=$u?>"><?=$canUse[$i]['name']?></label>
|
|
</div>
|
|
</th>
|
|
</tr>
|
|
<?php
|
|
}
|
|
} else {
|
|
?>
|
|
<tr>
|
|
<th scope="col">
|
|
<div class="checkbox">
|
|
<input id="t_h_s_<?=$canUse[$i]['id']?>_0" value="<?=$canUse[$i]['id']?>" name="serv_c" type="checkbox">
|
|
<label for="t_h_s_<?=$canUse[$i]['id']?>_0"><?=$canUse[$i]['name']?></label>
|
|
</div>
|
|
</th>
|
|
</tr>
|
|
<?php
|
|
}
|
|
}
|
|
} else {
|
|
?>
|
|
<tr>
|
|
<th scope="col">لا يوجد</th>
|
|
</tr>
|
|
<?php
|
|
}
|
|
?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div class="col-12 col-sm-12 col-md-6 col-lg-6 col-xl-6">
|
|
<div class="table-responsive">
|
|
<table class="table table-bordered text-center">
|
|
<thead class="table-danger">
|
|
<tr>
|
|
<th scope="col">لا يمكن الاستفادة</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php
|
|
if (count($cantUse)) {
|
|
for ($i=0; $i < count($cantUse); $i++) {
|
|
?>
|
|
<tr>
|
|
<th scope="col"><?=$cantUse[$i]['name']?></th>
|
|
</tr>
|
|
<?php
|
|
}
|
|
} else {
|
|
?>
|
|
<tr>
|
|
<th scope="col">لا يوجد</th>
|
|
</tr>
|
|
<?php
|
|
}
|
|
?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="tab-pane fade" id="w-money" role="tabpanel" aria-labelledby="w-money-tab">
|
|
<p class="mb-0 m-t-30">
|
|
2
|
|
</p>
|
|
</div>
|
|
<div class="tab-pane fade" id="w-points" role="tabpanel" aria-labelledby="w-points-tab">
|
|
<p class="mb-0 m-t-30">
|
|
3
|
|
</p>
|
|
</div>
|
|
<div class="tab-pane fade" id="w-free" role="tabpanel" aria-labelledby="w-free-tab">
|
|
<p class="mb-0 m-t-30">
|
|
4
|
|
</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="card-body new-user order-list">
|
|
<div id="after_stock" class="form-group row" style="display:none">
|
|
<div class="col-12 col-sm-12 col-md-12 col-lg-12 col-xl-12">
|
|
<h2 class="text-center" style="background: chartreuse;">
|
|
المبلغ المستحق بعد الاستفاده من احد الارصدة
|
|
<br />
|
|
<span id="price_after_stock" style="color:red">0</span>
|
|
ريال
|
|
</h2>
|
|
</div>
|
|
</div>
|
|
<div id="pay" class="form-group row">
|
|
<hr>
|
|
<div class="col-2"></div>
|
|
<div style="border-left: 1px solid rgba(0,0,0);" class="form-group col-12 col-sm-6 col-md-4 col-lg-4 col-xl-4">
|
|
<div class="col-12 col-sm-12 col-md-12 col-lg-12 col-xl-12">
|
|
<h4 class="text-center">
|
|
كاش
|
|
</h4>
|
|
</div>
|
|
<hr>
|
|
<div class="col-12 col-sm-12 col-md-12 col-lg-12 col-xl-12">
|
|
<label for="" class="col-form-label text-right">المبلغ المدفوع</label>
|
|
<input name="cash_pay" class="form-control" type="number" step="any" value="0">
|
|
</div>
|
|
<div class="col-12 col-sm-12 col-md-12 col-lg-12 col-xl-12">
|
|
<label for="" class="col-form-label text-right">ملاحظات</label>
|
|
<textarea rows="9" name="cash_note" class="form-control" type="text"></textarea>
|
|
</div>
|
|
</div>
|
|
<div style="border-right: 1px solid rgba(0,0,0);" class="form-group col-12 col-sm-6 col-md-4 col-lg-4 col-xl-4">
|
|
<div class="col-12 col-sm-12 col-md-12 col-lg-12 col-xl-12">
|
|
<h4 class="text-center">
|
|
شبكة
|
|
</h4>
|
|
</div>
|
|
<hr>
|
|
<div class="col-12 col-sm-12 col-md-12 col-lg-12 col-xl-12">
|
|
<label for="" class="col-form-label text-right">المبلغ المدفوع</label>
|
|
<input name="card_pay" class="form-control" type="number" step="any" value="0">
|
|
</div>
|
|
<div class="col-12 col-sm-12 col-md-12 col-lg-12 col-xl-12">
|
|
<label for="" class="col-form-label text-right">نوع الكرت</label>
|
|
<div style="transform: translateY(-6px);">
|
|
<div class="form-check form-check-inline">
|
|
<div class="radio radio-primary">
|
|
<input type="radio" id="card_type_mada" name="card_type" data-parsley-multiple="groups" data-parsley-mincheck="2" value="1">
|
|
<label class="mb-0" for="card_type_mada">مدى</label>
|
|
</div>
|
|
</div>
|
|
<div class="form-check form-check-inline">
|
|
<div class="radio radio-primary">
|
|
<input type="radio" id="card_type_visa" name="card_type" data-parsley-multiple="groups" data-parsley-mincheck="2" value="2">
|
|
<label class="mb-0" for="card_type_visa">فيزا</label>
|
|
</div>
|
|
</div>
|
|
<div class="form-check form-check-inline">
|
|
<div class="radio radio-primary">
|
|
<input type="radio" id="card_type_master" name="card_type" data-parsley-multiple="groups" data-parsley-mincheck="2" value="3">
|
|
<label class="mb-0" for="card_type_master">ماستر كارد</label>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div style="transform: translateY(-3px);" class="col-12 col-sm-12 col-md-12 col-lg-12 col-xl-12">
|
|
<label for="" class="col-form-label text-right">رقم التفويض</label>
|
|
<input name="card_approval_number" class="form-control" type="number" value="">
|
|
</div>
|
|
<div style="transform: translateY(-3px);" class="col-12 col-sm-12 col-md-12 col-lg-12 col-xl-12">
|
|
<label for="" class="col-form-label text-right">ملاحظات</label>
|
|
<textarea rows="3" name="card_note" class="form-control" type="text"></textarea>
|
|
</div>
|
|
</div>
|
|
<div class="col-2"></div>
|
|
<hr>
|
|
</div>
|
|
<div class="col-lg-12">
|
|
<div id="pay-action" class="form-control" style="background-color: #086367; color:white; text-align:center; cursor: pointer;">سداد</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?php require_once('fixed/footer/go.php'); ?>
|
|
</div>
|
|
</div>
|
|
<div id='get_data'></div>
|
|
<?php require_once('fixed/js/go.php'); ?>
|
|
<script>
|
|
let data = <?=json_encode($data);?>;
|
|
|
|
|
|
$("[name='serv_c']").change(function() {
|
|
if(this.checked) {
|
|
let checkbox_val = $(this).val();
|
|
|
|
let temp_serv = 0;
|
|
let temp_serv_c = 0;
|
|
let price = 0;
|
|
for (let x = 0; x < data['serv'].length; x++) {
|
|
temp_serv = data['serv'][x]['id'];
|
|
if (temp_serv == checkbox_val) {
|
|
temp_serv_c++
|
|
price = data['serv'][x]['price']
|
|
}
|
|
}
|
|
|
|
let checkbox_data = $("[name='serv_c']");
|
|
for (let x = temp_serv_c; x < checkbox_data.length; x++) {
|
|
if (checkbox_data[x].value == temp_serv) {
|
|
checkbox_data[x].setAttribute("disabled", true)
|
|
}
|
|
}
|
|
data['use_stock'] = true
|
|
data['total_discount'] += price
|
|
$("#price_after_stock").html(data['total'] - data['total_discount'])
|
|
$("#after_stock").show()
|
|
|
|
} else { // not checked
|
|
var legchecked = $('input[name="serv_c"]:checked').length;
|
|
if (legchecked == 0){
|
|
$("#after_stock").hide()
|
|
};
|
|
}
|
|
});
|
|
|
|
$("[name='cash_pay']").keypress(function (e) {
|
|
var key = e.which;
|
|
if(key == 13) {
|
|
pay()
|
|
}
|
|
});
|
|
$("[name='card_pay']").keypress(function (e) {
|
|
var key = e.which;
|
|
if(key == 13) {
|
|
pay()
|
|
}
|
|
});
|
|
$(function() {
|
|
$("#pay-action").click(function() {
|
|
pay();
|
|
});
|
|
});
|
|
let click = 0;
|
|
|
|
function pay() {
|
|
let cash_pay = $("[name='cash_pay']").val();
|
|
let cash_note = $("[name='cash_note']").val();
|
|
let card_pay = $("[name='card_pay']").val();
|
|
let card_type = $("[name='card_type']").val();
|
|
let card_approval_number = $("[name='card_approval_number']").val();
|
|
let card_note = $("[name='card_note']").val();
|
|
let free = $("[name='free']").val();
|
|
let reason_for_free = $("[name='reason_for_free']").val();
|
|
|
|
|
|
console.log(data)
|
|
|
|
let booking_id = <?=json_encode($booking_id);?>;
|
|
|
|
//for more action
|
|
let day_date = <?=json_encode($day_date);?>;
|
|
|
|
if (click == 0) {
|
|
click++;
|
|
$.post("work/order/ajax/active_ajax_1.php", {
|
|
data,
|
|
cash_pay,
|
|
cash_note,
|
|
card_pay,
|
|
card_type,
|
|
card_approval_number,
|
|
card_note,
|
|
free,
|
|
reason_for_free,
|
|
day_date,
|
|
booking_id
|
|
}, function(get_data) {
|
|
$("#get_data").html(get_data);
|
|
})
|
|
} else {
|
|
swalfun("يرجى الانتظار", "", "warning");
|
|
}
|
|
}
|
|
|
|
</script>
|
|
</body>
|
|
</html>
|