summaryrefslogtreecommitdiffstats
path: root/kmymoney2/reports/reportstestcommon.h
blob: a3f40fd6ceff32c481652321de84919cef618e13 (plain)
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
/***************************************************************************
                          reportstestcommon.h
                          -------------------
    copyright            : (C) 2002-2005 by Thomas Baumgart
    email                : [email protected]
                           Ace Jones <[email protected]>
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef REPORTSTESTCOMMON_H
#define REPORTSTESTCOMMON_H

#include <tqvaluelist.h>
class TQDomDocument;

#include "../mymoney/mymoneyaccount.h"
#include "../mymoney/mymoneytransaction.h"
#include "../mymoney/mymoneymoney.h"
class MyMoneyReport;

namespace reports {
class PivotTable;
class QueryTable;
}

namespace test {

extern const MyMoneyMoney moCheckingOpen;
extern const MyMoneyMoney moCreditOpen;
extern const MyMoneyMoney moConverterCheckingOpen;
extern const MyMoneyMoney moConverterCreditOpen;
extern const MyMoneyMoney moZero;
extern const MyMoneyMoney moSolo;
extern const MyMoneyMoney moParent1;
extern const MyMoneyMoney moParent2;
extern const MyMoneyMoney moParent;
extern const MyMoneyMoney moChild;
extern const MyMoneyMoney moThomas;
extern const MyMoneyMoney moNoPayee;

extern TQString acAsset;
extern TQString acLiability;
extern TQString acExpense;
extern TQString acIncome;
extern TQString acChecking;
extern TQString acCredit;
extern TQString acSolo;
extern TQString acParent;
extern TQString acChild;
extern TQString acSecondChild;
extern TQString acGrandChild1;
extern TQString acGrandChild2;
extern TQString acForeign;
extern TQString acCanChecking;
extern TQString acJpyChecking;
extern TQString acCanCash;
extern TQString acJpyCash;
extern TQString inBank;
extern TQString eqStock1;
extern TQString eqStock2;
extern TQString acInvestment;
extern TQString acStock1;
extern TQString acStock2;
extern TQString acDividends;
extern TQString acInterest;
extern TQString acTax;
extern TQString acCash;

class TransactionHelper: public MyMoneyTransaction
{
private:
  TQString m_id;
public:
  TransactionHelper( const TQDate& _date, const TQString& _action, MyMoneyMoney _value, const TQString& _accountid, const TQString& _categoryid, const TQString& _currencyid = TQString(), const TQString& _payee="Test Payee" );
  ~TransactionHelper();
  void update(void);
protected:
  TransactionHelper(void) {}
};

class InvTransactionHelper: public TransactionHelper
{
public:
  InvTransactionHelper( const TQDate& _date, const TQString& _action, MyMoneyMoney _shares, MyMoneyMoney _value, const TQString& _stockaccountid, const TQString& _transferid, const TQString& _categoryid );
  void init( const TQDate& _date, const TQString& _action, MyMoneyMoney _shares, MyMoneyMoney _value, const TQString& _stockaccountid, const TQString& _transferid, const TQString& _categoryid );
};

class BudgetEntryHelper
{
private:
  TQDate m_date;
  TQString m_categoryid;
  bool m_applytosub;
  MyMoneyMoney m_amount;

public:
  BudgetEntryHelper( void ): m_applytosub(false) {}
  BudgetEntryHelper( const TQDate& _date, const TQString& _categoryid, bool _applytosub, const MyMoneyMoney& _amount ): m_date(_date), m_categoryid(_categoryid), m_applytosub(_applytosub), m_amount(_amount) {}
};

class BudgetHelper: public TQValueList<BudgetEntryHelper>
{
  MyMoneyMoney budgetAmount( const TQDate& _date, const TQString& _categoryid, bool& _applytosub );
};

extern TQString makeAccount( const TQString& _name, MyMoneyAccount::accountTypeE _type, MyMoneyMoney _balance, const TQDate& _open, const TQString& _parent, TQString _currency="", bool _taxReport = false );
extern void makePrice(const TQString& _currencyid, const TQDate& _date, const MyMoneyMoney& _price );
TQString makeEquity(const TQString& _name, const TQString& _symbol );
extern void makeEquityPrice(const TQString& _id, const TQDate& _date, const MyMoneyMoney& _price );
extern void writeRCFtoXMLDoc( const MyMoneyReport& filter, TQDomDocument* doc );
extern void writeTabletoHTML( const reports::PivotTable& table, const TQString& _filename = TQString() );
extern void writeTabletoHTML( const reports::QueryTable& table, const TQString& _filename = TQString() );
extern void writeTabletoCSV( const reports::PivotTable& table, const TQString& _filename = TQString() );
extern void writeTabletoCSV( const reports::QueryTable& table, const TQString& _filename = TQString() );
extern void writeRCFtoXML( const MyMoneyReport& filter, const TQString& _filename = TQString() );
extern bool readRCFfromXMLDoc( TQValueList<MyMoneyReport>& list, TQDomDocument* doc );
extern bool readRCFfromXML( TQValueList<MyMoneyReport>& list, const TQString& filename );
extern void XMLandback( MyMoneyReport& filter );
extern MyMoneyMoney searchHTML(const TQString& _html, const TQString& _search);

} // end namespace test

#endif // REPORTSTESTCOMMON_H

// vim:cin:si:ai:et:ts=2:sw=2: