summaryrefslogtreecommitdiff
path: root/noncore/apps/qashmoney/transaction.cpp
Side-by-side diff
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 @@
// RESERVEDTWO REPRESENTS THE TRANSACTION DESCRIPTION
#include "transaction.h"
#include "account.h"
#include "transactiondisplay.h"
#include <stdlib.h>
#include <iostream.h>
extern Account *account;
extern Preferences *preferences;
Transaction::Transaction ()
{
tdb = sqlite_open ( "qmtransactions.db", 0, NULL );
}
Transaction::~Transaction ()
{
sqlite_close ( tdb );
}
void 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 )
{
- 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,
- 0, 0, 0, NULL );", 0, 0, 0, ( const char * ) payee, accountid, parentid, number, day, month, year, amount, cleared, budgetid, lineitemid, ( const char * ) description );
+ 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, "
+ "0, 0, 0, NULL );", 0, 0, 0, ( const char * ) payee, accountid, parentid, number, day, month, year, amount, cleared, budgetid, lineitemid, ( const char * ) description );
}
void Transaction::updateTransaction ( QString description, QString payee, int number, int day, int month, int year, float amount, int cleared, int budgetid, int lineitemid, int transactionid )
{
- sqlite_exec_printf ( tdb, "update transactions set reservedtwo = '%q', payee = '%q', number = %i, day = %i, month = %i, year = %i, amount = %.2f,
- cleared = %i, budgetid = %i, reservedone = %i where transid = %i;", 0, 0, 0, ( const char * ) description, ( const char * ) payee, number, day, month, year,
+ sqlite_exec_printf ( tdb, "update transactions set reservedtwo = '%q', payee = '%q', number = %i, day = %i, month = %i, year = %i, amount = %.2f,"
+ "cleared = %i, budgetid = %i, reservedone = %i where transid = %i;", 0, 0, 0, ( const char * ) description, ( const char * ) payee, number, day, month, year,
amount, cleared, budgetid, lineitemid, transactionid );
}
void Transaction::deleteTransaction ( int transid )
{
sqlite_exec_printf ( tdb, "delete from transactions where transid = %i;", 0, 0, 0, transid );
}
void Transaction::deleteAllTransactions ( int accountid )
{
sqlite_exec_printf ( tdb, "delete from transactions where accountid = %i;", 0, 0, 0, accountid );
}
int Transaction::getAccountID ( int id )
{
char **results;
sqlite_get_table_printf ( tdb, "select accountid from transactions where transid= %i;", &results, NULL, NULL, NULL, id );
return atol ( results [ 1 ] );
}
int Transaction::getNumberOfTransactions ()
{
char **results;
sqlite_get_table ( tdb, "select count() from transactions;", &results, NULL, NULL, NULL );