Commit 2c882a31 by Jansa Jose

pagination

parent a51afca5
......@@ -1117,36 +1117,38 @@ class Webservice extends CI_Controller {
$currentpage = (int)$_GET['page'];
$currentpage = $currentpage==0 ? $currentpage : $currentpage-1;
$start = $currentpage * $per_page;
$page_no = $_GET['page'];
}
else{
$currentpage = 0;
$start = 0;
$page_no = 0;
}
if(isset($data['doctor_id']) && strlen($data['doctor_id'])){
$notificationresult = $this->Webservice_model->review_list($data['doctor_id'],0,0);
$result = $this->Webservice_model->review_list($data['doctor_id'],$start,$per_page);
}
else if(isset($data['clinic_id']) && strlen($data['clinic_id'])){
$notificationresult = $this->Webservice_model->review_list_clinic($data['clinic_id'],$start,$per_page);
$result = $this->Webservice_model->review_list_clinic($data['clinic_id'],$start,$per_page);
}
$reviews = array();
if($result != false){
$total = count($result);
if($noificationresult != false){
$total = count($notificationresult);
}else{
$total = 0;
}
if($total >= $per_page){
$totalPages = $total / $per_page;
$totalPages = (int)($total % $per_page ==0
? $total / $per_page
:($total / $per_page)+1);
}
else{
$totalPages = $total;
}
if($result != ''){
foreach (array_slice($result,$start,$per_page) as $key => $value) {
foreach ($result as $key => $value) {
$pushData = array('id'=>$value['review_id'],
'name' => $value['name'],
'date' => floatval($value['date']),
......@@ -2715,32 +2717,33 @@ print_r(date('H:i',$ms));exit();*/
$currentpage = (int)$_GET['page'];
$currentpage = $currentpage==0 ? $currentpage : $currentpage-1;
$start = $currentpage * $per_page;
$page_no = $_GET['page'];
}
else{
$currentpage = 0;
$start = 0;
$page_no = 0;
}
$notificationresult = $this->Webservice_model->get_faqs(0,0);
$result = $this->Webservice_model->get_faqs($start,$per_page);
$faqArray = array();
if($result != false){
$total = count($result);
if($notificationresult != false){
$total = count($notificationresult);
}else{
$total = 0;
}
if($total >= $per_page){
$totalPages = (int)($total / $per_page);
$totalPages = (int)($total % $per_page ==0
? $total / $per_page
:($total / $per_page)+1);
}
else{
$totalPages = 1;
}
if($result != ''){
foreach (array_slice($result,$start,$per_page) as $key => $value) {
foreach ($result as $key => $value) {
array_push($faqArray, $value);
......@@ -3183,31 +3186,35 @@ print_r(date('H:i',$ms));exit();*/
$currentpage = (int)$_GET['page'];
$currentpage = $currentpage==0 ? $currentpage : $currentpage-1;
$start = $currentpage * $per_page;
$page_no = $_GET['page'];
}
else{
$currentpage = 0;
$start = 0;
$page_no = 0;
}
$type = 'user';
$notificationResult = $this->Webservice_model->get_recent_chat_list($auth_result->userid, 0, 0);
$result = $this->Webservice_model->get_recent_chat_list($auth_result->userid,$start,$per_page,$type);
$chatArray = array();
if($result != false){
$total = count($result);
if($notificationResult != false){
$total = count($notificationResult);
}else{
$total =0;
}
if($total >= $per_page){
$totalPages = (int)($total / $per_page);
$totalPages = (int)($total % $per_page ==0
? $total / $per_page
:($total / $per_page)+1);
}
else{
$totalPages = 1;
}
if($result != ''){
foreach (array_slice($result,$start,$per_page) as $key => $value) {
foreach ($result as $key => $value) {
array_push($chatArray, $value);
}
}
......@@ -4341,32 +4348,34 @@ print_r(date('H:i',$ms));exit();*/
$currentpage = (int)$_GET['page'];
$currentpage = $currentpage==0 ? $currentpage : $currentpage-1;
$start = $currentpage * $per_page;
$page_no = $_GET['page'];
}
else{
$currentpage = 0;
$start = 0;
$page_no = 0;
}
$notificationresult = $this->Webservice_model->get_doctor_review_list($authtoken->doctor_id,0,0);
$result = $this->Webservice_model->get_doctor_review_list($authtoken->doctor_id,$start,$per_page);
$revArray = array();
if($result != false){
$total = count($result);
if($notificationresult != false){
$total = count($notificationresult);
}else{
$total =0;
}
if($total >= $per_page){
$totalPages = (int)($total / $per_page);
$totalPages = (int)($total % $per_page ==0
? $total / $per_page
:($total / $per_page)+1);
}
else{
$totalPages = 1;
}
if($result != ''){
foreach (array_slice($result,$start,$per_page) as $key => $value) {
foreach ($result as $key => $value) {
array_push($revArray, $value);
......@@ -4425,32 +4434,34 @@ print_r(date('H:i',$ms));exit();*/
$currentpage = (int)$_GET['page'];
$currentpage = $currentpage==0 ? $currentpage : $currentpage-1;
$start = $currentpage * $per_page;
$page_no = $_GET['page'];
}
else{
$currentpage = 0;
$start = 0;
$page_no = 0;
}
$notificationresult = $this->Webservice_model->get_doctor_faq_list(0,0);
$result = $this->Webservice_model->get_doctor_faq_list($start,$per_page);
$faqArray = array();
if($result != false){
$total = count($result);
if($notificationresult != false){
$total = count($notificationresult);
}else{
$total = 0;
}
if($total >= $per_page){
$totalPages = (int)($total / $per_page);
$totalPages = (int)($total % $per_page ==0
? $total / $per_page
:($total / $per_page)+1);
}
else{
$totalPages = 1;
}
if($result != ''){
foreach (array_slice($result,$start,$per_page) as $key => $value) {
foreach ($result as $key => $value) {
array_push($faqArray, $value);
......@@ -4508,31 +4519,32 @@ print_r(date('H:i',$ms));exit();*/
$currentpage = (int)$_GET['page'];
$currentpage = $currentpage==0 ? $currentpage : $currentpage-1;
$start = $currentpage * $per_page;
$page_no = $_GET['page'];
}
else{
$currentpage = 0;
$start = 0;
$page_no = 0;
}
$notificationresult = $this->Webservice_model->get_patient_list($authtoken->doctor_id,0,0);
$result = $this->Webservice_model->get_patient_list($authtoken->doctor_id,$start,$per_page);
$patientArray = array();
if($result != false){
$total = count($result);
if($notificationresult != false){
$total = count($notificationresult);
}else{
$total = 0;
}
if($total >= $per_page){
$totalPages = (int)($total / $per_page);
$totalPages = (int)($total % $per_page ==0
? $total / $per_page
:($total / $per_page)+1);
}
else{
$totalPages = 1;
}
if($result != ''){
foreach (array_slice($result,$start,$per_page) as $key => $value) {
foreach ($result as $key => $value) {
array_push($patientArray, $value);
......@@ -4590,30 +4602,32 @@ print_r(date('H:i',$ms));exit();*/
$currentpage = (int)$_GET['page'];
$currentpage = $currentpage==0 ? $currentpage : $currentpage-1;
$start = $currentpage * $per_page;
$page_no = $_GET['page'];
}
else{
$currentpage = 0;
$start = 0;
$page_no = 0;
}
$notificationresult = $this->Webservice_model->get_patient_anniversary_list($authtoken->doctor_id,0,0);
$result = $this->Webservice_model->get_patient_anniversary_list($authtoken->doctor_id,$start,$per_page);
$annArray = array();
if($result != false){
$total = count($result);
if($notificationresult != false){
$total = count($notificationresult);
}else{
$total = 0;
}
if($total >= $per_page){
$totalPages = (int)($total / $per_page);
$totalPages = (int)($total % $per_page ==0
? $total / $per_page
:($total / $per_page)+1);
}
else{
$totalPages = 1;
}
if($result != ''){
foreach (array_slice($result,$start,$per_page) as $key => $value) {
foreach ($result as $key => $value) {
array_push($annArray, $value);
......@@ -4860,31 +4874,32 @@ print_r(date('H:i',$ms));exit();*/
$currentpage = (int)$_GET['page'];
$currentpage = $currentpage==0 ? $currentpage : $currentpage-1;
$start = $currentpage * $per_page;
$page_no = $_GET['page'];
}
else{
$currentpage = 0;
$start = 0;
$page_no = 0;
}
$notificationresult = $this->Webservice_model->get_patient_medical_record_list($authtoken->doctor_id,0,0,$id);
$result = $this->Webservice_model->get_patient_medical_record_list($authtoken->doctor_id,$start,$per_page,$id);
//print_r($result);exit()
$medicalArray = array();
if(count($result['medical']) > 0){
$total = count($result['medical']);
if(count($notificationresult['medical']) > 0){
$total = count($notificationresult['medical']);
}else{
$total = 0;
}
if($total >= $per_page){
$totalPages = (int)($total / $per_page);
$totalPages = (int)($total % $per_page ==0
? $total / $per_page
:($total / $per_page)+1);
}
else{
$totalPages = 1;
}
if($result != ''){
foreach (array_slice($result['medical'],$start,$per_page) as $key => $value) {
foreach ($result['medical'] as $key => $value) {
array_push($medicalArray, $value);
......@@ -4949,32 +4964,33 @@ print_r(date('H:i',$ms));exit();*/
$currentpage = (int)$_GET['page'];
$currentpage = $currentpage==0 ? $currentpage : $currentpage-1;
$start = $currentpage * $per_page;
$page_no = $_GET['page'];
}
else{
$currentpage = 0;
$start = 0;
$page_no = 0;
}
$type='0';
$notificationresult = $this->Webservice_model->get_doctor_upcoming_consultation_list($authtoken->doctor_id,0,0,$type);
$result = $this->Webservice_model->get_doctor_upcoming_consultation_list($authtoken->doctor_id,$start,$per_page,$type);
$upcomingArray = array();
if($result != false){
$total = count($result);
if($notificationresult != false){
$total = count($notificationresult);
}else{
$total = 0;
}
if($total >= $per_page){
$totalPages = (int)($total / $per_page);
$totalPages = (int)($total % $per_page ==0
? $total / $per_page
:($total / $per_page)+1);
}
else{
$totalPages = 1;
}
if($result != ''){
foreach (array_slice($result,$start,$per_page) as $key => $value) {
foreach ($result as $key => $value) {
array_push($upcomingArray, $value);
}
}
......@@ -5028,32 +5044,33 @@ print_r(date('H:i',$ms));exit();*/
$currentpage = (int)$_GET['page'];
$currentpage = $currentpage==0 ? $currentpage : $currentpage-1;
$start = $currentpage * $per_page;
$page_no = $_GET['page'];
}
else{
$currentpage = 0;
$start = 0;
$page_no = 0;
}
$type='1';
$notificationresult = $this->Webservice_model->get_doctor_upcoming_consultation_list($authtoken->doctor_id,0,0,$type);
$result = $this->Webservice_model->get_doctor_upcoming_consultation_list($authtoken->doctor_id,$start,$per_page,$type);
$upcomingArray = array();
if($result != false){
$total = count($result);
if($notificationresult != false){
$total = count($notificationresult);
}else{
$total = 0;
}
if($total >= $per_page){
$totalPages = (int)($total / $per_page);
$totalPages = (int)($total % $per_page ==0
? $total / $per_page
:($total / $per_page)+1);
}
else{
$totalPages = 1;
}
if($result != ''){
foreach (array_slice($result,$start,$per_page) as $key => $value) {
foreach ($result as $key => $value) {
array_push($upcomingArray, $value);
}
}
......@@ -5109,32 +5126,33 @@ print_r(date('H:i',$ms));exit();*/
$currentpage = (int)$_GET['page'];
$currentpage = $currentpage==0 ? $currentpage : $currentpage-1;
$start = $currentpage * $per_page;
$page_no = $_GET['page'];
}
else{
$currentpage = 0;
$start = 0;
$page_no = 0;
}
$type='2';
$notificationresult = $this->Webservice_model->get_doctor_upcoming_consultation_list($authtoken->doctor_id,0,0,$type);
$result = $this->Webservice_model->get_doctor_upcoming_consultation_list($authtoken->doctor_id,$start,$per_page,$type);
$upcomingArray = array();
if($result != false){
$total = count($result);
if($notificationresult != false){
$total = count($notificationresult);
}else{
$total = 0;
}
if($total >= $per_page){
$totalPages = (int)($total / $per_page);
$totalPages = (int)($total % $per_page ==0
? $total / $per_page
:($total / $per_page)+1);
}
else{
$totalPages = 1;
}
if($result != ''){
foreach (array_slice($result,$start,$per_page) as $key => $value) {
foreach ($result as $key => $value) {
array_push($upcomingArray, $value);
}
}
......@@ -5508,31 +5526,32 @@ print_r(date('H:i',$ms));exit();*/
$currentpage = (int)$_GET['page'];
$currentpage = $currentpage==0 ? $currentpage : $currentpage-1;
$start = $currentpage * $per_page;
$page_no = $_GET['page'];
}
else{
$currentpage = 0;
$start = 0;
$page_no = 0;
}
$type = 'doctor';
$notificationresult = $this->Webservice_model->get_recent_chat_list($authtoken->doctor_id,0,0,$type);
$result = $this->Webservice_model->get_recent_chat_list($authtoken->doctor_id,$start,$per_page,$type);
$chatArray = array();
if($result != false){
$total = count($result);
if($notificationresult != false){
$total = count($notificationresult);
}else{
$total =0;
}
if($total >= $per_page){
$totalPages = (int)($total / $per_page);
$totalPages = (int)($total % $per_page ==0
? $total / $per_page
:($total / $per_page)+1);
}
else{
$totalPages = 1;
}
if($result != ''){
foreach (array_slice($result,$start,$per_page) as $key => $value) {
foreach ($result as $key => $value) {
array_push($chatArray, $value);
......@@ -6226,31 +6245,32 @@ print_r(date('H:i',$ms));exit();*/
$currentpage = (int)$_GET['page'];
$currentpage = $currentpage==0 ? $currentpage : $currentpage-1;
$start = $currentpage * $per_page;
$page_no = $_GET['page'];
}
else{
$currentpage = 0;
$start = 0;
$page_no = 0;
}
$type = '1';
$notificationresult = $this->Webservice_model->get_consultation_transaction_list($authtoken->doctor_id,0,0,$type);
$result = $this->Webservice_model->get_consultation_transaction_list($authtoken->doctor_id,$start,$per_page,$type);
$transArray = array();
if($result['status'] != 'failed'){
$total = count($result['data']);
if($notificationresult['status'] != 'failed'){
$total = count($notificationresult['data']);
}else{
$total = 0;
}
if($total >= $per_page){
$totalPages = (int)($total / $per_page);
$totalPages = (int)($total % $per_page ==0
? $total / $per_page
:($total / $per_page)+1);
}
else{
$totalPages = 1;
}
if($result != ''){
foreach (array_slice($result['data'],$start,$per_page) as $key => $value) {
foreach ($result['data'] as $key => $value) {
array_push($transArray, $value);
......@@ -6309,31 +6329,32 @@ print_r(date('H:i',$ms));exit();*/
$currentpage = (int)$_GET['page'];
$currentpage = $currentpage==0 ? $currentpage : $currentpage-1;
$start = $currentpage * $per_page;
$page_no = $_GET['page'];
}
else{
$currentpage = 0;
$start = 0;
$page_no = 0;
}
$type = '2';
$notificationresult = $this->Webservice_model->get_consultation_transaction_list($authtoken->doctor_id,0,0,$type);
$result = $this->Webservice_model->get_consultation_transaction_list($authtoken->doctor_id,$start,$per_page,$type);
$transArray = array();
if($result['status'] == 'success'){
$total = count($result['data']);
if($notificationresult['status'] == 'success'){
$total = count($notificationresult['data']);
}else{
$total = 0;
}
if($total >= $per_page){
$totalPages = (int)($total / $per_page);
$totalPages = (int)($total % $per_page ==0
? $total / $per_page
:($total / $per_page)+1);
}
else{
$totalPages = 1;
}
if($result['status'] == 'success'){
foreach (array_slice($result['data'],$start,$per_page) as $key => $value) {
foreach ($result['data'] as $key => $value) {
array_push($transArray, $value);
......@@ -6536,13 +6557,12 @@ print_r(date('H:i',$ms));exit();*/
$currentpage = (int)$_GET['page'];
$currentpage = $currentpage==0 ? $currentpage : $currentpage-1;
$start = $currentpage * $per_page;
$page_no = $_GET['page'];
}
else{
$currentpage = 0;
$start = 0;
$page_no = 0;
}
$notificationresult = $this->Webservice_model->get_bank_list($authtoken->doctor_id,0,0);
$result = $this->Webservice_model->get_bank_list($authtoken->doctor_id,$start,$per_page);
$bankArray = array();
if($result['status'] != 'failed'){
......@@ -6553,13 +6573,15 @@ print_r(date('H:i',$ms));exit();*/
if($total >= $per_page){
$totalPages = (int)($total / $per_page);
$totalPages = (int)($total % $per_page ==0
? $total / $per_page
:($total / $per_page)+1);
}
else{
$totalPages = 1;
}
if($result['status'] != 'failed'){
foreach (array_slice($result['data'],$start,$per_page) as $key => $value) {
foreach ($result['data'] as $key => $value) {
array_push($bankArray, $value);
......@@ -6618,30 +6640,31 @@ print_r(date('H:i',$ms));exit();*/
$currentpage = (int)$_GET['page'];
$currentpage = $currentpage==0 ? $currentpage : $currentpage-1;
$start = $currentpage * $per_page;
$page_no = $_GET['page'];
}
else{
$currentpage = 0;
$start = 0;
$page_no = 0;
}
$notificationresult = $this->Webservice_model->get_withdrawal_history($authtoken->doctor_id,0,0);
$result = $this->Webservice_model->get_withdrawal_history($authtoken->doctor_id,$start,$per_page);
$withdrawArray = array();
if($result != false){
$total = count($result);
if($notificationresult != false){
$total = count($notificationresult);
}else{
$total = 0;
}
if($total >= $per_page){
$totalPages = (int)($total / $per_page);
$totalPages = (int)($total % $per_page ==0
? $total / $per_page
:($total / $per_page)+1);
}
else{
$totalPages = 1;
}
if($result != ''){
foreach (array_slice($result,$start,$per_page) as $key => $value) {
foreach ($result as $key => $value) {
array_push($withdrawArray, $value);
......
......@@ -1098,7 +1098,9 @@ class Webservice_model extends CI_Model {
function review_list($id,$start,$per_page){
$this->db->join('tbl_registration','tbl_registration.id = tbl_review.reviewer_id');
$this->db->limit($per_page,$start);
if($start != 0 || $per_page != 0){
$this->db->limit($per_page,$start);
}
$query = $this->db->get_where("tbl_review",array("tbl_review.doctor_id"=>$id))->result_array();
//echo $this->db->last_query();exit();
if(count($query)> 0){
......@@ -1113,7 +1115,9 @@ class Webservice_model extends CI_Model {
function review_list_clinic($id,$start,$per_page){
$this->db->join('tbl_registration','tbl_registration.id = tbl_review_clinic.reviewer_id');
$this->db->limit($per_page,$start);
if($start != 0 || $per_page != 0){
$this->db->limit($per_page,$start);
}
$query = $this->db->get_where("tbl_review_clinic",array("tbl_review_clinic.clinic_id"=>$id))->result_array();
if(count($query)> 0){
......@@ -1927,6 +1931,9 @@ class Webservice_model extends CI_Model {
}else{
$this->db->where('tbl_recent_chats.doctor_id',$id);
}
if($start != 0 || $per_page != 0){
$this->db->limit($per_page,$start);
}
$query = $this->db->get('tbl_recent_chats')->result();
//echo $this->db->last_query();exit();
if(count($query) > 0){
......@@ -2336,7 +2343,9 @@ class Webservice_model extends CI_Model {
public function get_faqs($start,$per_page){
$this->db->select('id,faq_title,faq_description');
$this->db->where('faq_for','0');
$this->db->limit($per_page,$start);
if($start != 0 || $per_page != 0){
$this->db->limit($per_page,$start);
}
$result = $this->db->get('tbl_faq')->result();
if($result){
return $result;
......@@ -2349,7 +2358,9 @@ class Webservice_model extends CI_Model {
public function get_doctor_faq_list($start,$per_page){
$this->db->select('id,faq_title,faq_description');
$this->db->where('faq_for','1');
$this->db->limit($per_page,$start);
if($start != 0 || $per_page != 0){
$this->db->limit($per_page,$start);
}
$result = $this->db->get('tbl_faq')->result();
if($result){
return $result;
......@@ -2969,7 +2980,9 @@ class Webservice_model extends CI_Model {
$this->db->from('tbl_review');
$this->db->join('tbl_registration','tbl_registration.id = tbl_review.reviewer_id');
$this->db->where('tbl_review.doctor_id',$id);
$this->db->limit($per_page,$start);
if($start != 0 || $per_page != 0){
$this->db->limit($per_page,$start);
}
$result = $this->db->get()->result();
if(count($result) > 0){
foreach ($result as $key => $value) {
......@@ -2988,7 +3001,9 @@ class Webservice_model extends CI_Model {
$this->db->join('tbl_registration','tbl_registration.id = tbl_booking.patient_id');
$this->db->where('tbl_booking.doctor_id',$id);
$this->db->where("(tbl_booking.booking_status != '0' or tbl_booking.booking_status != '4')");
$this->db->limit($per_page,$start);
if($start != 0 || $per_page != 0){
$this->db->limit($per_page,$start);
}
$this->db->order_by('tbl_registration.name','ASC');
$result = $this->db->get()->result();
/*if(count($result) > 0){
......@@ -3036,7 +3051,7 @@ class Webservice_model extends CI_Model {
// $result = $this->db->get()->result();
//echo $this->db->last_query();exit();
$result = $this->db->query("SELECT DISTINCT(reg_id) as id, reg_name as name, CAST(AES_DECRYPT(`reg_dob`, 'Ptf/PWNWrULQT72syxfaaBRTS9JbiKrj9dfuVEvT3rA') as CHAR) as dob,reg_photo as profile_photo, TIMESTAMPDIFF(YEAR, FROM_UNIXTIME(CAST(AES_DECRYPT(`reg_dob`, 'Ptf/PWNWrULQT72syxfaaBRTS9JbiKrj9dfuVEvT3rA') as CHAR), '%Y-%m-%d '), CURDATE()) as age FROM (select tbl_registration.id as reg_id, tbl_registration.name as reg_name, tbl_registration.dob as reg_dob, tbl_registration.profile_photo as reg_photo from `tbl_registration` JOIN `tbl_booking` ON `tbl_registration`.`id` = `tbl_booking`.`patient_id` WHERE `tbl_booking`.`booking_status` = '3' AND `tbl_booking`.`doctor_id` = '$id') temp WHERE (DATE_FORMAT(FROM_UNIXTIME(CAST(AES_DECRYPT(reg_dob,'Ptf/PWNWrULQT72syxfaaBRTS9JbiKrj9dfuVEvT3rA') as CHAR)), '%Y-%m-%e') like '%-$O_month-%' or DATE_FORMAT(FROM_UNIXTIME(CAST(AES_DECRYPT(reg_dob,'Ptf/PWNWrULQT72syxfaaBRTS9JbiKrj9dfuVEvT3rA') as CHAR)), '%Y-%m-%e') like '%-$T_month-%' or DATE_FORMAT(FROM_UNIXTIME(CAST(AES_DECRYPT(reg_dob,'Ptf/PWNWrULQT72syxfaaBRTS9JbiKrj9dfuVEvT3rA') as CHAR)), '%Y-%m-%e') like '%-$TH_month-%') ORDER BY DAYOFYEAR(DATE_FORMAT(FROM_UNIXTIME(CAST(AES_DECRYPT(reg_dob,'Ptf/PWNWrULQT72syxfaaBRTS9JbiKrj9dfuVEvT3rA') as CHAR)), '%Y-%m-%e')) < DAYOFYEAR(CURDATE()) , DAYOFYEAR(DATE_FORMAT(FROM_UNIXTIME(CAST(AES_DECRYPT(reg_dob,'Ptf/PWNWrULQT72syxfaaBRTS9JbiKrj9dfuVEvT3rA') as CHAR)), '%Y-%m-%e')) LIMIT 20")->result();
$result = $this->db->query("SELECT DISTINCT(reg_id) as id, reg_name as name, CAST(AES_DECRYPT(`reg_dob`, 'Ptf/PWNWrULQT72syxfaaBRTS9JbiKrj9dfuVEvT3rA') as CHAR) as dob,reg_photo as profile_photo, TIMESTAMPDIFF(YEAR, FROM_UNIXTIME(CAST(AES_DECRYPT(`reg_dob`, 'Ptf/PWNWrULQT72syxfaaBRTS9JbiKrj9dfuVEvT3rA') as CHAR), '%Y-%m-%d '), CURDATE()) as age FROM (select tbl_registration.id as reg_id, tbl_registration.name as reg_name, tbl_registration.dob as reg_dob, tbl_registration.profile_photo as reg_photo from `tbl_registration` JOIN `tbl_booking` ON `tbl_registration`.`id` = `tbl_booking`.`patient_id` WHERE `tbl_booking`.`booking_status` = '3' AND `tbl_booking`.`doctor_id` = '$id') temp WHERE (DATE_FORMAT(FROM_UNIXTIME(CAST(AES_DECRYPT(reg_dob,'Ptf/PWNWrULQT72syxfaaBRTS9JbiKrj9dfuVEvT3rA') as CHAR)), '%Y-%m-%e') like '%-$O_month-%' or DATE_FORMAT(FROM_UNIXTIME(CAST(AES_DECRYPT(reg_dob,'Ptf/PWNWrULQT72syxfaaBRTS9JbiKrj9dfuVEvT3rA') as CHAR)), '%Y-%m-%e') like '%-$T_month-%' or DATE_FORMAT(FROM_UNIXTIME(CAST(AES_DECRYPT(reg_dob,'Ptf/PWNWrULQT72syxfaaBRTS9JbiKrj9dfuVEvT3rA') as CHAR)), '%Y-%m-%e') like '%-$TH_month-%') ORDER BY DAYOFYEAR(DATE_FORMAT(FROM_UNIXTIME(CAST(AES_DECRYPT(reg_dob,'Ptf/PWNWrULQT72syxfaaBRTS9JbiKrj9dfuVEvT3rA') as CHAR)), '%Y-%m-%e')) < DAYOFYEAR(CURDATE()) , DAYOFYEAR(DATE_FORMAT(FROM_UNIXTIME(CAST(AES_DECRYPT(reg_dob,'Ptf/PWNWrULQT72syxfaaBRTS9JbiKrj9dfuVEvT3rA') as CHAR)), '%Y-%m-%e')) LIMIT $start,$per_page")->result();
if(count($result) > 0){
return $result;
......@@ -3055,7 +3070,9 @@ class Webservice_model extends CI_Model {
$this->db->where('doctor_id',$doctorid);
$this->db->where('patient_id',$patientid);
$this->db->where('booking_status','3');
$this->db->limit($per_page,$start);
if($start != 0 || $per_page != 0){
$this->db->limit($per_page,$start);
}
$query = $this->db->get('tbl_booking')->result();
$new = array();
......@@ -3835,7 +3852,9 @@ class Webservice_model extends CI_Model {
}else{
$this->db->where("(tbl_booking.booking_status = '1' or tbl_booking.booking_status = '2')");
}
$this->db->limit($per_page,$start);
if($start != 0 || $per_page != 0){
$this->db->limit($per_page,$start);
}
$query = $this->db->get()->result();
if(count($query) > 0 ){
foreach ($query as $key => $value) {
......@@ -3899,7 +3918,9 @@ class Webservice_model extends CI_Model {
public function get_bank_list($id,$start,$per_page){
$this->db->select('id,bank_name,agency as agency_name,account_no as bank_account,account_holder as name');
$this->db->limit($per_page,$start);
if($start != 0 || $per_page != 0){
$this->db->limit($per_page,$start);
}
$query = $this->db->get_where('tbl_bank_accounts',array('type_id'=>$id))->result();
if(count($query) > 0){
foreach ($query as $key => $value) {
......@@ -3945,7 +3966,9 @@ class Webservice_model extends CI_Model {
public function get_withdrawal_history($doctorid,$start,$per_page){
$this->db->select('tbl_withdrawal_history.id,tbl_withdrawal_history.bank_id,tbl_withdrawal_history.amount,tbl_withdrawal_history.date,tbl_withdrawal_history.status,tbl_bank_accounts.bank_name,tbl_bank_accounts.account_no as bank_account');
$this->db->join('tbl_bank_accounts','tbl_bank_accounts.id = tbl_withdrawal_history.bank_id');
$this->db->limit($per_page,$start);
if($start != 0 || $per_page != 0){
$this->db->limit($per_page,$start);
}
$query = $this->db->get_where('tbl_withdrawal_history',array('tbl_withdrawal_history.doctor_id'=>$doctorid))->result();
if(count($query) > 0){
foreach ($query as $key => $value) {
......
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