%PDF- <> %âãÏÓ endobj 2 0 obj <> endobj 3 0 obj <>/ExtGState<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI] >>/Annots[ 28 0 R 29 0 R] /MediaBox[ 0 0 595.5 842.25] /Contents 4 0 R/Group<>/Tabs/S>> endobj ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<> endobj 2 0 obj<>endobj 2 0 obj<>es 3 0 R>> endobj 2 0 obj<> ox[ 0.000000 0.000000 609.600000 935.600000]/Fi endobj 3 0 obj<> endobj 7 1 obj<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI]>>/Subtype/Form>> stream
<?php class Bookings_model extends CI_Model { public function __construct() { parent::__construct(); } public function deleteProduct($id) { $this->db->trans_begin(); $this->db->where('id', $id); if (!$this->db->delete('user_booking')) { log_message('error', print_r($this->db->error(), true)); } if ($this->db->trans_status() === FALSE) { $this->db->trans_rollback(); show_error(lang('database_error')); } else { $this->db->trans_commit(); } } public function getProducts($limit, $page, $search_title = null, $orderby = null, $category = null, $vendor = null, $to_date , $from_date) { if ($search_title != null) { $search_title = trim($this->db->escape_like_str($search_title)); $this->db->where("(orders.order_id LIKE '%$search_title%' or orders_clients.phone LIKE '%$search_title%' or orders_clients.email LIKE '%$search_title%')"); } if ($orderby !== null) { $ord = explode('=', $orderby); if (isset($ord[0]) && isset($ord[1])) { $this->db->order_by('orders.' . $ord[0], $ord[1]); } } else { $this->db->order_by('orders.id', 'desc'); } if ($category != null) { $this->db->where('order_status', $category); } /*if ($to_date != null) { $this->db->where('created_on>=', $to_date); } if ($from_date != null) { $this->db->where('created_on<=', $from_date); } */ if ($vendor != null) { $this->db->where('vendor_id', $vendor); } //$this->db->join('family_member', 'family_member.member_id = user_booking.member_id', 'FULL OUTER'); $this->db->join('users_public', 'users_public.id = orders.user_id'); if(!$query = $this->db->select('users_public.*,orders.id as id,orders.order_id as order_id,orders.user_id as user_id, orders.products as packsge_id,orders.order_date as order_date,orders.total_packages as total_packages,orders.our_price as price,orders.offer_price as offer_price,orders.order_status as status,orders.referrer as referrer,orders.payment_type as payment_type,orders.heard_copy_required as heard_copy_required,orders.booking_date as booking_date,orders.address as address,orders.city as city,orders.booking_time as booking_time,orders.post_code as post_code, orders.transaction_id as transaction_id,orders.transaction_status as transaction_status,rider_id')->get('orders', $limit, $page)){ print_r($this->db->error());die; log_message('error', print_r($this->db->error(), true)); } $result= $query->result(); //echo $qqq=$this->db->last_query();die; return $result; } public function reportactive($member_id,$orderID,$packagename){ return $flagreport = $this->db->query("SELECT COUNT(*) AS numrows FROM `user_report` where member_id='".$member_id."' and order_id='".$orderID."' and test_package_name LIKE '%". $packagename."%' ")->result_array(); } public function productsCount($search_title = null, $category = null) { if ($search_title != null) { $search_title = trim($this->db->escape_like_str($search_title)); $this->db->where("(orders.order_id LIKE '%$search_title%' or orders_clients.phone LIKE '%$search_title%' or orders_clients.email LIKE '%$search_title%')"); } if ($category != null) { $this->db->where('order_status', $category); } /*if ($to_date != null) { $this->db->where('created_on>=', $to_date); } if ($from_date != null) { $this->db->where('created_on<=', $from_date); }*/ $this->db->join('orders_clients', 'orders_clients.for_id = orders.id', 'FULL OUTER'); return $this->db->count_all_results('orders'); } public function getAllProducts(){ $this->db->where('shop_categorie', '2'); $query = $this->db->select('id,name,email,created_at')->get('vendors'); return $query->result(); } public function numShopProducts() { return $this->db->count_all_results('vendors'); } public function getOneProduct($id) { $this->db->select('family_member.member_id,family_member.full_name as full_name, family_member.relation as relation, family_member.mobile_number as contact, family_member.gender as gender, family_member.age as age'); $this->db->where('family_member.member_id', $id); $query = $this->db->get('family_member'); if ($query->num_rows() > 0) { return $query->row_array(); } else { return false; } } public function getProductDetail($id) { $this->db->where('orders.order_id', $id); //$this->db->join('family_member', 'family_member.member_id = user_booking.member_id', 'FULL OUTER'); $this->db->join('orders_clients', 'orders_clients.for_id = orders.id', 'FULL OUTER'); if(!$query = $this->db->select('orders_clients.*,orders.id as id,orders.order_id as order_id,orders.user_id as user_id, orders.products as packsge_id,orders.order_date as order_date,orders.total_packages as total_packages,orders.our_price as price,orders.order_status as status,orders.payment_type as payment_type,orders.heard_copy_required as heard_copy_required, orders.transaction_id as transaction_id,orders.transaction_status as transaction_status')->get('orders', $limit, $page)){ print_r($this->db->error());die; log_message('error', print_r($this->db->error(), true)); } $result= $query->result(); //echo $this->db->last_query();die; return $result; } /*public function getMemberDetails($id) { $this->db->select('family_member.full_name as name, family_member.relation as relation'); $this->db->where('family_member.member_id', $id); $query = $this->db->get('family_member'); if ($query->num_rows() > 0) { $return $query->result(); } else { return false; } }*/ public function uploadreport($params ,$id=0 ){ print_r($params['test_package_name']); $if_exist = $this->getStatus($params['order_id'],$params['test_package_name'],$params['member_id']); $param=array(); $param['order_status']=$params['status']; if(!$this->db->where('order_id', $params['order_id'])->update('orders', $param)){ print_r($this->db->error());die; log_message('error', print_r($this->db->error(), true)); } if($if_exist){ //die('update'); $this->db->where('order_id',$params['order_id']); $this->db->where('test_package_name',$params['test_package_name']); $query = $this->db->update('user_report', $params); if(!$query){ print_r($this->db->error());die; log_message('error', print_r($this->db->error(), true)); } } else { //die('insert'); if(!$this->db->insert('user_report', $params)){ print_r($this->db->error());die; log_message('error', print_r($this->db->error(), true)); } } } public function productStatusChange($params) { $id=$params['order_id']; $to_status=$params['status']; //$sms_content='Thank You for Booking!!Your ORDER ID id #'.$id.' Scheduled on '.$params['booking_date'].' at '.$params['booking_time'].'. We Will keep you updated.'; $this->db->where('order_id', $id); $result = $this->db->update('orders', array('order_status' => $to_status)); $sms_content = $this->smsContent($params); $result2 = $this->pushAlertSMS($params['phone'],$sms_content); return $result; } /* Send SMS to user */ function pushAlertSMS($mobile_number, $sms_content){ $feedid = 363901; $senderid = urlencode('shardacom_trans'); $username = "9015129267"; $password = "wgtpt"; $api_url = 'http://bulkpush.mytoday.com/BulkSms/SingleMsgApi'; if(strlen($mobile_number)>=10){ $params_url = ''; //send OTP to user $params_url = 'feedid='.$feedid.'&senderid='.$senderid.'&username='.$username.'&password='.$password.'&To='.$mobile_number.'&Text='.$sms_content; $otpresponse = $this->sendSMS($api_url, $params_url); // Send OTP return $otpresponse; } } function smsContent($params){ switch ($params['status']) { case 2: $sms_content='Your Order has been Cancelled with ORDER ID #'.$params['order_id'].' Scheduled on '.$params['booking_date'].' at '.$params['booking_time'].'. YOur Money will be refund within 48 Hours.You can Contact Us On 222222222 or Mail Us at info@shardadiagnostics.in'; return $sms_content; break; case 3: $sms_content='Thank You for Booking!!Your ORDER ID #'.$id.' Scheduled on '.$params['booking_date'].' at '.$params['booking_time'].'. We Will keep you updated or You can Contact Us On 222222222 or Mail Us at info@shardadiagnostics.in'; return $sms_content; break; case 4: $sms_content='Your Sample has been received by our experts. We Will keep you updated or You can Contact Us On 0120-2333999 or Mail Us at info@shardadiagnostics.in'; return $sms_content; break; case 5: $sms_content='Your Reports have been uploaded with ORDER ID #'.$id.' You can check it on info@shardadiagnostics.in, You can Contact Us On 0120-2333999 or Mail Us at info@shardadiagnostics.in'; return $sms_content; break; case 6: $sms_content='Hardcopy of your reports is depatched With ORDER ID #'.$id.' You can Contact Us On 0120-2333999 or Mail Us at info@shardadiagnostics.in'; return $sms_content; break; case 7: $sms_content='Thank You for Booking!!Your ORDER ID #'.$id.' Scheduled on '.$params['booking_date'].' at '.$params['booking_time'].'. We Will keep you updated.'; return $sms_content; break; default: $sms_content='Your appointment with our doctor is Scheduled on '.$params['booking_date'].' at '.$params['booking_time'].'With ORDER ID #'.$id.'. You can Contact Us On 0120-2333999 or Mail Us at info@shardadiagnostics.in'; } } /* SEND SMS */ function sendSMS($url, $params_url){ $ch = curl_init($url); curl_setopt($ch, CURLOPT_POST,1); curl_setopt($ch, CURLOPT_POSTFIELDS,$params_url); curl_setopt($ch, CURLOPT_FOLLOWLOCATION,1); curl_setopt($ch, CURLOPT_HEADER,0); // DO NOT RETURN HTTP HEADERS curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); // RETURN THE CONTENTS OF THE CALL $return_val = curl_exec($ch); $response = true; //Print error if any if(curl_errno($ch)) { $response = 'error:' . curl_error($ch); } curl_close($ch); return $response; } public function getStatus($id, $test,$member_id) { $this->db->select('report_name,status'); $this->db->where('order_id',$id); $this->db->where('member_id',$member_id); $this->db->where('test_package_name',$test); $query = $this->db->get('user_report'); if(!$query){ print_r($this->db->error());die; log_message('error', print_r($this->db->error(), true)); } if ($query->num_rows() > 0) { return $query->row_array(); } else { return false;} } public function setProduct($post, $id = 0) { if (!isset($post['brand_id'])) { $post['brand_id'] = null; } if (!isset($post['virtual_products'])) { $post['virtual_products'] = null; } $this->db->trans_begin(); $is_update = false; if ($id > 0) { $is_update = true; if (!$this->db->where('id', $id)->update('products', array( 'image' => $post['image'] != null ? $_POST['image'] : $_POST['old_image'], 'shop_categorie' => $post['shop_categorie'], 'quantity' => $post['quantity'], 'in_slider' => $post['in_slider'], 'position' => $post['position'], 'virtual_products' => $post['virtual_products'], 'brand_id' => $post['brand_id'], 'time_update' => time() ))) { log_message('error', print_r($this->db->error(), true)); } } else { /* * Lets get what is default tranlsation number * in titles and convert it to url * We want our plaform public ulrs to be in default * language that we use */ $i = 0; foreach ($_POST['translations'] as $translation) { if ($translation == MY_DEFAULT_LANGUAGE_ABBR) { $myTranslationNum = $i; } $i++; } if (!$this->db->insert('products', array( 'image' => $post['image'], 'shop_categorie' => $post['shop_categorie'], 'quantity' => $post['quantity'], 'in_slider' => $post['in_slider'], 'position' => $post['position'], 'virtual_products' => $post['virtual_products'], 'folder' => $post['folder'], 'brand_id' => $post['brand_id'], 'time' => time() ))) { log_message('error', print_r($this->db->error(), true)); } $id = $this->db->insert_id(); $this->db->where('id', $id); if (!$this->db->update('products', array( 'url' => except_letters($_POST['title'][$myTranslationNum]) . '_' . $id ))) { log_message('error', print_r($this->db->error(), true)); } } $this->setProductTranslation($post, $id, $is_update); if ($this->db->trans_status() === FALSE) { $this->db->trans_rollback(); show_error(lang('database_error')); } else { $this->db->trans_commit(); } } private function setProductTranslation($post, $id, $is_update) { $i = 0; $current_trans = $this->getTranslations($id); foreach ($post['translations'] as $abbr) { $arr = array(); $emergency_insert = false; if (!isset($current_trans[$abbr])) { $emergency_insert = true; } $post['title'][$i] = str_replace('"', "'", $post['title'][$i]); $post['tag_line'][$i] = str_replace(' ', '', $post['tag_line'][$i]); $post['price'][$i] = str_replace(' ', '', $post['price'][$i]); $post['price'][$i] = str_replace(',', '', $post['price'][$i]); $arr = array( 'title' => $post['title'][$i], 'tag_line' => $post['tag_line'][$i], 'recommended_for' => $post['recommended_for'][$i], 'gender' => $post['gender'][$i], 'reporting_time' => $post['reporting_time'][$i], 'fasting_time' => $post['fasting_time'][$i], 'precautions' => $post['precautions'][$i], 'basic_description' => $post['basic_description'][$i], 'description' => $post['description'][$i], 'price' => $post['price'][$i], 'old_price' => $post['old_price'][$i], 'abbr' => $abbr, 'for_id' => $id ); if ($is_update === true && $emergency_insert === false) { $abbr = $arr['abbr']; unset($arr['for_id'], $arr['abbr'], $arr['url']); if (!$this->db->where('abbr', $abbr)->where('for_id', $id)->update('products_translations', $arr)) { log_message('error', print_r($this->db->error(), true)); } } else { if (!$this->db->insert('products_translations', $arr)) { log_message('error', print_r($this->db->error(), true)); } } $i++; } } public function getTranslations($id) { $this->db->where('for_id', $id); $query = $this->db->get('products_translations'); $arr = array(); foreach ($query->result() as $row) { $arr[$row->abbr]['title'] = $row->title; $arr[$row->abbr]['tag_line'] = $row->tag_line; $arr[$row->abbr]['fasting_time'] = $row->fasting_time; $arr[$row->abbr]['reporting_time'] = $row->reporting_time; $arr[$row->abbr]['gender'] = $row->gender; $arr[$row->abbr]['recommended_for'] = $row->recommended_for; $arr[$row->abbr]['precautions'] = $row->precautions; $arr[$row->abbr]['basic_description'] = $row->basic_description; $arr[$row->abbr]['description'] = $row->description; $arr[$row->abbr]['price'] = $row->price; $arr[$row->abbr]['old_price'] = $row->old_price; } return $arr; } //get vendor details public function getVendor($id) { $this->db->select('name'); $this->db->where('id',$id); $query = $this->db->get('vendors'); if(!$query){ print_r($this->db->error());die; log_message('error', print_r($this->db->error(), true)); } if ($query->num_rows() > 0) { return $query->row_array(); } else { return false;} } /* * Function : getSingleDetail * */ public function getSingleDetail($tbl_name = '', $cond=array(), $col = '*') { $this->db->select($col); if(!empty($cond)) { foreach($cond as $key=>$val) { $this->db->where($key,$val); } } $query = $this->db->get($tbl_name); return $query->row_array(); } /* * Function : getAllDetails * */ public function getAllDetails($tbl_name = '', $cond=array(), $col = '*') { $this->db->select($col); if(!empty($cond)) { foreach($cond as $key=>$val) { $this->db->where($key,$val); } } $query = $this->db->get($tbl_name); return $query->result_array(); } /* * Function : setRecords */ public function setRecords($tbl_name='orders',$params ,$id=0 ){ $id=$params['id']; if($id > 0){ if(!$this->db->where('id', $id)->update($tbl_name, $params)){ print_r($this->db->error());die; log_message('error', print_r($this->db->error(), true)); } } else { unset($params['id']); if(!$this->db->insert($tbl_name, $params)){ print_r($this->db->error());die; log_message('error', print_r($this->db->error(), true)); } } } }