From f10431b454f3e671ba8dfd664d2e25ef76ba0ad1 Mon Sep 17 00:00:00 2001 From: Herwig Birke Date: Tue, 10 Mar 2020 12:16:09 +0100 Subject: [PATCH] yearly view --- cmainwindow.cpp | 17 ++- cmainwindow.h | 27 ++-- cmonthlyview.cpp | 21 +-- cmonthlyview.h | 5 +- cyearlyview.cpp | 369 +++++++++++++++++++++++++++++++++++++++++++++++ cyearlyview.h | 53 +++++++ cyearlyview.ui | 142 ++++++++++++++++++ workingHours.pro | 5 +- 8 files changed, 609 insertions(+), 30 deletions(-) create mode 100644 cyearlyview.cpp create mode 100644 cyearlyview.h create mode 100644 cyearlyview.ui diff --git a/cmainwindow.cpp b/cmainwindow.cpp index 8632dd4..33a5b39 100644 --- a/cmainwindow.cpp +++ b/cmainwindow.cpp @@ -18,9 +18,17 @@ cMainWindow::cMainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::cMainWindow), + m_lpYearyView(nullptr), m_lpMonthlyView(nullptr), m_lpBookingList(nullptr) { + m_code.insert(" ", tr("")); + m_code.insert("G", tr("Gleitzeit")); + m_code.insert("U", tr("Urlaub")); + m_code.insert("SU", tr("Sonderurlaub")); + m_code.insert("K", tr("Krank")); + m_code.insert("T", tr("Training")); + openDB(); m_dailyWorkingList.load(); m_vacationList.load(); @@ -38,6 +46,8 @@ cMainWindow::cMainWindow(QWidget *parent) : // cZeitnachweis zeitnachweis5("C:\\Users\\VET0572\\Downloads\\Zeitnachweis\\2016-05.pdf"); qDebug() << "count: " << m_lpBookingList->count(); + + connect(m_lpMonthlyView, &cMonthlyView::dateChanged, m_lpYearyView, &cYearlyView::onDateChanged); } cMainWindow::~cMainWindow() @@ -84,8 +94,13 @@ void cMainWindow::initUI() if(iX != -1 && iY != -1) move(iX, iY); - m_lpMonthlyView = new cMonthlyView(QDate::currentDate(), &m_monthlyBookingList, &m_publicHoliday, m_lpBookingList, this); + m_lpYearyView = new cYearlyView(QDate::currentDate(), m_code, &m_monthlyBookingList, &m_publicHoliday, m_lpBookingList, this); + ui->m_lpMainTab->addTab(m_lpYearyView, "Yearly"); + + m_lpMonthlyView = new cMonthlyView(QDate::currentDate(), m_code, &m_monthlyBookingList, &m_publicHoliday, m_lpBookingList, this); ui->m_lpMainTab->addTab(m_lpMonthlyView, "Monthly"); + + ui->m_lpMainTab->setCurrentWidget(m_lpMonthlyView); } void cMainWindow::openDB() diff --git a/cmainwindow.h b/cmainwindow.h index d107244..e895a13 100644 --- a/cmainwindow.h +++ b/cmainwindow.h @@ -2,6 +2,7 @@ #define CMAINWINDOW_H +#include "cyearlyview.h" #include "cmonthlyview.h" #include "cdailyworking.h" #include "cvacation.h" @@ -14,6 +15,8 @@ #include +#include + namespace Ui { class cMainWindow; @@ -28,21 +31,23 @@ public: ~cMainWindow(); private: - Ui::cMainWindow* ui; - cMonthlyView* m_lpMonthlyView; - QSqlDatabase m_db; - cPublicHoliday m_publicHoliday; - cDailyWorkingList m_dailyWorkingList; - cVacationList m_vacationList; - cMonthlyBookingList m_monthlyBookingList; - cBookingList* m_lpBookingList; + Ui::cMainWindow* ui; + cYearlyView* m_lpYearyView; + cMonthlyView* m_lpMonthlyView; + QSqlDatabase m_db; + cPublicHoliday m_publicHoliday; + cDailyWorkingList m_dailyWorkingList; + cVacationList m_vacationList; + cMonthlyBookingList m_monthlyBookingList; + cBookingList* m_lpBookingList; + QMap m_code; - void initUI(); - void openDB(); + void initUI(); + void openDB(); protected: - void closeEvent(QCloseEvent* event); + void closeEvent(QCloseEvent* event); }; #endif // CMAINWINDOW_H diff --git a/cmonthlyview.cpp b/cmonthlyview.cpp index c427b06..ea10658 100644 --- a/cmonthlyview.cpp +++ b/cmonthlyview.cpp @@ -14,10 +14,11 @@ #include -cMonthlyView::cMonthlyView(const QDate& date, cMonthlyBookingList* lpMonthlyBookingList, cPublicHoliday *lpPublicHoliday, cBookingList* lpBookingList, QWidget *parent) : +cMonthlyView::cMonthlyView(const QDate& date, const QMap code, cMonthlyBookingList* lpMonthlyBookingList, cPublicHoliday *lpPublicHoliday, cBookingList* lpBookingList, QWidget *parent) : QWidget(parent), ui(new Ui::cMonthlyView), m_loading(true), + m_code(code), m_lpMonthlyBookingList(lpMonthlyBookingList), m_lpPublicHoliday(lpPublicHoliday), m_lpBookingList(lpBookingList), @@ -25,13 +26,6 @@ cMonthlyView::cMonthlyView(const QDate& date, cMonthlyBookingList* lpMonthlyBook m_lpMonthlyBooking(nullptr), m_lpValidator(nullptr) { - m_code.insert(" ", tr("")); - m_code.insert("G", tr("Gleitzeit")); - m_code.insert("U", tr("Urlaub")); - m_code.insert("SU", tr("Sonderurlaub")); - m_code.insert("K", tr("Krank")); - m_code.insert("T", tr("Training")); - ui->setupUi(this); QRegExp rx("(?:\\d\\d\\d):(?:[0-5]\\d):(?:[0-5]\\d)"); @@ -80,7 +74,6 @@ cMonthlyView::cMonthlyView(const QDate& date, cMonthlyBookingList* lpMonthlyBook void cMonthlyView::setDate(const QDate& date) { m_loading = true; - m_date = date; m_lpPublicHoliday->setYear(static_cast(date.year())); @@ -224,13 +217,9 @@ void cMonthlyView::setDate(const QDate& date) ui->m_lpResturlaubLabel->setText(QString(tr("Resturlaub %1:")).arg(date.addMonths(-1).toString("MMMM yyyy"))); ui->m_lpUeberstunden->setText(secs2String(m_lpMonthlyBooking->ueberstunden(), 3)); -// if(!m_lpMonthlyBooking->timesheet().isEmpty()) -// { -// cZeitnachweis zeitnachweis(m_lpMonthlyBooking->timesheet()); -// } - updatePDF(); displaySummary(); +// emit dateChanged(date); m_loading = false; } @@ -577,10 +566,8 @@ void cMonthlyView::recalculate(int day, int /*field*/) void cMonthlyView::displaySummary() { QStandardItem* lpFirstItem = m_lpMonthlyListModel->item(0, COL_DAY1); -// QStandardItem* lpLastItem = m_lpMonthlyListModel->item(m_lpMonthlyListModel->rowCount()-1, COL_DAY1); cBooking* lpFirstBooking = lpFirstItem->data(DATA_BOOKING).value(); -// cBooking* lpLastBooking = lpLastItem->data(DATA_BOOKING).value(); ui->m_lpUebertrag->setText(lpFirstBooking->prevDiffString()); @@ -622,6 +609,8 @@ void cMonthlyView::displaySummary() ui->m_lpUrlaub->setText(QString::number(u)); ui->m_lpSonderurlaub->setText(QString::number(su)); ui->m_lpTraining->setText(QString::number(t)); + + emit dateChanged(ui->m_lpMonth->date()); } void cMonthlyView::updatePDF() diff --git a/cmonthlyview.h b/cmonthlyview.h index 8e77147..f5bcd43 100644 --- a/cmonthlyview.h +++ b/cmonthlyview.h @@ -25,7 +25,7 @@ class cMonthlyView : public QWidget Q_OBJECT public: - explicit cMonthlyView(const QDate& date, cMonthlyBookingList* lpMonthlyBookingList, cPublicHoliday* lpPublicHoliday, cBookingList* lpBookingList, QWidget *parent = nullptr); + explicit cMonthlyView(const QDate& date, const QMap code, cMonthlyBookingList* lpMonthlyBookingList, cPublicHoliday* lpPublicHoliday, cBookingList* lpBookingList, QWidget *parent = nullptr); ~cMonthlyView(); void setDate(const QDate& date); @@ -64,6 +64,9 @@ private slots: void onSaleryDownload(); void onSaleryReplace(); void onSaleryDelete(); + +signals: + void dateChanged(const QDate& date); }; #endif // CMONTHLYVIEW_H diff --git a/cyearlyview.cpp b/cyearlyview.cpp new file mode 100644 index 0000000..4e97d06 --- /dev/null +++ b/cyearlyview.cpp @@ -0,0 +1,369 @@ +#include "common.h" + +#include "cyearlyview.h" +#include "ui_cyearlyview.h" + +#include + + +cYearlyView::cYearlyView(const QDate& date, const QMap code, cMonthlyBookingList* lpMonthlyBookingList, cPublicHoliday *lpPublicHoliday, cBookingList* lpBookingList, QWidget *parent) : + QWidget(parent), + ui(new Ui::cYearlyView), + m_loading(true), + m_code(code), + m_lpMonthlyBookingList(lpMonthlyBookingList), + m_lpPublicHoliday(lpPublicHoliday), + m_lpBookingList(lpBookingList), + m_date(date), + m_lpMonthlyBooking(nullptr) +{ + ui->setupUi(this); + + m_lpYearlyListModel = new QStandardItemModel(0, 1); + ui->m_lpYearlyList->setModel(m_lpYearlyListModel); + + setDate(date); + + m_loading = false; +} + +cYearlyView::~cYearlyView() +{ + delete ui; +} + +QStandardItem* newItem(const QString& string, const QFont& font, const Qt::Alignment& alignment) +{ + QStandardItem* lpItem = new QStandardItem(string); + lpItem->setFont(font); + lpItem->setTextAlignment(alignment); + return(lpItem); +} + +void cYearlyView::setDate(const QDate& date) +{ + m_loading = true; + m_date = date; + + m_lpPublicHoliday->setYear(static_cast(date.year())); + + m_lpYearlyListModel->clear(); + + ui->m_lpYear->setDate(date); + + QStringList strings; + QFont font; + QFont fontBold; + QBrush weekend = QBrush(COLOR_WEEKEND); + QBrush gleitzeit = QBrush(COLOR_GLEITZEIT); + QBrush urlaub = QBrush(COLOR_URLAUB); + QBrush sonderurlaub = QBrush(COLOR_SONDERURLAUB); + QBrush krank = QBrush(COLOR_KRANK); + QBrush training = QBrush(COLOR_TRAINING); + QList spanList; + + fontBold.setBold(true); + + for(int x = 0;x < 31;x++) + strings.append(QString::number(x+1)); + + strings.append("SOLL Arbeitszeit"); + strings.append("IST Arbeitszeit"); + strings.append("+/-"); + strings.append("Gleitzeit"); + strings.append("Krank"); + strings.append("Urlaub"); + strings.append("Resturlaub"); + strings.append("Sonderurlaub"); + strings.append("Sonderurlaub Rest"); + + ui->m_lpYearlyList->horizontalHeader()->setMinimumSectionSize(1); + ui->m_lpYearlyList->setMinimumWidth(1); + ui->m_lpYearlyList->verticalHeader()->setMinimumSectionSize(1); + ui->m_lpYearlyList->setMinimumHeight(1); + + QList itemList; + + itemList.append(newItem("Day", fontBold, Qt::AlignHCenter)); + itemList.append(newItem("January", font, Qt::AlignHCenter)); itemList.append(newItem("", font, Qt::AlignHCenter)); itemList.append(newItem("", font, Qt::AlignHCenter)); + itemList.append(newItem("February", font, Qt::AlignHCenter)); itemList.append(newItem("", font, Qt::AlignHCenter)); itemList.append(newItem("", font, Qt::AlignHCenter)); + itemList.append(newItem("March", font, Qt::AlignHCenter)); itemList.append(newItem("", font, Qt::AlignHCenter)); itemList.append(newItem("", font, Qt::AlignHCenter)); + itemList.append(newItem("April", font, Qt::AlignHCenter)); itemList.append(newItem("", font, Qt::AlignHCenter)); itemList.append(newItem("", font, Qt::AlignHCenter)); + itemList.append(newItem("May", font, Qt::AlignHCenter)); itemList.append(newItem("", font, Qt::AlignHCenter)); itemList.append(newItem("", font, Qt::AlignHCenter)); + itemList.append(newItem("June", font, Qt::AlignHCenter)); itemList.append(newItem("", font, Qt::AlignHCenter)); itemList.append(newItem("", font, Qt::AlignHCenter)); + itemList.append(newItem("July", font, Qt::AlignHCenter)); itemList.append(newItem("", font, Qt::AlignHCenter)); itemList.append(newItem("", font, Qt::AlignHCenter)); + itemList.append(newItem("August", font, Qt::AlignHCenter)); itemList.append(newItem("", font, Qt::AlignHCenter)); itemList.append(newItem("", font, Qt::AlignHCenter)); + itemList.append(newItem("September", font, Qt::AlignHCenter)); itemList.append(newItem("", font, Qt::AlignHCenter)); itemList.append(newItem("", font, Qt::AlignHCenter)); + itemList.append(newItem("October", font, Qt::AlignHCenter)); itemList.append(newItem("", font, Qt::AlignHCenter)); itemList.append(newItem("", font, Qt::AlignHCenter)); + itemList.append(newItem("November", font, Qt::AlignHCenter)); itemList.append(newItem("", font, Qt::AlignHCenter)); itemList.append(newItem("", font, Qt::AlignHCenter)); + itemList.append(newItem("December", font, Qt::AlignHCenter)); itemList.append(newItem("", font, Qt::AlignHCenter)); itemList.append(newItem("", font, Qt::AlignHCenter)); + itemList.append(newItem("Day", fontBold, Qt::AlignHCenter)); + + for(int x = 0;x < itemList.count();x++) + itemList[x]->setData(QBrush(Qt::gray), Qt::BackgroundRole); + + m_lpYearlyListModel->appendRow(itemList); + + for(int x = 0;x < 12;x++) + { + ui->m_lpYearlyList->setSpan(0, x*3+1, 1, 3); + + ui->m_lpYearlyList->setColumnWidth(x*3+1, 25); + ui->m_lpYearlyList->setColumnWidth(x*3+2, 70); + ui->m_lpYearlyList->setColumnWidth(x*3+3, 20); + } + + for(int x = 0;x < strings.count();x++) + { + spanList.clear(); + + QList itemList; + + itemList.append(newItem(strings[x], fontBold, Qt::AlignHCenter)); + itemList[itemList.count()-1]->setData(QBrush(Qt::gray), Qt::BackgroundRole); + + if(x < 31) + { + for(int y = 0;y < 12;y++) + { + QDate d(m_date.year(), y+1, x+1); + + if(d.isValid()) + { + cBooking* lpBooking = m_lpBookingList->find(d); + + itemList.append(newItem(d.toString("ddd").left(2), font, Qt::AlignRight)); + itemList.append(newItem("", font, Qt::AlignRight)); + itemList.append(newItem("", font, Qt::AlignLeft)); + + if(m_lpPublicHoliday->isPublicHoliday(d)) + { + itemList[itemList.count()-3]->setData(weekend, Qt::BackgroundRole); + itemList[itemList.count()-2]->setData(weekend, Qt::BackgroundRole); + itemList[itemList.count()-1]->setData(weekend, Qt::BackgroundRole); + + itemList[itemList.count()-2]->setText(m_lpPublicHoliday->name(d)); + + spanList.append(itemList.count()-2); + } + else if(d.dayOfWeek() >= 6) + { + itemList[itemList.count()-3]->setData(weekend, Qt::BackgroundRole); + itemList[itemList.count()-2]->setData(weekend, Qt::BackgroundRole); + itemList[itemList.count()-1]->setData(weekend, Qt::BackgroundRole); + } + else if(lpBooking) + { + itemList[itemList.count()-2]->setData(QVariant::fromValue(lpBooking), Qt::UserRole); + + if(lpBooking->code() == "G") + { + itemList[itemList.count()-3]->setData(gleitzeit, Qt::BackgroundRole); + itemList[itemList.count()-2]->setData(gleitzeit, Qt::BackgroundRole); + itemList[itemList.count()-1]->setData(gleitzeit, Qt::BackgroundRole); + + itemList[itemList.count()-1]->setText(lpBooking->code()); + } + else if(lpBooking->code() == "U") + { + itemList[itemList.count()-3]->setData(urlaub, Qt::BackgroundRole); + itemList[itemList.count()-2]->setData(urlaub, Qt::BackgroundRole); + itemList[itemList.count()-1]->setData(urlaub, Qt::BackgroundRole); + + itemList[itemList.count()-1]->setText(lpBooking->code()); + } + else if(lpBooking->code() == "SU") + { + itemList[itemList.count()-3]->setData(sonderurlaub, Qt::BackgroundRole); + itemList[itemList.count()-2]->setData(sonderurlaub, Qt::BackgroundRole); + itemList[itemList.count()-1]->setData(sonderurlaub, Qt::BackgroundRole); + + itemList[itemList.count()-1]->setText(lpBooking->code()); + } + else if(lpBooking->code() == "K") + { + itemList[itemList.count()-3]->setData(krank, Qt::BackgroundRole); + itemList[itemList.count()-2]->setData(krank, Qt::BackgroundRole); + itemList[itemList.count()-1]->setData(krank, Qt::BackgroundRole); + + itemList[itemList.count()-1]->setText(lpBooking->code()); + } + else if(lpBooking->code() == "T") + { + itemList[itemList.count()-3]->setData(training, Qt::BackgroundRole); + itemList[itemList.count()-2]->setData(training, Qt::BackgroundRole); + itemList[itemList.count()-1]->setData(training, Qt::BackgroundRole); + + itemList[itemList.count()-1]->setText(lpBooking->code()); + } + else + { + itemList[itemList.count()-2]->setText(lpBooking->ist().toString("hh:mm:ss")); + } + } + } + else + { + itemList.append(newItem("", font, Qt::AlignRight)); + itemList[itemList.count()-1]->setData(QBrush(Qt::gray), Qt::BackgroundRole); + itemList.append(newItem("", font, Qt::AlignHCenter)); + itemList[itemList.count()-1]->setData(QBrush(Qt::gray), Qt::BackgroundRole); + itemList.append(newItem("", font, Qt::AlignLeft)); + itemList[itemList.count()-1]->setData(QBrush(Qt::gray), Qt::BackgroundRole); + } + } + } + else + { + for(int y = 0;y < 12;y++) + { + itemList.append(newItem("", font, Qt::AlignRight)); + itemList[itemList.count()-1]->setData(QBrush(Qt::gray), Qt::BackgroundRole); + itemList.append(newItem("", font, Qt::AlignRight)); + itemList[itemList.count()-1]->setData(QBrush(Qt::gray), Qt::BackgroundRole); + itemList.append(newItem("", font, Qt::AlignLeft)); + itemList[itemList.count()-1]->setData(QBrush(Qt::gray), Qt::BackgroundRole); + } + } + + itemList.append(newItem(strings[x], fontBold, Qt::AlignHCenter)); + itemList[itemList.count()-1]->setData(QBrush(Qt::gray), Qt::BackgroundRole); + + m_lpYearlyListModel->appendRow(itemList); + + for(int y = 0;y < spanList.count();y++) + ui->m_lpYearlyList->setSpan(m_lpYearlyListModel->rowCount()-1, spanList[y], 1, 2); + } + + for(int x = 0;x < m_lpYearlyListModel->rowCount();x++) + ui->m_lpYearlyList->setRowHeight(x, 18); + + ui->m_lpYearlyList->resizeColumnToContents(0); + ui->m_lpYearlyList->resizeColumnToContents(m_lpYearlyListModel->columnCount()-1); + + qint32 sollT = 0; + qint32 istT = 0; + qint16 gT = 0; + qint16 kT = 0; + qint16 uT = 0; + qint16 suT = 0; + qint16 tT = 0; + qint16 restUrlaub = 0; + + for(int col = 0;col < 12;col++) + { + qint32 soll = 0; + qint32 ist = 0; + qint16 g = 0; + qint16 k = 0; + qint16 u = 0; + qint16 su = 0; + qint16 t = 0; + + cBooking* lpFirstBooking = nullptr; + + for(int row = 0;row < 31;row++) + { + QStandardItem* lpItem = m_lpYearlyListModel->item(row+1, col*3+2); + + if(lpItem) + { + cBooking* lpBooking = lpItem->data(Qt::UserRole).value(); + if(lpBooking) + { + if(!lpFirstBooking) + lpFirstBooking = lpBooking; + + soll += lpBooking->sollSecs(); + ist += lpBooking->istSecs(); + + if(lpBooking->code() == "G") + g++; + else if(lpBooking->code() == "K") + k++; + else if(lpBooking->code() == "U") + u++; + else if(lpBooking->code() == "SU") + su++; + else if(lpBooking->code() == "T") + t++; + } + } + } + + m_lpYearlyListModel->item(32, col*3+2)->setText(secs2String(soll)); + m_lpYearlyListModel->item(33, col*3+2)->setText(secs2String(ist)); + m_lpYearlyListModel->item(34, col*3+2)->setText(secs2String(ist-soll)); + if(ist-soll < 0) + m_lpYearlyListModel->item(34, col*3+2)->setData(QBrush(Qt::red), Qt::ForegroundRole); + + m_lpYearlyListModel->item(35, col*3+2)->setText(QString::number(g)); + m_lpYearlyListModel->item(36, col*3+2)->setText(QString::number(k)); + m_lpYearlyListModel->item(37, col*3+2)->setText(QString::number(u)); + + if(lpFirstBooking) + { + restUrlaub = lpFirstBooking->vacation()-u; + m_lpYearlyListModel->item(38, col*3+2)->setText(QString::number(restUrlaub)); + if(restUrlaub < 0) + m_lpYearlyListModel->item(38, col*3+2)->setData(QBrush(Qt::red), Qt::ForegroundRole); + } + else + m_lpYearlyListModel->item(38, col*3+2)->setText("0"); + + m_lpYearlyListModel->item(39, col*3+2)->setText(QString::number(su)); + + sollT += soll; + istT += ist; + gT += g; + kT += k; + uT += u; + suT += su; + tT += t; + } + + m_lpYearlyListModel->item(32, 37)->setText(secs2String(sollT)); + m_lpYearlyListModel->item(33, 37)->setText(secs2String(istT)); + m_lpYearlyListModel->item(34, 37)->setText(secs2String(istT-sollT)); + if(istT-sollT < 0) + m_lpYearlyListModel->item(34, 37)->setData(QBrush(Qt::red), Qt::ForegroundRole); + + m_lpYearlyListModel->item(35, 37)->setText(QString::number(gT)); + m_lpYearlyListModel->item(36, 37)->setText(QString::number(kT)); + m_lpYearlyListModel->item(37, 37)->setText(QString::number(uT)); + m_lpYearlyListModel->item(38, 37)->setText(QString::number(restUrlaub)); + if(restUrlaub < 0) + m_lpYearlyListModel->item(38, 37)->setData(QBrush(Qt::red), Qt::ForegroundRole); + + m_lpYearlyListModel->item(39, 37)->setText(QString::number(suT)); + + m_loading = false; +} + +void cYearlyView::onPrevYear() +{ + if(m_loading) + return; + + setDate(ui->m_lpYear->date().addMonths(-12)); +} + +void cYearlyView::onNextYear() +{ + if(m_loading) + return; + + setDate(ui->m_lpYear->date().addMonths(12)); +} + +void cYearlyView::onDateChanged(const QDate& date) +{ + if(m_loading) + return; + + m_loading = true; + + setDate(date); + + m_loading = false; +} diff --git a/cyearlyview.h b/cyearlyview.h new file mode 100644 index 0000000..208c14a --- /dev/null +++ b/cyearlyview.h @@ -0,0 +1,53 @@ +#ifndef CYEARLYVIEW_H +#define CYEARLYVIEW_H + + +#include "cmonthlybooking.h" +#include "cmonthlyitemdelegate.h" +#include "cpublicholiday.h" + +#include "cbooking.h" + +#include +#include +#include +#include + +#include + + +namespace Ui { +class cYearlyView; +} + +class cYearlyView : public QWidget +{ + Q_OBJECT + +public: + explicit cYearlyView(const QDate& date, const QMap code, cMonthlyBookingList* lpMonthlyBookingList, cPublicHoliday* lpPublicHoliday, cBookingList* lpBookingList, QWidget *parent = nullptr); + ~cYearlyView(); + + void setDate(const QDate& date); + +private: + Ui::cYearlyView* ui; + bool m_loading; + QStandardItemModel* m_lpYearlyListModel; + QMap m_code; + cMonthlyBookingList* m_lpMonthlyBookingList; + cPublicHoliday* m_lpPublicHoliday; + cBookingList* m_lpBookingList; + QDate m_date; + cMonthlyBooking* m_lpMonthlyBooking; +// QRegExpValidator* m_lpValidator; +// QStringList m_temporaryFileList; + +public slots: + void onPrevYear(); + void onNextYear(); + void onDateChanged(const QDate& date); + +}; + +#endif // CYEARLYVIEW_H diff --git a/cyearlyview.ui b/cyearlyview.ui new file mode 100644 index 0000000..0557f94 --- /dev/null +++ b/cyearlyview.ui @@ -0,0 +1,142 @@ + + + cYearlyView + + + + 0 + 0 + 760 + 456 + + + + Form + + + + + + + + + + < + + + + + + + + 150 + 0 + + + + + 10 + 75 + true + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + 0 + 0 + 0 + 2016 + 5 + 1 + + + + QDateTimeEdit::YearSection + + + yyyy + + + true + + + + + + + > + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + true + + + + + 0 + 0 + 738 + 404 + + + + + + + QAbstractItemView::NoEditTriggers + + + true + + + QAbstractItemView::SelectRows + + + false + + + false + + + false + + + false + + + false + + + + + + + + + + + + + + diff --git a/workingHours.pro b/workingHours.pro index 40e4b37..cf77588 100644 --- a/workingHours.pro +++ b/workingHours.pro @@ -52,6 +52,7 @@ SOURCES += \ common.cpp \ cpublicholiday.cpp \ cvacation.cpp \ + cyearlyview.cpp \ czeitnachweis.cpp \ main.cpp \ cmainwindow.cpp @@ -65,12 +66,14 @@ HEADERS += \ cmonthlyview.h \ common.h \ cpublicholiday.h \ + cyearlyview.h \ czeitnachweis.h \ cvacation.h FORMS += \ cmainwindow.ui \ - cmonthlyview.ui + cmonthlyview.ui \ + cyearlyview.ui # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin