calculations
This commit is contained in:
+25
-9
@@ -157,6 +157,14 @@ qint32 cBooking::pauseSecs()
|
||||
int w = totalWork();
|
||||
int p = totalPause();
|
||||
|
||||
if(w > 21600 && w < 23400 && p < 1800)
|
||||
{
|
||||
int p1 = w-21600;
|
||||
p1 -= p;
|
||||
if(p1 > 0)
|
||||
return(p1);
|
||||
}
|
||||
|
||||
if(w < 21600)
|
||||
return(0);
|
||||
|
||||
@@ -174,15 +182,16 @@ QTime cBooking::pause()
|
||||
qint32 cBooking::istSecs()
|
||||
{
|
||||
int w = totalWork();
|
||||
int p = totalPause();
|
||||
int p = pauseSecs();
|
||||
|
||||
if(w < 21600)
|
||||
return(w);
|
||||
// if(w < 21600)
|
||||
// return(w);
|
||||
|
||||
if(p < 1800)
|
||||
return(w - (1800-p));
|
||||
// if(p < 1800)
|
||||
// return(w - (1800-p));
|
||||
|
||||
return(w);
|
||||
// return(w);
|
||||
return(w-p);
|
||||
}
|
||||
|
||||
QTime cBooking::ist()
|
||||
@@ -376,7 +385,8 @@ int cBooking::totalPause()
|
||||
return(geht1().secsTo(kommt2()) + geht2().secsTo(kommt3()) + geht3().secsTo(kommt4()) + geht4().secsTo(kommt5()));
|
||||
}
|
||||
|
||||
cBookingList::cBookingList(cPublicHoliday* lpPublicHoliday, cDailyWorkingList* lpDailyWorkingList, cVacationList* lpVacationList) :
|
||||
cBookingList::cBookingList(cMonthlyBookingList* lpMonthlyBookingList, cPublicHoliday* lpPublicHoliday, cDailyWorkingList* lpDailyWorkingList, cVacationList* lpVacationList) :
|
||||
m_lpMonthlyBookingList(lpMonthlyBookingList),
|
||||
m_lpPublicHoliday(lpPublicHoliday),
|
||||
m_lpDailyWorkingList(lpDailyWorkingList),
|
||||
m_lpVacationList(lpVacationList)
|
||||
@@ -510,19 +520,25 @@ void cBookingList::recalculate(const QDate& date)
|
||||
|
||||
for(;i != end(); i++)
|
||||
{
|
||||
cVacation* lpVacation = m_lpVacationList->find((*i)->date());
|
||||
cVacation* lpVacation = m_lpVacationList->find((*i)->date());
|
||||
if(lpVacation)
|
||||
(*i)->setVacation(oldVacation + lpVacation->days());
|
||||
else
|
||||
(*i)->setVacation(oldVacation);
|
||||
|
||||
cMonthlyBooking* lpMonthlyBooking = m_lpMonthlyBookingList->find((*i)->date());
|
||||
qint32 ueberstunden = 0;
|
||||
|
||||
if(lpMonthlyBooking)
|
||||
ueberstunden = time2Secs(lpMonthlyBooking->ueberstunden());
|
||||
|
||||
if(bFirst)
|
||||
{
|
||||
bFirst = false;
|
||||
(*i)->setPrevDiff(0);
|
||||
}
|
||||
else
|
||||
(*i)->setPrevDiff((*(i-1))->currentDiff());
|
||||
(*i)->setPrevDiff((*(i-1))->currentDiff()-ueberstunden);
|
||||
|
||||
oldVacation = (*i)->vacation();
|
||||
|
||||
|
||||
+75
-72
@@ -2,6 +2,7 @@
|
||||
#define CBOOKING_H
|
||||
|
||||
|
||||
#include "cmonthlybooking.h"
|
||||
#include "cpublicholiday.h"
|
||||
#include "cdailyworking.h"
|
||||
#include "cvacation.h"
|
||||
@@ -20,94 +21,95 @@ class cBooking : public QObject
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit cBooking(const QDate& date, QObject* parent = nullptr);
|
||||
explicit cBooking(const QDate& date, QObject* parent = nullptr);
|
||||
|
||||
QDate date();
|
||||
QDate date();
|
||||
|
||||
void setKommt1(const QTime& time);
|
||||
QTime kommt1();
|
||||
void setKommt1(const QTime& time);
|
||||
QTime kommt1();
|
||||
|
||||
void setGeht1(const QTime& time);
|
||||
QTime geht1();
|
||||
void setGeht1(const QTime& time);
|
||||
QTime geht1();
|
||||
|
||||
void setKommt2(const QTime& time);
|
||||
QTime kommt2();
|
||||
void setKommt2(const QTime& time);
|
||||
QTime kommt2();
|
||||
|
||||
void setGeht2(const QTime& time);
|
||||
QTime geht2();
|
||||
void setGeht2(const QTime& time);
|
||||
QTime geht2();
|
||||
|
||||
void setKommt3(const QTime& time);
|
||||
QTime kommt3();
|
||||
void setKommt3(const QTime& time);
|
||||
QTime kommt3();
|
||||
|
||||
void setGeht3(const QTime& time);
|
||||
QTime geht3();
|
||||
void setGeht3(const QTime& time);
|
||||
QTime geht3();
|
||||
|
||||
void setKommt4(const QTime& time);
|
||||
QTime kommt4();
|
||||
void setKommt4(const QTime& time);
|
||||
QTime kommt4();
|
||||
|
||||
void setGeht4(const QTime& time);
|
||||
QTime geht4();
|
||||
void setGeht4(const QTime& time);
|
||||
QTime geht4();
|
||||
|
||||
void setKommt5(const QTime& time);
|
||||
QTime kommt5();
|
||||
void setKommt5(const QTime& time);
|
||||
QTime kommt5();
|
||||
|
||||
void setGeht5(const QTime& time);
|
||||
QTime geht5();
|
||||
void setGeht5(const QTime& time);
|
||||
QTime geht5();
|
||||
|
||||
void setCode(const QString& code);
|
||||
QString code();
|
||||
void setCode(const QString& code);
|
||||
QString code();
|
||||
|
||||
void setInformation(const QString& information);
|
||||
QString information();
|
||||
void setInformation(const QString& information);
|
||||
QString information();
|
||||
|
||||
qint32 pauseSecs();
|
||||
QTime pause();
|
||||
qint32 pauseSecs();
|
||||
QTime pause();
|
||||
|
||||
qint32 istSecs();
|
||||
QTime ist();
|
||||
qint32 istSecs();
|
||||
QTime ist();
|
||||
|
||||
void setSoll(const QTime& time);
|
||||
qint32 sollSecs();
|
||||
QTime soll();
|
||||
void setSoll(const QTime& time);
|
||||
qint32 sollSecs();
|
||||
QTime soll();
|
||||
|
||||
qint32 diff();
|
||||
QString diffString();
|
||||
qint32 diff();
|
||||
QString diffString();
|
||||
|
||||
void setPrevDiff(qint32 diff);
|
||||
qint32 prevDiff();
|
||||
QString prevDiffString();
|
||||
void setPrevDiff(qint32 diff);
|
||||
qint32 prevDiff();
|
||||
QString prevDiffString();
|
||||
|
||||
qint32 currentDiff();
|
||||
QString currentDiffString();
|
||||
qint32 currentDiff();
|
||||
QString currentDiffString();
|
||||
|
||||
qreal hoursDecimal();
|
||||
qreal hoursDecimal();
|
||||
|
||||
void setVacation(qint16 vac);
|
||||
qint16 vacation();
|
||||
void setVacation(qint16 vac);
|
||||
qint16 vacation();
|
||||
|
||||
bool save();
|
||||
|
||||
bool save();
|
||||
private:
|
||||
QDate m_date;
|
||||
QTime m_kommt1;
|
||||
QTime m_geht1;
|
||||
QTime m_kommt2;
|
||||
QTime m_geht2;
|
||||
QTime m_kommt3;
|
||||
QTime m_geht3;
|
||||
QTime m_kommt4;
|
||||
QTime m_geht4;
|
||||
QTime m_kommt5;
|
||||
QTime m_geht5;
|
||||
QString m_code;
|
||||
QString m_information;
|
||||
QTime m_soll;
|
||||
qint32 m_prevDiff;
|
||||
qint16 m_vacation;
|
||||
QDate m_date;
|
||||
QTime m_kommt1;
|
||||
QTime m_geht1;
|
||||
QTime m_kommt2;
|
||||
QTime m_geht2;
|
||||
QTime m_kommt3;
|
||||
QTime m_geht3;
|
||||
QTime m_kommt4;
|
||||
QTime m_geht4;
|
||||
QTime m_kommt5;
|
||||
QTime m_geht5;
|
||||
QString m_code;
|
||||
QString m_information;
|
||||
QTime m_soll;
|
||||
qint32 m_prevDiff;
|
||||
qint16 m_vacation;
|
||||
|
||||
void bind(QSqlQuery& query, const QString& variable, const QTime& time);
|
||||
void bind(QSqlQuery& query, const QString& variable, const QTime& time);
|
||||
|
||||
int totalWork();
|
||||
int totalPause();
|
||||
int totalWork();
|
||||
int totalPause();
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(cBooking*)
|
||||
@@ -115,17 +117,18 @@ Q_DECLARE_METATYPE(cBooking*)
|
||||
class cBookingList : public QList<cBooking*>
|
||||
{
|
||||
public:
|
||||
explicit cBookingList(cPublicHoliday* lpPublicHoliday, cDailyWorkingList* lpDailyWorkingList, cVacationList* lpVacationList);
|
||||
bool load();
|
||||
cBooking* add(const QDate& date);
|
||||
cBooking* find(const QDate& date);
|
||||
void sort();
|
||||
explicit cBookingList(cMonthlyBookingList* lpMonthlyBookingList, cPublicHoliday* lpPublicHoliday, cDailyWorkingList* lpDailyWorkingList, cVacationList* lpVacationList);
|
||||
bool load();
|
||||
cBooking* add(const QDate& date);
|
||||
cBooking* find(const QDate& date);
|
||||
void sort();
|
||||
|
||||
void recalculate(const QDate& date = QDate());
|
||||
void recalculate(const QDate& date = QDate());
|
||||
private:
|
||||
cPublicHoliday* m_lpPublicHoliday;
|
||||
cDailyWorkingList* m_lpDailyWorkingList;
|
||||
cVacationList* m_lpVacationList;
|
||||
cMonthlyBookingList* m_lpMonthlyBookingList;
|
||||
cPublicHoliday* m_lpPublicHoliday;
|
||||
cDailyWorkingList* m_lpDailyWorkingList;
|
||||
cVacationList* m_lpVacationList;
|
||||
};
|
||||
|
||||
#endif // CBOOKING_H
|
||||
|
||||
+19
-2
@@ -22,8 +22,9 @@ cMainWindow::cMainWindow(QWidget *parent) :
|
||||
openDB();
|
||||
m_dailyWorkingList.load();
|
||||
m_vacationList.load();
|
||||
m_monthlyBookingList.load();
|
||||
|
||||
m_lpBookingList = new cBookingList(&m_publicHoliday, &m_dailyWorkingList, &m_vacationList);
|
||||
m_lpBookingList = new cBookingList(&m_monthlyBookingList, &m_publicHoliday, &m_dailyWorkingList, &m_vacationList);
|
||||
m_lpBookingList->load();
|
||||
|
||||
initUI();
|
||||
@@ -75,7 +76,7 @@ void cMainWindow::initUI()
|
||||
if(iX != -1 && iY != -1)
|
||||
move(iX, iY);
|
||||
|
||||
m_lpMonthlyView = new cMonthlyView(QDate::currentDate(), &m_publicHoliday, m_lpBookingList, this);
|
||||
m_lpMonthlyView = new cMonthlyView(QDate::currentDate(), &m_monthlyBookingList, &m_publicHoliday, m_lpBookingList, this);
|
||||
ui->m_lpMainTab->addTab(m_lpMonthlyView, "Monthly");
|
||||
}
|
||||
|
||||
@@ -151,6 +152,22 @@ void cMainWindow::openDB()
|
||||
qDebug() << "CREATE TABLE booking";
|
||||
}
|
||||
|
||||
if(!m_db.tables().contains("monthlyBooking"))
|
||||
{
|
||||
query.prepare("CREATE TABLE monthlyBooking "
|
||||
"( "
|
||||
" datum DATE PRIMARY KEY UNIQUE, "
|
||||
" ueberstunden TIME "
|
||||
");");
|
||||
|
||||
if(!query.exec())
|
||||
{
|
||||
qDebug() << "CREATE TABLE monthlyBooking: " << query.lastError().text();
|
||||
return;
|
||||
}
|
||||
qDebug() << "CREATE TABLE monthlyBooking";
|
||||
}
|
||||
|
||||
if(!m_db.tables().contains("vacation"))
|
||||
{
|
||||
query.prepare("CREATE TABLE vacation "
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "cdailyworking.h"
|
||||
#include "cvacation.h"
|
||||
#include "cpublicholiday.h"
|
||||
#include "cmonthlybooking.h"
|
||||
#include "cbooking.h"
|
||||
|
||||
#include <QMainWindow>
|
||||
@@ -33,6 +34,7 @@ private:
|
||||
cPublicHoliday m_publicHoliday;
|
||||
cDailyWorkingList m_dailyWorkingList;
|
||||
cVacationList m_vacationList;
|
||||
cMonthlyBookingList m_monthlyBookingList;
|
||||
cBookingList* m_lpBookingList;
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,127 @@
|
||||
#include "cmonthlybooking.h"
|
||||
|
||||
#include <QSqlQuery>
|
||||
#include <QSqlError>
|
||||
#include <QDebug>
|
||||
|
||||
|
||||
cMonthlyBooking::cMonthlyBooking(const QDate& date, QObject *parent) :
|
||||
QObject(parent),
|
||||
m_date(date),
|
||||
m_ueberstunden(QTime(0, 0, 0))
|
||||
{
|
||||
}
|
||||
|
||||
QDate cMonthlyBooking::date()
|
||||
{
|
||||
return(m_date);
|
||||
}
|
||||
|
||||
void cMonthlyBooking::setUeberstunden(const QTime &time)
|
||||
{
|
||||
m_ueberstunden = time;
|
||||
}
|
||||
|
||||
QTime cMonthlyBooking::ueberstunden()
|
||||
{
|
||||
return(m_ueberstunden);
|
||||
}
|
||||
|
||||
bool cMonthlyBooking::save()
|
||||
{
|
||||
QSqlQuery query;
|
||||
|
||||
query.prepare("SELECT datum FROM monthlyBooking WHERE datum=:datum;");
|
||||
query.bindValue(":datum", m_date);
|
||||
|
||||
if(!query.exec())
|
||||
{
|
||||
qDebug() << "Save: " << query.lastError().text();
|
||||
return(false);
|
||||
}
|
||||
|
||||
if(query.next())
|
||||
query.prepare("UPDATE monthlyBooking "
|
||||
"SET ueberstunden=:ueberstunden "
|
||||
"WHERE datum=:datum;");
|
||||
else
|
||||
query.prepare("INSERT INTO monthlyBooking ( "
|
||||
" datum, "
|
||||
" ueberstunden "
|
||||
" ) "
|
||||
"VALUES "
|
||||
" ( "
|
||||
" :datum, "
|
||||
" :ueberstunden "
|
||||
" );");
|
||||
|
||||
query.bindValue(":datum", date());
|
||||
query.bindValue(":ueberstunden", ueberstunden());
|
||||
|
||||
if(!query.exec())
|
||||
{
|
||||
qDebug() << "Save: " << query.lastError().text();
|
||||
return(false);
|
||||
}
|
||||
|
||||
qDebug() << "saved.";
|
||||
return(true);
|
||||
}
|
||||
|
||||
bool cMonthlyBookingList::load()
|
||||
{
|
||||
QSqlQuery query;
|
||||
|
||||
query.prepare("SELECT datum, "
|
||||
" ueberstunden "
|
||||
"FROM monthlyBooking "
|
||||
"ORDER BY datum;");
|
||||
|
||||
if(!query.exec())
|
||||
{
|
||||
qDebug() << "SELECT FROM monthlyBooking: " << query.lastError().text();
|
||||
return(false);
|
||||
}
|
||||
|
||||
while(query.next())
|
||||
{
|
||||
cMonthlyBooking* lpBooking = add(query.value("datum").toDate());
|
||||
|
||||
if(lpBooking)
|
||||
{
|
||||
lpBooking->setUeberstunden(query.value("ueberstunden").toTime());
|
||||
}
|
||||
}
|
||||
|
||||
return(true);
|
||||
}
|
||||
|
||||
cMonthlyBooking* cMonthlyBookingList::add(const QDate& date)
|
||||
{
|
||||
if(find(date))
|
||||
return(nullptr);
|
||||
|
||||
cMonthlyBooking* lpVacation = new cMonthlyBooking(date);
|
||||
append(lpVacation);
|
||||
return(lpVacation);
|
||||
}
|
||||
|
||||
cMonthlyBooking* cMonthlyBookingList::find(const QDate& date)
|
||||
{
|
||||
for(cMonthlyBookingList::iterator i = begin();i != end(); i++)
|
||||
{
|
||||
if((*i)->date() == date)
|
||||
return(*i);
|
||||
}
|
||||
return(nullptr);
|
||||
}
|
||||
|
||||
cMonthlyBooking* cMonthlyBookingList::get(const QDate& date)
|
||||
{
|
||||
for(cMonthlyBookingList::iterator i = begin();i != end(); i++)
|
||||
{
|
||||
if((*i)->date() <= date)
|
||||
return(*i);
|
||||
}
|
||||
return(nullptr);
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
#ifndef CMONTHLYBOOKING_H
|
||||
#define CMONTHLYBOOKING_H
|
||||
|
||||
|
||||
#include <QMetaType>
|
||||
#include <QList>
|
||||
#include <QObject>
|
||||
#include <QDate>
|
||||
#include <QTime>
|
||||
|
||||
|
||||
class cMonthlyBooking : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit cMonthlyBooking(const QDate& date, QObject *parent = nullptr);
|
||||
|
||||
QDate date();
|
||||
|
||||
void setUeberstunden(const QTime& time);
|
||||
QTime ueberstunden();
|
||||
|
||||
bool save();
|
||||
|
||||
private:
|
||||
QDate m_date;
|
||||
QTime m_ueberstunden;
|
||||
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(cMonthlyBooking*)
|
||||
|
||||
class cMonthlyBookingList : public QList<cMonthlyBooking*>
|
||||
{
|
||||
public:
|
||||
bool load();
|
||||
cMonthlyBooking* add(const QDate& date);
|
||||
cMonthlyBooking* find(const QDate& date);
|
||||
cMonthlyBooking* get(const QDate& date);
|
||||
};
|
||||
|
||||
#endif // CMONTHLYBOOKING_H
|
||||
+22
-3
@@ -6,13 +6,15 @@
|
||||
#include <QDebug>
|
||||
|
||||
|
||||
cMonthlyView::cMonthlyView(const QDate& date, cPublicHoliday *lpPublicHoliday, cBookingList* lpBookingList, QWidget *parent) :
|
||||
cMonthlyView::cMonthlyView(const QDate& date, cMonthlyBookingList* lpMonthlyBookingList, cPublicHoliday *lpPublicHoliday, cBookingList* lpBookingList, QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::cMonthlyView),
|
||||
m_loading(true),
|
||||
m_lpMonthlyBookingList(lpMonthlyBookingList),
|
||||
m_lpPublicHoliday(lpPublicHoliday),
|
||||
m_lpBookingList(lpBookingList),
|
||||
m_date(date)
|
||||
m_date(date),
|
||||
m_lpMonthlyBooking(nullptr)
|
||||
{
|
||||
m_code.insert(" ", tr(""));
|
||||
m_code.insert("G", tr("Gleitzeit"));
|
||||
@@ -46,6 +48,7 @@ cMonthlyView::cMonthlyView(const QDate& date, cPublicHoliday *lpPublicHoliday, c
|
||||
connect(static_cast<cMonthlyItemDelegate*>(ui->m_lpMonthlyList->itemDelegate()), &cMonthlyItemDelegate::textChanged, this, &cMonthlyView::onTextChanged);
|
||||
|
||||
connect(ui->m_lpMonth, &QDateEdit::dateChanged, this, &cMonthlyView::onDateChanged);
|
||||
connect(ui->m_lpUeberstunden, &QTimeEdit::timeChanged, this, &cMonthlyView::onUeberstundenChanged);
|
||||
}
|
||||
|
||||
void cMonthlyView::setDate(const QDate& date)
|
||||
@@ -99,6 +102,13 @@ void cMonthlyView::setDate(const QDate& date)
|
||||
QDate date1 = date;
|
||||
date1.setDate(date.year(), date.month(), 1);
|
||||
|
||||
m_lpMonthlyBooking = m_lpMonthlyBookingList->find(date1);
|
||||
if(!m_lpMonthlyBooking)
|
||||
{
|
||||
m_lpMonthlyBooking = m_lpMonthlyBookingList->add(date1);
|
||||
m_lpMonthlyBooking->save();
|
||||
}
|
||||
|
||||
for(;date1.month() == date.month();date1 = date1.addDays(1))
|
||||
{
|
||||
cBooking* lpBooking = m_lpBookingList->find(date1);
|
||||
@@ -186,6 +196,7 @@ void cMonthlyView::setDate(const QDate& date)
|
||||
ui->m_lpShouldLabel->setText(QString(tr("SOLL Arbeitszeit (%1):")).arg(date.toString("MMMM yyyy")));
|
||||
ui->m_lpIsLabel->setText(QString(tr("IST Arbeitszeit (%1):")).arg(date.toString("MMMM yyyy")));
|
||||
ui->m_lpResturlaubLabel->setText(QString(tr("Resturlaub %1:")).arg(date.addMonths(-1).toString("MMMM yyyy")));
|
||||
ui->m_lpUeberstunden->setTime(m_lpMonthlyBooking->ueberstunden());
|
||||
|
||||
displaySummary();
|
||||
|
||||
@@ -296,6 +307,14 @@ void cMonthlyView::onDateChanged(const QDate& date)
|
||||
setDate(date);
|
||||
}
|
||||
|
||||
void cMonthlyView::onUeberstundenChanged(const QTime& time)
|
||||
{
|
||||
m_lpMonthlyBooking->setUeberstunden(time);
|
||||
m_lpMonthlyBooking->save();
|
||||
|
||||
displaySummary();
|
||||
}
|
||||
|
||||
void cMonthlyView::setBackground(const int day, const QString& code)
|
||||
{
|
||||
QBrush brush;
|
||||
@@ -393,7 +412,7 @@ void cMonthlyView::displaySummary()
|
||||
ui->m_lpShould->setText(secs2String(soll));
|
||||
ui->m_lpIs->setText(secs2String(ist));
|
||||
ui->m_lpSaldo->setText(secs2String(ist-soll));
|
||||
ui->m_lpUebertragNaechsterMonat->setText(secs2String(lpFirstBooking->prevDiff()+ist-soll));
|
||||
ui->m_lpUebertragNaechsterMonat->setText(secs2String(lpFirstBooking->prevDiff()+ist-soll-time2Secs(m_lpMonthlyBooking->ueberstunden())));
|
||||
ui->m_lpResturlaub->setText(QString::number(lpFirstBooking->vacation()));
|
||||
ui->m_lpUebertragUrlaub->setText(QString::number(lpFirstBooking->vacation()-u));
|
||||
|
||||
|
||||
+5
-1
@@ -2,6 +2,7 @@
|
||||
#define CMONTHLYVIEW_H
|
||||
|
||||
|
||||
#include "cmonthlybooking.h"
|
||||
#include "cmonthlyitemdelegate.h"
|
||||
#include "cpublicholiday.h"
|
||||
|
||||
@@ -22,7 +23,7 @@ class cMonthlyView : public QWidget
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit cMonthlyView(const QDate& date, cPublicHoliday* lpPublicHoliday, cBookingList* lpBookingList, QWidget *parent = nullptr);
|
||||
explicit cMonthlyView(const QDate& date, cMonthlyBookingList* lpMonthlyBookingList, cPublicHoliday* lpPublicHoliday, cBookingList* lpBookingList, QWidget *parent = nullptr);
|
||||
~cMonthlyView();
|
||||
|
||||
void setDate(const QDate& date);
|
||||
@@ -31,9 +32,11 @@ private:
|
||||
bool m_loading;
|
||||
QStandardItemModel* m_lpMonthlyListModel;
|
||||
QMap<QString, QString> m_code;
|
||||
cMonthlyBookingList* m_lpMonthlyBookingList;
|
||||
cPublicHoliday* m_lpPublicHoliday;
|
||||
cBookingList* m_lpBookingList;
|
||||
QDate m_date;
|
||||
cMonthlyBooking* m_lpMonthlyBooking;
|
||||
|
||||
void setBackground(const int day, const QString& code);
|
||||
void setText(QStandardItem* lpItem, const QTime& time);
|
||||
@@ -45,6 +48,7 @@ private slots:
|
||||
void onTimeChanged(const int day, const int field, const QTime& time);
|
||||
void onTextChanged(const int day, const int field, const QString& text);
|
||||
void onDateChanged(const QDate& date);
|
||||
void onUeberstundenChanged(const QTime& time);
|
||||
};
|
||||
|
||||
#endif // CMONTHLYVIEW_H
|
||||
|
||||
+11
-1
@@ -11,13 +11,23 @@ QString secs2String(const qint32& secs)
|
||||
{
|
||||
QTime t;
|
||||
qint32 h = secs/3600;
|
||||
bool neg = false;
|
||||
|
||||
if(secs < 0)
|
||||
{
|
||||
t = QTime(0, 0, 0).addSecs(-secs);
|
||||
h = -h;
|
||||
neg = true;
|
||||
}
|
||||
else
|
||||
t = QTime(0, 0, 0).addSecs(secs);
|
||||
|
||||
return(QString::number(h) + t.toString(":mm:ss"));
|
||||
return((neg ? "-" : "") + QString::number(h) + t.toString(":mm:ss"));
|
||||
}
|
||||
|
||||
qint32 time2Secs(const QTime& time)
|
||||
{
|
||||
return(time.hour()*3600+time.minute()*60+time.second());
|
||||
}
|
||||
|
||||
#endif //COMMON_H
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
#include <QString>
|
||||
#include <QColor>
|
||||
#include <QTime>
|
||||
|
||||
|
||||
#define COL_DAY1 0
|
||||
@@ -40,6 +41,7 @@
|
||||
|
||||
|
||||
QString secs2String(const qint32& secs);
|
||||
qint32 time2Secs(const QTime& time);
|
||||
|
||||
|
||||
#endif // COMMON_H
|
||||
|
||||
@@ -12,7 +12,6 @@ cVacation::cVacation(const QDate& date, QObject *parent) :
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
QDate cVacation::date()
|
||||
{
|
||||
return(m_date);
|
||||
|
||||
@@ -27,6 +27,7 @@ CONFIG += c++11
|
||||
SOURCES += \
|
||||
cbooking.cpp \
|
||||
cdailyworking.cpp \
|
||||
cmonthlybooking.cpp \
|
||||
cmonthlyitemdelegate.cpp \
|
||||
cmonthlyview.cpp \
|
||||
common.cpp \
|
||||
@@ -39,6 +40,7 @@ HEADERS += \
|
||||
cbooking.h \
|
||||
cdailyworking.h \
|
||||
cmainwindow.h \
|
||||
cmonthlybooking.h \
|
||||
cmonthlyitemdelegate.h \
|
||||
cmonthlyview.h \
|
||||
common.h \
|
||||
|
||||
Reference in New Issue
Block a user