renewals shown
This commit is contained in:
parent
956ecb0d86
commit
f3f910b867
|
@ -98,6 +98,7 @@ void EditWindow::on_buttonRinnova_clicked() {
|
||||||
query.bindValue(":socio", id_socio);
|
query.bindValue(":socio", id_socio);
|
||||||
if (query.exec()) {
|
if (query.exec()) {
|
||||||
status(Ui::SUCCESS, "registration renewal successfull");
|
status(Ui::SUCCESS, "registration renewal successfull");
|
||||||
|
close();
|
||||||
} else {
|
} else {
|
||||||
status(Ui::ERROR, "registration renewal error: " + query.lastError().text());
|
status(Ui::ERROR, "registration renewal error: " + query.lastError().text());
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,11 @@
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
<string>Rinnovi</string>
|
<string>Rinnovi</string>
|
||||||
</attribute>
|
</attribute>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_3">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="RenewalTab" name="widget_2" native="true"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -70,6 +75,12 @@
|
||||||
<header>SociListTab.h</header>
|
<header>SociListTab.h</header>
|
||||||
<container>1</container>
|
<container>1</container>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
|
<customwidget>
|
||||||
|
<class>RenewalTab</class>
|
||||||
|
<extends>QWidget</extends>
|
||||||
|
<header>RenewalTab.h</header>
|
||||||
|
<container>1</container>
|
||||||
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
|
|
|
@ -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();
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QSqlQuery>
|
||||||
|
#include <QSqlQueryModel>
|
||||||
|
#include <QSettings>
|
||||||
|
#include <QTableWidgetItem>
|
||||||
|
|
||||||
|
#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();
|
||||||
|
|
||||||
|
};
|
|
@ -0,0 +1,52 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>RenewalTab</class>
|
||||||
|
<widget class="QWidget" name="RenewalTab">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>623</width>
|
||||||
|
<height>421</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_3">
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QTableView" name="table"/>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QDateEdit" name="dateEdit">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="buttonRefresh">
|
||||||
|
<property name="text">
|
||||||
|
<string>Aggiorna</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
|
@ -7,27 +7,6 @@ SociListTab::SociListTab(QWidget *parent) :
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
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() {
|
void SociListTab::on_buttonCerca_clicked() {
|
||||||
QSqlQuery query;
|
QSqlQuery query;
|
||||||
|
|
|
@ -29,7 +29,8 @@ SOURCES += \
|
||||||
MainWindow.cpp \
|
MainWindow.cpp \
|
||||||
status.cpp \
|
status.cpp \
|
||||||
fullQuery.cpp \
|
fullQuery.cpp \
|
||||||
SociListTab.cpp
|
SociListTab.cpp \
|
||||||
|
RenewalTab.cpp
|
||||||
|
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
|
@ -37,13 +38,15 @@ HEADERS += \
|
||||||
MainWindow.h \
|
MainWindow.h \
|
||||||
status.h \
|
status.h \
|
||||||
fullQuery.h \
|
fullQuery.h \
|
||||||
SociListTab.h
|
SociListTab.h \
|
||||||
|
RenewalTab.h
|
||||||
|
|
||||||
|
|
||||||
FORMS += \
|
FORMS += \
|
||||||
MainWindow.ui \
|
MainWindow.ui \
|
||||||
EditWindow.ui \
|
EditWindow.ui \
|
||||||
SociListTab.ui
|
SociListTab.ui \
|
||||||
|
RenewalTab.ui
|
||||||
|
|
||||||
# Default rules for deployment.
|
# Default rules for deployment.
|
||||||
qnx: target.path = /tmp/$${TARGET}/bin
|
qnx: target.path = /tmp/$${TARGET}/bin
|
||||||
|
|
Loading…
Reference in New Issue