summaryrefslogtreecommitdiff
path: root/noncore/apps/qashmoney/transaction.cpp
Unidiff
Diffstat (limited to 'noncore/apps/qashmoney/transaction.cpp') (more/less context) (show whitespace changes)
-rwxr-xr-xnoncore/apps/qashmoney/transaction.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/noncore/apps/qashmoney/transaction.cpp b/noncore/apps/qashmoney/transaction.cpp
index a3bd9e7..dcf46b1 100755
--- a/noncore/apps/qashmoney/transaction.cpp
+++ b/noncore/apps/qashmoney/transaction.cpp
@@ -4,56 +4,56 @@
4// RESERVEDTWO REPRESENTS THE TRANSACTION DESCRIPTION 4// RESERVEDTWO REPRESENTS THE TRANSACTION DESCRIPTION
5 5
6#include "transaction.h" 6#include "transaction.h"
7#include "account.h" 7#include "account.h"
8#include "transactiondisplay.h" 8#include "transactiondisplay.h"
9 9
10#include <stdlib.h> 10#include <stdlib.h>
11#include <iostream.h> 11#include <iostream.h>
12 12
13extern Account *account; 13extern Account *account;
14extern Preferences *preferences; 14extern Preferences *preferences;
15 15
16Transaction::Transaction () 16Transaction::Transaction ()
17 { 17 {
18 tdb = sqlite_open ( "qmtransactions.db", 0, NULL ); 18 tdb = sqlite_open ( "qmtransactions.db", 0, NULL );
19 } 19 }
20 20
21Transaction::~Transaction () 21Transaction::~Transaction ()
22 { 22 {
23 sqlite_close ( tdb ); 23 sqlite_close ( tdb );
24 } 24 }
25 25
26void Transaction::addTransaction ( QString description, QString payee, int accountid, int parentid, int number, int day, int month, int year, float amount, int cleared, int budgetid, int lineitemid ) 26void Transaction::addTransaction ( QString description, QString payee, int accountid, int parentid, int number, int day, int month, int year, float amount, int cleared, int budgetid, int lineitemid )
27 { 27 {
28 sqlite_exec_printf ( tdb, "insert into transactions values ( '%q', %i, %i, %i, %i, %i, %i, %.2f, %i, %i, 0, 0, 0, 0, 0, 0, %i, '%q', 0, 28 sqlite_exec_printf ( tdb, "insert into transactions values ( '%q', %i, %i, %i, %i, %i, %i, %.2f, %i, %i, 0, 0, 0, 0, 0, 0, %i, '%q', 0, "
29 0, 0, 0, NULL );", 0, 0, 0, ( const char * ) payee, accountid, parentid, number, day, month, year, amount, cleared, budgetid, lineitemid, ( const char * ) description ); 29 "0, 0, 0, NULL );", 0, 0, 0, ( const char * ) payee, accountid, parentid, number, day, month, year, amount, cleared, budgetid, lineitemid, ( const char * ) description );
30 } 30 }
31 31
32void Transaction::updateTransaction ( QString description, QString payee, int number, int day, int month, int year, float amount, int cleared, int budgetid, int lineitemid, int transactionid ) 32void Transaction::updateTransaction ( QString description, QString payee, int number, int day, int month, int year, float amount, int cleared, int budgetid, int lineitemid, int transactionid )
33 { 33 {
34 sqlite_exec_printf ( tdb, "update transactions set reservedtwo = '%q', payee = '%q', number = %i, day = %i, month = %i, year = %i, amount = %.2f, 34 sqlite_exec_printf ( tdb, "update transactions set reservedtwo = '%q', payee = '%q', number = %i, day = %i, month = %i, year = %i, amount = %.2f,"
35 cleared = %i, budgetid = %i, reservedone = %i where transid = %i;", 0, 0, 0, ( const char * ) description, ( const char * ) payee, number, day, month, year, 35 "cleared = %i, budgetid = %i, reservedone = %i where transid = %i;", 0, 0, 0, ( const char * ) description, ( const char * ) payee, number, day, month, year,
36 amount, cleared, budgetid, lineitemid, transactionid ); 36 amount, cleared, budgetid, lineitemid, transactionid );
37 } 37 }
38 38
39void Transaction::deleteTransaction ( int transid ) 39void Transaction::deleteTransaction ( int transid )
40 { 40 {
41 sqlite_exec_printf ( tdb, "delete from transactions where transid = %i;", 0, 0, 0, transid ); 41 sqlite_exec_printf ( tdb, "delete from transactions where transid = %i;", 0, 0, 0, transid );
42 } 42 }
43 43
44void Transaction::deleteAllTransactions ( int accountid ) 44void Transaction::deleteAllTransactions ( int accountid )
45 { 45 {
46 sqlite_exec_printf ( tdb, "delete from transactions where accountid = %i;", 0, 0, 0, accountid ); 46 sqlite_exec_printf ( tdb, "delete from transactions where accountid = %i;", 0, 0, 0, accountid );
47 } 47 }
48 48
49int Transaction::getAccountID ( int id ) 49int Transaction::getAccountID ( int id )
50 { 50 {
51 char **results; 51 char **results;
52 sqlite_get_table_printf ( tdb, "select accountid from transactions where transid= %i;", &results, NULL, NULL, NULL, id ); 52 sqlite_get_table_printf ( tdb, "select accountid from transactions where transid= %i;", &results, NULL, NULL, NULL, id );
53 return atol ( results [ 1 ] ); 53 return atol ( results [ 1 ] );
54 } 54 }
55 55
56int Transaction::getNumberOfTransactions () 56int Transaction::getNumberOfTransactions ()
57 { 57 {
58 char **results; 58 char **results;
59 sqlite_get_table ( tdb, "select count() from transactions;", &results, NULL, NULL, NULL ); 59 sqlite_get_table ( tdb, "select count() from transactions;", &results, NULL, NULL, NULL );