62 lines
2.5 KiB
PHP
Executable File
62 lines
2.5 KiB
PHP
Executable File
<?php
|
|
require_once('../../../fixed/config/go_con.php');
|
|
|
|
$booking_day_date = mysqli_real_escape_string($db, $_GET['date']);
|
|
$booking_day_time = mysqli_real_escape_string($db, $_GET['time']);
|
|
$booking_emp_id = mysqli_real_escape_string($db, $_GET['emp_id']);
|
|
$booking_branch_id = mysqli_real_escape_string($db, $_GET['branch']);
|
|
|
|
$location = mysqli_real_escape_string($db, $_GET['lo']); // name of the file
|
|
$status_id = 0;
|
|
switch ($location) {
|
|
case 'book':
|
|
$status_id = 25;
|
|
break;
|
|
case 'book_visits':
|
|
$status_id = 26;
|
|
break;
|
|
default:
|
|
$status_id = 0;
|
|
break;
|
|
}
|
|
|
|
if (!empty($_GET['booking_id'])) {
|
|
$booking_id = mysqli_real_escape_string($db, $_GET['booking_id']);
|
|
$get_booking_sql = mysqli_query($db, "SELECT `day_date`, `day_time`, `services_id`, `branch_id`, `emplyee_id` FROM `book_details` WHERE `book_id` = '$booking_id' ORDER BY `date_time` DESC LIMIT 1");
|
|
if (mysqli_num_rows($get_booking_sql) == 1) {
|
|
$row = mysqli_fetch_assoc($get_booking_sql);
|
|
$day_date = $row['day_date'];
|
|
$day_time = $row['day_time'];
|
|
$the_service = $row['services_id'];
|
|
$emplyee_id = $row['emplyee_id'];
|
|
$branch_id = $row['branch_id'];
|
|
$why = "-";
|
|
|
|
if(mysqli_query(
|
|
$db,
|
|
"INSERT INTO `book_details`(`day_date`, `day_time`, `services_id`, `branch_id`, `emplyee_id`, `notes`, `status_id`, `user_id`, `activation_id`, `date_time`, `book_id`)
|
|
VALUES ('$day_date','$day_time','$the_service','$branch_id','$emplyee_id','$why','$status_id','$admin_id','2','$date_time','$booking_id')"
|
|
)) {
|
|
require_once('../ajax/add_to_book_temp_ajax.php');
|
|
} else {
|
|
echo "
|
|
<script type='text/javascript'>
|
|
alert('saf')
|
|
</script>
|
|
";
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
mysqli_query($db, "INSERT INTO `table`(`day_date`, `day_time`, `notes`, `branch_id`, `emplyee_id`, `status_id`, `date_time`, `user_id`, `activation_id`)
|
|
VALUES ('$booking_day_date', '$booking_day_time', '', '$booking_branch_id', '$booking_emp_id', '1', '$date_time', '$admin_id', '2')");
|
|
|
|
echo "<script type='text/javascript'>
|
|
window.location.href = '../../../$location?date=$booking_day_date&branch=$booking_branch_id';
|
|
</script>";
|
|
?>
|
|
|
|
|
|
|