diff --git a/argento/EditWindow.cpp b/argento/EditWindow.cpp
index 882b307..299986c 100644
--- a/argento/EditWindow.cpp
+++ b/argento/EditWindow.cpp
@@ -98,6 +98,7 @@ void EditWindow::on_buttonRinnova_clicked() {
query.bindValue(":socio", id_socio);
if (query.exec()) {
status(Ui::SUCCESS, "registration renewal successfull");
+ close();
} else {
status(Ui::ERROR, "registration renewal error: " + query.lastError().text());
}
diff --git a/argento/MainWindow.ui b/argento/MainWindow.ui
index 40c285a..b68ebc9 100644
--- a/argento/MainWindow.ui
+++ b/argento/MainWindow.ui
@@ -34,6 +34,11 @@
Rinnovi
+
+ -
+
+
+
@@ -70,6 +75,12 @@
1
+
+ RenewalTab
+ QWidget
+
+ 1
+
diff --git a/argento/RenewalTab.cpp b/argento/RenewalTab.cpp
new file mode 100644
index 0000000..3beff51
--- /dev/null
+++ b/argento/RenewalTab.cpp
@@ -0,0 +1,29 @@
+#include "RenewalTab.h"
+#include "ui_RenewalTab.h"
+
+RenewalTab::RenewalTab(QWidget *parent) :
+ QWidget(parent),
+ ui(new Ui::RenewalTab)
+{
+ ui->setupUi(this);
+
+ ui->table->setModel(&model);
+
+ 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;");
+
+ if (! query.exec()) {
+ status(Ui::ERROR, model.lastError().text());
+ }
+
+ model.setQuery(query);
+
+}
+
+void RenewalTab::on_buttonRefresh_clicked() {
+ refresh();
+}
\ No newline at end of file
diff --git a/argento/RenewalTab.h b/argento/RenewalTab.h
new file mode 100644
index 0000000..9cecc29
--- /dev/null
+++ b/argento/RenewalTab.h
@@ -0,0 +1,31 @@
+#pragma once
+
+#include
+#include
+#include
+#include
+#include
+
+#include "status.h"
+
+namespace Ui {
+ class RenewalTab;
+}
+
+class RenewalTab : public QWidget {
+ Q_OBJECT
+
+private:
+ Ui::RenewalTab *ui;
+ QSqlQuery query;
+ QSqlQueryModel model;
+
+ void refresh();
+
+public:
+ RenewalTab(QWidget *parent = nullptr);
+
+private slots:
+ void on_buttonRefresh_clicked();
+
+};
diff --git a/argento/RenewalTab.ui b/argento/RenewalTab.ui
new file mode 100644
index 0000000..0e01d2b
--- /dev/null
+++ b/argento/RenewalTab.ui
@@ -0,0 +1,52 @@
+
+
+ RenewalTab
+
+
+
+ 0
+ 0
+ 623
+ 421
+
+
+
+ -
+
+
+ -
+
+
-
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+ false
+
+
+
+ -
+
+
+ Aggiorna
+
+
+
+
+
+
+
+
+
+
diff --git a/argento/SociListTab.cpp b/argento/SociListTab.cpp
index 7ba1f71..c78329b 100644
--- a/argento/SociListTab.cpp
+++ b/argento/SociListTab.cpp
@@ -7,27 +7,6 @@ SociListTab::SociListTab(QWidget *parent) :
{
ui->setupUi(this);
}
-/*
-void SociListTab::connectDatabase(void) {
- // retrieve settings for this application, group database
- QSettings settings("it.linux.golem", "argento");
- settings.beginGroup("database");
-
- // open database and attach query
- db = QSqlDatabase::addDatabase("QMYSQL"); // QMYSQL <-- database driver
- db.setHostName(settings.value("hostname").toString());
- db.setDatabaseName(settings.value("database").toString());
- db.setUserName(settings.value("username").toString());
- db.setPassword(settings.value("password").toString());
-
- status(Ui::INFO, QString("Connecting to %1...").arg(settings.value("hostname").toString()));
-
- if (! db.open())
- status(Ui::ERROR, db.lastError().text());
- else
- status(Ui::INFO, QString("Connected to %1").arg(settings.value("hostname").toString()));
-}
-*/
void SociListTab::on_buttonCerca_clicked() {
QSqlQuery query;
diff --git a/argento/argento.pro b/argento/argento.pro
index e5c5485..b76bb15 100644
--- a/argento/argento.pro
+++ b/argento/argento.pro
@@ -29,7 +29,8 @@ SOURCES += \
MainWindow.cpp \
status.cpp \
fullQuery.cpp \
- SociListTab.cpp
+ SociListTab.cpp \
+ RenewalTab.cpp
HEADERS += \
@@ -37,13 +38,15 @@ HEADERS += \
MainWindow.h \
status.h \
fullQuery.h \
- SociListTab.h
+ SociListTab.h \
+ RenewalTab.h
FORMS += \
MainWindow.ui \
EditWindow.ui \
- SociListTab.ui
+ SociListTab.ui \
+ RenewalTab.ui
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin