Hopefully fixed DXCC summary.
这个提交包含在:
		
							父节点
							
								
									640d0c151b
								
							
						
					
					
						当前提交
						9ced2f4791
					
				
					共有  3 个文件被更改,包括 108 次插入 和 20 次删除
				
			
		|  | @ -128,6 +128,7 @@ class Awards extends CI_Controller { | ||||||
| 
 | 
 | ||||||
| 		$dxcclist = $this->dxcc->fetchdxcc($postdata); | 		$dxcclist = $this->dxcc->fetchdxcc($postdata); | ||||||
|         $data['dxcc_array'] = $this->dxcc->get_dxcc_array($dxcclist, $bands, $postdata); |         $data['dxcc_array'] = $this->dxcc->get_dxcc_array($dxcclist, $bands, $postdata); | ||||||
|  |         $data['dxcc_summary'] = $this->dxcc->get_dxcc_summary($bands); | ||||||
| 
 | 
 | ||||||
| 		// Render Page
 | 		// Render Page
 | ||||||
| 		$data['page_title'] = "Awards - DXCC"; | 		$data['page_title'] = "Awards - DXCC"; | ||||||
|  |  | ||||||
|  | @ -463,5 +463,62 @@ class DXCC extends CI_Model { | ||||||
| 		} | 		} | ||||||
| 		return $sql; | 		return $sql; | ||||||
| 	} | 	} | ||||||
|  | 
 | ||||||
|  | 	/* | ||||||
|  |      * Function gets worked and confirmed summary on each band on the active stationprofile | ||||||
|  |      */ | ||||||
|  | 	function get_dxcc_summary($bands) | ||||||
|  | 	{ | ||||||
|  | 		$CI =& get_instance(); | ||||||
|  | 		$CI->load->model('Stations'); | ||||||
|  | 		$station_id = $CI->Stations->find_active(); | ||||||
|  | 
 | ||||||
|  | 		foreach ($bands as $band) { | ||||||
|  | 			$worked = $this->getSummaryByBand($band, $station_id); | ||||||
|  | 			$confirmed = $this->getSummaryByBandConfirmed($band, $station_id); | ||||||
|  | 			$dxccSummary['worked'][$band] = $worked[0]->count; | ||||||
|  | 			$dxccSummary['confirmed'][$band] = $confirmed[0]->count; | ||||||
|  | 		} | ||||||
|  | 
 | ||||||
|  | 		return $dxccSummary; | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	function getSummaryByBand($band, $station_id) | ||||||
|  | 	{ | ||||||
|  | 		$sql = "SELECT count(distinct thcv.col_dxcc) as count FROM " . $this->config->item('table_name') . " thcv"; | ||||||
|  | 
 | ||||||
|  | 		$sql .= " where station_id = " . $station_id; | ||||||
|  | 
 | ||||||
|  | 		if ($band == 'SAT') { | ||||||
|  | 			$sql .= " and thcv.col_prop_mode ='" . $band . "'"; | ||||||
|  | 		} else { | ||||||
|  | 			$sql .= " and thcv.col_prop_mode !='SAT'"; | ||||||
|  | 			$sql .= " and thcv.col_band ='" . $band . "'"; | ||||||
|  | 
 | ||||||
|  | 		} | ||||||
|  | 		$query = $this->db->query($sql); | ||||||
|  | 
 | ||||||
|  | 		return $query->result(); | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	function getSummaryByBandConfirmed($band, $station_id) | ||||||
|  | 	{ | ||||||
|  | 		$sql = "SELECT count(distinct thcv.col_dxcc) as count FROM " . $this->config->item('table_name') . " thcv"; | ||||||
|  | 
 | ||||||
|  | 		$sql .= " where station_id = " . $station_id; | ||||||
|  | 
 | ||||||
|  | 		if ($band == 'SAT') { | ||||||
|  | 			$sql .= " and thcv.col_prop_mode ='" . $band . "'"; | ||||||
|  | 		} else { | ||||||
|  | 			$sql .= " and thcv.col_prop_mode !='SAT'"; | ||||||
|  | 			$sql .= " and thcv.col_band ='" . $band . "'"; | ||||||
|  | 		} | ||||||
|  | 
 | ||||||
|  | 		$sql .= " and (col_qsl_rcvd = 'Y' or col_lotw_qsl_rcvd = 'Y')"; | ||||||
|  | 
 | ||||||
|  | 		$query = $this->db->query($sql); | ||||||
|  | 
 | ||||||
|  | 		return $query->result(); | ||||||
|  | 	} | ||||||
| } | } | ||||||
| ?>
 | ?>
 | ||||||
|  |  | ||||||
|  | @ -112,7 +112,7 @@ | ||||||
| 
 | 
 | ||||||
|         </fieldset> |         </fieldset> | ||||||
|     </form> |     </form> | ||||||
| <?php |     <?php | ||||||
|     $i = 1; |     $i = 1; | ||||||
|     if ($dxcc_array) { |     if ($dxcc_array) { | ||||||
|         echo ' |         echo ' | ||||||
|  | @ -140,11 +140,41 @@ | ||||||
|             } |             } | ||||||
|             echo '</tr>'; |             echo '</tr>'; | ||||||
|         } |         } | ||||||
|                         echo '</tfoot></table></div>'; |         echo '</table> | ||||||
|  |         <h1>Summary</h1> | ||||||
|  | 
 | ||||||
|  |         <table class="table table-bordered table-hover table-striped table-condensed text-center"> | ||||||
|  |         <thead> | ||||||
|  |         <tr><td></td>'; | ||||||
|  | 
 | ||||||
|  |         foreach($bands as $band) { | ||||||
|  |             echo '<td>' . $band . '</td>'; | ||||||
|  |         } | ||||||
|  |         echo '</tr>'; | ||||||
|  | 
 | ||||||
|  |         echo '</tr> | ||||||
|  |         </thead> | ||||||
|  |         <tbody> | ||||||
|  | 
 | ||||||
|  |         <tr><td>Total worked</td>'; | ||||||
|  | 
 | ||||||
|  |         foreach ($dxcc_summary['worked'] as $dxcc) {      // Fills the table with the data
 | ||||||
|  |             echo '<td style="text-align: center">' . $dxcc . '</td>'; | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         echo '</tr><tr> | ||||||
|  |         <td>Total confirmed</td>'; | ||||||
|  |         foreach ($dxcc_summary['confirmed'] as $dxcc) {      // Fills the table with the data
 | ||||||
|  |             echo '<td style="text-align: center">' . $dxcc . '</td>'; | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         echo '</tr> | ||||||
|  |         </table> | ||||||
|  |         </div>'; | ||||||
| 
 | 
 | ||||||
|     } |     } | ||||||
|     else { |     else { | ||||||
|         echo '<div class="alert alert-danger" role="alert"><a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>Nothing found!</div>'; |         echo '<div class="alert alert-danger" role="alert"><a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>Nothing found!</div>'; | ||||||
|     } |     } | ||||||
| ?>
 |     ?>
 | ||||||
| </div> | </div> | ||||||
|  |  | ||||||
		正在加载…
	
		在新工单中引用