num_rows > 0) { if ($check) { $arr = "false"; } } else { if ($id) { $insertSql = "UPDATE `appointment_details` SET doctor_id='$doctor_id' , time='$time',date='$date' WHERE id='$id'"; } else { $insertSql = "INSERT INTO `appointment_details`( `date`, `time`, `day`,`doctor_id`,`emp_id` ,`ohc_type_id` , `status` ,`app_type`) VALUES ('$date','$time','$day','$doctor_id','$emp_id' , '$ohc_type_id' , 'BOOKED' , '$type')"; } // If not, save the date and time to the database error_log("API LOGIN DM : " . $insertSql); $exe = mysqli_query($conn, $insertSql); if ($id) { $new_id=$id; }else{ $new_id=mysqli_insert_id($conn); } if ($exe) { $sql1 = "SELECT * from appointment_details where id = '$new_id'"; error_log('apps' . $sql1); $query1 = mysqli_query($conn, $sql1); $Update_Doc_Status = "UPDATE `doc_slots` SET `status` = 'BOOKED' WHERE doc_slot_id = '$time' AND ohc_type_id = '$ohc_type_id'"; error_log("Update_Doc_Status: " . $Update_Doc_Status); $update_exe = mysqli_query($conn, $Update_Doc_Status); $arr = "true"; // while ($fetch = mysqli_fetch_assoc($query1)) { // $emailContent = "

Dear Sir/Madam,

"; // $status = ''; // $sub_status = ''; // if ($fetch['status'] == 'BOOKED') { // $sub_status = 'confirmed'; // $status = "confirmed "; // } else if ($fetch['status'] == 'DRP') { // $sub_status = 'pending'; // $status = "confirmed"; // } else if ($fetch['status'] == 'DRA') { // $sub_status = 'completed'; // $status = "completed "; // } else if ($fetch['status'] == 'CANCELLED') { // $sub_status = 'cancelled'; // $status = " cancelled"; // } // if ($fetch['app_type'] == 'FIT') { // $fetch['app_type'] = 'sickness/fitness'; // } else if ($fetch['app_type'] == 'MED') { // $fetch['app_type'] = 'periodic health checkup'; // } // $email_list_to = getTableFieldValue('patient_master', 'offiial_email_id', 'id', '"' . $fetch['emp_id'] . '"'); // $email_list_cc = getTableFieldValue('patient_master', 'offiial_email_id', 'id', '"' . $fetch['doctor_id'] . '"'); // $ref_type = $fetch['app_type'] . " Appointment"; // $subject = 'Your appointment got ' . $sub_status . ' in ' . getTableFieldValue('ohc_type', 'ohc_type_name', 'ohc_type_id', '"' . $fetch['ohc_type_id'] . '"') . ' OHC on ' . // date_format(date_create($fetch['date']), "d-m-Y ") . '.'; // // if ($type != 'del') { // // emailContent += "

Your appointment got " + status + " in " + data.ohc_type + " OHC on " + // // data.date + // // " between " + // // data.slot + // // " - " + // // data.slot_end + // // ".

"; // // emailContent += // // "

Kindly make sure 12 hours fasting is required (You can consume water) before this health checkup.

Regards,

Team OHC

"; // // } else { // $emailContent .= "

You have booked your health checkup in " . getTableFieldValue('ohc_type', 'ohc_type_name', 'ohc_type_id', '"' . $fetch['ohc_type_id'] . '"') ." OHC got Cancelled .

"; // $emailContent .= "

Regards,

Team OHC

"; // // } // // emailContent += "
Details "; // $message = $emailContent; // $id = $appointmentId; // $message = $emailContent; // send_mail( // $email_list_to, // $subject, // $message, // "", // ); // //send_email($appointmentId, getTableFieldValue('ohc_type', 'ohc_type_name', 'ohc_type_id', '"' . $fetch['ohc_type_id'] . '"'), getTableFieldValue('ohc_type', 'primary_email', 'ohc_type_id', '"' . $fetch['ohc_type_id'] . '"'), date_format(date_create($fetch['date']), "d-m-Y "), getTableFieldValue('patient_master', 'patient_name', 'id', '"' . $fetch['emp_id'] . '"'), $fetch['app_type'], $link, $type); // } } else { $arr = "false"; } } echo json_encode($arr);