I've tweaked the source on my system to the following. When calculating the next transaction number, it will ignore transfers and any transaction number over 10000 when computing the max.
Code: Select all
Index: dbwrapper.cpp
===================================================================
--- dbwrapper.cpp (revision 2189)
+++ dbwrapper.cpp (working copy)
@@ -1573,11 +1573,16 @@
int mmDBWrapper::getTransactionNumber(wxSQLite3Database* db, int accountID)
{
- static const char sql[] =
- "select ifnull(max(cast(TRANSACTIONNUMBER as integer)),0)+1 as MaxTransID "
- "from CHECKINGACCOUNT_V1 "
- "where ACCOUNTID = ? ";
-
+ // BEGIN omalleypat custom mod ---------------------------------------------------
+ // IF THIS IS IN SVN, IT WAS CHECKED IN BY MISTAKE!!!!
+ // When automatically getting the next transaction number,
+ // ignore transfers and any withdrawal with transaction number over 10000
+ static const char sql[] =
+ "select ifnull(max(tnum),0)+1 as MaxTransID from "
+ "( select cast(TRANSACTIONNUMBER as integer) as tnum from "
+ " CHECKINGACCOUNT_V1 where ACCOUNTID = ? AND tnum<10000 AND TRANSCODE = 'Withdrawal'"
+ ")";
+ // END omalleypat custom mod ------------------------------------------------------
int transID = 1;
wxSQLite3Statement st = db->PrepareStatement(sql);
Pat