Commit b1c0be5a by Jansa Jose

wait list

parent 400df493
...@@ -2343,7 +2343,7 @@ CASE when tbl_doctors.gender='0' then 'MALE' when tbl_doctors.gender='1' then 'F ...@@ -2343,7 +2343,7 @@ CASE when tbl_doctors.gender='0' then 'MALE' when tbl_doctors.gender='1' then 'F
$nextday = $query['date']; $nextday = $query['date'];
$next_day_consult = $this->wait_list_data($query,$nextday,''); $next_day_consult = $this->wait_list_data($query,$nextday,'');
if(count($next_day_consult) > 0){ if(!empty($next_day_consult) && count($next_day_consult) > 0){
$msg3 = "Your Wait Listed Appointment on ".date('d.m.Y h:i a',$next_day_consult[0]['time_start'])." can be changed to ".date('d.m.Y h:i a',$query['time_start'])." as the Time Slot is Available Now. Would you like to change the Appointment on Available Slot ?"; $msg3 = "Your Wait Listed Appointment on ".date('d.m.Y h:i a',$next_day_consult[0]['time_start'])." can be changed to ".date('d.m.Y h:i a',$query['time_start'])." as the Time Slot is Available Now. Would you like to change the Appointment on Available Slot ?";
...@@ -2389,7 +2389,8 @@ CASE when tbl_doctors.gender='0' then 'MALE' when tbl_doctors.gender='1' then 'F ...@@ -2389,7 +2389,8 @@ CASE when tbl_doctors.gender='0' then 'MALE' when tbl_doctors.gender='1' then 'F
} }
public function wait_list_data($query,$nextday,$insertid){ public function wait_list_data($query,$nextday,$insertid,$day = 0){
$day++;
//print_r($insertid);exit(); //print_r($insertid);exit();
$this->db->order_by('id','ASC'); $this->db->order_by('id','ASC');
if(isset($insertid) && !empty($insertid)){ if(isset($insertid) && !empty($insertid)){
...@@ -2409,7 +2410,10 @@ CASE when tbl_doctors.gender='0' then 'MALE' when tbl_doctors.gender='1' then 'F ...@@ -2409,7 +2410,10 @@ CASE when tbl_doctors.gender='0' then 'MALE' when tbl_doctors.gender='1' then 'F
$insert_id = ''; $insert_id = '';
} }
$nextday = strtotime(date('Y-m-d', strtotime('+1 day', $nextday))); $nextday = strtotime(date('Y-m-d', strtotime('+1 day', $nextday)));
return $this->wait_list_data($query,$nextday,$insert_id); if($day == 7){
return false;
}
return $this->wait_list_data($query,$nextday,$insert_id,$day);
} }
} }
......
...@@ -89,9 +89,6 @@ public function getBooking() ...@@ -89,9 +89,6 @@ public function getBooking()
print json_encode($result); print json_encode($result);
} }
public function dsfsd(){
$this->Webservice->cancel_booking_resend_cron();
}
/*FUNCTION FOR CANCELING BOOKING - PATIENT DASHBOARD*/ /*FUNCTION FOR CANCELING BOOKING - PATIENT DASHBOARD*/
public function cancelBooking() public function cancelBooking()
...@@ -204,17 +201,18 @@ public function cancelBooking() ...@@ -204,17 +201,18 @@ public function cancelBooking()
}//if no user exist in waiting list on that particular date. check on next date. }//if no user exist in waiting list on that particular date. check on next date.
else{ else{
//echo "no";exit(); //echo "no";
$nextday = $booking_details['book_date']; $nextday = $booking_details['book_date'];
$next_day_consult = $this->wait_list_data($booking_details,$nextday,''); $next_day_consult = $this->wait_list_data($booking_details,$nextday,'');
//$nextday = strtotime(date('Y-m-d', strtotime('+1 day', $booking_details['book_date']))); //$nextday = strtotime(date('Y-m-d', strtotime('+1 day', $booking_details['book_date'])));
//$next_day_consult = $this->db->get_where('tbl_booking',array('doctor_id'=>$booking_details['doc_id'],'clinic_id'=>$booking_details['clinic_id'],'date'=>$nextday,'booking_status'=>'0','time'=>$booking_details['book_time'],'payment_status'=>'1'))->row_array(); //$next_day_consult = $this->db->get_where('tbl_booking',array('doctor_id'=>$booking_details['doc_id'],'clinic_id'=>$booking_details['clinic_id'],'date'=>$nextday,'booking_status'=>'0','time'=>$booking_details['book_time'],'payment_status'=>'1'))->row_array();
$doctor_data_waiting = $this->Doctor_model->get_single_doctor($next_day_consult[0]['doctor_id']);
$fcm_user = $this->Home_model->get_patient_fcm($next_day_consult[0]['patient_id']); //print_r($next_day_consult);exit();
if(!empty($next_day_consult) && count($next_day_consult) > 0){
if(count($next_day_consult) > 0){ //echo "sfs";
$doctor_data_waiting = $this->Doctor_model->get_single_doctor($next_day_consult[0]['doctor_id']);
$fcm_user = $this->Home_model->get_patient_fcm($next_day_consult[0]['patient_id']);
$text = "Your Wait Listed Appointment on ".date('d.m.Y h:i a',$next_day_consult[0]['time_start'])." can be changed to ".date('d.m.Y h:i a',$result['time_start'])." as the Time Slot is Available Now. Would you like to change the Appointment on Available Slot ?"; $text = "Your Wait Listed Appointment on ".date('d.m.Y h:i a',$next_day_consult[0]['time_start'])." can be changed to ".date('d.m.Y h:i a',$result['time_start'])." as the Time Slot is Available Now. Would you like to change the Appointment on Available Slot ?";
$this->db->insert('tbl_patient_notification',array('patient_id'=>$next_day_consult[0]['patient_id'],'type'=>'4','message'=>$text,'time'=>strtotime($nowin_server),'booking_id'=>$next_day_consult[0]['id'],'free_booking_id'=>$_POST['booking_id'],'read_status'=>'0')); $this->db->insert('tbl_patient_notification',array('patient_id'=>$next_day_consult[0]['patient_id'],'type'=>'4','message'=>$text,'time'=>strtotime($nowin_server),'booking_id'=>$next_day_consult[0]['id'],'free_booking_id'=>$_POST['booking_id'],'read_status'=>'0'));
...@@ -242,14 +240,16 @@ public function cancelBooking() ...@@ -242,14 +240,16 @@ public function cancelBooking()
$this->load->view('patient_dash_scheduled_booking',$template); $this->load->view('patient_dash_scheduled_booking',$template);
} }
public function wait_list_data($query,$nextday,$insertid){ public function wait_list_data($query,$nextday,$insertid,$day = 0){
$day++;
$this->db->order_by('id','ASC'); $this->db->order_by('id','ASC');
if(isset($insertid) && !empty($insertid)){ if(isset($insertid) && !empty($insertid)){
$this->db->where_not_in('id', $insertid); $this->db->where_not_in('id', $insertid);
} }
$next_day_consult = $this->db->get_where('tbl_booking',array('doctor_id'=>$query['doc_id'],'clinic_id'=>$query['clinic_id'],'booking_status'=>'0','date'=>$nextday,'payment_status'=>'1'))->result_array(); $next_day_consult = $this->db->get_where('tbl_booking',array('doctor_id'=>$query['doc_id'],'clinic_id'=>$query['clinic_id'],'booking_status'=>'0','date'=>$nextday,'payment_status'=>'1'))->result_array();
//echo $this->db->last_query();exit(); //echo $this->db->last_query();echo"<br><br>";
if(count($next_day_consult) > 0){ if(count($next_day_consult) > 0){
//print_r($next_day_consult);
return $next_day_consult; return $next_day_consult;
}else{ }else{
if(isset($insertid) && !empty($insertid)){ if(isset($insertid) && !empty($insertid)){
...@@ -258,7 +258,10 @@ public function cancelBooking() ...@@ -258,7 +258,10 @@ public function cancelBooking()
$insert_id = ''; $insert_id = '';
} }
$nextday = strtotime(date('Y-m-d', strtotime('+1 day', $nextday))); $nextday = strtotime(date('Y-m-d', strtotime('+1 day', $nextday)));
return $this->wait_list_data($query,$nextday,$insert_id); if($day == 7){
return false;
}
return $this->wait_list_data($query,$nextday,$insert_id,$day);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment