Replaced auswertung with report #13
This commit is contained in:
@@ -68,7 +68,7 @@ void ReportsWidget::refresh()
|
|||||||
m_labelBalance->setText(tr("%0: %1").arg(tr("Balance")).arg(tr("???")));
|
m_labelBalance->setText(tr("%0: %1").arg(tr("Balance")).arg(tr("???")));
|
||||||
m_labelHolidays->setText(tr("%0: %1").arg(tr("Holidays")).arg(tr("???")));
|
m_labelHolidays->setText(tr("%0: %1").arg(tr("Holidays")).arg(tr("???")));
|
||||||
|
|
||||||
m_reply = m_mainWindow.erfassung().doGetAuswertung(m_mainWindow.userInfo().userId, m_date);
|
m_reply = m_mainWindow.erfassung().doGetReport(m_mainWindow.userInfo().userId, m_date);
|
||||||
connect(m_reply.get(), &ZeiterfassungReply::finished, this, &ReportsWidget::finished);
|
connect(m_reply.get(), &ZeiterfassungReply::finished, this, &ReportsWidget::finished);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -82,7 +82,7 @@ void ReportsWidget::finished()
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
auto content = m_reply->auswertung();
|
auto content = m_reply->content();
|
||||||
|
|
||||||
{
|
{
|
||||||
static QRegularExpression regex(QStringLiteral("Gleitzeit +([0-9]+\\:[0-9]+\\-?) +([0-9]+\\:[0-9]+\\-?)"));
|
static QRegularExpression regex(QStringLiteral("Gleitzeit +([0-9]+\\:[0-9]+\\-?) +([0-9]+\\:[0-9]+\\-?)"));
|
||||||
@@ -117,7 +117,7 @@ void ReportsWidget::finished()
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
QTemporaryFile file(QDir::temp().absoluteFilePath(QStringLiteral("auswertungXXXXXX.pdf")));
|
QTemporaryFile file(QDir::temp().absoluteFilePath(QStringLiteral("reportXXXXXX.pdf")));
|
||||||
file.setAutoRemove(false);
|
file.setAutoRemove(false);
|
||||||
if(!file.open())
|
if(!file.open())
|
||||||
{
|
{
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
#include <QDate>
|
#include <QDate>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
|
|
||||||
#include "replies/getauswertungreply.h"
|
#include "replies/getreportreply.h"
|
||||||
|
|
||||||
class QLabel;
|
class QLabel;
|
||||||
class QAction;
|
class QAction;
|
||||||
@@ -37,7 +37,7 @@ private:
|
|||||||
QDate m_date;
|
QDate m_date;
|
||||||
QUrl m_url;
|
QUrl m_url;
|
||||||
|
|
||||||
std::unique_ptr<GetAuswertungReply> m_reply;
|
std::unique_ptr<GetReportReply> m_reply;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // REPORTSWIDGET_H
|
#endif // REPORTSWIDGET_H
|
||||||
|
@@ -245,7 +245,7 @@ void MainWindow::pushButtonStartPressed()
|
|||||||
if(bookingsChanged)
|
if(bookingsChanged)
|
||||||
{
|
{
|
||||||
m_currentStripWidget->refresh();
|
m_currentStripWidget->refresh();
|
||||||
//refreshAuswertung();
|
//refreshReport();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
m_currentStripWidget->refreshTimeAssignments();
|
m_currentStripWidget->refreshTimeAssignments();
|
||||||
@@ -296,7 +296,7 @@ void MainWindow::pushButtonEndPressed()
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_currentStripWidget->refresh();
|
m_currentStripWidget->refresh();
|
||||||
//refreshAuswertung();
|
//refreshReport();
|
||||||
|
|
||||||
ui->actionToday->setEnabled(false);
|
ui->actionToday->setEnabled(false);
|
||||||
ui->actionRefresh->setEnabled(false);
|
ui->actionRefresh->setEnabled(false);
|
||||||
|
@@ -1,30 +0,0 @@
|
|||||||
#ifndef GETAUSWERTUNGREPLY_H
|
|
||||||
#define GETAUSWERTUNGREPLY_H
|
|
||||||
|
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
#include <QNetworkReply>
|
|
||||||
#include <QByteArray>
|
|
||||||
|
|
||||||
#include "zeiterfassunglib_global.h"
|
|
||||||
#include "zeiterfassungreply.h"
|
|
||||||
|
|
||||||
class ZEITERFASSUNGLIBSHARED_EXPORT GetAuswertungReply : public ZeiterfassungReply
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
GetAuswertungReply(std::unique_ptr<QNetworkReply> &&reply, ZeiterfassungApi *zeiterfassung);
|
|
||||||
|
|
||||||
const QByteArray &auswertung() const;
|
|
||||||
|
|
||||||
private Q_SLOTS:
|
|
||||||
void request0Finished();
|
|
||||||
void request1Finished();
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::unique_ptr<QNetworkReply> m_reply;
|
|
||||||
QByteArray m_auswertung;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // GETAUSWERTUNGREPLY_H
|
|
@@ -1,20 +1,20 @@
|
|||||||
#include "getauswertungreply.h"
|
#include "getreportreply.h"
|
||||||
|
|
||||||
#include "zeiterfassungapi.h"
|
#include "zeiterfassungapi.h"
|
||||||
|
|
||||||
GetAuswertungReply::GetAuswertungReply(std::unique_ptr<QNetworkReply> &&reply, ZeiterfassungApi *zeiterfassung) :
|
GetReportReply::GetReportReply(std::unique_ptr<QNetworkReply> &&reply, ZeiterfassungApi *zeiterfassung) :
|
||||||
ZeiterfassungReply(zeiterfassung),
|
ZeiterfassungReply(zeiterfassung),
|
||||||
m_reply(std::move(reply))
|
m_reply(std::move(reply))
|
||||||
{
|
{
|
||||||
connect(m_reply.get(), &QNetworkReply::finished, this, &GetAuswertungReply::request0Finished);
|
connect(m_reply.get(), &QNetworkReply::finished, this, &GetReportReply::request0Finished);
|
||||||
}
|
}
|
||||||
|
|
||||||
const QByteArray &GetAuswertungReply::auswertung() const
|
const QByteArray &GetReportReply::content() const
|
||||||
{
|
{
|
||||||
return m_auswertung;
|
return m_content;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetAuswertungReply::request0Finished()
|
void GetReportReply::request0Finished()
|
||||||
{
|
{
|
||||||
if(m_reply->error() != QNetworkReply::NoError)
|
if(m_reply->error() != QNetworkReply::NoError)
|
||||||
{
|
{
|
||||||
@@ -29,10 +29,10 @@ void GetAuswertungReply::request0Finished()
|
|||||||
url.setPath(QString(m_reply->readAll()));
|
url.setPath(QString(m_reply->readAll()));
|
||||||
|
|
||||||
m_reply = std::unique_ptr<QNetworkReply>(zeiterfassung()->manager()->get(QNetworkRequest(url)));
|
m_reply = std::unique_ptr<QNetworkReply>(zeiterfassung()->manager()->get(QNetworkRequest(url)));
|
||||||
connect(m_reply.get(), &QNetworkReply::finished, this, &GetAuswertungReply::request1Finished);
|
connect(m_reply.get(), &QNetworkReply::finished, this, &GetReportReply::request1Finished);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetAuswertungReply::request1Finished()
|
void GetReportReply::request1Finished()
|
||||||
{
|
{
|
||||||
if(m_reply->error() != QNetworkReply::NoError)
|
if(m_reply->error() != QNetworkReply::NoError)
|
||||||
{
|
{
|
||||||
@@ -42,7 +42,7 @@ void GetAuswertungReply::request1Finished()
|
|||||||
}
|
}
|
||||||
|
|
||||||
setSuccess(true);
|
setSuccess(true);
|
||||||
m_auswertung = m_reply->readAll();
|
m_content = m_reply->readAll();
|
||||||
|
|
||||||
end:
|
end:
|
||||||
m_reply = Q_NULLPTR;
|
m_reply = Q_NULLPTR;
|
30
zeiterfassunglib/replies/getreportreply.h
Normal file
30
zeiterfassunglib/replies/getreportreply.h
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
#ifndef GETREPORTREPLY_H
|
||||||
|
#define GETREPORTREPLY_H
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
#include <QNetworkReply>
|
||||||
|
#include <QByteArray>
|
||||||
|
|
||||||
|
#include "zeiterfassunglib_global.h"
|
||||||
|
#include "zeiterfassungreply.h"
|
||||||
|
|
||||||
|
class ZEITERFASSUNGLIBSHARED_EXPORT GetReportReply : public ZeiterfassungReply
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
GetReportReply(std::unique_ptr<QNetworkReply> &&reply, ZeiterfassungApi *zeiterfassung);
|
||||||
|
|
||||||
|
const QByteArray &content() const;
|
||||||
|
|
||||||
|
private Q_SLOTS:
|
||||||
|
void request0Finished();
|
||||||
|
void request1Finished();
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::unique_ptr<QNetworkReply> m_reply;
|
||||||
|
QByteArray m_content;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // GETREPORTREPLY_H
|
@@ -13,7 +13,7 @@
|
|||||||
#include "replies/createtimeassignmentreply.h"
|
#include "replies/createtimeassignmentreply.h"
|
||||||
#include "replies/deletebookingreply.h"
|
#include "replies/deletebookingreply.h"
|
||||||
#include "replies/deletetimeassignmentreply.h"
|
#include "replies/deletetimeassignmentreply.h"
|
||||||
#include "replies/getauswertungreply.h"
|
#include "replies/getreportreply.h"
|
||||||
#include "replies/getbookingsreply.h"
|
#include "replies/getbookingsreply.h"
|
||||||
#include "replies/getpresencestatusreply.h"
|
#include "replies/getpresencestatusreply.h"
|
||||||
#include "replies/getprojectsreply.h"
|
#include "replies/getprojectsreply.h"
|
||||||
@@ -286,7 +286,7 @@ std::unique_ptr<GetProjectsReply> ZeiterfassungApi::doGetProjects(int userId, co
|
|||||||
return std::make_unique<GetProjectsReply>(std::move(reply), this);
|
return std::make_unique<GetProjectsReply>(std::move(reply), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<GetAuswertungReply> ZeiterfassungApi::doGetAuswertung(int userId, const QDate &date)
|
std::unique_ptr<GetReportReply> ZeiterfassungApi::doGetReport(int userId, const QDate &date)
|
||||||
{
|
{
|
||||||
QNetworkRequest request(QUrl(QStringLiteral("%0json/auswertung/month?persNr=%1&date=%2")
|
QNetworkRequest request(QUrl(QStringLiteral("%0json/auswertung/month?persNr=%1&date=%2")
|
||||||
.arg(m_url)
|
.arg(m_url)
|
||||||
@@ -296,7 +296,7 @@ std::unique_ptr<GetAuswertungReply> ZeiterfassungApi::doGetAuswertung(int userId
|
|||||||
|
|
||||||
auto reply = std::unique_ptr<QNetworkReply>(m_manager->get(request));
|
auto reply = std::unique_ptr<QNetworkReply>(m_manager->get(request));
|
||||||
|
|
||||||
return std::make_unique<GetAuswertungReply>(std::move(reply), this);
|
return std::make_unique<GetReportReply>(std::move(reply), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<GetPresenceStatusReply> ZeiterfassungApi::doGetPresenceStatus()
|
std::unique_ptr<GetPresenceStatusReply> ZeiterfassungApi::doGetPresenceStatus()
|
||||||
|
@@ -24,7 +24,7 @@ class CreateTimeAssignmentReply;
|
|||||||
class UpdateTimeAssignmentReply;
|
class UpdateTimeAssignmentReply;
|
||||||
class DeleteTimeAssignmentReply;
|
class DeleteTimeAssignmentReply;
|
||||||
class GetProjectsReply;
|
class GetProjectsReply;
|
||||||
class GetAuswertungReply;
|
class GetReportReply;
|
||||||
class GetPresenceStatusReply;
|
class GetPresenceStatusReply;
|
||||||
|
|
||||||
class ZEITERFASSUNGLIBSHARED_EXPORT ZeiterfassungApi : public QObject
|
class ZEITERFASSUNGLIBSHARED_EXPORT ZeiterfassungApi : public QObject
|
||||||
@@ -62,7 +62,7 @@ public:
|
|||||||
std::unique_ptr<DeleteTimeAssignmentReply> doDeleteTimeAssignment(int timeAssignmentId);
|
std::unique_ptr<DeleteTimeAssignmentReply> doDeleteTimeAssignment(int timeAssignmentId);
|
||||||
|
|
||||||
std::unique_ptr<GetProjectsReply> doGetProjects(int userId, const QDate &date);
|
std::unique_ptr<GetProjectsReply> doGetProjects(int userId, const QDate &date);
|
||||||
std::unique_ptr<GetAuswertungReply> doGetAuswertung(int userId, const QDate &date);
|
std::unique_ptr<GetReportReply> doGetReport(int userId, const QDate &date);
|
||||||
std::unique_ptr<GetPresenceStatusReply> doGetPresenceStatus();
|
std::unique_ptr<GetPresenceStatusReply> doGetPresenceStatus();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@@ -25,7 +25,6 @@ SOURCES += mainwindow.cpp \
|
|||||||
replies/createtimeassignmentreply.cpp \
|
replies/createtimeassignmentreply.cpp \
|
||||||
replies/deletebookingreply.cpp \
|
replies/deletebookingreply.cpp \
|
||||||
replies/deletetimeassignmentreply.cpp \
|
replies/deletetimeassignmentreply.cpp \
|
||||||
replies/getauswertungreply.cpp \
|
|
||||||
replies/getbookingsreply.cpp \
|
replies/getbookingsreply.cpp \
|
||||||
replies/getpresencestatusreply.cpp \
|
replies/getpresencestatusreply.cpp \
|
||||||
replies/getprojectsreply.cpp \
|
replies/getprojectsreply.cpp \
|
||||||
@@ -35,7 +34,8 @@ SOURCES += mainwindow.cpp \
|
|||||||
replies/updatebookingreply.cpp \
|
replies/updatebookingreply.cpp \
|
||||||
replies/updatetimeassignmentreply.cpp \
|
replies/updatetimeassignmentreply.cpp \
|
||||||
replies/zeiterfassungreply.cpp \
|
replies/zeiterfassungreply.cpp \
|
||||||
replies/getuserinforeply.cpp
|
replies/getuserinforeply.cpp \
|
||||||
|
replies/getreportreply.cpp
|
||||||
|
|
||||||
HEADERS += cpp14polyfills.h \
|
HEADERS += cpp14polyfills.h \
|
||||||
mainwindow.h \
|
mainwindow.h \
|
||||||
@@ -54,7 +54,6 @@ HEADERS += cpp14polyfills.h \
|
|||||||
replies/createtimeassignmentreply.h \
|
replies/createtimeassignmentreply.h \
|
||||||
replies/deletebookingreply.h \
|
replies/deletebookingreply.h \
|
||||||
replies/deletetimeassignmentreply.h \
|
replies/deletetimeassignmentreply.h \
|
||||||
replies/getauswertungreply.h \
|
|
||||||
replies/getbookingsreply.h \
|
replies/getbookingsreply.h \
|
||||||
replies/getpresencestatusreply.h \
|
replies/getpresencestatusreply.h \
|
||||||
replies/getprojectsreply.h \
|
replies/getprojectsreply.h \
|
||||||
@@ -64,7 +63,8 @@ HEADERS += cpp14polyfills.h \
|
|||||||
replies/updatebookingreply.h \
|
replies/updatebookingreply.h \
|
||||||
replies/updatetimeassignmentreply.h \
|
replies/updatetimeassignmentreply.h \
|
||||||
replies/zeiterfassungreply.h \
|
replies/zeiterfassungreply.h \
|
||||||
replies/getuserinforeply.h
|
replies/getuserinforeply.h \
|
||||||
|
replies/getreportreply.h
|
||||||
|
|
||||||
FORMS += mainwindow.ui \
|
FORMS += mainwindow.ui \
|
||||||
dialogs/settingsdialog.ui \
|
dialogs/settingsdialog.ui \
|
||||||
|
Reference in New Issue
Block a user