Merge pull request #1350 from AndreasK79/was_summary_filter
[WAS Award] Added filtering to summary
这个提交包含在:
		
						当前提交
						d559937459
					
				
					共有  3 个文件被更改,包括 19 次插入 和 11 次删除
				
			
		|  | @ -334,7 +334,7 @@ class Awards extends CI_Controller { | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         $data['was_array'] = $this->was->get_was_array($bands, $postdata); |         $data['was_array'] = $this->was->get_was_array($bands, $postdata); | ||||||
|         $data['was_summary'] = $this->was->get_was_summary($data['worked_bands']); |         $data['was_summary'] = $this->was->get_was_summary($bands, $postdata); | ||||||
| 
 | 
 | ||||||
|         // Render Page
 |         // Render Page
 | ||||||
|         $data['page_title'] = "Awards - WAS (Worked All States)"; |         $data['page_title'] = "Awards - WAS (Worked All States)"; | ||||||
|  |  | ||||||
|  | @ -80,7 +80,7 @@ class was extends CI_Model { | ||||||
|     /* |     /* | ||||||
|      * Function gets worked and confirmed summary on each band on the active stationprofile |      * Function gets worked and confirmed summary on each band on the active stationprofile | ||||||
|      */ |      */ | ||||||
|     function get_was_summary($bands) |     function get_was_summary($bands, $postdata) | ||||||
|     { |     { | ||||||
| 		$CI =& get_instance(); | 		$CI =& get_instance(); | ||||||
| 		$CI->load->model('logbooks_model'); | 		$CI->load->model('logbooks_model'); | ||||||
|  | @ -93,14 +93,14 @@ class was extends CI_Model { | ||||||
| 		$location_list = "'".implode("','",$logbooks_locations_array)."'"; | 		$location_list = "'".implode("','",$logbooks_locations_array)."'"; | ||||||
| 
 | 
 | ||||||
|         foreach ($bands as $band) { |         foreach ($bands as $band) { | ||||||
|             $worked = $this->getSummaryByBand($band, $location_list); |             $worked = $this->getSummaryByBand($band, $postdata, $location_list); | ||||||
|             $confirmed = $this->getSummaryByBandConfirmed($band, $location_list); |             $confirmed = $this->getSummaryByBandConfirmed($band, $postdata, $location_list); | ||||||
|             $wasSummary['worked'][$band] = $worked[0]->count; |             $wasSummary['worked'][$band] = $worked[0]->count; | ||||||
|             $wasSummary['confirmed'][$band] = $confirmed[0]->count; |             $wasSummary['confirmed'][$band] = $confirmed[0]->count; | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         $workedTotal = $this->getSummaryByBand('All', $location_list); |         $workedTotal = $this->getSummaryByBand($postdata['band'], $postdata, $location_list); | ||||||
|         $confirmedTotal = $this->getSummaryByBandConfirmed('All', $location_list); |         $confirmedTotal = $this->getSummaryByBandConfirmed($postdata['band'], $postdata, $location_list); | ||||||
| 
 | 
 | ||||||
|         $wasSummary['worked']['Total'] = $workedTotal[0]->count; |         $wasSummary['worked']['Total'] = $workedTotal[0]->count; | ||||||
|         $wasSummary['confirmed']['Total'] = $confirmedTotal[0]->count; |         $wasSummary['confirmed']['Total'] = $confirmedTotal[0]->count; | ||||||
|  | @ -108,7 +108,7 @@ class was extends CI_Model { | ||||||
|         return $wasSummary; |         return $wasSummary; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     function getSummaryByBand($band, $location_list) |     function getSummaryByBand($band, $postdata, $location_list) | ||||||
|     { |     { | ||||||
|         $sql = "SELECT count(distinct thcv.col_state) as count FROM " . $this->config->item('table_name') . " thcv"; |         $sql = "SELECT count(distinct thcv.col_state) as count FROM " . $this->config->item('table_name') . " thcv"; | ||||||
| 
 | 
 | ||||||
|  | @ -123,6 +123,10 @@ class was extends CI_Model { | ||||||
|             $sql .= " and thcv.col_band ='" . $band . "'"; |             $sql .= " and thcv.col_band ='" . $band . "'"; | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|  |         if ($postdata['mode'] != 'All') { | ||||||
|  | 			$sql .= " and (col_mode = '" . $postdata['mode'] . "' or col_submode = '" . $postdata['mode'] . "')"; | ||||||
|  | 		} | ||||||
|  | 
 | ||||||
|         $sql .= $this->addStateToQuery(); |         $sql .= $this->addStateToQuery(); | ||||||
| 
 | 
 | ||||||
|         $query = $this->db->query($sql); |         $query = $this->db->query($sql); | ||||||
|  | @ -130,7 +134,7 @@ class was extends CI_Model { | ||||||
|         return $query->result(); |         return $query->result(); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     function getSummaryByBandConfirmed($band, $location_list) |     function getSummaryByBandConfirmed($band, $postdata, $location_list) | ||||||
|     { |     { | ||||||
|         $sql = "SELECT count(distinct thcv.col_state) as count FROM " . $this->config->item('table_name') . " thcv"; |         $sql = "SELECT count(distinct thcv.col_state) as count FROM " . $this->config->item('table_name') . " thcv"; | ||||||
| 
 | 
 | ||||||
|  | @ -145,9 +149,13 @@ class was extends CI_Model { | ||||||
|             $sql .= " and thcv.col_band ='" . $band . "'"; |             $sql .= " and thcv.col_band ='" . $band . "'"; | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         $sql .= $this->addStateToQuery(); |         if ($postdata['mode'] != 'All') { | ||||||
|  | 			$sql .= " and (col_mode = '" . $postdata['mode'] . "' or col_submode = '" . $postdata['mode'] . "')"; | ||||||
|  | 		} | ||||||
| 
 | 
 | ||||||
|         $sql .= " and (col_qsl_rcvd = 'Y' or col_lotw_qsl_rcvd = 'Y')"; |         $sql .= $this->addQslToQuery($postdata); | ||||||
|  | 
 | ||||||
|  |         $sql .= $this->addStateToQuery(); | ||||||
| 
 | 
 | ||||||
|         $query = $this->db->query($sql); |         $query = $this->db->query($sql); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -120,7 +120,7 @@ | ||||||
|         <thead> |         <thead> | ||||||
|         <tr><td></td>'; |         <tr><td></td>'; | ||||||
| 
 | 
 | ||||||
|         foreach($worked_bands as $band) { |         foreach($bands as $band) { | ||||||
|             echo '<td>' . $band . '</td>'; |             echo '<td>' . $band . '</td>'; | ||||||
|         } |         } | ||||||
|         echo '<td>Total</td></tr> |         echo '<td>Total</td></tr> | ||||||
|  |  | ||||||
		正在加载…
	
		在新工单中引用