File: ordercluster.h

package info (click to toggle)
postbooks 4.10.0-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 112,660 kB
  • ctags: 22,890
  • sloc: cpp: 310,358; sh: 607; xml: 214; python: 140; awk: 104; makefile: 50
file content (226 lines) | stat: -rw-r--r-- 8,291 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
/*
 * This file is part of the xTuple ERP: PostBooks Edition, a free and
 * open source Enterprise Resource Planning software suite,
 * Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
 * It is licensed to you under the Common Public Attribution License
 * version 1.0, the full text of which (including xTuple-specific Exhibits)
 * is available at www.xtuple.com/CPAL.  By using this software, you agree
 * to be bound by its terms.
 */

#ifndef _orderCluster_h

#define _orderCluster_h

#include "applock.h"
#include "parameter.h"
#include "virtualCluster.h"

class XTUPLEWIDGETS_EXPORT OrderLineEdit : public VirtualClusterLineEdit
{
  Q_OBJECT
  Q_FLAGS (OrderStatuses)
  Q_FLAGS (OrderTypes)
  Q_PROPERTY(OrderStatuses allowedStatuses READ allowedStatuses WRITE setAllowedStatuses)
  Q_PROPERTY(OrderTypes    allowedTypes    READ allowedTypes    WRITE setAllowedTypes)

  public:
    OrderLineEdit(QWidget*, const char* = 0);
    ~OrderLineEdit();

    enum OrderStatus
    {
      AnyStatus = 0x00,
      Unposted  = 0x01, Open = 0x02, Closed = 0x04
    };
    Q_DECLARE_FLAGS(OrderStatuses, OrderStatus)

    enum OrderType
    {
      AnyType = 0x00,
      Purchase = 0x01, Return = 0x02, Sales = 0x04, Transfer = 0x08
    };
    Q_DECLARE_FLAGS(OrderTypes, OrderType)

    Q_INVOKABLE virtual OrderStatuses allowedStatuses()        const;
    Q_INVOKABLE virtual OrderTypes    allowedTypes()        const;
    Q_INVOKABLE virtual void          clear();
    Q_INVOKABLE virtual QString          from()                const;
    Q_INVOKABLE virtual bool          isClosed()                const;
    Q_INVOKABLE virtual bool          isOpen()                const;
    Q_INVOKABLE virtual bool          isPO()                const;
    Q_INVOKABLE virtual bool          isRA()                const;
    Q_INVOKABLE virtual bool          isSO()                const;
    Q_INVOKABLE virtual bool          isTO()                const;
    Q_INVOKABLE virtual bool          isUnposted()                const;
    Q_INVOKABLE virtual bool      fromSitePrivsEnforced() const {return _fromPrivs; }
    Q_INVOKABLE virtual bool      toSitePrivsEnforced()   const {return _toPrivs; }
    Q_INVOKABLE virtual void      setExtraClause(const QString & p) {VirtualClusterLineEdit::setExtraClause(p);}
    Q_INVOKABLE virtual void          setExtraClause(const QString &, const QString &);
    Q_INVOKABLE virtual void          setExtraClause(const OrderTypes, const QString &);
    Q_INVOKABLE virtual void      setFromSitePrivsEnforced(const bool p);
    Q_INVOKABLE virtual void      setToSitePrivsEnforced(const bool p);
    Q_INVOKABLE virtual OrderStatus          status();
    Q_INVOKABLE virtual QString          to()                        const;
    Q_INVOKABLE virtual QString          type();
    Q_INVOKABLE virtual QString       fromPrivsClause() {return _fromPrivsClause;}
    Q_INVOKABLE virtual QString       toPrivsClause()   {return _toPrivsClause;}

    Q_INVOKABLE virtual bool lockSelected() {return _lockOnSelect; }
    Q_INVOKABLE virtual void setLockSelected(bool lock) { _lockOnSelect = lock; }

  public slots:
    virtual void          setAllowedStatuses(const OrderStatuses);
    virtual void          setAllowedType(const QString &);
    virtual void          setAllowedTypes(const OrderTypes);
    virtual void          setCustId(int);
    virtual void          setId(const int, const QString & = QString::null);
    virtual void          sList();
    virtual void          sSearch();

  signals:
    void newId(const int, const QString &);
    void numberChanged(const QString &, const QString &);

  protected:
    OrderStatuses        _allowedStatuses;
    OrderTypes           _allowedTypes;
    QString              _from;
    QString              _to;

    virtual QString     buildExtraClause();
    virtual void        silentSetId(const int);
    virtual void        unlock();


  protected slots:
    virtual void        sNewId(const int);
    virtual void        sParse();
    virtual VirtualList*    listFactory();
    virtual VirtualSearch*  searchFactory();


  private:
    bool        _fromPrivs;
    bool        _toPrivs;
    bool        _lockOnSelect;
    AppLock     _lock;
    QString     _toPrivsClause;
    QString     _fromPrivsClause;
    QString        _allClause;
    QString        _poClause;
    QString        _raClause;
    QString        _soClause;
    QString        _toClause;
    QString        _statusClause;
    QString        _typeClause;
    int         _custid;
};
Q_DECLARE_OPERATORS_FOR_FLAGS(OrderLineEdit::OrderStatuses)
Q_DECLARE_OPERATORS_FOR_FLAGS(OrderLineEdit::OrderTypes)

class XTUPLEWIDGETS_EXPORT OrderCluster : public VirtualCluster
{
  Q_OBJECT

  Q_PROPERTY(OrderLineEdit::OrderStatuses allowedStatuses READ allowedStatuses WRITE setAllowedStatuses)
  Q_PROPERTY(OrderLineEdit::OrderTypes    allowedTypes    READ allowedTypes    WRITE setAllowedTypes)
  Q_PROPERTY(bool    nameVisible    READ nameVisible    WRITE setNameVisible)
  Q_PROPERTY(bool    descriptionVisible    READ descriptionVisible    WRITE setDescriptionVisible)

  public:
    OrderCluster(QWidget*, const char* = 0);

    Q_INVOKABLE virtual OrderLineEdit::OrderStatuses allowedStatuses() const;
    Q_INVOKABLE virtual OrderLineEdit::OrderTypes    allowedTypes()    const;
    Q_INVOKABLE virtual QString from()                  const;
    Q_INVOKABLE virtual bool    isClosed()              const;
    Q_INVOKABLE virtual bool    isOpen()                const;
    Q_INVOKABLE virtual bool    isPO()                  const;
    Q_INVOKABLE virtual bool    isRA()                  const;
    Q_INVOKABLE virtual bool    isSO()                  const;
    Q_INVOKABLE virtual bool    isTO()                  const;
    Q_INVOKABLE virtual bool    isUnposted()            const;
    Q_INVOKABLE virtual bool    fromSitePrivsEnforced() const;
    Q_INVOKABLE virtual bool    toSitePrivsEnforced()   const;
    Q_INVOKABLE virtual void    setExtraClause(const QString &, const QString &);
    Q_INVOKABLE virtual void    setExtraClause(const OrderLineEdit::OrderTypes,
                                               const QString &);
    Q_INVOKABLE virtual OrderLineEdit::OrderStatus status()            const;
    Q_INVOKABLE virtual QString                    to()                const;
    Q_INVOKABLE virtual QString                    type()              const;

    Q_INVOKABLE virtual bool lockSelected();
    Q_INVOKABLE virtual void setLockSelected(bool lock);

    virtual bool        nameVisible() const;
    virtual void        setNameVisible(const bool p);

    virtual bool        descriptionVisible() const;
    virtual void        setDescriptionVisible(const bool p);

  public slots:
    virtual void        setAllowedStatuses(const OrderLineEdit::OrderStatuses);
    virtual void        setAllowedStatuses(const int);
    virtual void        setAllowedType(const QString &);
    virtual void        setAllowedTypes(const OrderLineEdit::OrderTypes);
    virtual void        setAllowedTypes(const int);
    virtual void        setCustId(int);
    virtual void        setId(const int, const QString& = QString::null);
    virtual void        setFromSitePrivsEnforced(const bool p);
    virtual void        setToSitePrivsEnforced(const bool p);
    virtual void        sRefresh();

  signals:
    void newId(const int, const QString &);
    void numberChanged(const QString &, const QString &);

  protected:
    QLabel        *_fromLit;
    QLabel        *_from;
    QLabel        *_toLit;
    QLabel        *_to;
    bool           _nameVisible;
    bool           _descripVisible;
    
};

class XTUPLEWIDGETS_EXPORT OrderList : public VirtualList
{
  Q_OBJECT

  public:
    OrderList(QWidget*, Qt::WindowFlags = 0);

    QString type() const;

  public slots:
    virtual void sClose();

  protected:
    QList<XTreeWidgetItem*> selectedAtDone;

  protected slots:
    virtual void done(int);
};

class XTUPLEWIDGETS_EXPORT OrderSearch : public VirtualSearch
{
  Q_OBJECT

  public:
    OrderSearch(QWidget*, Qt::WindowFlags = 0);

    QString     type() const;

  public slots:
    virtual void sClose();

  protected:
   QList<XTreeWidgetItem*> selectedAtDone;

  protected slots:
    virtual void done(int);
};

#endif