booking/work/order/ajax/tretment_custom_discount_ajax.php
2025-03-24 19:02:58 +03:00

106 lines
3.8 KiB
PHP

<?php
require_once('../../../fixed/config/go_con.php');
$number = mysqli_real_escape_string($db, $_POST['number']);
if (!empty($number)) {
$get_tretment_sql = mysqli_query($db, "SELECT
`tretment_has_custom_discount`.`id`,
`tretment_has_custom_discount`.`discount`,
`type_discount`.`name` AS `type_discount`,
`services`.`name` AS `serv_name`,
`tretment`.`name` AS `tr_name`
FROM `tretment_has_custom_discount`
INNER JOIN `tretment` ON `tretment_has_custom_discount`.`tretment_id` = `tretment`.`id`
INNER JOIN `type_discount` ON `tretment_has_custom_discount`.`type_discount_id` = `type_discount`.`id`
INNER JOIN `services` ON `tretment_has_custom_discount`.`services_id` = `services`.`id`
WHERE `tretment`.`number` = $number
AND `tretment`.`commercial_register_id`= '$commercial_register_id'
AND `tretment_has_custom_discount`.`done_id` = 1
");
if (mysqli_num_rows($get_tretment_sql) > 0) {
?>
<table class="table table-bordered mb-0 table-centered text-center" style="vertical-align: middle;">
<tbody>
<?php
$count = 0;
$count2 = 1;
while ($booking_row = mysqli_fetch_assoc($get_tretment_sql)) {
if ($count == 0) {
?>
<thead>
<tr class="align-self-center">
<th colspan="8">
<?= $booking_row['tr_name'] ?>
</th>
</tr>
<tr class="align-self-center">
<th>#</th>
<th>الخصم</th>
<th>نوع الخصم</th>
<th>الخدمة</th>
<th>الحالة</th>
<th>تفاصيل</th>
</tr>
</thead>
<?php
$count++;
}
?>
<tr>
<td>
<?= $count2 ?>
</td>
<td>
<?= $booking_row['discount'] ?>
</td>
<td>
<?= $booking_row['type_discount'] ?>
</td>
<td>
<?= $booking_row['serv_name'] ?>
</td>
<td>مفعل</td>
<td>
<div class="btn btn-danger">
<a href="work/order/php/custom_discount_cancel?id=<?= $booking_row['id'] ?>" data-bs-original-title=""
title="">الغاء</a>
</div>
</td>
</tr><!--end tr-->
<?php
$count++;
$count2++;
}
?>
</tbody><!--end tbody-->
</table><!--end table-->
<?php
} else {
echo "
<script>
swalfun('تنبية','لا يتوفر خصومات مخصصة له','info');
click = 0;
</script>
";
}
} else {
echo "
<script>
swalfun('حدث خطأ', 'رقم الجوال يجب أن يتكون من 9 أرقام وبدون 0 في البداية', 'error');
click = 0;
</script>
";
}
?>