MagicSmoke  $VERSION$
order.h
Go to the documentation of this file.
1 //
2 // C++ Interface: unabstract
3 //
4 // Description: removes abstract flag from classes that only need to be abstract in PHP
5 //
6 //
7 // Author: Konrad Rosenbaum <konrad@silmor.de>, (C) 2009-2011
8 //
9 // Copyright: See README/COPYING.GPL files that come with this distribution
10 //
11 //
12 
13 #ifndef MAGICSMOKE_MOORDER_H
14 #define MAGICSMOKE_MOORDER_H
15 
16 #include "MOOrderAbstract"
17 #include "misc.h"
18 
19 #include <TimeStamp>
20 
21 #ifndef MSIFACE_EXPORT
22 #define MSIFACE_EXPORT Q_DECL_IMPORT
23 #endif
24 
25 
28 {
29  Q_GADGET
30  WOBJECT(MOOrder)
31  Q_PROPERTY(bool isValid READ isValid)
32  Q_PROPERTY(bool isReservation READ isReservation)
33  Q_PROPERTY(bool isSent READ isSent)
34  Q_PROPERTY(QString orderStatusString READ orderStatusString)
35  Q_PROPERTY(QString totalPriceString READ totalPriceString)
36  Q_PROPERTY(bool needsPayment READ needsPayment)
37  Q_PROPERTY(bool needsRefund READ needsRefund)
38  Q_PROPERTY(int amountToPay READ amountToPay)
39  Q_PROPERTY(QString amountToPayStr READ amountToPayStr)
40  Q_PROPERTY(int amountToRefund READ amountToRefund)
41  Q_PROPERTY(QString amountToRefundStr READ amountToRefundStr)
42  Q_PROPERTY(QString orderDateTimeStr READ orderDateTimeStr)
43  Q_PROPERTY(TimeStamp oderDateTime READ orderDateTime)
44  Q_PROPERTY(TimeStamp sentDateTime READ sentDateTime)
45  Q_PROPERTY(QString sentDateTimeStr READ sentDateTimeStr)
46  Q_PROPERTY(QString orderDateStr READ orderDateStr)
47  Q_PROPERTY(QString sentDateStr READ sentDateStr)
48  Q_PROPERTY(QString fullInvoiceAddress READ fullInvoiceAddress)
49  Q_PROPERTY(QString fullDeliveryAddress READ fullDeliveryAddress)
50  public:
52  MOOrder(qint64);
53 
55  bool isValid()const{return !orderid().isNull();}
56 
58  bool isReservation()const{return status()==Reserved;}
59 
61  bool isSent()const;
62 
64  QString orderStatusString()const{return OrderState2locstr(status());}
65 
67  QString totalPriceString()const{return cent2str(totalprice());}
68 
70  QString amountPaidString()const{return cent2str(amountpaid());}
71 
73  bool needsPayment()const;
74 
76  bool needsRefund()const;
77 
79  int amountToPay()const;
80 
82  QString amountToPayStr()const{return cent2str(amountToPay());}
83 
85  int amountToRefund()const;
86 
88  QString amountToRefundStr()const{return cent2str(amountToRefund());}
89 
91  TimeStamp orderDateTime();
92 
94  QString orderDateTimeStr();
95 
97  QString orderDateStr();
98 
100  TimeStamp sentDateTime();
101 
103  QString sentDateTimeStr();
104 
106  QString sentDateStr();
107 
109  QString fullInvoiceAddress(bool allowfallback=true)const;
111  QString fullDeliveryAddress(bool allowfallback=true)const;
112 };
113 
116 Q_DECLARE_METATYPE(Nullable<MOOrder>)
117 
118 #endif
static QString OrderState2locstr(OrderState)
Converts enum OrderState value into the corresponding localized string.
Definition: srcMOOrderAbstract.cpp:43
virtual Nullable< qint64 > totalprice() const
total price for this order (including shipping and all items)
Definition: srcMOOrderAbstract.h:153
QString totalPriceString() const
returns how much money needs to be paid in total for this order, in cents
Definition: order.h:67
bool isReservation() const
returns whether this order is a reservation
Definition: order.h:58
virtual Nullable< OrderState > status() const
Definition: srcMOOrderAbstract.h:147
QString orderStatusString() const
returns the status of the order as localized string
Definition: order.h:64
QString cent2str(qint64 c, bool localize)
converts a cent value into a (localized) string
Definition: misc.cpp:73
bool isValid() const
returns whether the order is valid (it comes from the DB and it has been understood by the parser) ...
Definition: order.h:55
QString amountToPayStr() const
returns how much there is to be paid, as localized string
Definition: order.h:82
The order is just a reservation for a limited time, application logic must determine the timeout...
Definition: srcMOOrderAbstract.h:38
virtual Nullable< qint64 > amountpaid() const
amount that has been paid for this order
Definition: srcMOOrderAbstract.h:149
QString amountPaidString() const
returns how much money has already been paid for this order, in cents
Definition: order.h:70
virtual Nullable< qint64 > orderid() const
Definition: srcMOOrderAbstract.h:125
QString amountToRefundStr() const
returns how much there is to be refunded, as localized string
Definition: order.h:88
Q_DECLARE_METATYPE(QDomNode)
this class represents a complete order
Definition: order.h:27
This class represents an order in its entirety, including any items sold in it.
Definition: srcMOOrderAbstract.h:22
#define MSIFACE_EXPORT
Definition: order.h:22