Develop and Download Open Source Software

Browse Subversion Repository

Contents of /branches/MoneyImport/Transaction.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 205 - (show annotations) (download) (as text)
Sun May 18 04:21:59 2008 UTC (15 years, 10 months ago) by tmurakam
File MIME type: text/x-chdr
File size: 3407 byte(s)
move older MoneyImport

1 /*
2 * MoneyImport : Convert Bank csv file to MS Money OFX file.
3 *
4 * Copyright (c) 2001-2003 Takuya Murakami. All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 *
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 *
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
21 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
22 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
23 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
24 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
25 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
26 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 *
29 * $Id$
30 */
31 #ifndef _TRANSACTION_H
32 #define _TRANSACTION_H
33
34 //
35 // ��������
36 //
37 typedef enum {
38 // ����
39 T_INT=0, // ����
40 T_DIV, // �z��
41 T_DIRECTDEP, // �U�������A���������A����������������
42 T_DEP, // ����������
43
44 // �o��
45 T_PAYMENT, // ��������������
46 T_CASH, // ���������o��
47 T_ATM, // �J�[�h�����������o��
48 T_CHECK, // ���������A����
49 T_DEBIT, // �������o��
50 } trntype;
51
52 //
53 // ���������� (�����l���������v��������)
54 //
55 #ifdef DEFINE_TRNNAME
56 const char *trnname[] = {
57 "INT", "DIV", "DIRECTDEP", "DEP",
58 "PAYMENT", "CASH", "ATM", "CHECK", "DEBIT"
59 };
60 #endif
61
62 //
63 // �������������\
64 //
65 struct trntable {
66 const char *key;
67 trntype type;
68 };
69
70 #define T_INCOME 0
71 #define T_OUTGO 1
72
73 //
74 // ���t����
75 //
76 typedef struct {
77 int year;
78 int month;
79 int date;
80 int hour;
81 int minutes;
82 int seconds;
83 } DateTime;
84
85
86 //
87 // �g�����U�N�V�����f�[�^
88 //
89 class Transaction {
90 public:
91 Transaction *next;
92
93 DateTime date; // ���t
94 unsigned long id; // ID
95 AnsiString desc; // ����
96 trntype type; // ����
97 long value; // ���z
98 long balance; // �c��
99
100 Transaction(void) { next = NULL; }
101 void SetTransactionType(const char *desc, int type);
102
103 const char *GetTrnTypeStr(void);
104 };
105
106 //
107 // �g�����U�N�V���������N���X
108 // pure virtual ���N���X�B�e���s�����h���������g�p�����B
109 //
110 class TransactionList {
111 private:
112 Transaction *head, *tail, *pos;
113 int prev_key, serial;
114
115 virtual const char *Ident(void) = 0;
116 virtual Transaction *GenerateTransaction(int nrows, char **rows, int *err) = 0;
117
118 public:
119 inline TransactionList(void) { head = tail = 0; prev_key = serial = 0; }
120 ~TransactionList();
121 int ReadCsv(FILE *fp);
122
123 int GenerateTransactionId(int key);
124
125 inline Transaction *Tail(void) { return tail; }
126 inline Transaction *Head(void) { pos = head; return head; }
127 inline Transaction *Next(void) {
128 if (pos == NULL) return NULL;
129 Transaction *r = pos;
130 pos = pos->next;
131 return r;
132 }
133 };
134
135 // ���[�e�B���e�B����
136 AnsiString utf8(char *sjis);
137
138 #endif
139

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26