%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 Vendorprofile_model extends CI_Model { public function __construct() { parent::__construct(); } public function getVendorInfoFromEmail($email) { $this->db->where('email', $email); $result = $this->db->get('vendors'); return $result->row_array(); } public function getVendorByUrlAddress($urlAddr) { $this->db->where('url', $urlAddr); $result = $this->db->get('vendors'); return $result->row_array(); } public function saveNewVendorDetails($post, $vendor_id) { if (!$this->db->where('id', $vendor_id)->update('vendors', array( 'name' => $post['vendor_name'], 'url' => $post['vendor_url'], 'phone' => $post['vendor_phone'] ))) { //print_r($this->db->error(), true);die; log_message('error', print_r($this->db->error(), true)); } //echo $this->db->last_query();die; } public function isVendorUrlFree($vendorUrl) { $this->db->where('phone', $vendorUrl); $num = $this->db->count_all_results('vendors'); if ($num > 0) { return false; } else { return true; } } public function getOrdersByMonth($vendor_id) { $result = $this->db->query("SELECT DATE_FORMAT(order_date, '%Y') as year, DATE_FORMAT(order_date, '%M') as month, COUNT(id) as num FROM orders WHERE referrer = $vendor_id GROUP BY DATE_FORMAT(order_date, '%Y'), DATE_FORMAT(order_date, '%M') ASC"); $result = $result->result_array(); $orders = array(); $years = array(); foreach ($result as $res) { if (!isset($orders[$res['year']])) { for ($i = 1; $i <= 12; $i++) { $orders[$res['year']][$i] = 0; } } $years[] = $res['year']; $orders[$res['year']][$res['month']] = $res['num']; } return array( 'years' => array_unique($years), 'orders' => $orders ); } public function getLeadsByMonth($vendor_id) { $result = $this->db->query("SELECT DATE_FORMAT(created_on, '%Y') as year, DATE_FORMAT(created_on, '%m') as month, COUNT(id) as num FROM prescription_requests WHERE vendor_id = $vendor_id GROUP BY DATE_FORMAT(created_on, '%Y'), DATE_FORMAT(created_on, '%m') ASC"); $result = $result->result_array(); $orders = array(); $years = array(); foreach ($result as $res) { if (!isset($orders[$res['year']])) { for ($i = 1; $i <= 12; $i++) { $orders[$res['year']][$i] = 0; } } $years[] = $res['year']; $orders[$res['year']][$res['month']] = $res['num']; } return array( 'years' => array_unique($years), 'orders' => $orders ); } }