Added support for saving receipts.

This commit is contained in:
2016-05-29 18:31:46 +02:00
parent 9707ec7c66
commit facaf98cf0
14 changed files with 128 additions and 32 deletions
+4 -3
View File
@@ -3,6 +3,7 @@
Voucher::Voucher(QObject *parent) : QObject(parent)
{
m_id = 0;
m_vatRateHigh = 0;
m_vatRateFirstLower = 0;
m_vatRateSecondLower = 0;
@@ -196,17 +197,17 @@ void Voucher::setTotalPriceVatSecondLower(QDecDouble totalPriceVatSecondLower)
QDecDouble Voucher::vatAmountHigh()
{
return m_totalPriceVatHigh - m_priceVatHigh;
return TO_DEC(m_totalPriceVatHigh) - TO_DEC(m_priceVatHigh);
}
QDecDouble Voucher::vatAmountFirstLower()
{
return m_totalPriceVatFirstLower - m_priceVatFirstLower;
return TO_DEC(m_totalPriceVatFirstLower) - TO_DEC(m_priceVatFirstLower);
}
QDecDouble Voucher::VatAmountSecondLower()
{
return m_totalPriceVatSecondLower - m_priceVatSecondLower;
return TO_DEC(m_totalPriceVatSecondLower) - TO_DEC(m_priceVatSecondLower);
}
int Voucher::id() const
+1
View File
@@ -121,6 +121,7 @@ private:
int m_totalPriceVatFirstLower;
int m_totalPriceVatSecondLower;
int m_totalPrice;
#pragma db value_not_null inverse(m_voucher)
QOdbList<QSharedPointer<VoucherItem> > m_items;
VoucherStatus m_status;
};
+11 -1
View File
@@ -113,7 +113,17 @@ void VoucherItem::setPriceWitouthVat(QDecDouble priceWitouthVat)
QDecDouble VoucherItem::vatAmount() const
{
return m_price - m_priceWitouthVat;
return TO_DEC(m_price) - TO_DEC(m_priceWitouthVat);
}
QWeakPointer<Voucher> VoucherItem::voucher() const
{
return m_voucher;
}
void VoucherItem::setVoucher(const QWeakPointer<Voucher> &voucher)
{
m_voucher = voucher;
}
+8
View File
@@ -5,9 +5,12 @@
#include <QString>
#include <QDecDouble.hh>
#include <odb/core.hxx>
#include <QSharedPointer>
#include <enums.h>
class Voucher;
#pragma db object
class VoucherItem : public QObject
{
@@ -56,6 +59,9 @@ public:
QDecDouble vatAmount() const;
QWeakPointer<Voucher> voucher() const;
void setVoucher(const QWeakPointer<Voucher> &voucher);
signals:
void countChanged();
@@ -72,6 +78,8 @@ private:
int m_refId;
QString m_itemPlugin;
Enums::VatType m_vatType;
#pragma db not_null
QWeakPointer<Voucher> m_voucher;
};
#endif // VOUCHERITEM_H