Added query and result

This commit is contained in:
Andreas Kristiansen
2025-05-26 18:40:48 +02:00
parent be13a4d26a
commit 56a1a20618
3 changed files with 65 additions and 29 deletions

View File

@@ -920,8 +920,37 @@
}
public function getInitialsFromDb($band, $mode) {
$binding = [];
$this->load->model('logbooks_model');
$logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
if (!$logbooks_locations_array) {
return null;
}
$sql = "SELECT col_call, min(col_time_on) firstworked, col_band FROM ".$this->config->item('table_name');
$sql .= " where station_id in (" . implode(',',$logbooks_locations_array) . ") and col_prop_mode ='EME'";
if ($mode != 'All') {
$sql .= " and (col_mode = ? or col_submode = ?)";
$binding[] = $mode;
$binding[] = $mode;
}
if ($band != 'All') {
$sql .= " and col_band = ?";
$binding[] = $band;
}
$sql .= " group by col_call, col_band order by firstworked";
$result = $this->db->query($sql, $binding);
return $result->result();
}
}
?>

View File

@@ -1,32 +1,39 @@
<?php
if ($intials_array) {
echo '<br />
<table style="width:100%" class="qsotable table-sm table table-bordered table-hover table-striped table-condensed text-center">
<thead>';
echo '<tr><th></th>';
foreach($bands as $band) {
echo '<th>' . $band . '</th>';
}
echo '<th>'.__("Total").'</th>';
echo '</tr>
</thead>
<tbody>';
foreach ($qsoarray as $mode => $value) {
// Get Date format
if($this->session->userdata('user_date_format')) {
// If Logged in and session exists
$custom_date_format = $this->session->userdata('user_date_format');
} else {
// Get Default date format from /config/wavelog.php
$custom_date_format = $this->config->item('qso_date_format');
}
echo '<table style="width:100%" class="table table-sm timelinetable table-bordered table-hover table-striped table-condensed text-center">
<thead>
<tr>
<td>#</td>
<td>' . __("Date") . '</td>
<td>' . __("Callsign") . '</td>
<td>' . __("Band") . '</td>
<td>' . __("Mode") . '</td>
<td>' . __("Show QSOs") . '</td>
</tr>
</thead>
<tbody>';
$i = 1;
foreach ($intials_array as $line) {
$date_as_timestamp = strtotime($line->firstworked ?? '1970-01-01 00:00:00');
echo '<tr>
<th>'. $mode .'</th>';
foreach ($value as $key => $val) {
echo '<td>' . $val . '</td>';
}
echo '<th>' . $modetotal[$mode] . '</th>';
echo '</tr>';
}
echo '</tbody><tfoot><tr><th>'.__("Total").'</th>';
<td>' . $i++ . '</td>
<td>' . date($custom_date_format, $date_as_timestamp) . '</td>
<td>' . $line->col_call . '</td>
<td>' . $line->col_band . '</td>
<td></td>
<td><a href=javascript:displayContacts()>' . __("Show") . '</a></td>
</tr>';
}
$grandtotal = 0;
foreach ($bandtotal as $band => $value) {
echo '<th>' . $value . '</th>';
$grandtotal += $value;
}
echo '<th>' . $grandtotal . '</th>';
echo '</tr></tfoot></table>';
echo '</tbody></table>';
} else {
echo __("No EME QSO(s) was found.");
}

View File

@@ -15,8 +15,8 @@ $(".activatorstable").DataTable({
function showinitials() {
var data = {
mode: $('#band').val(),
band: $('#mode').val()
band: $('#band').val(),
mode: $('#mode').val()
};
$.ajax({