MagicSmoke  $VERSION$
orderinfo.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_MOORDERI_H
14 #define MAGICSMOKE_MOORDERI_H
15 
16 #include "MOOrderInfoAbstract"
17 #include "misc.h"
18 
19 #ifndef MSIFACE_EXPORT
20 #define MSIFACE_EXPORT Q_DECL_IMPORT
21 #endif
22 
23 
25 {
26  Q_GADGET
27  WOBJECT(MOOrderInfo)
28  Q_PROPERTY(bool isReservation READ isReservation)
29  Q_PROPERTY(bool isSent READ isSent)
30  Q_PROPERTY(bool isCancelled READ isCancelled)
31  Q_PROPERTY(bool needsPayment READ needsPayment)
32  Q_PROPERTY(bool needsRefund READ needsRefund)
33  public:
34  QString totalPriceString()const{return cent2str(totalprice());}
35  QString amountPaidString()const{return cent2str(amountpaid());}
36  QString amountDueString()const{return cent2str(amountdue());}
37  QString orderStatusString()const{return OrderState2locstr(status());}
38 
39  bool needsPayment()const{return amountpaid()<totalprice();}
40  bool needsRefund()const{return amountpaid()>totalprice();}
41  bool isSent()const{return status()==Sent;}
42  bool isReservation()const{return status()==Reserved;}
43  bool isCancelled()const{return status()==Cancelled;}
44  bool isPlaced()const{return status()==Placed;}
45 };
46 
50 
51 #endif
QString totalPriceString() const
Definition: orderinfo.h:34
QString cent2str(qint64 c, bool localize)
converts a cent value into a (localized) string
Definition: misc.cpp:73
bool isCancelled() const
Definition: orderinfo.h:43
QString orderStatusString() const
Definition: orderinfo.h:37
#define MSIFACE_EXPORT
Definition: orderinfo.h:20
Definition: orderinfo.h:24
static QString OrderState2locstr(OrderState)
Converts enum OrderState value into the corresponding localized string.
Definition: srcMOOrderInfoAbstract.cpp:43
bool isSent() const
Definition: orderinfo.h:41
virtual Nullable< qint64 > amountpaid() const
amount that has been paid for this order
Definition: srcMOOrderInfoAbstract.h:105
The order has been sent out or handed to the customer.
Definition: srcMOOrderInfoAbstract.h:25
virtual Nullable< qint64 > amountdue() const
amount that needs to be paid, negative if too much has been paid
Definition: srcMOOrderInfoAbstract.h:107
This class represents the main information about an order as shown in lists.
Definition: srcMOOrderInfoAbstract.h:15
The order has been cancelled, if anything has been paid, it must be paid back.
Definition: srcMOOrderInfoAbstract.h:29
virtual Nullable< OrderState > status() const
Definition: srcMOOrderInfoAbstract.h:103
bool needsPayment() const
Definition: orderinfo.h:39
The order has been placed, but not acted upon yet.
Definition: srcMOOrderInfoAbstract.h:23
bool needsRefund() const
Definition: orderinfo.h:40
Q_DECLARE_METATYPE(QDomNode)
bool isReservation() const
Definition: orderinfo.h:42
The order is just a reservation for a limited time, application logic must determine the timeout...
Definition: srcMOOrderInfoAbstract.h:31
virtual Nullable< qint64 > totalprice() const
total price for this order (including shipping and all items)
Definition: srcMOOrderInfoAbstract.h:109
bool isPlaced() const
Definition: orderinfo.h:44
QString amountDueString() const
Definition: orderinfo.h:36
QString amountPaidString() const
Definition: orderinfo.h:35