File: calendarTools.h

package info (click to toggle)
postbooks 4.9.5-1~bpo8%2B1
  • links: PTS, VCS
  • area: main
  • in suites: jessie-backports
  • size: 103,120 kB
  • sloc: cpp: 288,269; sh: 607; xml: 214; awk: 104; makefile: 49
file content (115 lines) | stat: -rw-r--r-- 2,484 bytes parent folder | download | duplicates (3)
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
/*
 * 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 calendarTools_h
#define calendarTools_h

#include <QDateTime>

#include <parameter.h>

#include "widgets.h"
#include "xcombobox.h"
#include "xtreewidget.h"

class QString;

class XTUPLEWIDGETS_EXPORT Numeric
{
  public:
    Numeric()
    {
      value = 0.0;
    }
  
    inline double operator+=(double pValue) { value += pValue; return value; }
    inline double toDouble()                { return value;                  }

    double value;
};

class XTUPLEWIDGETS_EXPORT DatePair
{
  public:
    DatePair()
    {
    }

    DatePair(QDate pStartDate, QDate pEndDate)
    {
      startDate = pStartDate;
      endDate = pEndDate;
    }

    QDate startDate;
    QDate endDate;
};


class XTUPLEWIDGETS_EXPORT CalendarComboBox : public XComboBox
{
  Q_OBJECT

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

    Q_INVOKABLE void load(ParameterList &);

  signals:
    void newCalendarId(int);
    void select(ParameterList &);
};


class PeriodListViewItem;

class XTUPLEWIDGETS_EXPORT PeriodsListView : public XTreeWidget
{
  Q_OBJECT

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

    Q_INVOKABLE QList<QVariant>    periodList();
    Q_INVOKABLE QString            periodString();
    Q_INVOKABLE PeriodListViewItem *getSelected(int);
    Q_INVOKABLE void               getSelected(ParameterList &);
    Q_INVOKABLE bool               isPeriodSelected();

  public slots:	
    void populate(int);
    void load(ParameterList &);

  private:
    int _calheadid;
};


void setupPeriodListViewItem(QScriptEngine *engine);

class XTUPLEWIDGETS_EXPORT PeriodListViewItem : public XTreeWidgetItem
{
  Q_OBJECT

  public:
    PeriodListViewItem( PeriodsListView *, XTreeWidgetItem *, int,
                        QDate, QDate,
                        QString, QString );

    Q_INVOKABLE inline QDate startDate() { return _startDate; }
    Q_INVOKABLE inline QDate endDate()   { return _endDate;   }

  private:
    QDate _startDate;
    QDate _endDate;
};
Q_DECLARE_METATYPE(PeriodListViewItem*)

#endif