| 
									
										
										
										
											2020-04-25 05:29:01 +08:00
										 |  |  | <?php | 
					
						
							|  |  |  | if (!defined('BASEPATH')) exit('No direct script access allowed'); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class Dayswithqso_model extends CI_Model | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     function __construct() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         // Call the Model constructor
 | 
					
						
							|  |  |  |         parent::__construct(); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     function getDaysWithQso() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         $CI =& get_instance(); | 
					
						
							|  |  |  |         $CI->load->model('Stations'); | 
					
						
							|  |  |  |         $station_id = $CI->Stations->find_active(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-04-26 04:51:44 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         $sql = "select year(COL_TIME_ON) Year, COUNT(DISTINCT TO_DAYS(COL_TIME_ON)) as Days from " | 
					
						
							| 
									
										
										
										
											2020-04-25 05:29:01 +08:00
										 |  |  |             .$this->config->item('table_name'). " thcv
 | 
					
						
							| 
									
										
										
										
											2020-04-26 04:45:11 +08:00
										 |  |  |             where station_id = " . $station_id . " and COL_TIME_ON is not null group by year";
 | 
					
						
							| 
									
										
										
										
											2020-04-25 05:29:01 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |         $query = $this->db->query($sql); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         return $query->result(); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } |