2024-10-16 19:18:52 +05:30
< ? php
error_reporting ( E_ERROR | E_PARSE );
include ( 'includes/config/config.php' );
include ( 'includes/functions.php' );
include ( 'log_entry.php' );
begin ();
$query = " SELECT *,DATE_FORMAT(date(date),'%d/%m/%Y') AS app_date FROM `cancelled_appointment_details` WHERE date(`date`)>=str_to_date('08-01-2024','%d-%m-%Y') and status='DELETED' " ;
error_log ( " sql " . $query );
if ( ! $result = @ mysqli_query ( $conn , $query )) {
rollback ();
2024-11-02 18:03:13 +05:30
die ( mysqli_error ( $conn ));
2024-10-16 19:18:52 +05:30
}
$data = array ();
if ( mysqli_num_rows ( $result ) > 0 ) {
while ( $row = mysqli_fetch_assoc ( $result )) {
$app_id = 0 ;
//
$query_s = " select max(checkup_id) as id from checkup_form where emp_id = ' " . $row [ 'emp_id' ] . " ' and date(checkup_date)=STR_TO_DATE(' " . $row [ 'app_date' ] . " ','%d/%m/%Y') and ohc_type_id=' " . $row [ 'ohc_type_id' ] . " ' " ;
error_log ( " select appointment_details " . $query_s );
// error_log($query_s . "update appointment_details");
if ( ! $result_s = @ mysqli_query ( $GLOBALS [ 'conn' ], $query_s )) {
rollback ();
2024-11-02 18:03:13 +05:30
die ( error_log ( mysqli_error ( $GLOBALS [ 'conn' ])));
2024-10-16 19:18:52 +05:30
}
if ( mysqli_num_rows ( $result_s ) > 0 ){
while ( $row_s = mysqli_fetch_array ( $result_s )) {
$app_id = $row_s [ 'id' ];
}
}
//
if ( $app_id != 0 ){
$sql = " insert into appointment_details SET emp_id=' " . $row [ 'emp_id' ] . " ' , date=' " . $row [ 'date' ] . " ' , time=' " . $row [ 'time' ] . " ' , app_type=' " . $row [ 'app_type' ] . " ',ohc_type_id=' " . $row [ 'ohc_type_id' ] . " ',status='DRA',app_id= " . $app_id ;
echo ( '----' . $sql );
// if (!$result_sql = @mysqli_query($conn,$sql)) {
// rollback();
2024-11-02 18:03:13 +05:30
// die(mysqli_error($conn));
2024-10-16 19:18:52 +05:30
// }
}
}
$data [ 'status' ] = " succes " ;
$data [ 'message' ] = " Assign menu done! " ;
}
else
{
$data [ 'status' ] = 200 ;
$data [ 'message' ] = " Data not found! " ;
}
commit ();
if ( $data [ 'status' ] == 'succes' ){
echo " <h3>Slots Created Succesfully</h3><br><button type='button' class='btn btn-info btn-sm save_button' onclick='window.location=`shift_details.php`;'><i class='ace-icon fa fa-floppy-o bigger-110'></i>Back </button> " ;
} else {
echo json_encode ( $data );
}
?>