Skip to content

Commit 1ee55d3

Browse files
committed
Add mode and satellite info to monthly report
Enhances the monthly report to display QSO mode and satellite name for new DXCCs and grids. Adds a satellite breakdown table showing QSOs per satellite and their percentage of total satellite QSOs. Improves data structure in the model to support these features and updates the view for clearer presentation.
1 parent f7e03cc commit 1ee55d3

2 files changed

Lines changed: 165 additions & 37 deletions

File tree

application/models/Monthlyreport_model.php

Lines changed: 99 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ public function generate_report($logbooks_locations_array, $year, $month) {
4040
'bands' => $this->get_bands_breakdown($logbooks_locations_array, $start_date, $end_date),
4141
'continents' => $this->get_continents_breakdown($logbooks_locations_array, $start_date, $end_date),
4242
'satellite_qsos' => $this->get_satellite_qsos($logbooks_locations_array, $start_date, $end_date),
43+
'satellite_breakdown' => $this->get_satellite_breakdown($logbooks_locations_array, $start_date, $end_date),
4344
'eme_qsos' => $this->get_eme_qsos($logbooks_locations_array, $start_date, $end_date),
4445
'top_band' => '',
4546
'top_mode' => ''
@@ -288,8 +289,8 @@ private function get_new_dxcc_by_band($locations, $start_date, $end_date, $prev_
288289

289290
// If not worked before on this band, it's new
290291
if ($prev_row->count == 0) {
291-
// Get the callsign from the first QSO with this DXCC on this band
292-
$this->db->select('COL_CALL');
292+
// Get the callsign and mode from the first QSO with this DXCC on this band
293+
$this->db->select('COL_CALL, COL_MODE, COL_SUBMODE');
293294
$this->db->from($this->config->item('table_name'));
294295
$this->db->where_in('station_id', $locations);
295296
$this->db->where('COL_DXCC', $row->COL_DXCC);
@@ -300,10 +301,16 @@ private function get_new_dxcc_by_band($locations, $start_date, $end_date, $prev_
300301
$call_query = $this->db->get();
301302
$call_row = $call_query->row();
302303

304+
$mode = '';
305+
if ($call_row) {
306+
$mode = !empty($call_row->COL_SUBMODE) ? $call_row->COL_SUBMODE : $call_row->COL_MODE;
307+
}
308+
303309
$new_dxcc_by_band[$band][] = array(
304310
'dxcc_id' => $row->COL_DXCC,
305311
'name' => $row->COL_COUNTRY,
306-
'callsign' => $call_row ? $call_row->COL_CALL : ''
312+
'callsign' => $call_row ? $call_row->COL_CALL : '',
313+
'mode' => $mode
307314
);
308315
}
309316
}
@@ -370,22 +377,27 @@ private function get_new_gridsquares($locations, $start_date, $end_date, $prev_m
370377
$new_grids = array();
371378

372379
// Get all gridsquares worked this month (including VUCC grids)
373-
$this->db->select('COL_CALL, COL_GRIDSQUARE, COL_VUCC_GRIDS, COL_TIME_ON');
380+
$this->db->select('COL_CALL, COL_GRIDSQUARE, COL_VUCC_GRIDS, COL_TIME_ON, COL_MODE, COL_SUBMODE');
374381
$this->db->from($this->config->item('table_name'));
375382
$this->db->where_in('station_id', $locations);
376383
$this->db->where('COL_TIME_ON >=', $start_date);
377384
$this->db->where('COL_TIME_ON <=', $end_date);
378385
$this->db->order_by('COL_TIME_ON', 'ASC');
379386

380387
$query = $this->db->get();
381-
$grid_callsigns = array();
388+
$grid_data = array();
382389

383390
foreach ($query->result() as $row) {
391+
$mode = !empty($row->COL_SUBMODE) ? $row->COL_SUBMODE : $row->COL_MODE;
392+
384393
// Process main gridsquare (first 4 characters only)
385394
if (!empty($row->COL_GRIDSQUARE) && strlen($row->COL_GRIDSQUARE) >= 4) {
386395
$grid_4char = strtoupper(substr($row->COL_GRIDSQUARE, 0, 4));
387-
if (!isset($grid_callsigns[$grid_4char])) {
388-
$grid_callsigns[$grid_4char] = $row->COL_CALL;
396+
if (!isset($grid_data[$grid_4char])) {
397+
$grid_data[$grid_4char] = array(
398+
'callsign' => $row->COL_CALL,
399+
'mode' => $mode
400+
);
389401
}
390402
}
391403

@@ -396,18 +408,25 @@ private function get_new_gridsquares($locations, $start_date, $end_date, $prev_m
396408
$grid = trim($grid);
397409
if (strlen($grid) >= 4) {
398410
$grid_4char = strtoupper(substr($grid, 0, 4));
399-
if (!isset($grid_callsigns[$grid_4char])) {
400-
$grid_callsigns[$grid_4char] = $row->COL_CALL;
411+
if (!isset($grid_data[$grid_4char])) {
412+
$grid_data[$grid_4char] = array(
413+
'callsign' => $row->COL_CALL,
414+
'mode' => $mode
415+
);
401416
}
402417
}
403418
}
404419
}
405420
}
406421

407422
// Check each grid to see if it's new
408-
foreach ($grid_callsigns as $grid => $callsign) {
423+
foreach ($grid_data as $grid => $data) {
409424
if ($this->is_grid_new($locations, $grid, $start_date)) {
410-
$new_grids[] = array('grid' => $grid, 'callsign' => $callsign);
425+
$new_grids[] = array(
426+
'grid' => $grid,
427+
'callsign' => $data['callsign'],
428+
'mode' => $data['mode']
429+
);
411430
}
412431
}
413432

@@ -426,7 +445,7 @@ private function get_new_gridsquares_by_prop($locations, $start_date, $end_date,
426445
$new_grids = array();
427446

428447
// Get all gridsquares worked this month with this prop mode
429-
$this->db->select('COL_CALL, COL_GRIDSQUARE, COL_VUCC_GRIDS, COL_TIME_ON');
448+
$this->db->select('COL_CALL, COL_GRIDSQUARE, COL_VUCC_GRIDS, COL_TIME_ON, COL_SAT_NAME, COL_MODE, COL_SUBMODE');
430449
$this->db->from($this->config->item('table_name'));
431450
$this->db->where_in('station_id', $locations);
432451
$this->db->where('COL_TIME_ON >=', $start_date);
@@ -435,14 +454,20 @@ private function get_new_gridsquares_by_prop($locations, $start_date, $end_date,
435454
$this->db->order_by('COL_TIME_ON', 'ASC');
436455

437456
$query = $this->db->get();
438-
$grid_callsigns = array();
457+
$grid_data = array();
439458

440459
foreach ($query->result() as $row) {
460+
$mode = !empty($row->COL_SUBMODE) ? $row->COL_SUBMODE : $row->COL_MODE;
461+
441462
// Process main gridsquare (first 4 characters only)
442463
if (!empty($row->COL_GRIDSQUARE) && strlen($row->COL_GRIDSQUARE) >= 4) {
443464
$grid_4char = strtoupper(substr($row->COL_GRIDSQUARE, 0, 4));
444-
if (!isset($grid_callsigns[$grid_4char])) {
445-
$grid_callsigns[$grid_4char] = $row->COL_CALL;
465+
if (!isset($grid_data[$grid_4char])) {
466+
$grid_data[$grid_4char] = array(
467+
'callsign' => $row->COL_CALL,
468+
'satellite' => !empty($row->COL_SAT_NAME) ? $row->COL_SAT_NAME : '',
469+
'mode' => $mode
470+
);
446471
}
447472
}
448473

@@ -453,18 +478,27 @@ private function get_new_gridsquares_by_prop($locations, $start_date, $end_date,
453478
$grid = trim($grid);
454479
if (strlen($grid) >= 4) {
455480
$grid_4char = strtoupper(substr($grid, 0, 4));
456-
if (!isset($grid_callsigns[$grid_4char])) {
457-
$grid_callsigns[$grid_4char] = $row->COL_CALL;
481+
if (!isset($grid_data[$grid_4char])) {
482+
$grid_data[$grid_4char] = array(
483+
'callsign' => $row->COL_CALL,
484+
'satellite' => !empty($row->COL_SAT_NAME) ? $row->COL_SAT_NAME : '',
485+
'mode' => $mode
486+
);
458487
}
459488
}
460489
}
461490
}
462491
}
463492

464493
// Check each grid to see if it's new for this prop mode
465-
foreach ($grid_callsigns as $grid => $callsign) {
494+
foreach ($grid_data as $grid => $data) {
466495
if ($this->is_grid_new_for_prop($locations, $grid, $start_date, $prop_mode)) {
467-
$new_grids[] = array('grid' => $grid, 'callsign' => $callsign);
496+
$new_grids[] = array(
497+
'grid' => $grid,
498+
'callsign' => $data['callsign'],
499+
'satellite' => $data['satellite'],
500+
'mode' => $data['mode']
501+
);
468502
}
469503
}
470504

@@ -483,7 +517,7 @@ private function get_new_gridsquares_hf($locations, $start_date, $end_date, $pre
483517
$new_grids = array();
484518

485519
// Get all gridsquares worked this month via HF
486-
$this->db->select('COL_CALL, COL_GRIDSQUARE, COL_VUCC_GRIDS, COL_TIME_ON');
520+
$this->db->select('COL_CALL, COL_GRIDSQUARE, COL_VUCC_GRIDS, COL_TIME_ON, COL_MODE, COL_SUBMODE');
487521
$this->db->from($this->config->item('table_name'));
488522
$this->db->where_in('station_id', $locations);
489523
$this->db->where('COL_TIME_ON >=', $start_date);
@@ -492,14 +526,19 @@ private function get_new_gridsquares_hf($locations, $start_date, $end_date, $pre
492526
$this->db->order_by('COL_TIME_ON', 'ASC');
493527

494528
$query = $this->db->get();
495-
$grid_callsigns = array();
529+
$grid_data = array();
496530

497531
foreach ($query->result() as $row) {
532+
$mode = !empty($row->COL_SUBMODE) ? $row->COL_SUBMODE : $row->COL_MODE;
533+
498534
// Process main gridsquare (first 4 characters only)
499535
if (!empty($row->COL_GRIDSQUARE) && strlen($row->COL_GRIDSQUARE) >= 4) {
500536
$grid_4char = strtoupper(substr($row->COL_GRIDSQUARE, 0, 4));
501-
if (!isset($grid_callsigns[$grid_4char])) {
502-
$grid_callsigns[$grid_4char] = $row->COL_CALL;
537+
if (!isset($grid_data[$grid_4char])) {
538+
$grid_data[$grid_4char] = array(
539+
'callsign' => $row->COL_CALL,
540+
'mode' => $mode
541+
);
503542
}
504543
}
505544

@@ -510,18 +549,25 @@ private function get_new_gridsquares_hf($locations, $start_date, $end_date, $pre
510549
$grid = trim($grid);
511550
if (strlen($grid) >= 4) {
512551
$grid_4char = strtoupper(substr($grid, 0, 4));
513-
if (!isset($grid_callsigns[$grid_4char])) {
514-
$grid_callsigns[$grid_4char] = $row->COL_CALL;
552+
if (!isset($grid_data[$grid_4char])) {
553+
$grid_data[$grid_4char] = array(
554+
'callsign' => $row->COL_CALL,
555+
'mode' => $mode
556+
);
515557
}
516558
}
517559
}
518560
}
519561
}
520562

521563
// Check each grid to see if it's new for HF
522-
foreach ($grid_callsigns as $grid => $callsign) {
564+
foreach ($grid_data as $grid => $data) {
523565
if ($this->is_grid_new_for_hf($locations, $grid, $start_date)) {
524-
$new_grids[] = array('grid' => $grid, 'callsign' => $callsign);
566+
$new_grids[] = array(
567+
'grid' => $grid,
568+
'callsign' => $data['callsign'],
569+
'mode' => $data['mode']
570+
);
525571
}
526572
}
527573

@@ -676,6 +722,32 @@ private function get_satellite_qsos($locations, $start_date, $end_date) {
676722
return $row ? (int)$row->count : 0;
677723
}
678724

725+
/**
726+
* Get breakdown of QSOs per satellite
727+
*/
728+
private function get_satellite_breakdown($locations, $start_date, $end_date) {
729+
$satellites = array();
730+
731+
$this->db->select('COL_SAT_NAME, COUNT(*) as count');
732+
$this->db->from($this->config->item('table_name'));
733+
$this->db->where_in('station_id', $locations);
734+
$this->db->where('COL_TIME_ON >=', $start_date);
735+
$this->db->where('COL_TIME_ON <=', $end_date);
736+
$this->db->where('COL_PROP_MODE', 'SAT');
737+
$this->db->where('COL_SAT_NAME IS NOT NULL');
738+
$this->db->where('COL_SAT_NAME !=', '');
739+
$this->db->group_by('COL_SAT_NAME');
740+
$this->db->order_by('count', 'DESC');
741+
742+
$query = $this->db->get();
743+
744+
foreach ($query->result() as $row) {
745+
$satellites[$row->COL_SAT_NAME] = (int)$row->count;
746+
}
747+
748+
return $satellites;
749+
}
750+
679751
/**
680752
* Get EME (moonbounce) QSO count
681753
*/

application/views/monthlyreport/report.php

Lines changed: 66 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,16 @@
127127
<h6 class="text-muted"><i class="fas fa-signal"></i> <?php echo $band; ?> (<?php echo count($dxcc_list); ?> new)</h6>
128128
<div class="row">
129129
<?php foreach ($dxcc_list as $dxcc) { ?>
130-
<div class="col-md-4 mb-2">
131-
<span class="badge bg-success fs-6">
132-
<i class="fas fa-star"></i> <?php echo $dxcc['name']; ?><?php if (!empty($dxcc['callsign'])) echo ' (' . $dxcc['callsign'] . ')'; ?>
133-
</span>
130+
<div class="col-md-6 col-lg-4 mb-2">
131+
<div class="d-flex align-items-center">
132+
<span class="badge bg-success me-2">
133+
<i class="fas fa-star"></i> <?php echo $dxcc['name']; ?>
134+
</span>
135+
<small class="text-muted">
136+
<?php echo $dxcc['callsign']; ?>
137+
<?php if (!empty($dxcc['mode'])) echo '' . $dxcc['mode']; ?>
138+
</small>
139+
</div>
134140
</div>
135141
<?php } ?>
136142
</div>
@@ -195,8 +201,14 @@
195201
<h6 class="text-muted"><i class="fas fa-tower-broadcast"></i> HF/VHF Terrestrial (<?php echo count($report['new_grids_hf']); ?>)</h6>
196202
<div class="row">
197203
<?php foreach ($report['new_grids_hf'] as $grid) { ?>
198-
<div class="col-md-3 col-sm-4 col-6 mb-2">
199-
<span class="badge bg-primary fs-6"><?php echo $grid['grid']; ?> (<?php echo $grid['callsign']; ?>)</span>
204+
<div class="col-md-4 col-lg-3 mb-2">
205+
<div class="d-flex align-items-center">
206+
<span class="badge bg-primary me-2"><?php echo $grid['grid']; ?></span>
207+
<small class="text-muted">
208+
<?php echo $grid['callsign']; ?>
209+
<?php if (!empty($grid['mode'])) echo '' . $grid['mode']; ?>
210+
</small>
211+
</div>
200212
</div>
201213
<?php } ?>
202214
</div>
@@ -208,8 +220,15 @@
208220
<h6 class="text-muted"><i class="fas fa-satellite-dish"></i> Satellite (<?php echo count($report['new_grids_satellite']); ?>)</h6>
209221
<div class="row">
210222
<?php foreach ($report['new_grids_satellite'] as $grid) { ?>
211-
<div class="col-md-3 col-sm-4 col-6 mb-2">
212-
<span class="badge bg-success fs-6"><?php echo $grid['grid']; ?> (<?php echo $grid['callsign']; ?>)</span>
223+
<div class="col-md-6 col-lg-4 mb-2">
224+
<div class="d-flex align-items-center">
225+
<span class="badge bg-success me-2"><?php echo $grid['grid']; ?></span>
226+
<small class="text-muted">
227+
<?php echo $grid['callsign']; ?>
228+
<?php if (!empty($grid['satellite'])) echo '' . $grid['satellite']; ?>
229+
<?php if (!empty($grid['mode'])) echo '' . $grid['mode']; ?>
230+
</small>
231+
</div>
213232
</div>
214233
<?php } ?>
215234
</div>
@@ -221,8 +240,14 @@
221240
<h6 class="text-muted"><i class="fas fa-moon"></i> EME (Moonbounce) (<?php echo count($report['new_grids_eme']); ?>)</h6>
222241
<div class="row">
223242
<?php foreach ($report['new_grids_eme'] as $grid) { ?>
224-
<div class="col-md-3 col-sm-4 col-6 mb-2">
225-
<span class="badge bg-warning text-dark fs-6"><?php echo $grid['grid']; ?> (<?php echo $grid['callsign']; ?>)</span>
243+
<div class="col-md-4 col-lg-3 mb-2">
244+
<div class="d-flex align-items-center">
245+
<span class="badge bg-warning text-dark me-2"><?php echo $grid['grid']; ?></span>
246+
<small class="text-muted">
247+
<?php echo $grid['callsign']; ?>
248+
<?php if (!empty($grid['mode'])) echo '' . $grid['mode']; ?>
249+
</small>
250+
</div>
226251
</div>
227252
<?php } ?>
228253
</div>
@@ -304,6 +329,37 @@
304329
</div>
305330
</div>
306331

332+
<!-- Satellite Breakdown -->
333+
<?php if (!empty($report['satellite_breakdown'])) { ?>
334+
<div class="card mb-4">
335+
<div class="card-header">
336+
<h5 class="mb-0"><i class="fas fa-satellite"></i> Satellites Worked (<?php echo count($report['satellite_breakdown']); ?>)</h5>
337+
</div>
338+
<div class="card-body">
339+
<table class="table table-sm table-hover">
340+
<thead class="table-light">
341+
<tr>
342+
<th>Satellite</th>
343+
<th class="text-end">QSOs</th>
344+
<th class="text-end">% of Satellite QSOs</th>
345+
</tr>
346+
</thead>
347+
<tbody>
348+
<?php foreach ($report['satellite_breakdown'] as $satellite => $count) {
349+
$percentage = ($report['satellite_qsos'] > 0) ? round(($count / $report['satellite_qsos']) * 100, 1) : 0;
350+
?>
351+
<tr>
352+
<td><strong><?php echo $satellite; ?></strong></td>
353+
<td class="text-end"><?php echo number_format($count); ?></td>
354+
<td class="text-end"><span class="badge bg-success"><?php echo $percentage; ?>%</span></td>
355+
</tr>
356+
<?php } ?>
357+
</tbody>
358+
</table>
359+
</div>
360+
</div>
361+
<?php } ?>
362+
307363
<!-- Continental Distribution -->
308364
<?php if (!empty($report['continents'])) { ?>
309365
<div class="card mb-4">

0 commit comments

Comments
 (0)