aggiunto filtro per anno sui rinnovi iscrizione soci
This commit is contained in:
parent
b3c6151d0e
commit
a0eeb84de2
|
@ -8,10 +8,28 @@ RenewalTab::RenewalTab(QWidget *parent) :
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
ui->table->setModel(&model);
|
ui->table->setModel(&model);
|
||||||
|
|
||||||
|
QSqlQuery query;
|
||||||
|
QSqlRecord record;
|
||||||
|
|
||||||
|
{
|
||||||
|
query.prepare("SELECT DISTINCT(YEAR(anno)) AS anno FROM iscrizione UNION SELECT YEAR(CURRENT_DATE()) AS anno UNION SELECT YEAR(CURRENT_DATE()) + 1 AS anno;");
|
||||||
|
if (! query.exec()) status(Ui::ERROR, query.lastError().text());
|
||||||
|
record = query.record();
|
||||||
|
while (query.next()) {
|
||||||
|
const int anno = query.value(record.indexOf("anno")).toInt();
|
||||||
|
ui->renewalYear->addItem(QString::number(anno), anno);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenewalTab::refresh() {
|
void RenewalTab::refresh() {
|
||||||
query.prepare("SELECT YEAR(i.anno) AS anno, s.cognome, s.nome FROM iscrizione AS i INNER JOIN socio AS s ON s.id = i.socio ORDER BY s.cognome;");
|
const int anno = ui->renewalYear->currentData().toInt();
|
||||||
|
|
||||||
|
query.prepare("SELECT YEAR(i.anno) AS anno, s.cognome, s.nome FROM iscrizione AS i INNER JOIN socio AS s ON s.id = i.socio WHERE YEAR(i.anno) = :anno ORDER BY s.cognome");
|
||||||
|
query.bindValue(":anno", anno);
|
||||||
|
|
||||||
if (! query.exec()) {
|
if (! query.exec()) {
|
||||||
status(Ui::ERROR, model.lastError().text());
|
status(Ui::ERROR, model.lastError().text());
|
||||||
|
|
|
@ -34,11 +34,7 @@
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QDateEdit" name="dateEdit">
|
<widget class="QComboBox" name="renewalYear"/>
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="buttonRefresh">
|
<widget class="QPushButton" name="buttonRefresh">
|
||||||
|
|
Loading…
Reference in New Issue