add switch for band/freq

This commit is contained in:
DB4SCW
2025-09-12 11:36:49 +00:00
parent 6a9e9d7da4
commit d6ff837163
4 changed files with 42 additions and 3 deletions

View File

@@ -70,7 +70,7 @@ class Qslprint_model extends CI_Model {
function get_qsos_for_print($station_id = 'All') {
$binding=[];
$binding[]=$this->session->userdata('user_id');
$sql="SELECT count(distinct oldlog.col_primary_key) as previous_qsl, log.COL_QSL_SENT, log.COL_PRIMARY_KEY, log.COL_DXCC, log.COL_CALL, log.COL_SAT_NAME, log.COL_SAT_MODE, log.COL_BAND_RX, log.COL_TIME_ON, log.COL_MODE, log.COL_RST_SENT, log.COL_RST_RCVD, log.COL_QSL_VIA, log.COL_QSL_SENT_VIA, log.COL_SUBMODE, log.COL_BAND, sp.station_id, sp.station_callsign, sp.station_profile_name, o.qsoid
$sql="SELECT count(distinct oldlog.col_primary_key) as previous_qsl, log.COL_QSL_SENT, log.COL_PRIMARY_KEY, log.COL_DXCC, log.COL_CALL, log.COL_SAT_NAME, log.COL_SAT_MODE, log.COL_BAND_RX, COALESCE(log.COL_FREQ_RX, log.COL_FREQ) as frequency, log.COL_TIME_ON, log.COL_MODE, log.COL_RST_SENT, log.COL_RST_RCVD, log.COL_QSL_VIA, log.COL_QSL_SENT_VIA, log.COL_SUBMODE, log.COL_BAND, sp.station_id, sp.station_callsign, sp.station_profile_name, o.qsoid
FROM ".$this->config->item('table_name')." log
INNER JOIN station_profile sp ON sp.`station_id` = log.`station_id`
LEFT OUTER JOIN oqrs o ON o.`qsoid` = log.`COL_PRIMARY_KEY`

View File

@@ -26,6 +26,15 @@
</select>
</form>
<div>
<?= __("Show Band or Frequency:"); ?>
<select id="frequency_or_band" class="form-select mb-3 me-sm-3" style="width: 20%;">
<option value="band" selected><?= __("Band"); ?></option>
<option value="frequency"><?= __("Frequency"); ?></option>
<option value="both"><?= __("Both"); ?></option>
</select>
</div>
<p class="card-text"><?= __("Here you can export requested QSLs as CSV or ADIF files for printing and, optionally, mark them as sent."); ?></p>
<p class="card-text">
<?= __("Requested QSLs are any QSOs with a value of 'Requested' or 'Queued' in their 'QSL Sent' field."); ?><br>

View File

@@ -1,4 +1,5 @@
<?php
$ci =& get_instance();
function echo_qsl_sent_via($method) {
switch($method) {
@@ -22,7 +23,8 @@ if ($qsos->result() != NULL) {
<th style=\'text-align: center\'>' . __("Date") . '</th>
<th style=\'text-align: center\'>'. __("Time") .'</th>
<th style=\'text-align: center\'>' . __("Mode") . '</th>
<th style=\'text-align: center\'>' . __("Band") . '</th>
<th class=\'col-band\' style=\'text-align: center\'>' . __("Band") . '</th>
<th class=\'col-freq\' style=\'text-align: center;display:none;\'>' . __("Frequency") . '</th>
<th style=\'text-align: center\'>' . __("RST (S)") . '</th>
<th style=\'text-align: center\'>' . __("RST (R)") . '</th>
<th style=\'text-align: center\'>' . __("QSL") . ' ' . __("Via") . '</th>
@@ -52,7 +54,8 @@ if ($qsos->result() != NULL) {
echo '<td style=\'text-align: center\'>'; $timestamp = strtotime($qsl->COL_TIME_ON); echo date($custom_date_format, $timestamp); echo '</td>';
echo '<td style=\'text-align: center\'>'; $timestamp = strtotime($qsl->COL_TIME_ON); echo date('H:i', $timestamp); echo '</td>';
echo '<td style=\'text-align: center\'>'; echo $qsl->COL_SUBMODE==null?$qsl->COL_MODE:$qsl->COL_SUBMODE; echo '</td>';
echo '<td style=\'text-align: center\'>'; if($qsl->COL_SAT_NAME != null) { echo $qsl->COL_SAT_NAME; } else { echo strtolower($qsl->COL_BAND); }; echo '</td>';
echo '<td class=\'col-band\' style=\'text-align: center\'>'; if($qsl->COL_SAT_NAME != null) { echo $qsl->COL_SAT_NAME; } else { echo strtolower($qsl->COL_BAND); }; echo '</td>';
echo '<td class=\'col-freq\' style=\'text-align: center;display:none;\'>'; if($qsl->COL_SAT_NAME != null) { echo $qsl->COL_SAT_NAME; } else { echo $ci->frequency->qrg_conversion($qsl->frequency); }; echo '</td>';
echo '<td style=\'text-align: center\'>' . $qsl->COL_RST_SENT . '</td>';
echo '<td style=\'text-align: center\'>' . $qsl->COL_RST_RCVD . '</td>';
echo '<td style=\'text-align: center\'>' . $qsl->COL_QSL_VIA . '</td>';

View File

@@ -332,3 +332,30 @@ function exportSelectedQsos() {
$('.exportselected').prop("disabled", false);
}
document.getElementById('frequency_or_band').addEventListener('change', function (event) {
//get selected option
const selectedValue = event.target.value;
//react to the different states
if (selectedValue === "band") {
bandcols = document.querySelectorAll('.col-band');
bandcols.forEach(cell => { cell.style.display = '';});
freqcols = document.querySelectorAll('.col-freq');
freqcols.forEach(cell => { cell.style.display = 'none';});
}
if (selectedValue === "frequency") {
bandcols = document.querySelectorAll('.col-band');
bandcols.forEach(cell => { cell.style.display = 'none';});
freqcols = document.querySelectorAll('.col-freq');
freqcols.forEach(cell => { cell.style.display = '';});
}
if (selectedValue === "both") {
bandcols = document.querySelectorAll('.col-band');
bandcols.forEach(cell => { cell.style.display = '';});
freqcols = document.querySelectorAll('.col-freq');
freqcols.forEach(cell => { cell.style.display = '';});
}
});