From: <gua...@us...> - 2013-07-03 22:58:37
|
Revision: 4255 http://sourceforge.net/p/moneymanagerex/code/4255 Author: guanlisheng Date: 2013-07-03 22:58:33 +0000 (Wed, 03 Jul 2013) Log Message: ----------- sample asset model Added Paths: ----------- trunk/src/model/Model.h trunk/src/model/Model_Asset.h Added: trunk/src/model/Model.h =================================================================== --- trunk/src/model/Model.h (rev 0) +++ trunk/src/model/Model.h 2013-07-03 22:58:33 UTC (rev 4255) @@ -0,0 +1,42 @@ +// -*- C++ -*- +//============================================================================= +/** + * Copyright (c) 2013 Guan Lisheng (gua...@gm...) + * + * @file + * + * @author [sqlite2cpp.py] + * + * @brief + * + * Revision History: + * AUTO GENERATED at 2013-07-03 22:55:49.491495. + * DO NOT EDIT! + */ +//============================================================================= + +#ifndef MODEL_H +#define MODEL_H + +#include <vector> +#include <map> +#include <algorithm> +#include "db/DB_Table.h" +#include "singleton.h" + +class wxString; +class wxSQLite3Statement; +class wxSQLite3Database; +class wxSQLite3ResultSet; + +class Model +{ +public: + Model():table_(0) {}; + Model(DB_Table* table):table_(table) {}; + virtual ~Model() { if (table_) delete table_; }; + +protected: + DB_Table* table_; +}; +#endif // Added: trunk/src/model/Model_Asset.h =================================================================== --- trunk/src/model/Model_Asset.h (rev 0) +++ trunk/src/model/Model_Asset.h 2013-07-03 22:58:33 UTC (rev 4255) @@ -0,0 +1,41 @@ +// -*- C++ -*- +//============================================================================= +/** + * Copyright (c) 2013 Guan Lisheng (gua...@gm...) + * + * @file + * + * @author [sqlite2cpp.py] + * + * @brief + * + * Revision History: + * AUTO GENERATED at 2013-07-03 22:55:49.491495. + * DO NOT EDIT! + */ +//============================================================================= + +#ifndef MODEL_ASSET_H +#define MODEL_ASSET_H + +#include "Model.h" +#include "db/DB_Table_Assets_V1.h" + +class Model_Asset : public Model +{ +public: + typedef DB_Table_ASSETS_V1::COLUMN COLUMN; + typedef DB_Table_ASSETS_V1::Data Data; + typedef DB_Table_ASSETS_V1::Data_Set Data_Set; +public: + Model_Asset() {}; + Model_Asset(DB_Table_ASSETS_V1* table) {}; + ~Model_Asset() {}; + +public: + Data_Set all(wxSQLite3Database* db, COLUMN col = COLUMN(0), bool asc = true) + { + return dynamic_cast<DB_Table_ASSETS_V1*>(this->table_)->all(db, col, asc); + } +}; +#endif // This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gua...@us...> - 2013-07-04 14:06:47
|
Revision: 4271 http://sourceforge.net/p/moneymanagerex/code/4271 Author: guanlisheng Date: 2013-07-04 14:06:43 +0000 (Thu, 04 Jul 2013) Log Message: ----------- more Model (MVC) Modified Paths: -------------- trunk/src/model/Model_Asset.h Added Paths: ----------- trunk/src/model/Model_Infotable.h trunk/src/model/Model_Setting.h Modified: trunk/src/model/Model_Asset.h =================================================================== --- trunk/src/model/Model_Asset.h 2013-07-04 13:02:57 UTC (rev 4270) +++ trunk/src/model/Model_Asset.h 2013-07-04 14:06:43 UTC (rev 4271) @@ -20,7 +20,6 @@ #include "Model.h" #include "db/DB_Table_Assets_V1.h" -class wxSQLite3Database; class Model_Asset : public Model { Added: trunk/src/model/Model_Infotable.h =================================================================== --- trunk/src/model/Model_Infotable.h (rev 0) +++ trunk/src/model/Model_Infotable.h 2013-07-04 14:06:43 UTC (rev 4271) @@ -0,0 +1,70 @@ +// -*- C++ -*- +//============================================================================= +/** + * Copyright (c) 2013 Guan Lisheng (gua...@gm...) + * + * @file + * + * @author [sqlite2cpp.py] + * + * @brief + * + * Revision History: + * AUTO GENERATED at 2013-07-03 22:55:49.491495. + * DO NOT EDIT! + */ +//============================================================================= + +#ifndef MODEL_INFOTABLE_H +#define MODEL_INFOTABLE_H + +#include "Model.h" +#include "db/DB_Table_Infotable_V1.h" +#include "defs.h" + +class Model_Infotable : public Model +{ +public: + typedef DB_Table_INFOTABLE_V1::COLUMN COLUMN; + typedef DB_Table_INFOTABLE_V1::Data Data; + typedef DB_Table_INFOTABLE_V1::Data_Set Data_Set; +public: + Model_Infotable(): Model(new DB_Table_INFOTABLE_V1()) {}; + ~Model_Infotable() {}; + +public: + static Model_Infotable& instance() + { + return Singleton<Model_Infotable>::instance(); + } + +public: + Data_Set all(COLUMN col = COLUMN(0), bool asc = true) + { + return dynamic_cast<DB_Table_INFOTABLE_V1*>(this->table_)->all(this->db_, col, asc); + } + +public: + // Setter + void Set(const wxString& key, int value) + { + this->Set(key, wxString::Format("%d", value)); + } + + void Set(const wxString& key, const wxString& value) + { + + } +public: + // Getter + bool GetIntInfotable(const wxString& key, int default_value); + { + return default_value; + } + wxString GetStringInfotable(const wxString& key, const wxString& default_value) + { + return default_value; + } +}; + +#endif // Added: trunk/src/model/Model_Setting.h =================================================================== --- trunk/src/model/Model_Setting.h (rev 0) +++ trunk/src/model/Model_Setting.h 2013-07-04 14:06:43 UTC (rev 4271) @@ -0,0 +1,87 @@ +// -*- C++ -*- +//============================================================================= +/** + * Copyright (c) 2013 Guan Lisheng (gua...@gm...) + * + * @file + * + * @author [sqlite2cpp.py] + * + * @brief + * + * Revision History: + * AUTO GENERATED at 2013-07-03 22:55:49.491495. + * DO NOT EDIT! + */ +//============================================================================= + +#ifndef MODEL_SETTING_H +#define MODEL_SETTING_H + +#include "Model.h" +#include "db/DB_Table_Setting_V1.h" +#include "defs.h" + +class Model_Setting : public Model +{ +public: + typedef DB_Table_SETTING_V1::COLUMN COLUMN; + typedef DB_Table_SETTING_V1::Data Data; + typedef DB_Table_SETTING_V1::Data_Set Data_Set; +public: + Model_Setting(): Model(new DB_Table_SETTING_V1()) {}; + ~Model_Setting() {}; + +public: + static Model_Setting& instance() + { + return Singleton<Model_Setting>::instance(); + } + +public: + Data_Set all(COLUMN col = COLUMN(0), bool asc = true) + { + return dynamic_cast<DB_Table_SETTING_V1*>(this->table_)->all(this->db_, col, asc); + } + +public: + // Setter + void Set(const wxString& key, int value) + { + this->Set(key, wxString::Format("%d", value)); + } + + void Set(const wxString& key, bool value) + { + this->Set(key, (value) ? "TRUE" : "FALSE"); + } + + void Set(const wxString& key, const wxColour& value) + { + } + + void Set(const wxString& key, const wxString& value) + { + + } +public: + // Getter + bool GetBoolSetting(const wxString& key, bool default_value); + { + return default_value; + } + bool GetIntSetting(const wxString& key, int default_value); + { + return default_value; + } + wxColour GetColourSetting(const wxString& key, const wxColour& default_value = wxColour(255, 255,255)) + { + return default_value; + } + wxString GetStringSetting(const wxString& key, const wxString& default_value) + { + return default_value; + } +}; + +#endif // This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gua...@us...> - 2013-07-05 01:00:12
|
Revision: 4276 http://sourceforge.net/p/moneymanagerex/code/4276 Author: guanlisheng Date: 2013-07-05 01:00:05 +0000 (Fri, 05 Jul 2013) Log Message: ----------- use C++ multiple inheritance Modified Paths: -------------- trunk/src/model/Model.h trunk/src/model/Model_Asset.h trunk/src/model/Model_Infotable.h trunk/src/model/Model_Setting.h Modified: trunk/src/model/Model.h =================================================================== --- trunk/src/model/Model.h 2013-07-04 19:45:42 UTC (rev 4275) +++ trunk/src/model/Model.h 2013-07-05 01:00:05 UTC (rev 4276) @@ -21,7 +21,6 @@ #include <vector> #include <map> #include <algorithm> -#include "db/DB_Table.h" #include "singleton.h" class wxString; @@ -32,13 +31,10 @@ class Model { public: - Model(DB_Table* table):table_(table), db_(0) {}; - virtual ~Model() { if (table_) delete table_; }; + Model():db_(0) {}; + virtual ~Model() {}; public: wxSQLite3Database* db_; - -protected: - DB_Table* table_; }; #endif // Modified: trunk/src/model/Model_Asset.h =================================================================== --- trunk/src/model/Model_Asset.h 2013-07-04 19:45:42 UTC (rev 4275) +++ trunk/src/model/Model_Asset.h 2013-07-05 01:00:05 UTC (rev 4276) @@ -21,14 +21,11 @@ #include "Model.h" #include "db/DB_Table_Assets_V1.h" -class Model_Asset : public Model +class Model_Asset : public Model, public DB_Table_ASSETS_V1 { + using DB_Table_ASSETS_V1::all; public: - typedef DB_Table_ASSETS_V1::COLUMN COLUMN; - typedef DB_Table_ASSETS_V1::Data Data; - typedef DB_Table_ASSETS_V1::Data_Set Data_Set; -public: - Model_Asset(): Model(new DB_Table_ASSETS_V1()) {}; + Model_Asset(): Model(), DB_Table_ASSETS_V1() {}; ~Model_Asset() {}; public: @@ -40,7 +37,7 @@ public: Data_Set all(COLUMN col = COLUMN(0), bool asc = true) { - return dynamic_cast<DB_Table_ASSETS_V1*>(this->table_)->all(this->db_, col, asc); + return all(db_, col, asc); } }; Modified: trunk/src/model/Model_Infotable.h =================================================================== --- trunk/src/model/Model_Infotable.h 2013-07-04 19:45:42 UTC (rev 4275) +++ trunk/src/model/Model_Infotable.h 2013-07-05 01:00:05 UTC (rev 4276) @@ -22,14 +22,11 @@ #include "db/DB_Table_Infotable_V1.h" #include "defs.h" -class Model_Infotable : public Model +class Model_Infotable : public Model, public DB_Table_INFOTABLE_V1 { + using DB_Table_INFOTABLE_V1::all; public: - typedef DB_Table_INFOTABLE_V1::COLUMN COLUMN; - typedef DB_Table_INFOTABLE_V1::Data Data; - typedef DB_Table_INFOTABLE_V1::Data_Set Data_Set; -public: - Model_Infotable(): Model(new DB_Table_INFOTABLE_V1()) {}; + Model_Infotable(): Model(), DB_Table_INFOTABLE_V1() {}; ~Model_Infotable() {}; public: @@ -38,10 +35,10 @@ return Singleton<Model_Infotable>::instance(); } -public: +private: Data_Set all(COLUMN col = COLUMN(0), bool asc = true) { - return dynamic_cast<DB_Table_INFOTABLE_V1*>(this->table_)->all(this->db_, col, asc); + return this->all(this->db_, col, asc); } public: @@ -53,7 +50,6 @@ void Set(const wxString& key, const wxString& value) { - } public: // Getter @@ -63,6 +59,9 @@ } wxString GetStringInfotable(const wxString& key, const wxString& default_value) { + for (const auto& record: this->all()) + if (record.INFONAME == key) return record.INFOVALUE; + return default_value; } }; Modified: trunk/src/model/Model_Setting.h =================================================================== --- trunk/src/model/Model_Setting.h 2013-07-04 19:45:42 UTC (rev 4275) +++ trunk/src/model/Model_Setting.h 2013-07-05 01:00:05 UTC (rev 4276) @@ -22,14 +22,11 @@ #include "db/DB_Table_Setting_V1.h" #include "defs.h" -class Model_Setting : public Model +class Model_Setting : public Model, public DB_Table_SETTING_V1 { + using DB_Table_SETTING_V1::all; public: - typedef DB_Table_SETTING_V1::COLUMN COLUMN; - typedef DB_Table_SETTING_V1::Data Data; - typedef DB_Table_SETTING_V1::Data_Set Data_Set; -public: - Model_Setting(): Model(new DB_Table_SETTING_V1()) {}; + Model_Setting(): Model(), DB_Table_SETTING_V1() {}; ~Model_Setting() {}; public: @@ -41,7 +38,7 @@ public: Data_Set all(COLUMN col = COLUMN(0), bool asc = true) { - return dynamic_cast<DB_Table_SETTING_V1*>(this->table_)->all(this->db_, col, asc); + this->all(this->db_, col, asc); } public: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gua...@us...> - 2013-07-05 01:47:01
|
Revision: 4278 http://sourceforge.net/p/moneymanagerex/code/4278 Author: guanlisheng Date: 2013-07-05 01:46:59 +0000 (Fri, 05 Jul 2013) Log Message: ----------- model Infotable & Setting Modified Paths: -------------- trunk/src/model/Model_Infotable.h trunk/src/model/Model_Setting.h Modified: trunk/src/model/Model_Infotable.h =================================================================== --- trunk/src/model/Model_Infotable.h 2013-07-05 01:45:20 UTC (rev 4277) +++ trunk/src/model/Model_Infotable.h 2013-07-05 01:46:59 UTC (rev 4278) @@ -55,7 +55,6 @@ { if (record.INFONAME == key) { - info = &record; info = this->get(record.INFOID, this->db_); break; } Modified: trunk/src/model/Model_Setting.h =================================================================== --- trunk/src/model/Model_Setting.h 2013-07-05 01:45:20 UTC (rev 4277) +++ trunk/src/model/Model_Setting.h 2013-07-05 01:46:59 UTC (rev 4278) @@ -65,7 +65,6 @@ { if (record.SETTINGNAME == key) { - setting = &record; setting = this->get(record.SETTINGID, this->db_); break; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vo...@us...> - 2013-07-06 18:01:28
|
Revision: 4294 http://sourceforge.net/p/moneymanagerex/code/4294 Author: vomikan Date: 2013-07-06 18:01:25 +0000 (Sat, 06 Jul 2013) Log Message: ----------- VS2012 warning fix Modified Paths: -------------- trunk/src/model/Model_Infotable.h trunk/src/model/Model_Setting.h Modified: trunk/src/model/Model_Infotable.h =================================================================== --- trunk/src/model/Model_Infotable.h 2013-07-06 17:52:33 UTC (rev 4293) +++ trunk/src/model/Model_Infotable.h 2013-07-06 18:01:25 UTC (rev 4294) @@ -90,7 +90,7 @@ return default_value; } - bool GetIntInfo(const wxString& key, int default_value) + int GetIntInfo(const wxString& key, int default_value) { wxString value = this->GetStringInfo(key, ""); if (!value.IsEmpty() && value.IsNumber()) return wxAtoi(value); Modified: trunk/src/model/Model_Setting.h =================================================================== --- trunk/src/model/Model_Setting.h 2013-07-06 17:52:33 UTC (rev 4293) +++ trunk/src/model/Model_Setting.h 2013-07-06 18:01:25 UTC (rev 4294) @@ -50,7 +50,10 @@ void Set(const wxString& key, bool value) { - this->Set(key, (value) ? "TRUE" : "FALSE"); + if (value) + this->Set(key, "TRUE"); + else + this->Set(key, "FALSE"); } void Set(const wxString& key, const wxColour& value) @@ -93,7 +96,7 @@ return default_value; } - bool GetIntSetting(const wxString& key, int default_value) + int GetIntSetting(const wxString& key, int default_value) { wxString value = this->GetStringSetting(key, ""); if (!value.IsEmpty() && value.IsNumber()) return wxAtoi(value); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gua...@us...> - 2013-07-07 02:19:58
|
Revision: 4298 http://sourceforge.net/p/moneymanagerex/code/4298 Author: guanlisheng Date: 2013-07-07 02:19:55 +0000 (Sun, 07 Jul 2013) Log Message: ----------- Model_Currency.h Modified Paths: -------------- trunk/src/model/Model_Asset.h Added Paths: ----------- trunk/src/model/Model_Currency.h Modified: trunk/src/model/Model_Asset.h =================================================================== --- trunk/src/model/Model_Asset.h 2013-07-07 02:10:22 UTC (rev 4297) +++ trunk/src/model/Model_Asset.h 2013-07-07 02:19:55 UTC (rev 4298) @@ -20,6 +20,7 @@ #include "Model.h" #include "db/DB_Table_Assets_V1.h" +#include "Model_Currency.h" // detect base currency class Model_Asset : public Model, public DB_Table_ASSETS_V1 { Added: trunk/src/model/Model_Currency.h =================================================================== --- trunk/src/model/Model_Currency.h (rev 0) +++ trunk/src/model/Model_Currency.h 2013-07-07 02:19:55 UTC (rev 4298) @@ -0,0 +1,45 @@ +// -*- C++ -*- +//============================================================================= +/** + * Copyright (c) 2013 Guan Lisheng (gua...@gm...) + * + * @file + * + * @author [sqlite2cpp.py] + * + * @brief + * + * Revision History: + * AUTO GENERATED at 2013-07-03 22:55:49.491495. + * DO NOT EDIT! + */ +//============================================================================= + +#ifndef MODEL_CURRENCY_H +#define MODEL_CURRENCY_H + +#include "Model.h" +#include "db/DB_Table_Currencyformats_V1.h" +#include "Model_Infotable.h" // detect base currency setting BASECURRENCYID + +class Model_Currency : public Model, public DB_Table_CURRENCYFORMATS_V1 +{ + using DB_Table_CURRENCYFORMATS_V1::all; +public: + Model_Currency(): Model(), DB_Table_CURRENCYFORMATS_V1() {}; + ~Model_Currency() {}; + +public: + static Model_Currency& instance() + { + return Singleton<Model_Currency>::instance(); + } + +public: + Data_Set all(COLUMN col = COLUMN(0), bool asc = true) + { + return all(db_, col, asc); + } +}; + +#endif // This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gua...@us...> - 2013-07-09 03:42:36
|
Revision: 4332 http://sourceforge.net/p/moneymanagerex/code/4332 Author: guanlisheng Date: 2013-07-09 03:42:32 +0000 (Tue, 09 Jul 2013) Log Message: ----------- keywords Property Changed: ---------------- trunk/src/model/Model.h trunk/src/model/Model_Asset.h trunk/src/model/Model_Budgetyear.h trunk/src/model/Model_Currency.h trunk/src/model/Model_Infotable.h trunk/src/model/Model_Setting.h trunk/src/model/Model_Stock.h Index: trunk/src/model/Model.h =================================================================== --- trunk/src/model/Model.h 2013-07-09 03:40:35 UTC (rev 4331) +++ trunk/src/model/Model.h 2013-07-09 03:42:32 UTC (rev 4332) Property changes on: trunk/src/model/Model.h ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Revision \ No newline at end of property Index: trunk/src/model/Model_Asset.h =================================================================== --- trunk/src/model/Model_Asset.h 2013-07-09 03:40:35 UTC (rev 4331) +++ trunk/src/model/Model_Asset.h 2013-07-09 03:42:32 UTC (rev 4332) Property changes on: trunk/src/model/Model_Asset.h ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Revision \ No newline at end of property Index: trunk/src/model/Model_Budgetyear.h =================================================================== --- trunk/src/model/Model_Budgetyear.h 2013-07-09 03:40:35 UTC (rev 4331) +++ trunk/src/model/Model_Budgetyear.h 2013-07-09 03:42:32 UTC (rev 4332) Property changes on: trunk/src/model/Model_Budgetyear.h ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Revision \ No newline at end of property Index: trunk/src/model/Model_Currency.h =================================================================== --- trunk/src/model/Model_Currency.h 2013-07-09 03:40:35 UTC (rev 4331) +++ trunk/src/model/Model_Currency.h 2013-07-09 03:42:32 UTC (rev 4332) Property changes on: trunk/src/model/Model_Currency.h ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Revision \ No newline at end of property Index: trunk/src/model/Model_Infotable.h =================================================================== --- trunk/src/model/Model_Infotable.h 2013-07-09 03:40:35 UTC (rev 4331) +++ trunk/src/model/Model_Infotable.h 2013-07-09 03:42:32 UTC (rev 4332) Property changes on: trunk/src/model/Model_Infotable.h ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Revision \ No newline at end of property Index: trunk/src/model/Model_Setting.h =================================================================== --- trunk/src/model/Model_Setting.h 2013-07-09 03:40:35 UTC (rev 4331) +++ trunk/src/model/Model_Setting.h 2013-07-09 03:42:32 UTC (rev 4332) Property changes on: trunk/src/model/Model_Setting.h ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Revision \ No newline at end of property Index: trunk/src/model/Model_Stock.h =================================================================== --- trunk/src/model/Model_Stock.h 2013-07-09 03:40:35 UTC (rev 4331) +++ trunk/src/model/Model_Stock.h 2013-07-09 03:42:32 UTC (rev 4332) Property changes on: trunk/src/model/Model_Stock.h ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Revision \ No newline at end of property This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gua...@us...> - 2013-07-10 12:37:20
|
Revision: 4341 http://sourceforge.net/p/moneymanagerex/code/4341 Author: guanlisheng Date: 2013-07-10 12:37:16 +0000 (Wed, 10 Jul 2013) Log Message: ----------- ensure all tables Modified Paths: -------------- trunk/src/model/Model_Asset.h trunk/src/model/Model_Currency.h trunk/src/model/Model_Setting.h trunk/src/model/Model_Stock.h Modified: trunk/src/model/Model_Asset.h =================================================================== --- trunk/src/model/Model_Asset.h 2013-07-10 07:01:01 UTC (rev 4340) +++ trunk/src/model/Model_Asset.h 2013-07-10 12:37:16 UTC (rev 4341) @@ -69,6 +69,7 @@ public: Data_Set all(COLUMN col = COLUMN(0), bool asc = true) { + this->ensure(this->db_); return all(db_, col, asc); } double balance() Modified: trunk/src/model/Model_Currency.h =================================================================== --- trunk/src/model/Model_Currency.h 2013-07-10 07:01:01 UTC (rev 4340) +++ trunk/src/model/Model_Currency.h 2013-07-10 12:37:16 UTC (rev 4341) @@ -38,6 +38,7 @@ public: Data_Set all(COLUMN col = COLUMN(0), bool asc = true) { + this->ensure(this->db_); return all(db_, col, asc); } public: Modified: trunk/src/model/Model_Setting.h =================================================================== --- trunk/src/model/Model_Setting.h 2013-07-10 07:01:01 UTC (rev 4340) +++ trunk/src/model/Model_Setting.h 2013-07-10 12:37:16 UTC (rev 4341) @@ -39,6 +39,7 @@ public: Data_Set all(COLUMN col = COLUMN(0), bool asc = true) { + this->ensure(this->db_); return this->all(this->db_, col, asc); } Modified: trunk/src/model/Model_Stock.h =================================================================== --- trunk/src/model/Model_Stock.h 2013-07-10 07:01:01 UTC (rev 4340) +++ trunk/src/model/Model_Stock.h 2013-07-10 12:37:16 UTC (rev 4341) @@ -43,6 +43,7 @@ public: Data_Set all(COLUMN col = COLUMN(0), bool asc = true) { + this->ensure(this->db_); return all(db_, col, asc); } }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gua...@us...> - 2013-07-19 02:45:44
|
Revision: 4394 http://sourceforge.net/p/moneymanagerex/code/4394 Author: guanlisheng Date: 2013-07-19 02:45:39 +0000 (Fri, 19 Jul 2013) Log Message: ----------- auxiliary to_date function to parse string date Modified Paths: -------------- trunk/src/model/Model.h trunk/src/model/Model_Asset.h trunk/src/model/Model_Stock.h Modified: trunk/src/model/Model.h =================================================================== --- trunk/src/model/Model.h 2013-07-18 19:27:56 UTC (rev 4393) +++ trunk/src/model/Model.h 2013-07-19 02:45:39 UTC (rev 4394) @@ -21,6 +21,7 @@ #include <vector> #include <map> #include <algorithm> +#include <wx/datetime.h> #include "singleton.h" #include <memory> @@ -29,6 +30,8 @@ class wxSQLite3Database; class wxSQLite3ResultSet; +typedef wxDateTime wxDate; + class Model { public: @@ -45,6 +48,13 @@ this->db_->Commit(); } public: + wxDate to_date(const wxString& str_date) + { + wxDate date = wxDateTime::Today(); + date.ParseISODate(str_date); // the date in ISO 8601 format "YYYY-MM-DD". + return date; + } +public: wxSQLite3Database* db_; }; #endif // Modified: trunk/src/model/Model_Asset.h =================================================================== --- trunk/src/model/Model_Asset.h 2013-07-18 19:27:56 UTC (rev 4393) +++ trunk/src/model/Model_Asset.h 2013-07-19 02:45:39 UTC (rev 4394) @@ -81,6 +81,10 @@ } return balance; } + +public: + wxDate STARTDATE(const Data* asset) { return this->to_date(asset->STARTDATE); } + wxDate STARTDATE(const Data& asset) { return this->to_date(asset.STARTDATE); } }; #endif // Modified: trunk/src/model/Model_Stock.h =================================================================== --- trunk/src/model/Model_Stock.h 2013-07-18 19:27:56 UTC (rev 4393) +++ trunk/src/model/Model_Stock.h 2013-07-19 02:45:39 UTC (rev 4394) @@ -46,6 +46,10 @@ this->ensure(this->db_); return all(db_, col, asc); } + +public: + wxDate PURCHASEDATE(const Data* stock) { return this->to_date(stock->PURCHASEDATE); } + wxDate PURCHASEDATE(const Data& stock) { return this->to_date(stock.PURCHASEDATE); } }; #endif // This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gua...@us...> - 2013-09-24 08:48:14
|
Revision: 4565 http://sourceforge.net/p/moneymanagerex/code/4565 Author: guanlisheng Date: 2013-09-24 08:48:08 +0000 (Tue, 24 Sep 2013) Log Message: ----------- category related code Modified Paths: -------------- trunk/src/model/Model_Category.h trunk/src/model/Model_Payee.h Modified: trunk/src/model/Model_Category.h =================================================================== --- trunk/src/model/Model_Category.h 2013-09-24 07:39:32 UTC (rev 4564) +++ trunk/src/model/Model_Category.h 2013-09-24 08:48:08 UTC (rev 4565) @@ -21,6 +21,8 @@ #include "Model.h" #include "db/DB_Table_Category_V1.h" #include "Model_Subcategory.h" +#include "Model_Checking.h" +#include "Model_Account.h" class Model_Category : public Model, public DB_Table_CATEGORY_V1 { @@ -67,10 +69,22 @@ asset->save(this->db_); return asset->id(); } +public: Model_Subcategory::Data_Set sub_category(const Data* r) { return Model_Subcategory::instance().find(Model_Subcategory::COL_CATEGID, r->CATEGID); } + + void top_category(std::vector<std::pair<wxString /*category name*/, double/*amount*/> >& category, const mmDateRange* date_range, int top_n = 7) + { + for (const auto& tran: Model_Checking::instance().all()) + { + if (tran.STATUS == "V") continue; + // TODO + const Model_Account::Data* account = Model_Account::instance().get(tran.ACCOUNTID); + if (!account) continue; + } + } }; #endif // Modified: trunk/src/model/Model_Payee.h =================================================================== --- trunk/src/model/Model_Payee.h 2013-09-24 07:39:32 UTC (rev 4564) +++ trunk/src/model/Model_Payee.h 2013-09-24 08:48:08 UTC (rev 4565) @@ -98,7 +98,7 @@ { Model_Checking::Data_Set trans = Model_Checking::instance().find(Model_Checking::COL_PAYEEID, id); Model_Billsdeposits::Data_Set bills = Model_Billsdeposits::instance().find(Model_Billsdeposits::COL_PAYEEID, id); - return !trans.empty() && !bills.empty(); + return !trans.empty() || !bills.empty(); } bool is_used(const Data* record) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gua...@us...> - 2013-09-24 14:44:04
|
Revision: 4571 http://sourceforge.net/p/moneymanagerex/code/4571 Author: guanlisheng Date: 2013-09-24 14:44:01 +0000 (Tue, 24 Sep 2013) Log Message: ----------- TRANSDATE Modified Paths: -------------- trunk/src/model/Model_Category.h trunk/src/model/Model_Checking.h Modified: trunk/src/model/Model_Category.h =================================================================== --- trunk/src/model/Model_Category.h 2013-09-24 12:01:38 UTC (rev 4570) +++ trunk/src/model/Model_Category.h 2013-09-24 14:44:01 UTC (rev 4571) @@ -82,8 +82,8 @@ { if (tran.STATUS == "V" || tran.STATUS == "X") continue; if (tran.TRANSCODE == TRANS_TYPE_TRANSFER_STR) continue; // skip - //if (tran.TRANSDATE < date_range->start_date()) continue; - //if (tran.TRANSDATE.GetDateOnly() > date_range->end_date()) continue; + if (Model_Checking::TRANSDATE(tran) < date_range->start_date()) continue; + if (Model_Checking::TRANSDATE(tran) > date_range->end_date()) continue; // TODO: see getTopCategoryStats const Model_Account::Data* account = Model_Account::instance().get(tran.ACCOUNTID); if (!account) continue; Modified: trunk/src/model/Model_Checking.h =================================================================== --- trunk/src/model/Model_Checking.h 2013-09-24 12:01:38 UTC (rev 4570) +++ trunk/src/model/Model_Checking.h 2013-09-24 14:44:01 UTC (rev 4571) @@ -66,6 +66,9 @@ asset->save(this->db_); return asset->id(); } +public: + static wxDate TRANSDATE(const Data* asset) { return Model::to_date(asset->TRANSDATE); } + static wxDate TRANSDATE(const Data& asset) { return Model::to_date(asset.TRANSDATE); } }; #endif // This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gua...@us...> - 2013-09-24 15:27:25
|
Revision: 4572 http://sourceforge.net/p/moneymanagerex/code/4572 Author: guanlisheng Date: 2013-09-24 15:27:22 +0000 (Tue, 24 Sep 2013) Log Message: ----------- TODO Modified Paths: -------------- trunk/src/model/Model_Category.h trunk/src/model/Model_Subcategory.h Modified: trunk/src/model/Model_Category.h =================================================================== --- trunk/src/model/Model_Category.h 2013-09-24 14:44:01 UTC (rev 4571) +++ trunk/src/model/Model_Category.h 2013-09-24 15:27:22 UTC (rev 4572) @@ -100,6 +100,11 @@ } } + static bool is_used(int id) + { + // TODO + return true; + } }; #endif // Modified: trunk/src/model/Model_Subcategory.h =================================================================== --- trunk/src/model/Model_Subcategory.h 2013-09-24 14:44:01 UTC (rev 4571) +++ trunk/src/model/Model_Subcategory.h 2013-09-24 15:27:22 UTC (rev 4572) @@ -67,6 +67,12 @@ asset->save(this->db_); return asset->id(); } +public: + static bool is_used(int id) + { + // TODO + return true; + } }; #endif // This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gua...@us...> - 2013-09-24 15:51:07
|
Revision: 4573 http://sourceforge.net/p/moneymanagerex/code/4573 Author: guanlisheng Date: 2013-09-24 15:51:02 +0000 (Tue, 24 Sep 2013) Log Message: ----------- rename asset to r Modified Paths: -------------- trunk/src/model/Model_Asset.h trunk/src/model/Model_Billsdeposits.h trunk/src/model/Model_Category.h trunk/src/model/Model_Checking.h trunk/src/model/Model_Payee.h trunk/src/model/Model_Subcategory.h Modified: trunk/src/model/Model_Asset.h =================================================================== --- trunk/src/model/Model_Asset.h 2013-09-24 15:27:22 UTC (rev 4572) +++ trunk/src/model/Model_Asset.h 2013-09-24 15:51:02 UTC (rev 4573) @@ -77,53 +77,53 @@ { return this->get(id, this->db_); } - int save(Data* asset) + int save(Data* r) { - asset->save(this->db_); - return asset->id(); + r->save(this->db_); + return r->id(); } double balance() { double balance = 0.0; - for (const auto& asset: this->all()) + for (const auto& r: this->all()) { - balance += asset.VALUE; + balance += r.VALUE; } return balance; } public: - static wxDate STARTDATE(const Data* asset) { return Model::to_date(asset->STARTDATE); } - static wxDate STARTDATE(const Data& asset) { return Model::to_date(asset.STARTDATE); } + static wxDate STARTDATE(const Data* r) { return Model::to_date(r->STARTDATE); } + static wxDate STARTDATE(const Data& r) { return Model::to_date(r.STARTDATE); } - static TYPE type(const Data* asset) + static TYPE type(const Data* r) { - if (asset->ASSETTYPE.CmpNoCase("Property") == 0) + if (r->ASSETTYPE.CmpNoCase("Property") == 0) return TYPE_PROPERTY; - else if (asset->ASSETTYPE.CmpNoCase("Automobile") == 0) + else if (r->ASSETTYPE.CmpNoCase("Automobile") == 0) return TYPE_AUTO; return TYPE(-1); } - static TYPE type(const Data& asset) + static TYPE type(const Data& r) { - return type(&asset); + return type(&r); } - static RATE rate(const Data* asset) + static RATE rate(const Data* r) { - if (asset->VALUECHANGE.CmpNoCase("None") == 0) + if (r->VALUECHANGE.CmpNoCase("None") == 0) return RATE_NONE; - else if (asset->VALUECHANGE.CmpNoCase("Appreciates") == 0) + else if (r->VALUECHANGE.CmpNoCase("Appreciates") == 0) return RATE_APPRECIATE; - else if (asset->VALUECHANGE.CmpNoCase("Depreciates") == 0) + else if (r->VALUECHANGE.CmpNoCase("Depreciates") == 0) return RATE_DEPRECIATE; return RATE(-1); } - static RATE rate(const Data& asset) + static RATE rate(const Data& r) { - return rate(&asset); + return rate(&r); } }; Modified: trunk/src/model/Model_Billsdeposits.h =================================================================== --- trunk/src/model/Model_Billsdeposits.h 2013-09-24 15:27:22 UTC (rev 4572) +++ trunk/src/model/Model_Billsdeposits.h 2013-09-24 15:51:02 UTC (rev 4573) @@ -61,10 +61,10 @@ { return this->get(id, this->db_); } - int save(Data* asset) + int save(Data* r) { - asset->save(this->db_); - return asset->id(); + r->save(this->db_); + return r->id(); } }; Modified: trunk/src/model/Model_Category.h =================================================================== --- trunk/src/model/Model_Category.h 2013-09-24 15:27:22 UTC (rev 4572) +++ trunk/src/model/Model_Category.h 2013-09-24 15:51:02 UTC (rev 4573) @@ -64,10 +64,10 @@ { return this->get(id, this->db_); } - int save(Data* asset) + int save(Data* r) { - asset->save(this->db_); - return asset->id(); + r->save(this->db_); + return r->id(); } public: static Model_Subcategory::Data_Set sub_category(const Data* r) Modified: trunk/src/model/Model_Checking.h =================================================================== --- trunk/src/model/Model_Checking.h 2013-09-24 15:27:22 UTC (rev 4572) +++ trunk/src/model/Model_Checking.h 2013-09-24 15:51:02 UTC (rev 4573) @@ -61,14 +61,14 @@ { return this->get(id, this->db_); } - int save(Data* asset) + int save(Data* r) { - asset->save(this->db_); - return asset->id(); + r->save(this->db_); + return r->id(); } public: - static wxDate TRANSDATE(const Data* asset) { return Model::to_date(asset->TRANSDATE); } - static wxDate TRANSDATE(const Data& asset) { return Model::to_date(asset.TRANSDATE); } + static wxDate TRANSDATE(const Data* r) { return Model::to_date(r->TRANSDATE); } + static wxDate TRANSDATE(const Data& r) { return Model::to_date(r.TRANSDATE); } }; #endif // Modified: trunk/src/model/Model_Payee.h =================================================================== --- trunk/src/model/Model_Payee.h 2013-09-24 15:27:22 UTC (rev 4572) +++ trunk/src/model/Model_Payee.h 2013-09-24 15:51:02 UTC (rev 4573) @@ -72,10 +72,10 @@ if (!items.empty()) payee = this->get(items[0].PAYEEID, this->db_); return payee; } - int save(Data* asset) + int save(Data* r) { - asset->save(this->db_); - return asset->id(); + r->save(this->db_); + return r->id(); } bool remove(int id) { Modified: trunk/src/model/Model_Subcategory.h =================================================================== --- trunk/src/model/Model_Subcategory.h 2013-09-24 15:27:22 UTC (rev 4572) +++ trunk/src/model/Model_Subcategory.h 2013-09-24 15:51:02 UTC (rev 4573) @@ -62,10 +62,10 @@ { return this->get(id, this->db_); } - int save(Data* asset) + int save(Data* r) { - asset->save(this->db_); - return asset->id(); + r->save(this->db_); + return r->id(); } public: static bool is_used(int id) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gua...@us...> - 2013-09-28 13:30:02
|
Revision: 4615 http://sourceforge.net/p/moneymanagerex/code/4615 Author: guanlisheng Date: 2013-09-28 13:29:58 +0000 (Sat, 28 Sep 2013) Log Message: ----------- cleanup Modified Paths: -------------- trunk/src/model/Model_Account.h trunk/src/model/Model_Checking.h Modified: trunk/src/model/Model_Account.h =================================================================== --- trunk/src/model/Model_Account.h 2013-09-28 13:01:41 UTC (rev 4614) +++ trunk/src/model/Model_Account.h 2013-09-28 13:29:58 UTC (rev 4615) @@ -21,6 +21,7 @@ #include "Model.h" #include "db/DB_Table_Accountlist_V1.h" #include "Model_Currency.h" // detect base currency +#include "Model_Checking.h" class Model_Account : public Model, public DB_Table_ACCOUNTLIST_V1 { @@ -70,8 +71,17 @@ { return Model_Currency::instance().get(r->CURRENCYID); } - public: + static double balance(const Data* r) + { + double sum = 0; + for (const auto& tran: Model_Checking::instance().find(Model_Checking::COL_ACCOUNTID, r->ACCOUNTID)) + { + sum += Model_Checking::balance(tran, r->ACCOUNTID); + } + return sum; + } +public: static STATUS status(const Data* account) { if (account->STATUS.CmpNoCase("Open") == 0) Modified: trunk/src/model/Model_Checking.h =================================================================== --- trunk/src/model/Model_Checking.h 2013-09-28 13:01:41 UTC (rev 4614) +++ trunk/src/model/Model_Checking.h 2013-09-28 13:29:58 UTC (rev 4615) @@ -99,6 +99,27 @@ return TRANSFER; } static TYPE type(const Data& r) { return type(&r); } + static double balance(const Data* r, int account_id = -1) + { + double sum = 0; + switch (type(r)) + { + case WITHDRAWAL: + sum -= r->TRANSAMOUNT; + break; + case DEPOSIT: + sum += r->TRANSAMOUNT; + break; + case TRANSFER: + if (account_id == r->ACCOUNTID) sum -= r->TRANSAMOUNT; + if (account_id == r->TOACCOUNTID) sum -= r->TRANSAMOUNT; + break; + default: + break; + } + return sum; + } + static double balance(const Data& r, int account_id = -1) { return balance(&r, account_id); } }; #endif // This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sie...@us...> - 2013-09-30 03:02:24
|
Revision: 4643 http://sourceforge.net/p/moneymanagerex/code/4643 Author: siena123 Date: 2013-09-30 03:02:21 +0000 (Mon, 30 Sep 2013) Log Message: ----------- cleanup - unused parameters Modified Paths: -------------- trunk/src/model/Model_Asset.h trunk/src/model/Model_Category.h trunk/src/model/Model_Subcategory.h Modified: trunk/src/model/Model_Asset.h =================================================================== --- trunk/src/model/Model_Asset.h 2013-09-30 02:59:36 UTC (rev 4642) +++ trunk/src/model/Model_Asset.h 2013-09-30 03:02:21 UTC (rev 4643) @@ -125,7 +125,7 @@ { return rate(&r); } - static Model_Currency::Data* currency(const Data* r) + static Model_Currency::Data* currency(const Data* /* r */) { return Model_Currency::instance().GetBaseCurrency(); } Modified: trunk/src/model/Model_Category.h =================================================================== --- trunk/src/model/Model_Category.h 2013-09-30 02:59:36 UTC (rev 4642) +++ trunk/src/model/Model_Category.h 2013-09-30 03:02:21 UTC (rev 4643) @@ -86,7 +86,7 @@ } static void top_category(std::vector<std::pair<wxString /*category name*/ - , double/*amount*/> >& category, const mmDateRange* date_range, int top_n = 7) + , double/*amount*/> >& /* category */, const mmDateRange* date_range, int /* top_n = 7 */) { for (const auto& tran: Model_Checking::instance().all()) { Modified: trunk/src/model/Model_Subcategory.h =================================================================== --- trunk/src/model/Model_Subcategory.h 2013-09-30 02:59:36 UTC (rev 4642) +++ trunk/src/model/Model_Subcategory.h 2013-09-30 03:02:21 UTC (rev 4643) @@ -68,7 +68,7 @@ return r->id(); } public: - static bool is_used(int id) + static bool is_used(int /* id */) { // TODO return true; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gua...@us...> - 2013-10-07 06:20:32
|
Revision: 4774 http://sourceforge.net/p/moneymanagerex/code/4774 Author: guanlisheng Date: 2013-10-07 06:20:28 +0000 (Mon, 07 Oct 2013) Log Message: ----------- cleanup Modified Paths: -------------- trunk/src/model/Model.h trunk/src/model/Model_Account.h trunk/src/model/Model_Asset.h trunk/src/model/Model_Billsdeposits.h trunk/src/model/Model_Budgetyear.h trunk/src/model/Model_Category.h trunk/src/model/Model_Checking.h trunk/src/model/Model_Currency.h trunk/src/model/Model_Infotable.h trunk/src/model/Model_Payee.h trunk/src/model/Model_Setting.h trunk/src/model/Model_Splittransaction.h trunk/src/model/Model_Stock.h trunk/src/model/Model_Subcategory.h Modified: trunk/src/model/Model.h =================================================================== --- trunk/src/model/Model.h 2013-10-07 05:44:57 UTC (rev 4773) +++ trunk/src/model/Model.h 2013-10-07 06:20:28 UTC (rev 4774) @@ -1,19 +1,3 @@ -// -*- C++ -*- -//============================================================================= -/** - * Copyright (c) 2013 Guan Lisheng (gua...@gm...) - * - * @file - * - * @author [sqlite2cpp.py] - * - * @brief - * - * Revision History: - * AUTO GENERATED at 2013-07-03 22:55:49.491495. - * DO NOT EDIT! - */ -//============================================================================= #ifndef MODEL_H #define MODEL_H Modified: trunk/src/model/Model_Account.h =================================================================== --- trunk/src/model/Model_Account.h 2013-10-07 05:44:57 UTC (rev 4773) +++ trunk/src/model/Model_Account.h 2013-10-07 06:20:28 UTC (rev 4774) @@ -1,19 +1,3 @@ -// -*- C++ -*- -//============================================================================= -/** - * Copyright (c) 2013 Guan Lisheng (gua...@gm...) - * - * @file - * - * @author [sqlite2cpp.py] - * - * @brief - * - * Revision History: - * AUTO GENERATED at 2013-07-03 22:55:49.491495. - * DO NOT EDIT! - */ -//============================================================================= #ifndef MODEL_ACCOUNT_H #define MODEL_ACCOUNT_H Modified: trunk/src/model/Model_Asset.h =================================================================== --- trunk/src/model/Model_Asset.h 2013-10-07 05:44:57 UTC (rev 4773) +++ trunk/src/model/Model_Asset.h 2013-10-07 06:20:28 UTC (rev 4774) @@ -1,19 +1,3 @@ -// -*- C++ -*- -//============================================================================= -/** - * Copyright (c) 2013 Guan Lisheng (gua...@gm...) - * - * @file - * - * @author [sqlite2cpp.py] - * - * @brief - * - * Revision History: - * AUTO GENERATED at 2013-07-03 22:55:49.491495. - * DO NOT EDIT! - */ -//============================================================================= #ifndef MODEL_ASSET_H #define MODEL_ASSET_H Modified: trunk/src/model/Model_Billsdeposits.h =================================================================== --- trunk/src/model/Model_Billsdeposits.h 2013-10-07 05:44:57 UTC (rev 4773) +++ trunk/src/model/Model_Billsdeposits.h 2013-10-07 06:20:28 UTC (rev 4774) @@ -1,19 +1,3 @@ -// -*- C++ -*- -//============================================================================= -/** - * Copyright (c) 2013 Guan Lisheng (gua...@gm...) - * - * @file - * - * @author [sqlite2cpp.py] - * - * @brief - * - * Revision History: - * AUTO GENERATED at 2013-07-03 22:55:49.491495. - * DO NOT EDIT! - */ -//============================================================================= #ifndef MODEL_BILLSDEPOSITS_H #define MODEL_BILLSDEPOSITS_H Modified: trunk/src/model/Model_Budgetyear.h =================================================================== --- trunk/src/model/Model_Budgetyear.h 2013-10-07 05:44:57 UTC (rev 4773) +++ trunk/src/model/Model_Budgetyear.h 2013-10-07 06:20:28 UTC (rev 4774) @@ -1,19 +1,3 @@ -// -*- C++ -*- -//============================================================================= -/** - * Copyright (c) 2013 Guan Lisheng (gua...@gm...) - * - * @file - * - * @author [sqlite2cpp.py] - * - * @brief - * - * Revision History: - * AUTO GENERATED at 2013-07-03 22:55:49.491495. - * DO NOT EDIT! - */ -//============================================================================= #ifndef MODEL_BUDGETYEAR_H #define MODEL_BUDGETYEAR_H Modified: trunk/src/model/Model_Category.h =================================================================== --- trunk/src/model/Model_Category.h 2013-10-07 05:44:57 UTC (rev 4773) +++ trunk/src/model/Model_Category.h 2013-10-07 06:20:28 UTC (rev 4774) @@ -1,19 +1,3 @@ -// -*- C++ -*- -//============================================================================= -/** - * Copyright (c) 2013 Guan Lisheng (gua...@gm...) - * - * @file - * - * @author [sqlite2cpp.py] - * - * @brief - * - * Revision History: - * AUTO GENERATED at 2013-07-03 22:55:49.491495. - * DO NOT EDIT! - */ -//============================================================================= #ifndef MODEL_CATEGORY_H #define MODEL_CATEGORY_H Modified: trunk/src/model/Model_Checking.h =================================================================== --- trunk/src/model/Model_Checking.h 2013-10-07 05:44:57 UTC (rev 4773) +++ trunk/src/model/Model_Checking.h 2013-10-07 06:20:28 UTC (rev 4774) @@ -1,19 +1,3 @@ -// -*- C++ -*- -//============================================================================= -/** - * Copyright (c) 2013 Guan Lisheng (gua...@gm...) - * - * @file - * - * @author [sqlite2cpp.py] - * - * @brief - * - * Revision History: - * AUTO GENERATED at 2013-07-03 22:55:49.491495. - * DO NOT EDIT! - */ -//============================================================================= #ifndef MODEL_CHECKING_H #define MODEL_CHECKING_H Modified: trunk/src/model/Model_Currency.h =================================================================== --- trunk/src/model/Model_Currency.h 2013-10-07 05:44:57 UTC (rev 4773) +++ trunk/src/model/Model_Currency.h 2013-10-07 06:20:28 UTC (rev 4774) @@ -1,19 +1,3 @@ -// -*- C++ -*- -//============================================================================= -/** - * Copyright (c) 2013 Guan Lisheng (gua...@gm...) - * - * @file - * - * @author [sqlite2cpp.py] - * - * @brief - * - * Revision History: - * AUTO GENERATED at 2013-07-03 22:55:49.491495. - * DO NOT EDIT! - */ -//============================================================================= #ifndef MODEL_CURRENCY_H #define MODEL_CURRENCY_H Modified: trunk/src/model/Model_Infotable.h =================================================================== --- trunk/src/model/Model_Infotable.h 2013-10-07 05:44:57 UTC (rev 4773) +++ trunk/src/model/Model_Infotable.h 2013-10-07 06:20:28 UTC (rev 4774) @@ -1,19 +1,3 @@ -// -*- C++ -*- -//============================================================================= -/** - * Copyright (c) 2013 Guan Lisheng (gua...@gm...) - * - * @file - * - * @author [sqlite2cpp.py] - * - * @brief - * - * Revision History: - * AUTO GENERATED at 2013-07-03 22:55:49.491495. - * DO NOT EDIT! - */ -//============================================================================= #ifndef MODEL_INFOTABLE_H #define MODEL_INFOTABLE_H Modified: trunk/src/model/Model_Payee.h =================================================================== --- trunk/src/model/Model_Payee.h 2013-10-07 05:44:57 UTC (rev 4773) +++ trunk/src/model/Model_Payee.h 2013-10-07 06:20:28 UTC (rev 4774) @@ -1,19 +1,3 @@ -// -*- C++ -*- -//============================================================================= -/** - * Copyright (c) 2013 Guan Lisheng (gua...@gm...) - * - * @file - * - * @author [sqlite2cpp.py] - * - * @brief - * - * Revision History: - * AUTO GENERATED at 2013-07-03 22:55:49.491495. - * DO NOT EDIT! - */ -//============================================================================= #ifndef MODEL_PAYEE_H #define MODEL_PAYEE_H Modified: trunk/src/model/Model_Setting.h =================================================================== --- trunk/src/model/Model_Setting.h 2013-10-07 05:44:57 UTC (rev 4773) +++ trunk/src/model/Model_Setting.h 2013-10-07 06:20:28 UTC (rev 4774) @@ -1,19 +1,3 @@ -// -*- C++ -*- -//============================================================================= -/** - * Copyright (c) 2013 Guan Lisheng (gua...@gm...) - * - * @file - * - * @author [sqlite2cpp.py] - * - * @brief - * - * Revision History: - * AUTO GENERATED at 2013-07-03 22:55:49.491495. - * DO NOT EDIT! - */ -//============================================================================= #ifndef MODEL_SETTING_H #define MODEL_SETTING_H Modified: trunk/src/model/Model_Splittransaction.h =================================================================== --- trunk/src/model/Model_Splittransaction.h 2013-10-07 05:44:57 UTC (rev 4773) +++ trunk/src/model/Model_Splittransaction.h 2013-10-07 06:20:28 UTC (rev 4774) @@ -1,19 +1,3 @@ -// -*- C++ -*- -//============================================================================= -/** - * Copyright (c) 2013 Guan Lisheng (gua...@gm...) - * - * @file - * - * @author [sqlite2cpp.py] - * - * @brief - * - * Revision History: - * AUTO GENERATED at 2013-07-03 22:55:49.491495. - * DO NOT EDIT! - */ -//============================================================================= #ifndef MODEL_SPLITTRANSACTIONS_H #define MODEL_SPLITTRANSACTIONS_H Modified: trunk/src/model/Model_Stock.h =================================================================== --- trunk/src/model/Model_Stock.h 2013-10-07 05:44:57 UTC (rev 4773) +++ trunk/src/model/Model_Stock.h 2013-10-07 06:20:28 UTC (rev 4774) @@ -1,19 +1,3 @@ -// -*- C++ -*- -//============================================================================= -/** - * Copyright (c) 2013 Guan Lisheng (gua...@gm...) - * - * @file - * - * @author [sqlite2cpp.py] - * - * @brief - * - * Revision History: - * AUTO GENERATED at 2013-07-03 22:55:49.491495. - * DO NOT EDIT! - */ -//============================================================================= #ifndef MODEL_STOCK_H #define MODEL_STOCK_H Modified: trunk/src/model/Model_Subcategory.h =================================================================== --- trunk/src/model/Model_Subcategory.h 2013-10-07 05:44:57 UTC (rev 4773) +++ trunk/src/model/Model_Subcategory.h 2013-10-07 06:20:28 UTC (rev 4774) @@ -1,19 +1,3 @@ -// -*- C++ -*- -//============================================================================= -/** - * Copyright (c) 2013 Guan Lisheng (gua...@gm...) - * - * @file - * - * @author [sqlite2cpp.py] - * - * @brief - * - * Revision History: - * AUTO GENERATED at 2013-07-03 22:55:49.491495. - * DO NOT EDIT! - */ -//============================================================================= #ifndef MODEL_SUBCATEGORY_H #define MODEL_SUBCATEGORY_H This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gua...@us...> - 2013-10-07 11:47:28
|
Revision: 4784 http://sourceforge.net/p/moneymanagerex/code/4784 Author: guanlisheng Date: 2013-10-07 11:47:23 +0000 (Mon, 07 Oct 2013) Log Message: ----------- batch save for Model_Billsdeposits and Model_Splittransaction Modified Paths: -------------- trunk/src/model/Model_Billsdeposits.h trunk/src/model/Model_Splittransaction.h Modified: trunk/src/model/Model_Billsdeposits.h =================================================================== --- trunk/src/model/Model_Billsdeposits.h 2013-10-07 11:04:32 UTC (rev 4783) +++ trunk/src/model/Model_Billsdeposits.h 2013-10-07 11:47:23 UTC (rev 4784) @@ -59,6 +59,15 @@ r->save(this->db_); return r->id(); } + int save(Data_Set& rows) + { + this->Begin(); + for (auto& r : rows) this->save(&r); + this->Commit(); + + return rows.size(); + } + }; #endif // Modified: trunk/src/model/Model_Splittransaction.h =================================================================== --- trunk/src/model/Model_Splittransaction.h 2013-10-07 11:04:32 UTC (rev 4783) +++ trunk/src/model/Model_Splittransaction.h 2013-10-07 11:47:23 UTC (rev 4784) @@ -50,6 +50,14 @@ r->save(this->db_); return r->id(); } + int save(Data_Set& rows) + { + this->Begin(); + for (auto& r : rows) this->save(&r); + this->Commit(); + + return rows.size(); + } }; #endif // This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sie...@us...> - 2013-10-11 02:43:13
|
Revision: 4828 http://sourceforge.net/p/moneymanagerex/code/4828 Author: siena123 Date: 2013-10-11 02:43:06 +0000 (Fri, 11 Oct 2013) Log Message: ----------- cleanup Modified Paths: -------------- trunk/src/model/Model_Category.h trunk/src/model/Model_Checking.h Modified: trunk/src/model/Model_Category.h =================================================================== --- trunk/src/model/Model_Category.h 2013-10-11 02:09:30 UTC (rev 4827) +++ trunk/src/model/Model_Category.h 2013-10-11 02:43:06 UTC (rev 4828) @@ -220,7 +220,7 @@ if (categID > -1) { if (transaction.TRANSCODE != TRANS_TYPE_TRANSFER_STR) - categoryStats[categID][transaction.SUBCATEGID][idx] += Model_Checking::value(transaction) * convRate; + categoryStats[categID][transaction.SUBCATEGID][idx] += Model_Checking::balance(transaction) * convRate; } else { @@ -228,7 +228,7 @@ for (const auto& entry: split) { categoryStats[entry.CATEGID][entry.SUBCATEGID][idx] += entry.SPLITTRANSAMOUNT - * convRate * (Model_Checking::value(transaction) < 0 ? -1 : 1); + * convRate * (Model_Checking::balance(transaction) < 0 ? -1 : 1); } } } Modified: trunk/src/model/Model_Checking.h =================================================================== --- trunk/src/model/Model_Checking.h 2013-10-11 02:09:30 UTC (rev 4827) +++ trunk/src/model/Model_Checking.h 2013-10-11 02:43:06 UTC (rev 4828) @@ -146,29 +146,6 @@ return sum; } static double balance(const Data& r, int account_id = -1) { return balance(&r, account_id); } - static double value(const Data& r, int account_id = -1) - { - double balance = 0.0; - switch (type(r)) - { - case WITHDRAWAL: - balance -= r.TRANSAMOUNT; - break; - case DEPOSIT: - balance = r.TRANSAMOUNT; - case TRANSFER: - //Bug fix for broken transactions (as result of wrong import) if account and to account the same - if (account_id != r.TOACCOUNTID) - { - if (account_id == r.ACCOUNTID) balance -= r.TRANSAMOUNT; - if (account_id == r.TOACCOUNTID) balance += r.TRANSAMOUNT; - } - break; - default: - break; - } - return balance; - } }; #endif // This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sie...@us...> - 2013-10-14 11:49:41
|
Revision: 4856 http://sourceforge.net/p/moneymanagerex/code/4856 Author: siena123 Date: 2013-10-14 11:49:38 +0000 (Mon, 14 Oct 2013) Log Message: ----------- add GPL Modified Paths: -------------- trunk/src/model/Model.h trunk/src/model/Model_Account.h trunk/src/model/Model_Asset.h trunk/src/model/Model_Billsdeposits.h trunk/src/model/Model_Budgetyear.h trunk/src/model/Model_Category.h trunk/src/model/Model_Checking.h trunk/src/model/Model_Currency.h trunk/src/model/Model_Infotable.h trunk/src/model/Model_Payee.h trunk/src/model/Model_Setting.h trunk/src/model/Model_Splittransaction.h trunk/src/model/Model_Stock.h trunk/src/model/Model_Subcategory.h Modified: trunk/src/model/Model.h =================================================================== --- trunk/src/model/Model.h 2013-10-14 11:37:52 UTC (rev 4855) +++ trunk/src/model/Model.h 2013-10-14 11:49:38 UTC (rev 4856) @@ -1,4 +1,21 @@ +/******************************************************* + Copyright (C) 2013 Guan Lisheng + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + ********************************************************/ + #ifndef MODEL_H #define MODEL_H Modified: trunk/src/model/Model_Account.h =================================================================== --- trunk/src/model/Model_Account.h 2013-10-14 11:37:52 UTC (rev 4855) +++ trunk/src/model/Model_Account.h 2013-10-14 11:49:38 UTC (rev 4856) @@ -1,4 +1,21 @@ +/******************************************************* + Copyright (C) 2013 Guan Lisheng + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + ********************************************************/ + #ifndef MODEL_ACCOUNT_H #define MODEL_ACCOUNT_H Modified: trunk/src/model/Model_Asset.h =================================================================== --- trunk/src/model/Model_Asset.h 2013-10-14 11:37:52 UTC (rev 4855) +++ trunk/src/model/Model_Asset.h 2013-10-14 11:49:38 UTC (rev 4856) @@ -1,4 +1,21 @@ +/******************************************************* + Copyright (C) 2013 Guan Lisheng + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + ********************************************************/ + #ifndef MODEL_ASSET_H #define MODEL_ASSET_H Modified: trunk/src/model/Model_Billsdeposits.h =================================================================== --- trunk/src/model/Model_Billsdeposits.h 2013-10-14 11:37:52 UTC (rev 4855) +++ trunk/src/model/Model_Billsdeposits.h 2013-10-14 11:49:38 UTC (rev 4856) @@ -1,4 +1,21 @@ +/******************************************************* + Copyright (C) 2013 Guan Lisheng + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + ********************************************************/ + #ifndef MODEL_BILLSDEPOSITS_H #define MODEL_BILLSDEPOSITS_H Modified: trunk/src/model/Model_Budgetyear.h =================================================================== --- trunk/src/model/Model_Budgetyear.h 2013-10-14 11:37:52 UTC (rev 4855) +++ trunk/src/model/Model_Budgetyear.h 2013-10-14 11:49:38 UTC (rev 4856) @@ -1,4 +1,21 @@ +/******************************************************* + Copyright (C) 2013 Guan Lisheng + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + ********************************************************/ + #ifndef MODEL_BUDGETYEAR_H #define MODEL_BUDGETYEAR_H Modified: trunk/src/model/Model_Category.h =================================================================== --- trunk/src/model/Model_Category.h 2013-10-14 11:37:52 UTC (rev 4855) +++ trunk/src/model/Model_Category.h 2013-10-14 11:49:38 UTC (rev 4856) @@ -1,4 +1,21 @@ +/******************************************************* + Copyright (C) 2013 Guan Lisheng + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + ********************************************************/ + #ifndef MODEL_CATEGORY_H #define MODEL_CATEGORY_H Modified: trunk/src/model/Model_Checking.h =================================================================== --- trunk/src/model/Model_Checking.h 2013-10-14 11:37:52 UTC (rev 4855) +++ trunk/src/model/Model_Checking.h 2013-10-14 11:49:38 UTC (rev 4856) @@ -1,4 +1,21 @@ +/******************************************************* + Copyright (C) 2013 Guan Lisheng + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + ********************************************************/ + #ifndef MODEL_CHECKING_H #define MODEL_CHECKING_H Modified: trunk/src/model/Model_Currency.h =================================================================== --- trunk/src/model/Model_Currency.h 2013-10-14 11:37:52 UTC (rev 4855) +++ trunk/src/model/Model_Currency.h 2013-10-14 11:49:38 UTC (rev 4856) @@ -1,4 +1,21 @@ +/******************************************************* + Copyright (C) 2013 Guan Lisheng + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + ********************************************************/ + #ifndef MODEL_CURRENCY_H #define MODEL_CURRENCY_H Modified: trunk/src/model/Model_Infotable.h =================================================================== --- trunk/src/model/Model_Infotable.h 2013-10-14 11:37:52 UTC (rev 4855) +++ trunk/src/model/Model_Infotable.h 2013-10-14 11:49:38 UTC (rev 4856) @@ -1,4 +1,21 @@ +/******************************************************* + Copyright (C) 2013 Guan Lisheng + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + ********************************************************/ + #ifndef MODEL_INFOTABLE_H #define MODEL_INFOTABLE_H Modified: trunk/src/model/Model_Payee.h =================================================================== --- trunk/src/model/Model_Payee.h 2013-10-14 11:37:52 UTC (rev 4855) +++ trunk/src/model/Model_Payee.h 2013-10-14 11:49:38 UTC (rev 4856) @@ -1,4 +1,21 @@ +/******************************************************* + Copyright (C) 2013 Guan Lisheng + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + ********************************************************/ + #ifndef MODEL_PAYEE_H #define MODEL_PAYEE_H Modified: trunk/src/model/Model_Setting.h =================================================================== --- trunk/src/model/Model_Setting.h 2013-10-14 11:37:52 UTC (rev 4855) +++ trunk/src/model/Model_Setting.h 2013-10-14 11:49:38 UTC (rev 4856) @@ -1,4 +1,21 @@ +/******************************************************* + Copyright (C) 2013 Guan Lisheng + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + ********************************************************/ + #ifndef MODEL_SETTING_H #define MODEL_SETTING_H Modified: trunk/src/model/Model_Splittransaction.h =================================================================== --- trunk/src/model/Model_Splittransaction.h 2013-10-14 11:37:52 UTC (rev 4855) +++ trunk/src/model/Model_Splittransaction.h 2013-10-14 11:49:38 UTC (rev 4856) @@ -1,4 +1,21 @@ +/******************************************************* + Copyright (C) 2013 Guan Lisheng + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + ********************************************************/ + #ifndef MODEL_SPLITTRANSACTIONS_H #define MODEL_SPLITTRANSACTIONS_H Modified: trunk/src/model/Model_Stock.h =================================================================== --- trunk/src/model/Model_Stock.h 2013-10-14 11:37:52 UTC (rev 4855) +++ trunk/src/model/Model_Stock.h 2013-10-14 11:49:38 UTC (rev 4856) @@ -1,4 +1,21 @@ +/******************************************************* + Copyright (C) 2013 Guan Lisheng + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + ********************************************************/ + #ifndef MODEL_STOCK_H #define MODEL_STOCK_H Modified: trunk/src/model/Model_Subcategory.h =================================================================== --- trunk/src/model/Model_Subcategory.h 2013-10-14 11:37:52 UTC (rev 4855) +++ trunk/src/model/Model_Subcategory.h 2013-10-14 11:49:38 UTC (rev 4856) @@ -1,4 +1,21 @@ +/******************************************************* + Copyright (C) 2013 Guan Lisheng + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + ********************************************************/ + #ifndef MODEL_SUBCATEGORY_H #define MODEL_SUBCATEGORY_H This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gua...@us...> - 2013-10-16 07:20:14
|
Revision: 4873 http://sourceforge.net/p/moneymanagerex/code/4873 Author: guanlisheng Date: 2013-10-16 07:20:09 +0000 (Wed, 16 Oct 2013) Log Message: ----------- cleanup and find by key Modified Paths: -------------- trunk/src/model/Model_Infotable.h trunk/src/model/Model_Setting.h Modified: trunk/src/model/Model_Infotable.h =================================================================== --- trunk/src/model/Model_Infotable.h 2013-10-16 06:20:00 UTC (rev 4872) +++ trunk/src/model/Model_Infotable.h 2013-10-16 07:20:09 UTC (rev 4873) @@ -81,13 +81,10 @@ void Set(const wxString& key, const wxString& value) { Data* info = 0; - for (auto& record: this->all()) + for (auto& record: this->find(INFONAME(key))) { - if (record.INFONAME == key) - { - info = this->get(record.INFOID, this->db_); - break; - } + info = this->get(record.INFOID, this->db_); + break; } if (info) { @@ -121,10 +118,9 @@ } wxString GetStringInfo(const wxString& key, const wxString& default_value) { - for (const auto& record: this->all()) + for (const auto& record: this->find(INFONAME(key))) { - if (record.INFONAME == key) - return record.INFOVALUE; + return record.INFOVALUE; } return default_value; @@ -135,10 +131,9 @@ } bool Exists(const wxString& key) { - for (const auto& record: this->all()) + for (const auto& record: this->find(INFONAME(key))) { - if (record.INFONAME == key) - return true; + return true; } return false; } Modified: trunk/src/model/Model_Setting.h =================================================================== --- trunk/src/model/Model_Setting.h 2013-10-16 06:20:00 UTC (rev 4872) +++ trunk/src/model/Model_Setting.h 2013-10-16 07:20:09 UTC (rev 4873) @@ -134,10 +134,9 @@ wxString GetStringSetting(const wxString& key, const wxString& default_value) { - for (const auto& record: this->all()) + for (const auto& record: this->find(SETTINGNAME(key))) { - if (record.SETTINGNAME == key) - return record.SETTINGVALUE; + return record.SETTINGVALUE; } return default_value; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gua...@us...> - 2013-10-17 03:52:11
|
Revision: 4887 http://sourceforge.net/p/moneymanagerex/code/4887 Author: guanlisheng Date: 2013-10-17 03:52:08 +0000 (Thu, 17 Oct 2013) Log Message: ----------- write more readable and simplier code Modified Paths: -------------- trunk/src/model/Model_Budget.h trunk/src/model/Model_Category.h Modified: trunk/src/model/Model_Budget.h =================================================================== --- trunk/src/model/Model_Budget.h 2013-10-17 02:41:03 UTC (rev 4886) +++ trunk/src/model/Model_Budget.h 2013-10-17 03:52:08 UTC (rev 4887) @@ -71,7 +71,7 @@ static void getBudgetEntry(int budgetYearID, int categID, int subCategID, wxString& period, double& amt) { const Data_Set budget = instance().find(BUDGETYEARID(budgetYearID), CATEGID(categID), SUBCATEGID(subCategID)); - if (budget.size() > 0) + if (!budget.empty()) { period = budget[0].PERIOD; amt = budget[0].AMOUNT; Modified: trunk/src/model/Model_Category.h =================================================================== --- trunk/src/model/Model_Category.h 2013-10-17 02:41:03 UTC (rev 4886) +++ trunk/src/model/Model_Category.h 2013-10-17 03:52:08 UTC (rev 4887) @@ -182,26 +182,24 @@ } } //Calculations - for (const auto& transaction: Model_Checking::instance().all()) + for (const auto& transaction: Model_Checking::instance().find(Model_Checking::STATUS(Model_Checking::VOID_, NOT_EQUAL))) { - if (transaction.STATUS == "V") continue; // skip - if (ignoreFuture) { - if (Model_Checking::to_date(transaction.TRANSDATE).GetDateOnly().IsLaterThan(wxDateTime::Now().GetDateOnly())) + if (Model_Checking::TRANSDATE(transaction).GetDateOnly().IsLaterThan(wxDateTime::Now().GetDateOnly())) continue; //skip future dated transactions } if (with_date) { - if (!Model_Checking::to_date(transaction.TRANSDATE).IsBetween(date_range->start_date(), date_range->end_date())) + if (!Model_Checking::TRANSDATE(transaction).IsBetween(date_range->start_date(), date_range->end_date())) continue; //skip } // We got this far, get the currency conversion rate for this account double convRate = acc_conv_rates[transaction.ACCOUNTID]; - wxDateTime d = Model_Checking::to_date(transaction.TRANSDATE); + wxDateTime d = Model_Checking::TRANSDATE(transaction); int idx = group_by_month ? (d.GetYear()*100 + (int)d.GetMonth()) : 0; int categID = transaction.CATEGID; @@ -235,23 +233,22 @@ double amt = 0.0; const wxDateTime dtNow = wxDateTime::Now().GetDateOnly(); - for (const auto& transaction: Model_Checking::instance().all()) + for (const auto& transaction: Model_Checking::instance().find(Model_Checking::STATUS(Model_Checking::VOID_, NOT_EQUAL))) { - if (transaction.STATUS == "V") continue; if (!ignoreDate) { - if (!Model_Checking::to_date(transaction.TRANSDATE).GetDateOnly().IsBetween(dtBegin, dtEnd)) continue; + if (!Model_Checking::TRANSDATE(transaction).GetDateOnly().IsBetween(dtBegin, dtEnd)) continue; } if (ignoreFuture) { //skip future dated transactions - if (Model_Checking::to_date(transaction.TRANSDATE).GetDateOnly().IsLaterThan(dtNow)) continue; + if (Model_Checking::TRANSDATE(transaction).GetDateOnly().IsLaterThan(dtNow)) continue; } Model_Account::Data* account = Model_Account::instance().get(transaction.ACCOUNTID); Model_Currency::Data* currency = Model_Account::currency(account); double convRate = currency->BASECONVRATE; - if (transaction.TRANSCODE == TRANS_TYPE_TRANSFER_STR) + if (Model_Checking::type(transaction) == Model_Checking::TRANSFER) { if (evaluateTransfer) { @@ -266,11 +263,11 @@ } continue; //skip } - if (transaction.TRANSCODE == TRANS_TYPE_WITHDRAWAL_STR) + if (Model_Checking::type(transaction) == Model_Checking::WITHDRAWAL) { amt -= Model_Checking::instance().getAmountForSplit(transaction, categID, subcategID) * convRate; } - else if (transaction.TRANSCODE == TRANS_TYPE_DEPOSIT_STR) + else if (Model_Checking::type(transaction) == Model_Checking::DEPOSIT) { amt += Model_Checking::instance().getAmountForSplit(transaction, categID, subcategID) * convRate; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gua...@us...> - 2013-10-18 14:39:41
|
Revision: 4910 http://sourceforge.net/p/moneymanagerex/code/4910 Author: guanlisheng Date: 2013-10-18 14:39:36 +0000 (Fri, 18 Oct 2013) Log Message: ----------- rename to separate find function to fix vs2013 compile Modified Paths: -------------- trunk/src/model/Model_Account.h trunk/src/model/Model_Billsdeposits.h trunk/src/model/Model_Checking.h Modified: trunk/src/model/Model_Account.h =================================================================== --- trunk/src/model/Model_Account.h 2013-10-18 13:41:14 UTC (rev 4909) +++ trunk/src/model/Model_Account.h 2013-10-18 14:39:36 UTC (rev 4910) @@ -100,9 +100,9 @@ } bool remove(int id) { - for (const auto& r: Model_Checking::instance().find(false, Model_Checking::ACCOUNTID(id), Model_Checking::TOACCOUNTID(id))) + for (const auto& r: Model_Checking::instance().find_or(Model_Checking::ACCOUNTID(id), Model_Checking::TOACCOUNTID(id))) Model_Checking::instance().remove(r.TRANSID); - for (const auto& r: Model_Billsdeposits::instance().find(false, Model_Billsdeposits::ACCOUNTID(id), Model_Billsdeposits::TOACCOUNTID(id))) + for (const auto& r: Model_Billsdeposits::instance().find_or(Model_Billsdeposits::ACCOUNTID(id), Model_Billsdeposits::TOACCOUNTID(id))) Model_Billsdeposits::instance().remove(r.BDID); return this->remove(id, db_); @@ -116,13 +116,13 @@ public: static Model_Checking::Data_Set transaction(const Data*r ) { - return Model_Checking::instance().find(false, Model_Checking::ACCOUNTID(r->ACCOUNTID), Model_Checking::TOACCOUNTID(r->ACCOUNTID)); - } + return Model_Checking::instance().find_or(Model_Checking::ACCOUNTID(r->ACCOUNTID), Model_Checking::TOACCOUNTID(r->ACCOUNTID)); + } static Model_Checking::Data_Set transaction(const Data& r) { return transaction(&r); } static Model_Billsdeposits::Data_Set billsdeposits(const Data* r) { - return Model_Billsdeposits::instance().find(false, Model_Billsdeposits::ACCOUNTID(r->ACCOUNTID), Model_Billsdeposits::TOACCOUNTID(r->ACCOUNTID)); - } + return Model_Billsdeposits::instance().find_or(Model_Billsdeposits::ACCOUNTID(r->ACCOUNTID), Model_Billsdeposits::TOACCOUNTID(r->ACCOUNTID)); + } static Model_Billsdeposits::Data_Set billsdeposits(const Data& r) { return billsdeposits(&r); } static double balance(const Data* r) { Modified: trunk/src/model/Model_Billsdeposits.h =================================================================== --- trunk/src/model/Model_Billsdeposits.h 2013-10-18 13:41:14 UTC (rev 4909) +++ trunk/src/model/Model_Billsdeposits.h 2013-10-18 14:39:36 UTC (rev 4910) @@ -84,9 +84,9 @@ return find_by(this, db_, true, args...); } template<typename... Args> - Data_Set find(bool op_and, const Args&... args) + Data_Set find_or(const Args&... args) { - return find_by(this, db_, op_and, args...); + return find_by(this, db_, false, args...); } Data* get(int id) { Modified: trunk/src/model/Model_Checking.h =================================================================== --- trunk/src/model/Model_Checking.h 2013-10-18 13:41:14 UTC (rev 4909) +++ trunk/src/model/Model_Checking.h 2013-10-18 14:39:36 UTC (rev 4910) @@ -83,9 +83,9 @@ return find_by(this, db_, true, args...); } template<typename... Args> - Data_Set find(bool op_and, const Args&... args) + Data_Set find_or(const Args&... args) { - return find_by(this, db_, op_and, args...); + return find_by(this, db_, false, args...); } Data* get(int id) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gua...@us...> - 2013-10-19 10:12:37
|
Revision: 4914 http://sourceforge.net/p/moneymanagerex/code/4914 Author: guanlisheng Date: 2013-10-19 10:12:32 +0000 (Sat, 19 Oct 2013) Log Message: ----------- fix unreachable warnings Modified Paths: -------------- trunk/src/model/Model_Infotable.h trunk/src/model/Model_Setting.h Modified: trunk/src/model/Model_Infotable.h =================================================================== --- trunk/src/model/Model_Infotable.h 2013-10-19 08:21:23 UTC (rev 4913) +++ trunk/src/model/Model_Infotable.h 2013-10-19 10:12:32 UTC (rev 4914) @@ -81,11 +81,9 @@ void Set(const wxString& key, const wxString& value) { Data* info = 0; - for (auto& record: this->find(INFONAME(key))) - { - info = this->get(record.INFOID, this->db_); - break; - } + Data_Set items = this->find(INFONAME(key)); + if (!items.empty()) + info = this->get(items[0].INFOID); if (info) { info->INFOVALUE= value; @@ -118,10 +116,8 @@ } wxString GetStringInfo(const wxString& key, const wxString& default_value) { - for (const auto& record: this->find(INFONAME(key))) - { - return record.INFOVALUE; - } + Data_Set items = this->find(INFONAME(key)); + if (!items.empty()) return items[0].INFOVALUE; return default_value; } Modified: trunk/src/model/Model_Setting.h =================================================================== --- trunk/src/model/Model_Setting.h 2013-10-19 08:21:23 UTC (rev 4913) +++ trunk/src/model/Model_Setting.h 2013-10-19 10:12:32 UTC (rev 4914) @@ -134,10 +134,8 @@ wxString GetStringSetting(const wxString& key, const wxString& default_value) { - for (const auto& record: this->find(SETTINGNAME(key))) - { - return record.SETTINGVALUE; - } + Data_Set items = this->find(SETTINGNAME(key)); + if (!items.empty()) return items[0].SETTINGVALUE; return default_value; } wxString getLastDbPath() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gua...@us...> - 2013-10-26 09:09:40
|
Revision: 4977 http://sourceforge.net/p/moneymanagerex/code/4977 Author: guanlisheng Date: 2013-10-26 09:09:37 +0000 (Sat, 26 Oct 2013) Log Message: ----------- improve performance Modified Paths: -------------- trunk/src/model/Model_Category.h trunk/src/model/Model_Currency.h Modified: trunk/src/model/Model_Category.h =================================================================== --- trunk/src/model/Model_Category.h 2013-10-26 09:02:17 UTC (rev 4976) +++ trunk/src/model/Model_Category.h 2013-10-26 09:09:37 UTC (rev 4977) @@ -209,6 +209,7 @@ all_categoris.push_back(std::make_pair(wxTRANSLATE("Transfer"), sub_categoris)); } + this->Begin(); for (const auto& record : all_categoris) { Model_Category::Data* category = Model_Category::instance().create(); @@ -222,6 +223,7 @@ Model_Subcategory::instance().save(sub_category); } } + this->Commit(); } return all(db_, col, asc); } Modified: trunk/src/model/Model_Currency.h =================================================================== --- trunk/src/model/Model_Currency.h 2013-10-26 09:02:17 UTC (rev 4976) +++ trunk/src/model/Model_Currency.h 2013-10-26 09:09:37 UTC (rev 4977) @@ -213,6 +213,8 @@ std::make_tuple("ZMK", "Zambian kwacha" , L"ZK", L"", L"", L"", 1, 1), std::make_tuple("ZWR", "Zimbabwean dollar" , L"Z$", L"", L"", L"", 100, 1) }; + + this->Begin(); for (const auto& i : all_currency) { Data *currency = this->create(); @@ -230,6 +232,7 @@ currency->save(this->db_); } + this->Commit(); } return all(db_, col, asc); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ste...@us...> - 2013-11-03 02:42:06
|
Revision: 5080 http://sourceforge.net/p/moneymanagerex/code/5080 Author: stef145g Date: 2013-11-03 02:42:01 +0000 (Sun, 03 Nov 2013) Log Message: ----------- Correction to comments Modified Paths: -------------- trunk/src/model/Model_Billsdeposits.h trunk/src/model/Model_Budgetsplittransaction.h Modified: trunk/src/model/Model_Billsdeposits.h =================================================================== --- trunk/src/model/Model_Billsdeposits.h 2013-11-03 02:20:02 UTC (rev 5079) +++ trunk/src/model/Model_Billsdeposits.h 2013-11-03 02:42:01 UTC (rev 5080) @@ -187,7 +187,7 @@ return rows.size(); } - /** Remove any splits associated with id*/ + /** Remove the Data record including any splits associated with id*/ bool remove(int id) { for (auto &item : Model_Billsdeposits::splittransaction(get(id))) Modified: trunk/src/model/Model_Budgetsplittransaction.h =================================================================== --- trunk/src/model/Model_Budgetsplittransaction.h 2013-11-03 02:20:02 UTC (rev 5079) +++ trunk/src/model/Model_Budgetsplittransaction.h 2013-11-03 02:42:01 UTC (rev 5080) @@ -77,6 +77,8 @@ return rows.size(); } + + /** Remove the Data record from the database and the memory table (cashe)*/ bool remove(int id) { return this->remove(id, this->db_); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |