Commit 48392bfa by Jansa Jose

price

parent 6d32c6e5
...@@ -956,9 +956,9 @@ class Webservice extends CI_Controller { ...@@ -956,9 +956,9 @@ class Webservice extends CI_Controller {
if(isset($headers['Auth'])){ if(isset($headers['Auth'])){
$check_authToken = $this->Webservice_model->check_auth_token($headers['Auth']); $check_authToken = $this->Webservice_model->check_auth_token($headers['Auth']);
if($check_authToken){ if($check_authToken){
if(isset($data['doctor_id']) && strlen($data['doctor_id'])/* && isset($data['clinic_id']) && strlen($data['clinic_id'])*/){ if(isset($data['doctor_id']) && strlen($data['doctor_id']) && isset($data['clinic_id']) && strlen($data['clinic_id'])){
$result = $this->Webservice_model->get_doctor_profile($data['doctor_id']); $result = $this->Webservice_model->get_doctor_profile($data);
if($result['status'] == 'success'){ if($result['status'] == 'success'){
if($result['data']['online_status'] == 0){ if($result['data']['online_status'] == 0){
$online = false; $online = false;
......
...@@ -1073,14 +1073,14 @@ CASE when tbl_registration.gender='0' then 'MALE' when tbl_registration.gender=' ...@@ -1073,14 +1073,14 @@ CASE when tbl_registration.gender='0' then 'MALE' when tbl_registration.gender='
//................. get doctor profile //................. get doctor profile
function get_doctor_profile($doctorid){ function get_doctor_profile($data){
$this->db->select("tbl_doctors.*,CASE when tbl_doctors.gender='0' then 'MALE' when tbl_doctors.gender='1' then 'FEMALE' else 'OTHERS' end as pt_gender,tbl_specialization.specialization_name,tbl_specialization.sub_name,tbl_clinic.street_address as location_name,tbl_clinic.location_lattitude,tbl_clinic.location_longitude,COUNT(DISTINCT(tbl_review.review_id)) as reviewcount,GROUP_CONCAT(DISTINCT(tbl_doctors_photos.photo_url) SEPARATOR ',') as photos"); $this->db->select("tbl_doctors.*,CASE when tbl_doctors.gender='0' then 'MALE' when tbl_doctors.gender='1' then 'FEMALE' else 'OTHERS' end as pt_gender,tbl_specialization.specialization_name,tbl_specialization.sub_name,case when tbl_clinic_doctors.clinic_id != '0' then tbl_clinic.street_address else tbl_doctors.street_address end as location_name,case when tbl_clinic_doctors.clinic_id != '0' then tbl_clinic.location_lattitude else tbl_doctors.default_latitude end as location_lattitude,case when tbl_clinic_doctors.clinic_id != '0' then tbl_clinic.location_longitude else tbl_doctors.default_longitude end as location_longitude,COUNT(DISTINCT(tbl_review.review_id)) as reviewcount,GROUP_CONCAT(DISTINCT(tbl_doctors_photos.photo_url) SEPARATOR ',') as photos");
$this->db->join('tbl_clinic_doctors', 'tbl_clinic_doctors.doctor_id = tbl_doctors.id','INNER'); $this->db->join('tbl_clinic_doctors', 'tbl_clinic_doctors.doctor_id = tbl_doctors.id','INNER');
$this->db->join('tbl_clinic', 'tbl_clinic.id = tbl_clinic_doctors.clinic_id','INNER'); $this->db->join('tbl_clinic', 'tbl_clinic.id = tbl_clinic_doctors.clinic_id','INNER');
$this->db->join('tbl_doctors_photos', 'tbl_doctors_photos.doctor_id = tbl_doctors.id','LEFT'); $this->db->join('tbl_doctors_photos', 'tbl_doctors_photos.doctor_id = tbl_doctors.id','LEFT');
$this->db->join('tbl_specialization', 'tbl_specialization.id = tbl_doctors.specialization','LEFT'); $this->db->join('tbl_specialization', 'tbl_specialization.id = tbl_doctors.specialization','LEFT');
$this->db->join('tbl_review', 'tbl_review.doctor_id = tbl_doctors.id','LEFT'); $this->db->join('tbl_review', 'tbl_review.doctor_id = tbl_doctors.id','LEFT');
$query = $this->db->get_where("tbl_doctors",array("tbl_doctors.id"=>$doctorid)); $query = $this->db->get_where("tbl_doctors",array("tbl_doctors.id"=>$data['doctor_id'],'tbl_clinic_doctors.clinic_id'=>$data['clinic_id']));
if($query->num_rows() > 0 && !is_null($query->row_array()['id'])){ if($query->num_rows() > 0 && !is_null($query->row_array()['id'])){
...@@ -1100,6 +1100,13 @@ CASE when tbl_registration.gender='0' then 'MALE' when tbl_registration.gender=' ...@@ -1100,6 +1100,13 @@ CASE when tbl_registration.gender='0' then 'MALE' when tbl_registration.gender='
$query['locality'] = decrypt_data($query['locality']); $query['locality'] = decrypt_data($query['locality']);
$query['number'] = decrypt_data($query['number']); $query['number'] = decrypt_data($query['number']);
if(isset($data['promocode_id']) && strlen(trim($data['promocode_id']," ")) > 0){
$promo = $this->db->get_where('tbl_promocode',array('id'=>$data['promocode_id']))->row();
if($promo){
$new_fee = $query['price'] - ($query['price'] * $promo->amount/100);
$query['price'] = $new_fee;
}
}
$return_array = array('status'=>'success','data'=>$query); $return_array = array('status'=>'success','data'=>$query);
} }
...@@ -2916,10 +2923,13 @@ CASE when tbl_doctors.gender='0' then 'MALE' when tbl_doctors.gender='1' then 'F ...@@ -2916,10 +2923,13 @@ CASE when tbl_doctors.gender='0' then 'MALE' when tbl_doctors.gender='1' then 'F
if(in_array(0, array_column($query, 'id')) || in_array('Default', array_column($query, 'name'))) { // if(in_array(0, array_column($query, 'id')) || in_array('Default', array_column($query, 'name'))) { //
array_splice($query, 0, 1); array_splice($query, 0, 1);
}else{ }else{
$this->db->insert('tbl_clinic',array('name'=>'Default','username'=>'default','password'=>md5('default'))); $get_row = $this->db->get_where('tbl_clinic',array('id'=>'0'))->row();
$last = $this->db->insert_id(); if($get_row == ''){
if($last != '0'){ $this->db->insert('tbl_clinic',array('name'=>'Default','username'=>'default','password'=>md5('default')));
$this->db->update('tbl_clinic',array('id'=>'0'),array('id'=>$last)); $last = $this->db->insert_id();
if($last != '0'){
$this->db->update('tbl_clinic',array('id'=>'0'),array('id'=>$last));
}
} }
} }
......
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