49 lines
1.8 KiB
PHP
49 lines
1.8 KiB
PHP
|
<?php
|
||
|
include('includes/config/config.php');
|
||
|
include('includes/functions.php');
|
||
|
|
||
|
$status = $_POST['status'];
|
||
|
$remarks = $_POST['app_remarks'];
|
||
|
$app_date = $_POST['approval_date'];
|
||
|
$user_id = $_SESSION['user_id'];
|
||
|
$item_list = $_POST['item_list'];
|
||
|
$items=explode(",", $item_list);
|
||
|
error_log('itemlist'.count($item_list));
|
||
|
begin();
|
||
|
|
||
|
for($i=0;$i<count($items);$i++){
|
||
|
|
||
|
$app_id=$items[$i];
|
||
|
|
||
|
if($status=='CANCELLED'){
|
||
|
|
||
|
$query_appointment="select *, DATE_FORMAT(date, '%Y-%m-%d') as date from appointment_details where id='$app_id' ";
|
||
|
error_log($query_appointment);
|
||
|
$result_stock = @mysqli_query($conn,$query_appointment);
|
||
|
while($row_app=@mysqli_fetch_array($result_stock)){
|
||
|
|
||
|
|
||
|
$sql_item_cancel="insert into cancelled_appointment_details set status='".$status."' , emp_id='".$row_app['emp_id']."' , doctor_id='".$row_app['doctor_id']."' , date=str_to_date('".$row_app['date']."','%Y-%m-%d') , time='".$row_app['time']."', ohc_type_id='".$row_app['ohc_type_id']."',app_type='".$row_app['app_type']."',modified_by = '".$_SESSION['user_id']."' ";
|
||
|
error_log($sql_item_cancel);
|
||
|
if (!$result_item_cancel = @mysqli_query($conn, $sql_item_cancel)) {
|
||
|
error_log ("Exception saving save_app_indent_vendor_rate:".mysqli_error($conn)." failing query:".$sql_item_cancel);
|
||
|
rollback();
|
||
|
|
||
|
exit(mysqli_error($conn));
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
$sql_item="update appointment_details set status='".$status."' , remarks='".$remarks."' ,modified_by='".$user_id."' where id='".$app_id."' ";
|
||
|
error_log($sql_item);
|
||
|
if (!$result_item = @mysqli_query($conn, $sql_item)) {
|
||
|
error_log ("Exception saving save_app_indent_vendor_rate:".mysqli_error($conn)." failing query:".$sql_item);
|
||
|
rollback();
|
||
|
|
||
|
exit(mysqli_error($conn));
|
||
|
}
|
||
|
|
||
|
}
|
||
|
commit();
|
||
|
echo json_encode($data);
|