You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

225 lines
6.6 KiB
C

#ifndef VOUCHER_H
#define VOUCHER_H
#include <QObject>
#include <QDecDouble.hh>
#include <QString>
#include <QSharedPointer>
#include <data/addressbookdata.h>
#include <data/season.h>
#include "../shop_global.h"
#include "voucheritem.h"
#include <QtCore/qglobal.h>
class SHOPSHARED_EXPORT Voucher : public QObject
{
Q_OBJECT
QX_REGISTER_FRIEND_CLASS(Voucher)
Q_PROPERTY(QString numSer READ numSer WRITE setNumSer)
Q_PROPERTY(QDateTime payDateTime READ payDateTime WRITE setPayDateTime)
Q_PROPERTY(QDateTime saveDateTime READ saveDateTime WRITE setSaveDateTime)
Q_PROPERTY(QString name READ name WRITE setName)
Q_PROPERTY(QString description READ description WRITE setDescription)
Q_PROPERTY(QSharedPointer<QObject> contact READ contact WRITE setContact)
Q_PROPERTY(QDecDouble vatRateHigh READ vatRateHigh WRITE setVatRateHigh)
Q_PROPERTY(QDecDouble vatRateFirstLower READ vatRateFirstLower WRITE setVatRateFirstLower)
Q_PROPERTY(QDecDouble vatRateSecondLower READ vatRateSecondLower WRITE setVatRateSecondLower)
Q_PROPERTY(QDecDouble priceVatHigh READ priceVatHigh WRITE setPriceVatHigh)
Q_PROPERTY(QDecDouble priceVatFirstLower READ priceVatFirstLower WRITE setPriceVatFirstLower)
Q_PROPERTY(QDecDouble priceVatSecondLower READ priceVatSecondLower WRITE setPriceVatSecondLower)
Q_PROPERTY(QDecDouble totalPrice READ totalPrice WRITE setTotalPrice)
Q_PROPERTY(EetStatus eetStatus READ eetStatus WRITE setEetStatus)
Q_PROPERTY(QDateTime eetSendDateTime READ eetSendDateTime WRITE setEetSendDateTime)
Q_PROPERTY(QString eetBkp READ eetBkp WRITE setEetBkp)
Q_PROPERTY(QString eetPkp READ eetPkp WRITE setEetPkp)
Q_PROPERTY(QString eetFik READ eetFik WRITE setEetFik)
Q_PROPERTY(VoucherStatus status READ status WRITE setStatus)
Q_PROPERTY(QString createdBy READ createdBy WRITE setCreatedBy)
Q_PROPERTY(QString updatedBy READ updatedBy WRITE setUpdatedBy)
Q_PROPERTY(QDateTime created READ created WRITE setCreated)
Q_PROPERTY(QDateTime updated READ updated WRITE setUpdated)
public:
explicit Voucher(QObject *parent = nullptr);
enum VoucherStatus
{
NEW,
TEMPORARY,
NOT_PAID,
PAID
};
enum EetStatus
{
EET_FOR_SEND,
EET_NOT_ENTERING,
EET_SENT,
EET_ERROR
};
Q_ENUM(VoucherStatus)
Q_ENUM(EetStatus)
long id() const;
void setId(long id);
QString name() const;
void setName(const QString &name);
QString description() const;
void setDescription(const QString &description);
QSharedPointer<QObject> contact() const;
void setContact(const QSharedPointer<QObject> &contact);
VoucherStatus status() const;
void setStatus(const VoucherStatus &status);
QDecDouble totalPrice() const;
void setTotalPrice(QDecDouble totalPrice);
QList<QSharedPointer<VoucherItem> > items() const;
void setItems(const QList<QSharedPointer<VoucherItem> > &items);
void addItem(QSharedPointer<VoucherItem> item);
void removeItem(QSharedPointer<VoucherItem> item);
void clearItems();
QDecDouble vatRateHigh() const;
void setVatRateHigh(QDecDouble vatRateHigh);
QDecDouble vatRateFirstLower() const;
void setVatRateFirstLower(QDecDouble vatRateFirstLower);
QDecDouble vatRateSecondLower() const;
void setVatRateSecondLower(QDecDouble vatRateSecondLower);
QDecDouble priceVatHigh() const;
void setPriceVatHigh(QDecDouble priceVatHigh);
QDecDouble priceVatFirstLower() const;
void setPriceVatFirstLower(QDecDouble priceVatFirstLower);
QDecDouble priceVatSecondLower() const;
void setPriceVatSecondLower(QDecDouble priceVatSecondLower);
QDecDouble priceNoVat() const;
void setPriceNoVat(QDecDouble priceNoVat);
QDecDouble priceWitouthVat() const;
void setPriceWitouthVat(QDecDouble priceWitouthVat);
QDecDouble totalPriceVatHigh() const;
void setTotalPriceVatHigh(QDecDouble totalPriceVatHigh);
QDecDouble totalPriceVatFirstLower() const;
void setTotalPriceVatFirstLower(QDecDouble totalPriceVatFirstLower);
QDecDouble totalPriceVatSecondLower() const;
void setTotalPriceVatSecondLower(QDecDouble totalPriceVatSecondLower);
QDecDouble vatAmountHigh();
QDecDouble vatAmountFirstLower();
QDecDouble VatAmountSecondLower();
QString numSer() const;
void setNumSer(const QString &numSer);
QDateTime payDateTime() const;
void setPayDateTime(const QDateTime &payDateTime);
EetStatus eetStatus() const;
void setEetStatus(const EetStatus &eetStatus);
QDateTime eetSendDateTime() const;
void setEetSendDateTime(const QDateTime &eetSendDateTime);
QString eetPkp() const;
void setEetPkp(const QString &eetPkp);
QString eetBkp() const;
void setEetBkp(const QString &eetBkp);
QString eetFik() const;
void setEetFik(const QString &eetFik);
QDateTime saveDateTime() const;
void setSaveDateTime(const QDateTime &saveDateTime);
SeasonPtr season() const;
void setSeason(const SeasonPtr &season);
QString createdBy() const;
void setCreatedBy(const QString &createdBy);
QString updatedBy() const;
void setUpdatedBy(const QString &updatedBy);
QDateTime created() const;
void setCreated(const QDateTime &created);
QDateTime updated() const;
void setUpdated(const QDateTime &updated);
Q_INVOKABLE QStringList eagerLoad();
private:
long m_id;
QString m_numSer;
QDateTime m_payDateTime;
QDateTime m_saveDateTime;
QString m_name;
QString m_description;
QSharedPointer<AddressbookData> m_contact;
int m_vatRateHigh;
int m_vatRateFirstLower;
int m_vatRateSecondLower;
int m_priceNoVat;
int m_priceVatHigh;
int m_priceVatFirstLower;
int m_priceVatSecondLower;
int m_priceWitouthVat;
int m_totalPriceVatHigh;
int m_totalPriceVatFirstLower;
int m_totalPriceVatSecondLower;
int m_totalPrice;
EetStatus m_eetStatus;
QDateTime m_eetSendDateTime;
QString m_eetPkp;
QString m_eetBkp;
QString m_eetFik;
QList<QSharedPointer<VoucherItem>> m_items;
VoucherStatus m_status;
SeasonPtr m_season;
QString m_createdBy;
QString m_updatedBy;
QDateTime m_created;
QDateTime m_updated;
};
typedef QSharedPointer<Voucher> VoucherPtr;
QX_REGISTER_HPP_SHOP(Voucher, QObject, 0)
class VoucherSum
{
QX_REGISTER_FRIEND_CLASS(VoucherSum)
public:
VoucherSum() = default;
QDecDouble totalPrice() const;
int count() const;
private:
int m_count{0};
int m_totalPrice{0};
};
QX_REGISTER_HPP_SHOP(VoucherSum, qx::trait::no_base_class_defined, 0)
#endif // VOUCHER_H