diff --git a/argento/RenewalTab.cpp b/argento/RenewalTab.cpp
index b892112..b50e752 100644
--- a/argento/RenewalTab.cpp
+++ b/argento/RenewalTab.cpp
@@ -28,13 +28,18 @@ RenewalTab::RenewalTab(QWidget *parent) :
}
-
+ ui->orderBy->addItem("id");
+ ui->orderBy->addItem("nome");
+ ui->orderBy->addItem("cognome");
}
void RenewalTab::refresh() {
const int anno = ui->renewalYear->currentData().toInt();
+ const QString order_by = ui->orderBy->currentText();
+ QString query_str = "SELECT YEAR(i.anno) AS anno, s.id, s.cognome, s.nome FROM iscrizione AS i INNER JOIN socio AS s ON s.id = i.socio WHERE YEAR(i.anno) = :anno";
+ query_str += " ORDER BY s." + order_by;
- 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.prepare(query_str);
query.bindValue(":anno", anno);
if (! query.exec()) {
@@ -49,4 +54,4 @@ void RenewalTab::refresh() {
void RenewalTab::on_buttonRefresh_clicked() {
refresh();
-}
\ No newline at end of file
+}
diff --git a/argento/RenewalTab.ui b/argento/RenewalTab.ui
index 68dc60b..1693745 100644
--- a/argento/RenewalTab.ui
+++ b/argento/RenewalTab.ui
@@ -10,14 +10,7 @@
421
-
- -
-
-
- false
-
-
-
+
-
-
@@ -40,6 +33,9 @@
+ -
+
+
-
@@ -52,6 +48,13 @@
+ -
+
+
+ false
+
+
+