Implemented camp wizard and service methods for camp calculation.

master
Josef Rokos 8 years ago
parent 9a087e1874
commit b0f129f38d

@ -0,0 +1,27 @@
#include "addservicedialog.h"
#include "ui_addservicedialog.h"
AddServiceDialog::AddServiceDialog(AccServicePtr service, QWidget *parent) :
QDialog(parent),
ui(new Ui::AddServiceDialog)
{
ui->setupUi(this);
ui->editName->setText(service->accServiceName());
ui->editPrice->setValue(service->price().toDouble());
}
AddServiceDialog::~AddServiceDialog()
{
delete ui;
}
QString AddServiceDialog::description()
{
return ui->editDescription->text();
}
QDecDouble AddServiceDialog::price()
{
return QDecDouble(ui->editPrice->value());
}

@ -0,0 +1,27 @@
#ifndef ADDSERVICEDIALOG_H
#define ADDSERVICEDIALOG_H
#include <QDialog>
#include <QDecDouble.hh>
#include <data/accservice.h>
namespace Ui {
class AddServiceDialog;
}
class AddServiceDialog : public QDialog
{
Q_OBJECT
public:
explicit AddServiceDialog(AccServicePtr service, QWidget *parent = 0);
~AddServiceDialog();
QString description();
QDecDouble price();
private:
Ui::AddServiceDialog *ui;
};
#endif // ADDSERVICEDIALOG_H

@ -0,0 +1,105 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>AddServiceDialog</class>
<widget class="QDialog" name="AddServiceDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>143</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Service name</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="editName">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="6" column="0" colspan="2">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="editDescription"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Description</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QDoubleSpinBox" name="editPrice">
<property name="buttonSymbols">
<enum>QAbstractSpinBox::NoButtons</enum>
</property>
<property name="maximum">
<double>999999.989999999990687</double>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Price</string>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>AddServiceDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>AddServiceDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

@ -25,3 +25,8 @@ QTranslator *Camp::translator()
{ {
return translatorFrom(":/translations/camp_"); return translatorFrom(":/translations/camp_");
} }
bool Camp::hasNumberSeries()
{
return true;
}

@ -23,6 +23,7 @@ protected:
public: public:
virtual QIcon pluginIcon(); virtual QIcon pluginIcon();
QTranslator *translator(); QTranslator *translator();
bool hasNumberSeries();
}; };
#endif // CAMP_H #endif // CAMP_H

@ -8,7 +8,7 @@
"default" : "", "default" : "",
"CZ" : "" "CZ" : ""
}, },
"schemaVersion" : 3, "schemaVersion" : 5,
"sql" : [ "sql" : [
"CREATE TABLE \"CampData\" ( "CREATE TABLE \"CampData\" (
\"id\" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, \"id\" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
@ -80,8 +80,17 @@ CREATE TABLE \"PersonPrice\" (
", ",
"ALTER TABLE AddressItem ADD \"owner\" INTEGER NULL; "ALTER TABLE AddressItem ADD \"owner\" INTEGER NULL;
" ",
"ALTER TABLE ServiceItem ADD \"sale\" INTEGER NULL;
ALTER TABLE ServiceItem ADD \"description\" TEXT NULL;
",
"ALTER TABLE ServiceItem ADD \"totalPrice\" INTEGER NULL;
ALTER TABLE ServiceItem ADD \"fullPrice\" INTEGER NULL;
ALTER TABLE CampData ADD \"fullPrice\" INTEGER NULL;
ALTER TABLE CampData ADD \"totalSale\" INTEGER NULL;
"
], ],
"dependencies" : [ "ADDRESSBOOK", "SHOP", "SERVICES" ], "dependencies" : [ "ADDRESSBOOK", "SHOP", "SERVICES" ],
"translations" : { "translations" : {

@ -33,7 +33,8 @@ SOURCES += camp.cpp \
data/personprice.cpp \ data/personprice.cpp \
settings/campsettings.cpp \ settings/campsettings.cpp \
campwizard.cpp \ campwizard.cpp \
campservice.cpp campservice.cpp \
addservicedialog.cpp
HEADERS += camp.h\ HEADERS += camp.h\
camp_global.h \ camp_global.h \
@ -48,7 +49,8 @@ HEADERS += camp.h\
data/personprice.h \ data/personprice.h \
settings/campsettings.h \ settings/campsettings.h \
campwizard.h \ campwizard.h \
campservice.h campservice.h \
addservicedialog.h
include(../config_plugin.pri) include(../config_plugin.pri)
@ -94,4 +96,5 @@ RESOURCES += \
FORMS += \ FORMS += \
campform.ui \ campform.ui \
settings/campsettingsform.ui \ settings/campsettingsform.ui \
campwizard.ui campwizard.ui \
addservicedialog.ui

@ -10,9 +10,14 @@ CampGrid::CampGrid(QWidget *parent) : GridForm<CampData>(parent)
void CampGrid::handleNewRecord() void CampGrid::handleNewRecord()
{ {
CampService srv; CampService srv;
CampDataPtr data = srv.create();
CampWizard *wizard = new CampWizard(); CampWizard *wizard = new CampWizard();
wizard->setAttribute(Qt::WA_DeleteOnClose); wizard->setAttribute(Qt::WA_DeleteOnClose);
wizard->setData(srv.create()); wizard->setData(data);
connect(wizard, &QDialog::accepted, [this, data](){
addRow(data);
});
wizard->show(); wizard->show();
} }

@ -1,7 +1,14 @@
#include "campservice.h" #include "campservice.h"
#include <settingsservice.h>
#include <seasonservice.h>
#include <numberseriesservice.h>
#include <math.h>
CampService::CampService() CampService::CampService()
{ {
SettingsService srv("CAMP");
m_settings = srv.loadSettings<CampSettings>();
m_pluginId = "CAMP";
} }
void CampService::addPerson(CampDataPtr data, AddressbookDataPtr address) void CampService::addPerson(CampDataPtr data, AddressbookDataPtr address)
@ -22,6 +29,26 @@ void CampService::addPerson(CampDataPtr data, AddressbookDataPtr address)
data->addPerson(addrItem); data->addPerson(addrItem);
} }
void CampService::addService(CampDataPtr data, AccServicePtr service)
{
ServiceItemPtr serviceItem(new ServiceItem);
serviceItem->setName(service->accServiceName());
serviceItem->setCode(service->accServiceCode());
serviceItem->setPrice(service->price());
serviceItem->setSalePossible(service->salePossible());
serviceItem->setType(service->serviceType());
data->addServiceItem(serviceItem);
}
void CampService::addService(CampDataPtr data, AccServicePtr service, QDecDouble price, QString description)
{
ServiceItemPtr item = addServiceInt(data, service);
item->setPrice(price);
item->setDescription(description);
}
void CampService::setOwner(CampDataPtr data, AddressItemPtr person) void CampService::setOwner(CampDataPtr data, AddressItemPtr person)
{ {
foreach (AddressItemPtr p, data->people()) { foreach (AddressItemPtr p, data->people()) {
@ -43,3 +70,217 @@ CampDataPtr CampService::create()
return data; return data;
} }
void CampService::calculate(CampDataPtr data)
{
calcServices(data);
calcPeople(data);
calcPrice(data);
}
void CampService::saveCamp(CampDataPtr data)
{
if (!checkPermission(PERM_ADD))
{
return;
}
SeasonService seasonSrv;
SeasonPtr season = seasonSrv.active();
data->setSeason(season);
Transaction tr;
try
{
odb::database *db = Context::instance().db();
NumberSeriesService numSrv;
data->setNumSer(numSrv.nextStrForPlugin("CAMP"));
db->persist(data);
foreach (ServiceItemPtr item, data->services()) {
item->setCampData(data.toWeakRef());
db->persist(item);
}
foreach (AddressItemPtr item, data->people()) {
item->setCampData(data.toWeakRef());
db->persist(item);
}
tr.commit();
}
catch (const odb::exception &ex)
{
emit dbError(ex.what());
emit dbErrorUpdate(ex.what());
return;
}
}
void CampService::calcPeople(CampDataPtr data)
{
foreach (ServiceItemPtr service, data->services()) {
if (service->type() == AccService::ACCFEE)
{
data->removeServiceItem(service);
}
}
Service<PersonPrice> srvPrices;
QList<PersonPricePtr> prices = srvPrices.all("active = 1");
int days = data->start().daysTo(data->end());
foreach (AddressItemPtr item, data->people()) {
QDate first(1,1,1);
qint64 daysStart = item->adbItem()->birthDate().daysTo(data->start());
first = first.addDays(daysStart);
int startAge = first.year() - 1;
first = QDate(1,1,1);
qint64 daysEnd = item->adbItem()->birthDate().daysTo(data->end());
first = first.addDays(daysEnd);
int endAge = first.year() - 1;
if (!item->personPrice().isNull())
{
item->setPrice(item->personPrice()->price() * days);
addAccFee(data, item, startAge, endAge, days);
continue;
}
else
{
item->setPrice(0);
}
foreach (PersonPricePtr price, prices) {
if (price->fromAge() <= endAge && price->toAge() >= endAge)
{
item->setPersonPrice(price);
item->setPrice(price->price() * days);
break;
}
}
if (item->adbItem()->ztp())
{
continue;
}
addAccFee(data, item, startAge, endAge, days);
}
}
void CampService::calcServices(CampDataPtr data)
{
QDecDouble sale = data->sale();
bool fixedSale = data->fixedSale();
int days = data->start().daysTo(data->end());
foreach (ServiceItemPtr item, data->services()) {
item->setFullPrice(item->price() * days);
if (sale != QDecDouble(0) && !fixedSale && item->salePossible())
{
QDecDouble itemSale = (item->fullPrice() * sale) / 100;
item->setSale(itemSale);
item->setTotalPrice(item->fullPrice() - itemSale);
}
else
{
item->setSale(0);
item->setTotalPrice(item->fullPrice());
}
}
}
void CampService::calcPrice(CampDataPtr data)
{
QDecDouble totalPrice(0);
QDecDouble sale(0);
foreach (ServiceItemPtr service, data->services()) {
totalPrice += service->totalPrice();
sale += service->sale();
}
foreach (AddressItemPtr addr, data->people()) {
totalPrice += addr->price();
}
if (data->fixedSale())
{
totalPrice -= data->sale();
sale = data->sale();
}
switch (m_settings->rounding()) {
case Enums::R_UP:
totalPrice = QDecDouble(ceil(totalPrice.toDouble() * pow(10, m_settings->decimalPlaces())) / pow(10, m_settings->decimalPlaces()));
break;
case Enums::R_DOWN:
totalPrice = QDecDouble(floor(totalPrice.toDouble() * pow(10, m_settings->decimalPlaces())) / pow(10, m_settings->decimalPlaces()));
break;
case Enums::R_MATH:
totalPrice = QDecDouble(round(totalPrice.toDouble() * pow(10, m_settings->decimalPlaces())) / pow(10, m_settings->decimalPlaces()));
break;
case Enums::R_NONE:
break;
}
data->setTotalPrice(totalPrice);
data->setTotalSale(sale);
}
void CampService::addAccFee(CampDataPtr data, AddressItemPtr item, int startAge, int endAge, int days)
{
auto addAccService = [this, item, data](int count){
ServiceItemPtr srvItem(new ServiceItem);
srvItem->setName(item->firstName() + " " + item->lastName());
srvItem->setDescription(m_settings->accFeeText());
srvItem->setPrice(m_settings->accFee());
srvItem->setTotalPrice(m_settings->accFee() * count);
srvItem->setFullPrice(srvItem->totalPrice());
srvItem->setType(AccService::ACCFEE);
srvItem->setSalePossible(false);
srvItem->setCampData(data);
data->addServiceItem(srvItem);
};
if (startAge == endAge || (startAge >= m_settings->accFeeStartAge() && startAge <= m_settings->accFeeEndAge()))
{
if (endAge >= m_settings->accFeeStartAge() && endAge <= m_settings->accFeeEndAge())
{
addAccService(days);
}
}
else
{
if (endAge >= m_settings->accFeeStartAge() && endAge <= m_settings->accFeeEndAge())
{
QDate tmp(data->end().year(), item->adbItem()->birthDate().month(), item->adbItem()->birthDate().day());
int count = tmp.daysTo(data->end());
addAccService(count);
}
}
}
ServiceItemPtr CampService::addServiceInt(CampDataPtr data, AccServicePtr service)
{
ServiceItemPtr serviceItem(new ServiceItem);
serviceItem->setName(service->accServiceName());
serviceItem->setCode(service->accServiceCode());
serviceItem->setPrice(service->price());
serviceItem->setSalePossible(service->salePossible());
serviceItem->setType(service->serviceType());
serviceItem->setCampData(data);
data->addServiceItem(serviceItem);
return serviceItem;
}

@ -3,7 +3,9 @@
#include <core.h> #include <core.h>
#include <addressbookdata.h> #include <addressbookdata.h>
#include <accservice.h>
#include "data/camp-data.h" #include "data/camp-data.h"
#include "settings/campsettings.h"
#include "camp-odb.hxx" #include "camp-odb.hxx"
class CampService : public Service<CampData> class CampService : public Service<CampData>
@ -11,8 +13,20 @@ class CampService : public Service<CampData>
public: public:
CampService(); CampService();
void addPerson(CampDataPtr data, AddressbookDataPtr address); void addPerson(CampDataPtr data, AddressbookDataPtr address);
void addService(CampDataPtr data, AccServicePtr service);
void addService(CampDataPtr data, AccServicePtr service, QDecDouble price, QString description);
void setOwner(CampDataPtr data, AddressItemPtr person); void setOwner(CampDataPtr data, AddressItemPtr person);
CampDataPtr create(); CampDataPtr create();
void calculate(CampDataPtr data);
void saveCamp(CampDataPtr data);
private:
ServiceItemPtr addServiceInt(CampDataPtr data, AccServicePtr service);
void calcPeople(CampDataPtr data);
void calcServices(CampDataPtr data);
void calcPrice(CampDataPtr data);
void addAccFee(CampDataPtr data, AddressItemPtr item, int startAge, int endAge, int days);
CampSettingsPtr m_settings;
}; };
#endif // CAMPSERVICE_H #endif // CAMPSERVICE_H

@ -1,9 +1,16 @@
#include "campwizard.h" #include "campwizard.h"
#include "ui_campwizard.h" #include "ui_campwizard.h"
#include "campservice.h" #include "campservice.h"
#include "addservicedialog.h"
#include <core.h> #include <core.h>
#include <addressbookservice.h> #include <addressbookservice.h>
#include <accservice.h>
////////////////////////////////////
/// \brief AddressHelper::AddressHelper
/// \param parent
///
AddressHelper::AddressHelper(QObject *parent) AddressHelper::AddressHelper(QObject *parent)
:QObject(parent) :QObject(parent)
{ {
@ -51,6 +58,39 @@ AddressbookDataPtr AddressHelper::copyAddress()
return m_copyAddress; return m_copyAddress;
} }
//////////////////////////////////////////////////////////////
/// \brief SaleHelper::SaleHelper
/// \param parent
///
SaleHelper::SaleHelper(QObject *parent) :QObject(parent)
{
m_sale = SalePtr(new Sale);
}
SalePtr SaleHelper::salePtr() const
{
return m_sale;
}
void SaleHelper::setSalePtr(const SalePtr &sale)
{
m_sale = sale;
}
QSharedPointer<QObject> SaleHelper::sale() const
{
return m_sale;
}
void SaleHelper::setSale(const QSharedPointer<QObject> &sale)
{
if (qobject_cast<Sale*>(sale.data()) != NULL)
{
m_sale = qSharedPointerDynamicCast<Sale, QObject>(sale);
emit saleChanged();
}
}
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
/// \brief CampWizard::CampWizard /// \brief CampWizard::CampWizard
/// \param parent /// \param parent
@ -76,6 +116,8 @@ CampWizard::CampWizard(QWidget *parent) :
m_dataBinder = new ObjectBinder(this); m_dataBinder = new ObjectBinder(this);
m_dataBinder->registerBinding(ui->start); m_dataBinder->registerBinding(ui->start);
m_dataBinder->registerBinding(ui->end); m_dataBinder->registerBinding(ui->end);
m_dataBinder->registerBinding(ui->totalPrice);
m_dataBinder->registerBinding(ui->totalSale);
m_addrHelper = new AddressHelper(this); m_addrHelper = new AddressHelper(this);
@ -103,6 +145,47 @@ CampWizard::CampWizard(QWidget *parent) :
m_addressBinder->bindToUi(); m_addressBinder->bindToUi();
m_bindAddrCombo = true; m_bindAddrCombo = true;
Service<AccService> serviceSrv;
m_servicesModel = new AutoTableModel<AccService>(this);
m_servicesModel->setData(serviceSrv.all());
ui->tableServices->setModel(m_servicesModel);
ui->tableServices->hideColumn(1);
ui->tableServices->hideColumn(3);
ui->tableServices->hideColumn(4);
ui->tableServices->hideColumn(5);
ui->tableServices->hideColumn(6);
ui->tableServices->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Stretch);
m_itemsModel = new AutoTableModel<ServiceItem>();
ui->tableItems->setModel(m_itemsModel);
ui->tableItems->hideColumn(1);
ui->tableItems->hideColumn(4);
ui->tableItems->hideColumn(5);
ui->tableItems->hideColumn(6);
ui->tableItems->horizontalHeader()->setSectionResizeMode(2, QHeaderView::Stretch);
connect(ui->tableServices->selectionModel(), &QItemSelectionModel::currentRowChanged, [this](QModelIndex current, QModelIndex){
ui->btnAddService->setEnabled(current.isValid());
});
connect(ui->tableItems->selectionModel(), &QItemSelectionModel::currentRowChanged, [this](QModelIndex, QModelIndex){
ui->btnRemoveService->setEnabled(!m_data->services().isEmpty());
});
m_saleHelper = new SaleHelper(this);
m_saleBinder = new ObjectBinder(this);
Service<Sale> saleSrv;
m_saleBinder->registerBinding(ui->sale, ComboData::createComboData(saleSrv.all()));
m_saleBinder->setData(m_saleHelper);
m_saleBinder->bindToUi();
ui->tabPeople->setModel(m_peopleModel);
ui->tabServices->setModel(m_itemsModel);
} }
CampWizard::~CampWizard() CampWizard::~CampWizard()
@ -117,6 +200,9 @@ void CampWizard::setData(const CampDataPtr &data)
m_dataBinder->setData(data.data()); m_dataBinder->setData(data.data());
m_dataBinder->bindToUi(); m_dataBinder->bindToUi();
m_addrHelperBinder->bindToUi(); m_addrHelperBinder->bindToUi();
m_peopleModel->setData(data->people());
m_itemsModel->setData(data->services());
} }
void CampWizard::on_btnAdd_clicked() void CampWizard::on_btnAdd_clicked()
@ -192,5 +278,119 @@ void CampWizard::on_groupNew_clicked(bool checked)
void CampWizard::on_CampWizard_currentIdChanged(int id) void CampWizard::on_CampWizard_currentIdChanged(int id)
{ {
if (id == 2)
{
CampService srv;
srv.calculate(m_data);
m_dataBinder->bindToUi();
m_itemsModel->setData(m_data->services());
ui->lFrom->setText(m_data->start().toString());
ui->lTo->setText(m_data->end().toString());
ui->lDays->setText(QString::number(m_data->start().daysTo(m_data->end())));
ui->lOwner->setText(m_data->ownerAddress());
}
}
void CampWizard::on_btnAddService_clicked()
{
AccServicePtr service = m_servicesModel->itemFromIndex(ui->tableServices->currentIndex());
AddServiceDialog *dialog = new AddServiceDialog(service, this);
dialog->setAttribute(Qt::WA_DeleteOnClose);
connect(dialog, &QDialog::accepted, [=](){
CampService srv;
srv.addService(m_data, service, dialog->price(), dialog->description());
m_itemsModel->setData(m_data->services());
});
dialog->show();
}
void CampWizard::on_btnRemoveService_clicked()
{
ServiceItemPtr item = m_itemsModel->itemFromIndex(ui->tableItems->currentIndex());
m_data->removeServiceItem(item);
m_itemsModel->setData(m_data->services());
ui->btnRemoveService->setEnabled(false);
}
void CampWizard::on_checkSale_clicked()
{
ui->sale->setEnabled(ui->checkSale->isChecked());
applySale();
}
void CampWizard::applySale()
{
if (m_data.isNull())
{
return;
}
if (ui->checkSale->isChecked())
{
m_saleBinder->bindToData();
m_data->setSale(m_saleHelper->salePtr()->sale());
m_data->setFixedSale(m_saleHelper->salePtr()->fixed());
}
else
{
m_data->setSale(QDecDouble(0));
}
}
void CampWizard::on_sale_currentIndexChanged(int)
{
applySale();
}
bool CampWizard::validateCurrentPage()
{
m_dataBinder->bindToData();
if (currentPage() == ui->peoplePage && m_data->people().isEmpty())
{
QMessageBox::critical(this, tr("Error"), tr("Add people."));
return false;
}
if (currentPage() == ui->peoplePage && m_data->start() >= m_data->end())
{
QMessageBox::critical(this, tr("Error"), tr("Start date is after or equals end date."));
return false;
}
if (currentPage() == ui->servicePage && m_data->services().isEmpty())
{
QMessageBox::critical(this, tr("Error"), tr("Add service."));
return false;
}
return true;
}
void CampWizard::accept()
{
CampService srv;
srv.saveCamp(m_data);
bool success = true;
connect(&srv, &IService::dbError, [this, &success](QString msg){
QMessageBox::critical(this, tr("Database error"), tr(msg.toStdString().c_str()));
success = false;
});
connect(&srv, &IService::permissionDenied, [this, &success](QString msg){
QMessageBox::critical(this, "Permission denied", msg.toStdString().c_str());
success = false;
});
if (success)
{
QDialog::accept();
}
} }

@ -5,6 +5,7 @@
#include "data/camp-data.h" #include "data/camp-data.h"
#include <objectbinder.h> #include <objectbinder.h>
#include <data/addressbookdata.h> #include <data/addressbookdata.h>
#include <data/accservice.h>
#include <core.h> #include <core.h>
class AddressHelper : public QObject class AddressHelper : public QObject
@ -29,6 +30,27 @@ private:
AddressbookDataPtr m_copyAddress; AddressbookDataPtr m_copyAddress;
}; };
class SaleHelper : public QObject
{
Q_OBJECT
Q_PROPERTY(QSharedPointer<QObject> sale READ sale WRITE setSale NOTIFY saleChanged)
public:
SaleHelper(QObject *parent = NULL);
SalePtr salePtr() const;
void setSalePtr(const SalePtr &sale);
QSharedPointer<QObject> sale() const;
void setSale(const QSharedPointer<QObject> &sale);
signals:
void saleChanged();
private:
SalePtr m_sale;
};
namespace Ui { namespace Ui {
class CampWizard; class CampWizard;
} }
@ -56,6 +78,16 @@ private slots:
void on_CampWizard_currentIdChanged(int id); void on_CampWizard_currentIdChanged(int id);
void on_btnAddService_clicked();
void on_btnRemoveService_clicked();
void on_checkSale_clicked();
void applySale();
void on_sale_currentIndexChanged(int index);
private: private:
Ui::CampWizard *ui; Ui::CampWizard *ui;
CampDataPtr m_data; CampDataPtr m_data;
@ -63,9 +95,21 @@ private:
ObjectBinder *m_addrHelperBinder; ObjectBinder *m_addrHelperBinder;
ObjectBinder *m_addressBinder; ObjectBinder *m_addressBinder;
AddressHelper *m_addrHelper; AddressHelper *m_addrHelper;
ObjectBinder *m_saleBinder;
SaleHelper *m_saleHelper;
AutoTableModel<AddressItem> *m_peopleModel; AutoTableModel<AddressItem> *m_peopleModel;
AutoTableModel<AccService> *m_servicesModel;
AutoTableModel<ServiceItem> *m_itemsModel;
bool m_bindAddrCombo; bool m_bindAddrCombo;
// QWizard interface
public:
bool validateCurrentPage();
// QDialog interface
public slots:
void accept();
}; };
#endif // CAMPWIZARD_H #endif // CAMPWIZARD_H

@ -268,7 +268,7 @@
<item row="0" column="1" colspan="3"> <item row="0" column="1" colspan="3">
<widget class="QComboBox" name="address"> <widget class="QComboBox" name="address">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding"> <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
@ -422,7 +422,7 @@
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout_3"> <layout class="QHBoxLayout" name="horizontalLayout_3">
<item> <item>
<widget class="QTableView" name="tableView_2"/> <widget class="QTableView" name="tableServices"/>
</item> </item>
<item> <item>
<widget class="QWidget" name="widget_2" native="true"> <widget class="QWidget" name="widget_2" native="true">
@ -441,14 +441,20 @@
</spacer> </spacer>
</item> </item>
<item> <item>
<widget class="QToolButton" name="toolButton"> <widget class="QToolButton" name="btnAddService">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text"> <property name="text">
<string>...</string> <string>...</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QToolButton" name="toolButton_2"> <widget class="QToolButton" name="btnRemoveService">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text"> <property name="text">
<string>...</string> <string>...</string>
</property> </property>
@ -471,7 +477,7 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QTableView" name="tableView_3"/> <widget class="QTableView" name="tableItems"/>
</item> </item>
</layout> </layout>
</widget> </widget>
@ -483,14 +489,18 @@
</property> </property>
<layout class="QGridLayout" name="gridLayout_2"> <layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0"> <item row="0" column="0">
<widget class="QCheckBox" name="checkBox_2"> <widget class="QCheckBox" name="checkSale">
<property name="text"> <property name="text">
<string>Apply sale</string> <string>Apply sale</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="0"> <item row="1" column="0">
<widget class="QComboBox" name="sale"/> <widget class="QComboBox" name="sale">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item> </item>
</layout> </layout>
</widget> </widget>
@ -525,7 +535,7 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLabel" name="label_17"> <widget class="QLabel" name="lFrom">
<property name="text"> <property name="text">
<string>TextLabel</string> <string>TextLabel</string>
</property> </property>
@ -539,7 +549,7 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLabel" name="label_19"> <widget class="QLabel" name="lTo">
<property name="text"> <property name="text">
<string>TextLabel</string> <string>TextLabel</string>
</property> </property>
@ -581,7 +591,7 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLabel" name="label_21"> <widget class="QLabel" name="lDays">
<property name="text"> <property name="text">
<string>TextLabel</string> <string>TextLabel</string>
</property> </property>
@ -603,6 +613,48 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item>
<widget class="QWidget" name="widget_10" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_9">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label_23">
<property name="text">
<string>Owner:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lOwner">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_7">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item> <item>
<widget class="QLabel" name="label_14"> <widget class="QLabel" name="label_14">
<property name="text"> <property name="text">
@ -611,7 +663,7 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QTableView" name="tableView_4"/> <widget class="QTableView" name="tabPeople"/>
</item> </item>
<item> <item>
<widget class="QLabel" name="label_15"> <widget class="QLabel" name="label_15">
@ -621,7 +673,7 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QTableView" name="tableView_5"/> <widget class="QTableView" name="tabServices"/>
</item> </item>
<item> <item>
<widget class="QWidget" name="widget_6" native="true"> <widget class="QWidget" name="widget_6" native="true">
@ -633,13 +685,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="1">
<widget class="QLabel" name="label_23">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item row="1" column="0"> <item row="1" column="0">
<widget class="QLabel" name="label_24"> <widget class="QLabel" name="label_24">
<property name="font"> <property name="font">
@ -654,15 +699,26 @@
</widget> </widget>
</item> </item>
<item row="1" column="1"> <item row="1" column="1">
<widget class="QLabel" name="label_25"> <widget class="QLineEdit" name="totalPrice">
<property name="font"> <property name="font">
<font> <font>
<weight>75</weight> <weight>75</weight>
<bold>true</bold> <bold>true</bold>
<kerning>true</kerning>
</font> </font>
</property> </property>
<property name="text"> <property name="frame">
<string>TextLabel</string> <bool>false</bool>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="totalSale">
<property name="frame">
<bool>false</bool>
</property> </property>
</widget> </widget>
</item> </item>
@ -725,19 +781,19 @@
<tabstop>btnRemove</tabstop> <tabstop>btnRemove</tabstop>
<tabstop>btnOwner</tabstop> <tabstop>btnOwner</tabstop>
<tabstop>tablePeople</tabstop> <tabstop>tablePeople</tabstop>
<tabstop>toolButton</tabstop> <tabstop>btnAddService</tabstop>
<tabstop>toolButton_2</tabstop> <tabstop>btnRemoveService</tabstop>
<tabstop>tableView_3</tabstop> <tabstop>tableItems</tabstop>
<tabstop>tableView_4</tabstop> <tabstop>tabPeople</tabstop>
<tabstop>tableView_5</tabstop> <tabstop>tabServices</tabstop>
<tabstop>pushButton_2</tabstop> <tabstop>pushButton_2</tabstop>
<tabstop>checkBox_2</tabstop> <tabstop>checkSale</tabstop>
<tabstop>sale</tabstop> <tabstop>sale</tabstop>
<tabstop>tableView_2</tabstop> <tabstop>tableServices</tabstop>
</tabstops> </tabstops>
<resources> <resources>
<include location="../core/rc.qrc"/>
<include location="camprc.qrc"/> <include location="camprc.qrc"/>
<include location="../core/rc.qrc"/>
</resources> </resources>
<connections/> <connections/>
</ui> </ui>

@ -6,6 +6,7 @@ CampData::CampData(QObject *parent) : QObject(parent)
m_id = 0; m_id = 0;
m_totalPrice = 0; m_totalPrice = 0;
m_sale = 0; m_sale = 0;
m_totalSale = 0;
m_ownerFirstame = false; m_ownerFirstame = false;
} }
@ -158,3 +159,23 @@ void CampData::setNumSer(const QString &numSer)
{ {
m_numSer = numSer; m_numSer = numSer;
} }
QDecDouble CampData::totalSale() const
{
return TO_DEC(m_totalSale);
}
void CampData::setTotalSale(QDecDouble totalSale)
{
m_totalSale = FROM_DEC(totalSale);
}
QDecDouble CampData::fullPrice() const
{
return TO_DEC(m_fullPrice);
}
void CampData::setFullPrice(QDecDouble fullPrice)
{
m_fullPrice = FROM_DEC(fullPrice);
}

@ -23,6 +23,7 @@ class CampData : public QObject
Q_PROPERTY(QDecDouble totalPrice READ totalPrice WRITE setTotalPrice) Q_PROPERTY(QDecDouble totalPrice READ totalPrice WRITE setTotalPrice)
Q_PROPERTY(QDecDouble sale READ sale WRITE setSale) Q_PROPERTY(QDecDouble sale READ sale WRITE setSale)
Q_PROPERTY(bool fixedSale READ fixedSale WRITE setFixedSale) Q_PROPERTY(bool fixedSale READ fixedSale WRITE setFixedSale)
Q_PROPERTY(QDecDouble totalSale READ totalSale WRITE setTotalSale)
public: public:
explicit CampData(QObject *parent = 0); explicit CampData(QObject *parent = 0);
@ -70,6 +71,12 @@ public:
QString numSer() const; QString numSer() const;
void setNumSer(const QString &numSer); void setNumSer(const QString &numSer);
QDecDouble totalSale() const;
void setTotalSale(QDecDouble totalSale);
QDecDouble fullPrice() const;
void setFullPrice(QDecDouble fullPrice);
private: private:
friend class odb::access; friend class odb::access;
#pragma db id auto #pragma db id auto
@ -84,8 +91,10 @@ private:
QOdbList<ServiceItemPtr> m_services; QOdbList<ServiceItemPtr> m_services;
#pragma db value_not_null inverse(m_campData) #pragma db value_not_null inverse(m_campData)
QOdbList<AddressItemPtr> m_people; QOdbList<AddressItemPtr> m_people;
int m_fullPrice;
int m_totalPrice; int m_totalPrice;
int m_sale; int m_sale;
int m_totalSale;
bool m_fixedSale; bool m_fixedSale;
SeasonPtr m_season; SeasonPtr m_season;
}; };

@ -1,7 +1,7 @@
#include "sale.h" #include "sale.h"
#include <define.h> #include <define.h>
Sale::Sale(QObject *parent) : QObject(parent) Sale::Sale(QObject *parent) : ComboItem(parent)
{ {
m_id = 0; m_id = 0;
m_sale = 0; m_sale = 0;
@ -47,3 +47,20 @@ void Sale::setDescription(const QString &description)
{ {
m_description = description; m_description = description;
} }
bool Sale::eq(ComboItem *other)
{
Sale *sale = qobject_cast<Sale*>(other);
if (sale == NULL)
{
return false;
}
return this->m_id == sale->m_id && this->m_sale == sale->m_sale && this->m_fixed == sale->m_fixed;
}
QString Sale::toString()
{
return m_description;
}

@ -4,9 +4,10 @@
#include <QObject> #include <QObject>
#include <odb/core.hxx> #include <odb/core.hxx>
#include <QDecDouble.hh> #include <QDecDouble.hh>
#include <combodata.h>
#pragma db object #pragma db object
class Sale : public QObject class Sale : public ComboItem
{ {
Q_OBJECT Q_OBJECT
Q_PROPERTY(QString description READ description WRITE setDescription) Q_PROPERTY(QString description READ description WRITE setDescription)
@ -35,6 +36,11 @@ private:
QString m_description; QString m_description;
int m_sale; int m_sale;
bool m_fixed; bool m_fixed;
// ComboItem interface
public:
bool eq(ComboItem *other);
QString toString();
}; };
#endif // SALE_H #endif // SALE_H

@ -5,7 +5,9 @@ ServiceItem::ServiceItem(QObject *parent) : QObject(parent)
{ {
m_id = 0; m_id = 0;
m_salePossible = false; m_salePossible = false;
m_sale = 0;
m_price = 0; m_price = 0;
m_totalPrice = 0;
m_type = AccService::OTHER; m_type = AccService::OTHER;
} }
@ -78,3 +80,43 @@ void ServiceItem::setCampData(const QWeakPointer<CampData> &campData)
{ {
m_campData = campData; m_campData = campData;
} }
QString ServiceItem::description() const
{
return m_description;
}
void ServiceItem::setDescription(const QString &description)
{
m_description = description;
}
QDecDouble ServiceItem::sale() const
{
return TO_DEC(m_sale);
}
void ServiceItem::setSale(QDecDouble sale)
{
m_sale = FROM_DEC(sale);
}
QDecDouble ServiceItem::totalPrice() const
{
return TO_DEC(m_totalPrice);
}
void ServiceItem::setTotalPrice(QDecDouble totalPrice)
{
m_totalPrice = FROM_DEC(totalPrice);
}
QDecDouble ServiceItem::fullPrice() const
{
return TO_DEC(m_fullPrice);
}
void ServiceItem::setFullPrice(QDecDouble fullPrice)
{
m_fullPrice = FROM_DEC(fullPrice);
}

@ -18,8 +18,10 @@ class ServiceItem : public QObject
Q_OBJECT Q_OBJECT
Q_PROPERTY(QString name READ name WRITE setName) Q_PROPERTY(QString name READ name WRITE setName)
Q_PROPERTY(QString code READ code WRITE setCode) Q_PROPERTY(QString code READ code WRITE setCode)
Q_PROPERTY(QString description READ description WRITE setDescription)
Q_PROPERTY(QDecDouble price READ price WRITE setPrice) Q_PROPERTY(QDecDouble price READ price WRITE setPrice)
Q_PROPERTY(bool salePossible READ salePossible WRITE setSalePossible) Q_PROPERTY(QDecDouble sale READ sale WRITE setSale)
Q_PROPERTY(QDecDouble totalPrice READ totalPrice WRITE setTotalPrice)
Q_PROPERTY(AccService::ServiceType type READ type WRITE setType) Q_PROPERTY(AccService::ServiceType type READ type WRITE setType)
Q_ENUMS(AccService::ServiceType) Q_ENUMS(AccService::ServiceType)
@ -47,13 +49,29 @@ public:
QWeakPointer<CampData> campData() const; QWeakPointer<CampData> campData() const;
void setCampData(const QWeakPointer<CampData> &campData); void setCampData(const QWeakPointer<CampData> &campData);
QString description() const;
void setDescription(const QString &description);
QDecDouble sale() const;
void setSale(QDecDouble sale);
QDecDouble totalPrice() const;
void setTotalPrice(QDecDouble totalPrice);
QDecDouble fullPrice() const;
void setFullPrice(QDecDouble fullPrice);
private: private:
friend class odb::access; friend class odb::access;
#pragma db id auto #pragma db id auto
int m_id; int m_id;
QString m_name; QString m_name;
QString m_code; QString m_code;
QString m_description;
int m_price; int m_price;
int m_fullPrice;
int m_totalPrice;
int m_sale;
bool m_salePossible; bool m_salePossible;
AccService::ServiceType m_type; AccService::ServiceType m_type;
#pragma db not_null #pragma db not_null

@ -38,3 +38,33 @@ void CampSettings::setDecimalPlaces(int decimalPlaces)
{ {
m_decimalPlaces = decimalPlaces; m_decimalPlaces = decimalPlaces;
} }
int CampSettings::accFeeStartAge() const
{
return m_accFeeStartAge;
}
void CampSettings::setAccFeeStartAge(int accFeeStartAge)
{
m_accFeeStartAge = accFeeStartAge;
}
int CampSettings::accFeeEndAge() const
{
return m_accFeeEndAge;
}
void CampSettings::setAccFeeEndAge(int accFeeEndAge)
{
m_accFeeEndAge = accFeeEndAge;
}
QString CampSettings::accFeeText() const
{
return m_accFeeText;
}
void CampSettings::setAccFeeText(const QString &accFeeText)
{
m_accFeeText = accFeeText;
}

@ -10,8 +10,11 @@ class CampSettings : public QObject
{ {
Q_OBJECT Q_OBJECT
Q_PROPERTY(QDecDouble accFee READ accFee WRITE setAccFee) Q_PROPERTY(QDecDouble accFee READ accFee WRITE setAccFee)
Q_PROPERTY(int accFeeStartAge READ accFeeStartAge WRITE setAccFeeStartAge)
Q_PROPERTY(int accFeeEndAge READ accFeeEndAge WRITE setAccFeeEndAge)
Q_PROPERTY(Enums::Rounding rounding READ rounding WRITE setRounding) Q_PROPERTY(Enums::Rounding rounding READ rounding WRITE setRounding)
Q_PROPERTY(int decimalPlaces READ decimalPlaces WRITE setDecimalPlaces) Q_PROPERTY(int decimalPlaces READ decimalPlaces WRITE setDecimalPlaces)
Q_PROPERTY(QString accFeeText READ accFeeText WRITE setAccFeeText)
public: public:
explicit CampSettings(QObject *parent = 0); explicit CampSettings(QObject *parent = 0);
@ -25,8 +28,20 @@ public:
int decimalPlaces() const; int decimalPlaces() const;
void setDecimalPlaces(int decimalPlaces); void setDecimalPlaces(int decimalPlaces);
int accFeeStartAge() const;
void setAccFeeStartAge(int accFeeStartAge);
int accFeeEndAge() const;
void setAccFeeEndAge(int accFeeEndAge);
QString accFeeText() const;
void setAccFeeText(const QString &accFeeText);
private: private:
int m_accFee; int m_accFee;
int m_accFeeStartAge;
int m_accFeeEndAge;
QString m_accFeeText;
Enums::Rounding m_rounding; Enums::Rounding m_rounding;
int m_decimalPlaces; int m_decimalPlaces;
}; };

@ -37,7 +37,10 @@ CampSettingsForm::CampSettingsForm(QWidget *parent) :
}); });
registerBinding(ui->accFee); registerBinding(ui->accFee);
registerBinding(ui->accFeeStartAge);
registerBinding(ui->accFeeEndAge);
registerBinding(ui->decimalPlaces); registerBinding(ui->decimalPlaces);
registerBinding(ui->accFeeText);
QList<ComboData> roundings ; QList<ComboData> roundings ;
roundings << ComboData(Enums::R_NONE, tr("None")) roundings << ComboData(Enums::R_NONE, tr("None"))
<< ComboData(Enums::R_UP, tr("Up")) << ComboData(Enums::R_UP, tr("Up"))

@ -6,214 +6,227 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>696</width> <width>995</width>
<height>489</height> <height>641</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Form</string> <string>Form</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QHBoxLayout" name="horizontalLayout_3">
<item> <item>
<widget class="QGroupBox" name="groupBox"> <widget class="QWidget" name="widget_3" native="true">
<property name="title"> <layout class="QVBoxLayout" name="verticalLayout">
<string>Person prices</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item> <item>
<widget class="QWidget" name="widget" native="true"> <widget class="QGroupBox" name="groupBox">
<layout class="QHBoxLayout" name="horizontalLayout"> <property name="title">
<property name="leftMargin"> <string>Person prices</string>
<number>0</number> </property>
</property> <layout class="QVBoxLayout" name="verticalLayout_2">
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QToolButton" name="btnPriceAdd">
<property name="toolTip">
<string>Add</string>
</property>
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="../../core/rc.qrc">
<normaloff>:/icons/new.svg</normaloff>:/icons/new.svg</iconset>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="btnPriceRemove">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Remove</string>
</property>
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="../../core/rc.qrc">
<normaloff>:/icons/remove.svg</normaloff>:/icons/remove.svg</iconset>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="btnPriceDisable">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Deactivate</string>
</property>
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="../../core/rc.qrc">
<normaloff>:/icons/ok.svg</normaloff>:/icons/ok.svg</iconset>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item> <item>
<widget class="QToolButton" name="btnPriceFilter"> <widget class="QWidget" name="widget" native="true">
<property name="toolTip"> <layout class="QHBoxLayout" name="horizontalLayout">
<string>Filter active</string> <property name="leftMargin">
</property> <number>0</number>
<property name="text"> </property>
<string>...</string> <property name="topMargin">
</property> <number>0</number>
<property name="icon"> </property>
<iconset resource="../../core/rc.qrc"> <property name="rightMargin">
<normaloff>:/icons/filter.svg</normaloff>:/icons/filter.svg</iconset> <number>0</number>
</property> </property>
<property name="checkable"> <property name="bottomMargin">
<bool>true</bool> <number>0</number>
</property> </property>
<property name="autoRaise"> <item>
<bool>true</bool> <widget class="QToolButton" name="btnPriceAdd">
</property> <property name="toolTip">
<string>Add</string>
</property>
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="../../core/rc.qrc">
<normaloff>:/icons/new.svg</normaloff>:/icons/new.svg</iconset>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="btnPriceRemove">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Remove</string>
</property>
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="../../core/rc.qrc">
<normaloff>:/icons/remove.svg</normaloff>:/icons/remove.svg</iconset>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="btnPriceDisable">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Deactivate</string>
</property>
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="../../core/rc.qrc">
<normaloff>:/icons/ok.svg</normaloff>:/icons/ok.svg</iconset>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="btnPriceFilter">
<property name="toolTip">
<string>Filter active</string>
</property>
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="../../core/rc.qrc">
<normaloff>:/icons/filter.svg</normaloff>:/icons/filter.svg</iconset>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<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>
</layout>
</widget> </widget>
</item> </item>
<item> <item>
<spacer name="horizontalSpacer"> <widget class="QTableView" name="tablePersonPrices">
<property name="orientation"> <property name="minimumSize">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size> <size>
<width>40</width> <width>550</width>
<height>20</height> <height>0</height>
</size> </size>
</property> </property>
</spacer> </widget>
</item> </item>
</layout> </layout>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QTableView" name="tablePersonPrices"/> <widget class="QGroupBox" name="groupBox_2">
</item> <property name="title">
</layout> <string>Sales</string>
</widget> </property>
</item> <layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>Sales</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QWidget" name="widget_2" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QToolButton" name="btnSaleAdd">
<property name="toolTip">
<string>Add</string>
</property>
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="../../core/rc.qrc">
<normaloff>:/icons/new.svg</normaloff>:/icons/new.svg</iconset>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item> <item>
<widget class="QToolButton" name="btnSaleRemove"> <widget class="QWidget" name="widget_2" native="true">
<property name="enabled"> <layout class="QHBoxLayout" name="horizontalLayout_2">
<bool>false</bool> <property name="leftMargin">
</property> <number>0</number>
<property name="toolTip"> </property>
<string>Remove</string> <property name="topMargin">
</property> <number>0</number>
<property name="text"> </property>
<string>...</string> <property name="rightMargin">
</property> <number>0</number>
<property name="icon"> </property>
<iconset resource="../../core/rc.qrc"> <property name="bottomMargin">
<normaloff>:/icons/remove.svg</normaloff>:/icons/remove.svg</iconset> <number>0</number>
</property> </property>
<property name="autoRaise"> <item>
<bool>true</bool> <widget class="QToolButton" name="btnSaleAdd">
</property> <property name="toolTip">
<string>Add</string>
</property>
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="../../core/rc.qrc">
<normaloff>:/icons/new.svg</normaloff>:/icons/new.svg</iconset>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="btnSaleRemove">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Remove</string>
</property>
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="../../core/rc.qrc">
<normaloff>:/icons/remove.svg</normaloff>:/icons/remove.svg</iconset>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget> </widget>
</item> </item>
<item> <item>
<spacer name="horizontalSpacer_2"> <widget class="QTableView" name="tableSales"/>
<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>
</layout> </layout>
</widget> </widget>
</item> </item>
<item>
<widget class="QTableView" name="tableSales"/>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>
@ -223,31 +236,31 @@
<string>Other settings</string> <string>Other settings</string>
</property> </property>
<layout class="QFormLayout" name="formLayout"> <layout class="QFormLayout" name="formLayout">
<item row="0" column="0"> <item row="2" column="0">
<widget class="QLabel" name="label"> <widget class="QLabel" name="label">
<property name="text"> <property name="text">
<string>Accommodation fee</string> <string>Accommodation fee</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="0"> <item row="6" column="0">
<widget class="QLabel" name="label_2"> <widget class="QLabel" name="label_2">
<property name="text"> <property name="text">
<string>Rounding</string> <string>Rounding</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="1"> <item row="6" column="1">
<widget class="QComboBox" name="rounding"/> <widget class="QComboBox" name="rounding"/>
</item> </item>
<item row="2" column="0"> <item row="7" column="0">
<widget class="QLabel" name="decimalPlaceslab"> <widget class="QLabel" name="decimalPlaceslab">
<property name="text"> <property name="text">
<string>Decimal places</string> <string>Decimal places</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="1"> <item row="7" column="1">
<widget class="QDoubleSpinBox" name="decimalPlaces"> <widget class="QDoubleSpinBox" name="decimalPlaces">
<property name="buttonSymbols"> <property name="buttonSymbols">
<enum>QAbstractSpinBox::NoButtons</enum> <enum>QAbstractSpinBox::NoButtons</enum>
@ -260,7 +273,21 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="1"> <item row="3" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Fee start age</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QSpinBox" name="accFeeStartAge">
<property name="buttonSymbols">
<enum>QAbstractSpinBox::NoButtons</enum>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QDoubleSpinBox" name="accFee"> <widget class="QDoubleSpinBox" name="accFee">
<property name="buttonSymbols"> <property name="buttonSymbols">
<enum>QAbstractSpinBox::NoButtons</enum> <enum>QAbstractSpinBox::NoButtons</enum>
@ -270,6 +297,30 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Fee end age</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QSpinBox" name="accFeeEndAge">
<property name="buttonSymbols">
<enum>QAbstractSpinBox::NoButtons</enum>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Fee description</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLineEdit" name="accFeeText"/>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>

@ -4,6 +4,7 @@
#include <QObject> #include <QObject>
#include <QString> #include <QString>
#include <QDecDouble.hh> #include <QDecDouble.hh>
#include <QSharedPointer>
#include <odb/core.hxx> #include <odb/core.hxx>
@ -28,7 +29,7 @@ public:
enum ServiceType { CAR,TENT,OTHER }; enum ServiceType { CAR,TENT,OTHER,ACCFEE };
int id() const; int id() const;
void setId(int id); void setId(int id);
@ -68,4 +69,7 @@ private:
Enums::VatType m_vatType; Enums::VatType m_vatType;
}; };
typedef QSharedPointer<AccService> AccServicePtr;
#endif // ACCSERVICE_H #endif // ACCSERVICE_H

Loading…
Cancel
Save