diff --git a/argento/RenewalTab.cpp b/argento/RenewalTab.cpp
index 4fb8546..fd87da9 100644
--- a/argento/RenewalTab.cpp
+++ b/argento/RenewalTab.cpp
@@ -8,10 +8,28 @@ RenewalTab::RenewalTab(QWidget *parent) :
ui->setupUi(this);
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() {
- 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()) {
status(Ui::ERROR, model.lastError().text());
diff --git a/argento/RenewalTab.ui b/argento/RenewalTab.ui
index 76bfac7..98ccef5 100644
--- a/argento/RenewalTab.ui
+++ b/argento/RenewalTab.ui
@@ -34,11 +34,7 @@
-
-
-
- false
-
-
+
-