| 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 |
|
| 32 |
#include <vcl.h> |
| 33 |
#pragma hdrstop |
| 34 |
#include <stdio.h> |
| 35 |
#include "Account.h" |
| 36 |
#include "Transaction.h" |
| 37 |
#include "JNB.h" |
| 38 |
|
| 39 |
// |
| 40 |
// JNB �A�J�E���g |
| 41 |
// |
| 42 |
JNBAccount::JNBAccount(void) |
| 43 |
{ |
| 44 |
Ident = "JapanNetBank"; |
| 45 |
BankName = "�W���p���l�b�g���s"; |
| 46 |
BankId = "0033"; |
| 47 |
} |
| 48 |
|
| 49 |
TransactionList * JNBAccount::ReadFile(FILE *fp) |
| 50 |
{ |
| 51 |
TransactionList *list = new JNBTransaction; |
| 52 |
if (list->ReadCsv(fp) < 0) { |
| 53 |
delete list; |
| 54 |
return NULL; |
| 55 |
} |
| 56 |
return list; |
| 57 |
} |
| 58 |
|
| 59 |
// |
| 60 |
// JNB �g�����U�N�V�������X�g |
| 61 |
// |
| 62 |
Transaction *JNBTransaction::GenerateTransaction(int nrows, char **rows, int *err) |
| 63 |
{ |
| 64 |
Transaction *trans = new Transaction; |
| 65 |
|
| 66 |
/* "������(�N)","������(��)","������(��)","����������", |
| 67 |
"�E�v", "���x�����z","���a�����z","�c��" */ |
| 68 |
trans->date.year = atoi(rows[0]); |
| 69 |
trans->date.month = atoi(rows[1]); |
| 70 |
trans->date.date = atoi(rows[2]); |
| 71 |
|
| 72 |
trans->date.hour = 0; |
| 73 |
trans->date.minutes = 0; |
| 74 |
trans->date.seconds = 0; |
| 75 |
|
| 76 |
trans->id = atol(rows[3]); |
| 77 |
if (strcmp(rows[5], "") != 0) { |
| 78 |
trans->SetTransactionType(rows[4], T_OUTGO); |
| 79 |
trans->value = - atol(rows[5]); |
| 80 |
} else { |
| 81 |
trans->SetTransactionType(rows[4], T_INCOME); |
| 82 |
trans->value = atol(rows[6]); |
| 83 |
} |
| 84 |
trans->desc = utf8(rows[4]); |
| 85 |
trans->balance = atol(rows[7]); |
| 86 |
|
| 87 |
return trans; |
| 88 |
} |