Add check mode

Fix bug with KissCount title on start
This commit is contained in:
Grégory Soutadé 2010-08-21 11:49:03 +02:00
parent d12e00c6fb
commit 9f7d858bc3
10 changed files with 179 additions and 81 deletions

Binary file not shown.

View File

@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2010-08-18 20:59+0200\n"
"POT-Creation-Date: 2010-08-21 11:44+0200\n"
"PO-Revision-Date: \n"
"Last-Translator: Soutadé <soutade@gmail.com>\n"
"Language-Team: \n"
@ -19,7 +19,7 @@ msgstr ""
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#: src/view/PreferencesPanel.cpp:574
#: src/view/StatsPanel.cpp:288
#: src/view/StatsPanel.cpp:279
msgid " - "
msgstr " - "
@ -40,7 +40,7 @@ msgstr " entrées trouvées"
msgid " not found, aborting"
msgstr " non trouvé, arrêt"
#: src/view/AccountPanel.cpp:924
#: src/view/AccountPanel.cpp:982
msgid " operations ?"
msgstr " opérations ?"
@ -66,16 +66,16 @@ msgstr "Compte"
msgid "Account "
msgstr "Le compte "
#: src/view/AccountPanel.cpp:101
#: src/view/AccountPanel.cpp:102
msgid "Account name"
msgstr "Nom du compte"
#: src/view/AccountPanel.cpp:100
#: src/view/AccountPanel.cpp:101
msgid "Account number"
msgstr "Numéro de compte"
#: src/view/PreferencesPanel.cpp:55
#: src/view/StatsPanel.cpp:256
#: src/view/StatsPanel.cpp:247
msgid "Accounts"
msgstr "Comptes"
@ -89,12 +89,12 @@ msgstr "Montant max"
#: src/view/PreferencesPanel.cpp:340
#: src/view/PreferencesPanel.cpp:581
#: src/view/AccountPanel.cpp:919
#: src/view/AccountPanel.cpp:977
msgid "Are you sure want to delete "
msgstr "Etes vous sûr de vouloir supprimer "
#: src/view/PreferencesPanel.cpp:449
#: src/view/AccountPanel.cpp:621
#: src/view/AccountPanel.cpp:669
#: src/view/SearchPanel.cpp:345
msgid "Are you sure want to delete : \n"
msgstr "Etes vous sûr de vouloir supprimer : \n"
@ -139,6 +139,10 @@ msgstr "Changer le mot de passe"
msgid "Change user"
msgstr "Changer d'utilisateur"
#: src/view/AccountPanel.cpp:118
msgid "Check mode"
msgstr "Mode rapprochement"
#: src/view/PreferencesPanel.cpp:207
msgid "Color"
msgstr "Couleur"
@ -148,7 +152,7 @@ msgid "Confirm password "
msgstr "Confirmer le mot de passe"
#: src/view/StatsPanel.cpp:130
#: src/view/AccountPanel.cpp:111
#: src/view/AccountPanel.cpp:112
msgid "Cost repartition"
msgstr "Répartition des coûts"
@ -156,15 +160,15 @@ msgstr "Répartition des coûts"
msgid "Credit"
msgstr "Crédit"
#: src/view/AccountPanel.cpp:181
#: src/view/AccountPanel.cpp:187
msgid "Cur Credit"
msgstr "Cur Crédit"
#: src/view/AccountPanel.cpp:182
#: src/view/AccountPanel.cpp:188
msgid "Cur Debit"
msgstr "Cur Débit"
#: src/view/AccountPanel.cpp:103
#: src/view/AccountPanel.cpp:104
msgid "Current value"
msgstr "Valeur courante"
@ -190,7 +194,7 @@ msgstr "Défaut"
#: src/view/PreferencesPanel.cpp:159
#: src/view/PreferencesPanel.cpp:209
#: src/view/AccountPanel.cpp:778
#: src/view/AccountPanel.cpp:836
msgid "Delete"
msgstr "Supprimer"
@ -214,7 +218,7 @@ msgstr "Description"
#: src/view/PreferencesPanel.cpp:487
#: src/view/PreferencesPanel.cpp:526
#: src/view/PreferencesPanel.cpp:532
#: src/view/AccountPanel.cpp:915
#: src/view/AccountPanel.cpp:973
#: src/view/UsersDialog.cpp:86
#: src/view/UsersDialog.cpp:114
#: src/view/SearchPanel.cpp:134
@ -228,12 +232,12 @@ msgstr "Erreur"
msgid "Error creating original database"
msgstr "Erreur durant la création de la base de données initiale"
#: src/view/AccountPanel.cpp:104
#: src/view/AccountPanel.cpp:105
msgid "Final value"
msgstr "Valeur finale"
#: src/model/Database.cpp:260
#: src/controller/KissCount.cpp:259
#: src/controller/KissCount.cpp:276
#: src/view/GridAccount.cpp:126
msgid "Fix"
msgstr "Fixe"
@ -251,19 +255,19 @@ msgid "From "
msgstr "De"
#: src/view/GenerateDialog.cpp:31
#: src/view/AccountPanel.cpp:775
#: src/view/AccountPanel.cpp:833
msgid "Generate month"
msgstr "Générer mois"
#: src/controller/KissCount.cpp:261
#: src/controller/KissCount.cpp:278
msgid "Groceries"
msgstr "Courses"
#: src/controller/KissCount.cpp:263
#: src/controller/KissCount.cpp:280
msgid "Hobbies"
msgstr "Loisirs"
#: src/view/AccountPanel.cpp:102
#: src/view/AccountPanel.cpp:103
msgid "Initial value"
msgstr "Valeur initiale"
@ -295,7 +299,7 @@ msgstr "Ancien mot de passe invalide"
msgid "Invalid password"
msgstr "Mot de passe invalide"
#: src/view/StatsPanel.cpp:303
#: src/view/StatsPanel.cpp:294
msgid "Invalide date range"
msgstr "Intervalle de temps invalide"
@ -303,7 +307,7 @@ msgstr "Intervalle de temps invalide"
msgid "It must be at least one account !"
msgstr "Il doit y avoir au moins un compte !"
#: src/view/AccountPanel.cpp:915
#: src/view/AccountPanel.cpp:973
msgid "It must be at least one month !"
msgstr "Il doit rester au mois un mois"
@ -313,7 +317,7 @@ msgstr "Kill me"
#: src/view/PreferencesPanel.cpp:566
#: src/view/PreferencesPanel.cpp:569
#: src/view/StatsPanel.cpp:303
#: src/view/StatsPanel.cpp:294
msgid "KissCount"
msgstr "KissCount"
@ -370,7 +374,7 @@ msgstr "OK"
msgid "Old password "
msgstr "Ancien mot de passe"
#: src/controller/KissCount.cpp:265
#: src/controller/KissCount.cpp:282
msgid "Operating exepense"
msgstr "Frais de fonctionnement"
@ -382,7 +386,7 @@ msgstr "Ordre des opérations"
msgid "Operations"
msgstr "Opérations"
#: src/controller/KissCount.cpp:269
#: src/controller/KissCount.cpp:286
msgid "Other"
msgstr "Autres"
@ -422,7 +426,7 @@ msgstr "Quitter"
msgid "Quit KissCount ?"
msgstr "Quitter KissCount ?"
#: src/view/AccountPanel.cpp:183
#: src/view/AccountPanel.cpp:189
msgid "Remains"
msgstr "Restant"
@ -433,7 +437,7 @@ msgid "Search"
msgstr "Chercher"
#: src/view/StatsPanel.cpp:122
#: src/view/AccountPanel.cpp:85
#: src/view/AccountPanel.cpp:86
msgid "Serie 1"
msgstr "Série 1"
@ -441,7 +445,7 @@ msgstr "Série 1"
msgid "Shared"
msgstr "Partagé"
#: src/view/StatsPanel.cpp:288
#: src/view/StatsPanel.cpp:279
#: src/view/ButtonPanel.cpp:48
msgid "Statistics"
msgstr "Statistiques"
@ -454,15 +458,15 @@ msgstr "A"
msgid "To "
msgstr "A"
#: src/view/AccountPanel.cpp:165
#: src/view/AccountPanel.cpp:171
msgid "Total Credit"
msgstr "Total Crédit"
#: src/view/AccountPanel.cpp:166
#: src/view/AccountPanel.cpp:172
msgid "Total Debit"
msgstr "Total Débit"
#: src/controller/KissCount.cpp:267
#: src/controller/KissCount.cpp:284
msgid "Unexpected"
msgstr "Exceptionnel"

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2010-08-18 20:59+0200\n"
"POT-Creation-Date: 2010-08-21 11:44+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -16,7 +16,7 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: src/view/PreferencesPanel.cpp:574 src/view/StatsPanel.cpp:288
#: src/view/PreferencesPanel.cpp:574 src/view/StatsPanel.cpp:279
msgid " - "
msgstr ""
@ -34,7 +34,7 @@ msgstr ""
msgid " not found, aborting"
msgstr ""
#: src/view/AccountPanel.cpp:924
#: src/view/AccountPanel.cpp:982
msgid " operations ?"
msgstr ""
@ -58,15 +58,15 @@ msgstr ""
msgid "Account "
msgstr ""
#: src/view/AccountPanel.cpp:101
#: src/view/AccountPanel.cpp:102
msgid "Account name"
msgstr ""
#: src/view/AccountPanel.cpp:100
#: src/view/AccountPanel.cpp:101
msgid "Account number"
msgstr ""
#: src/view/PreferencesPanel.cpp:55 src/view/StatsPanel.cpp:256
#: src/view/PreferencesPanel.cpp:55 src/view/StatsPanel.cpp:247
msgid "Accounts"
msgstr ""
@ -79,11 +79,11 @@ msgid "Amount to"
msgstr ""
#: src/view/PreferencesPanel.cpp:340 src/view/PreferencesPanel.cpp:581
#: src/view/AccountPanel.cpp:919
#: src/view/AccountPanel.cpp:977
msgid "Are you sure want to delete "
msgstr ""
#: src/view/PreferencesPanel.cpp:449 src/view/AccountPanel.cpp:621
#: src/view/PreferencesPanel.cpp:449 src/view/AccountPanel.cpp:669
#: src/view/SearchPanel.cpp:345
msgid "Are you sure want to delete : \n"
msgstr ""
@ -125,6 +125,10 @@ msgstr ""
msgid "Change user"
msgstr ""
#: src/view/AccountPanel.cpp:118
msgid "Check mode"
msgstr ""
#: src/view/PreferencesPanel.cpp:207
msgid "Color"
msgstr ""
@ -133,7 +137,7 @@ msgstr ""
msgid "Confirm password "
msgstr ""
#: src/view/StatsPanel.cpp:130 src/view/AccountPanel.cpp:111
#: src/view/StatsPanel.cpp:130 src/view/AccountPanel.cpp:112
msgid "Cost repartition"
msgstr ""
@ -141,15 +145,15 @@ msgstr ""
msgid "Credit"
msgstr ""
#: src/view/AccountPanel.cpp:181
#: src/view/AccountPanel.cpp:187
msgid "Cur Credit"
msgstr ""
#: src/view/AccountPanel.cpp:182
#: src/view/AccountPanel.cpp:188
msgid "Cur Debit"
msgstr ""
#: src/view/AccountPanel.cpp:103
#: src/view/AccountPanel.cpp:104
msgid "Current value"
msgstr ""
@ -174,7 +178,7 @@ msgid "Default"
msgstr ""
#: src/view/PreferencesPanel.cpp:159 src/view/PreferencesPanel.cpp:209
#: src/view/AccountPanel.cpp:778
#: src/view/AccountPanel.cpp:836
msgid "Delete"
msgstr ""
@ -191,7 +195,7 @@ msgstr ""
#: src/view/PreferencesPanel.cpp:336 src/view/PreferencesPanel.cpp:359
#: src/view/PreferencesPanel.cpp:378 src/view/PreferencesPanel.cpp:468
#: src/view/PreferencesPanel.cpp:487 src/view/PreferencesPanel.cpp:526
#: src/view/PreferencesPanel.cpp:532 src/view/AccountPanel.cpp:915
#: src/view/PreferencesPanel.cpp:532 src/view/AccountPanel.cpp:973
#: src/view/UsersDialog.cpp:86 src/view/UsersDialog.cpp:114
#: src/view/SearchPanel.cpp:134 src/view/SearchPanel.cpp:144
#: src/view/SearchPanel.cpp:158 src/view/SearchPanel.cpp:169
@ -202,11 +206,11 @@ msgstr ""
msgid "Error creating original database"
msgstr ""
#: src/view/AccountPanel.cpp:104
#: src/view/AccountPanel.cpp:105
msgid "Final value"
msgstr ""
#: src/model/Database.cpp:260 src/controller/KissCount.cpp:259
#: src/model/Database.cpp:260 src/controller/KissCount.cpp:276
#: src/view/GridAccount.cpp:126
msgid "Fix"
msgstr ""
@ -223,19 +227,19 @@ msgstr ""
msgid "From "
msgstr ""
#: src/view/GenerateDialog.cpp:31 src/view/AccountPanel.cpp:775
#: src/view/GenerateDialog.cpp:31 src/view/AccountPanel.cpp:833
msgid "Generate month"
msgstr ""
#: src/controller/KissCount.cpp:261
#: src/controller/KissCount.cpp:278
msgid "Groceries"
msgstr ""
#: src/controller/KissCount.cpp:263
#: src/controller/KissCount.cpp:280
msgid "Hobbies"
msgstr ""
#: src/view/AccountPanel.cpp:102
#: src/view/AccountPanel.cpp:103
msgid "Initial value"
msgstr ""
@ -267,7 +271,7 @@ msgstr ""
msgid "Invalid password"
msgstr ""
#: src/view/StatsPanel.cpp:303
#: src/view/StatsPanel.cpp:294
msgid "Invalide date range"
msgstr ""
@ -275,7 +279,7 @@ msgstr ""
msgid "It must be at least one account !"
msgstr ""
#: src/view/AccountPanel.cpp:915
#: src/view/AccountPanel.cpp:973
msgid "It must be at least one month !"
msgstr ""
@ -284,7 +288,7 @@ msgid "Kill me"
msgstr ""
#: src/view/PreferencesPanel.cpp:566 src/view/PreferencesPanel.cpp:569
#: src/view/StatsPanel.cpp:303
#: src/view/StatsPanel.cpp:294
msgid "KissCount"
msgstr ""
@ -338,7 +342,7 @@ msgstr ""
msgid "Old password "
msgstr ""
#: src/controller/KissCount.cpp:265
#: src/controller/KissCount.cpp:282
msgid "Operating exepense"
msgstr ""
@ -350,7 +354,7 @@ msgstr ""
msgid "Operations"
msgstr ""
#: src/controller/KissCount.cpp:269
#: src/controller/KissCount.cpp:286
msgid "Other"
msgstr ""
@ -386,7 +390,7 @@ msgstr ""
msgid "Quit KissCount ?"
msgstr ""
#: src/view/AccountPanel.cpp:183
#: src/view/AccountPanel.cpp:189
msgid "Remains"
msgstr ""
@ -395,7 +399,7 @@ msgstr ""
msgid "Search"
msgstr ""
#: src/view/StatsPanel.cpp:122 src/view/AccountPanel.cpp:85
#: src/view/StatsPanel.cpp:122 src/view/AccountPanel.cpp:86
msgid "Serie 1"
msgstr ""
@ -403,7 +407,7 @@ msgstr ""
msgid "Shared"
msgstr ""
#: src/view/StatsPanel.cpp:288 src/view/ButtonPanel.cpp:48
#: src/view/StatsPanel.cpp:279 src/view/ButtonPanel.cpp:48
msgid "Statistics"
msgstr ""
@ -415,15 +419,15 @@ msgstr ""
msgid "To "
msgstr ""
#: src/view/AccountPanel.cpp:165
#: src/view/AccountPanel.cpp:171
msgid "Total Credit"
msgstr ""
#: src/view/AccountPanel.cpp:166
#: src/view/AccountPanel.cpp:172
msgid "Total Debit"
msgstr ""
#: src/controller/KissCount.cpp:267
#: src/controller/KissCount.cpp:284
msgid "Unexpected"
msgstr ""

View File

@ -365,3 +365,8 @@ void KissCount::GetStats(int monthFrom, int yearFrom, int monthTo, int yearTo,
_db->GetStats(_user, monthF, yearF, monthT, yearT, accountAmounts, categories);
}
std::map<wxString, double>* KissCount::GetNotChecked(int month, int year)
{
return _db->GetNotChecked(_user, month, year);
}

View File

@ -80,6 +80,8 @@ class KissCount
std::map<wxString, std::map<int, std::map<int, double> > >* accountAmounts,
std::map<wxString, double>* categories);
std::map<wxString, double>* GetNotChecked(int month, int year);
private:
wxUI* _wxUI;
Database* _db;

View File

@ -411,7 +411,7 @@ void Database::LinkOrUnlinkOperation(Operation& op)
req += wxT(" AND month='") + wxString::Format(wxT("%d"), op.month) + wxT("'");
req += wxT(" AND year='") + wxString::Format(wxT("%d"), op.year) + wxT("'");
req += wxT(" AND amount='") + DoubleToString(-op.amount) + wxT("'");
req += wxT(" AND transfert=''");
req += wxT(" AND (transfert='' OR transfert IS NULL)");
EXECUTE_SQL_QUERY(req, set, );
@ -1196,8 +1196,8 @@ void Database::GetStats(User* user, const wxString& monthFrom, const wxString& y
req += wxT(" AND (year > '") + yearFrom + wxT("' OR (year == '") + yearFrom + wxT("' AND month >= '") + monthFrom + wxT("'))");
req += wxT(" AND (year < '") + yearTo + wxT("' OR (year == '") + yearTo + wxT("' AND month <= '") + monthTo + wxT("'))");
req += wxT(" AND (transfert='' OR transfert IS NULL)");
req += wxT(" AND amount < 0");
req += wxT(" AND transfert=''");
EXECUTE_SQL_QUERY(req, set, );
@ -1209,3 +1209,28 @@ void Database::GetStats(User* user, const wxString& monthFrom, const wxString& y
}
}
}
std::map<wxString, double>* Database::GetNotChecked(User* user, int month, int year)
{
std::vector<Account>::iterator accountIt;
std::map<wxString, double>* res = new std::map<wxString, double>;
wxSQLite3ResultSet set;
wxString req;
for (accountIt = user->_accounts.begin() ;accountIt != user->_accounts.end(); accountIt++)
{
req = wxT("SELECT SUM(amount) AS amount FROM operation WHERE account='") + accountIt->id + wxT("'");
req += wxT(" AND checked='0'");
req += wxT(" AND (year < '") + wxString::Format(wxT("%d"), year) + wxT("'") ;
req += wxT(" OR (year == '") + wxString::Format(wxT("%d"), year) + wxT("'") ;
req += wxT(" AND month < '") + wxString::Format(wxT("%d"), month) + wxT("'") ;
req += wxT("))");
EXECUTE_SQL_QUERY_WITH_CODE(req, set, NULL, delete res, delete res);
if (set.NextRow())
(*res)[accountIt->id] = set.GetDouble(wxT("amount"));
}
return res;
}

View File

@ -78,6 +78,8 @@ class Database
void KillMe(User* user);
bool GetOperation(const wxString& id, Operation* op);
std::map<wxString, double>* GetNotChecked(User* user, int month, int year);
private:
wxSQLite3Database _db;

View File

@ -21,7 +21,7 @@ along with KissCount. If not, see <http://www.gnu.org/licenses/>.
enum {ACCOUNT_NUMBER, ACCOUNT_NAME, ACCOUNT_INIT, ACCOUNT_CUR, ACCOUNT_FINAL, NUMBER_COLS_ACCOUNTS};
enum {CUR_CREDIT, CUR_DEBIT, TOTAL_CREDIT, TOTAL_DEBIT, REMAINS, STATS_ROW, CATS_STATS};
enum {CALENDAR_TREE_ID=1, OPS_GRID_ID, CALENDAR_ID, ACCOUNTS_GRID_ID, MENU_GENERATE_ID, MENU_DELETE_ID};
enum {CALENDAR_TREE_ID=1, OPS_GRID_ID, CALENDAR_ID, ACCOUNTS_GRID_ID, MENU_GENERATE_ID, MENU_DELETE_ID, CHECK_MODE_ID};
BEGIN_EVENT_TABLE(AccountPanel, wxPanel)
EVT_GRID_CMD_CELL_CHANGE(OPS_GRID_ID, AccountPanel::OnOperationModified)
@ -33,6 +33,7 @@ EVT_MENU(MENU_GENERATE_ID, AccountPanel::OnMenuGenerate)
EVT_MENU(MENU_DELETE_ID, AccountPanel::OnMenuDelete)
EVT_SHOW(AccountPanel::OnShow)
EVT_CALENDAR_SEL_CHANGED(CALENDAR_ID, AccountPanel::OnCalendarChange)
EVT_CHECKBOX(CHECK_MODE_ID, AccountPanel::OnCheckMode)
END_EVENT_TABLE()
AccountPanel::AccountPanel(KissCount* kiss, wxUI *parent) : wxScrolledWindow(&(*parent)), _curMonth(-1), _curYear(-1), _kiss(kiss), _wxUI(parent), _tree(this, CALENDAR_TREE_ID, wxDefaultPosition, wxDefaultSize, wxTR_HIDE_ROOT)
@ -113,6 +114,9 @@ AccountPanel::AccountPanel(KissCount* kiss, wxUI *parent) : wxScrolledWindow(&(*
chart->Layout();
chart->SetMinSize(// chart->GetSize()
wxSize(200,250));
_checkCheckMode = new wxCheckBox(this, CHECK_MODE_ID, _("Check mode"));
hbox->Add(&_tree, 0);
hbox2->Add(_accountsGrid, 0);
hbox2->Add(_calendar, 0);
@ -124,6 +128,8 @@ AccountPanel::AccountPanel(KissCount* kiss, wxUI *parent) : wxScrolledWindow(&(*
vbox->Add(-1, 10);
vbox->Add(chart, 0);
hbox->Add(-1, 10);
vbox->Add(_checkCheckMode, 0);
hbox->Add(-1, 10);
hbox->Add(vbox, 0);
ChangeUser();
@ -437,12 +443,20 @@ void AccountPanel::UpdateStats()
int i;
User* user = _kiss->GetUser();
std::vector<Operation>::iterator it;
double curCredit, curDebit, totalCredit, totalDebit, remains, value, percents;
double curCredit, curDebit, totalCredit, totalDebit, remains, value, value2, percents;
std::map<wxString, double> curAccountAmount, finalAccountAmount;
std::map<wxString, double>::iterator doubleIt;
std::map<wxString, int>::iterator intIt;
std::vector<Account>::iterator accountIt;
unsigned int day;
bool checkMode = _checkCheckMode->IsChecked();
std::map<wxString, double>* notChecked = NULL;
if (checkMode)
{
notChecked = _kiss->GetNotChecked(_curMonth, _curYear);
}
day = _calendar->GetDate().GetDay()-1;
curCredit = curDebit = totalCredit = totalDebit = 0.0;
@ -458,27 +472,35 @@ void AccountPanel::UpdateStats()
for (it=_curOperations->begin(); it!=_curOperations->end(); it++)
{
if (it->transfert.Length()) continue;
if (it->amount > 0)
{
if (day >= it->day)
{
curCredit += it->amount;
curAccountAmount[it->account] += it->amount;
if (!it->transfert.Length())
curCredit += it->amount;
if (!checkMode || (checkMode && it->checked))
curAccountAmount[it->account] += it->amount;
}
totalCredit += it->amount;
finalAccountAmount[it->account] += it->amount;
if (!it->transfert.Length())
totalCredit += it->amount;
if (!checkMode || (checkMode && it->checked))
finalAccountAmount[it->account] += it->amount;
}
else
{
_categoriesValues[_categoriesIndexes[user->GetCategoryName(it->category)]] += -it->amount ;
if (!it->transfert.Length())
_categoriesValues[_categoriesIndexes[user->GetCategoryName(it->category)]] += -it->amount ;
if (day >= it->day)
{
curDebit += -it->amount;
curAccountAmount[it->account] += it->amount;
if (!it->transfert.Length())
curDebit += -it->amount;
if (!checkMode || (checkMode && it->checked))
curAccountAmount[it->account] += it->amount;
}
totalDebit += -it->amount;
finalAccountAmount[it->account] += it->amount;
if (!it->transfert.Length())
totalDebit += -it->amount;
if (!checkMode || (checkMode && it->checked))
finalAccountAmount[it->account] += it->amount;
}
}
@ -499,16 +521,41 @@ void AccountPanel::UpdateStats()
for (i=0, accountIt=user->_accounts.begin(); accountIt!=user->_accounts.end(); accountIt++, i++)
{
value = curAccountAmount[accountIt->id];
_accountsGrid->SetCellValue(i, ACCOUNT_CUR, wxString::Format(wxT("%.2lf"), value));
_accountsGrid->SetCellTextColour(i, ACCOUNT_CUR, (value >= 0.0) ? wxColor(0x00, 0x00, 0x00) : wxColor(0xFF, 0x00, 0x00));
value = finalAccountAmount[accountIt->id];
_accountsGrid->SetCellValue(i, ACCOUNT_FINAL, wxString::Format(wxT("%.2lf"), value));
if (!checkMode || !notChecked)
{
value = _accountsInitValues[accountIt->id];
_accountsGrid->SetCellValue(i, ACCOUNT_INIT, wxString::Format(wxT("%.2lf"), value));
value = curAccountAmount[accountIt->id];
_accountsGrid->SetCellValue(i, ACCOUNT_CUR, wxString::Format(wxT("%.2lf"), value));
_accountsGrid->SetCellTextColour(i, ACCOUNT_CUR, (value >= 0.0) ? wxColor(0x00, 0x00, 0x00) : wxColor(0xFF, 0x00, 0x00));
value = finalAccountAmount[accountIt->id];
_accountsGrid->SetCellValue(i, ACCOUNT_FINAL, wxString::Format(wxT("%.2lf"), value));
}
else
{
value = _accountsInitValues[accountIt->id];
value2 = (*notChecked)[accountIt->id];
_accountsGrid->SetCellValue(i, ACCOUNT_INIT, wxString::Format(wxT("%.2lf (%.2lf)"), value, value+value2));
value = curAccountAmount[accountIt->id];
_accountsGrid->SetCellValue(i, ACCOUNT_CUR, wxString::Format(wxT("%.2lf (%.2lf)"), value, value+value2));
_accountsGrid->SetCellTextColour(i, ACCOUNT_CUR, (value >= 0.0) ? wxColor(0x00, 0x00, 0x00) : wxColor(0xFF, 0x00, 0x00));
value = finalAccountAmount[accountIt->id];
_accountsGrid->SetCellValue(i, ACCOUNT_FINAL, wxString::Format(wxT("%.2lf (%.2lf)"), value, value+value2));
}
}
_accountsGrid->AutoSizeColumn(ACCOUNT_INIT, true);
_accountsGrid->AutoSizeColumn(ACCOUNT_CUR, true);
_accountsGrid->AutoSizeColumn(ACCOUNT_FINAL, true);
if (notChecked) delete notChecked;
_statsGrid->AutoSizeColumn(1, true);
_pie->DatasetChanged(_dataset);
Layout();
}
void AccountPanel::OnOperationModified(wxGridEvent& event)
@ -1048,3 +1095,8 @@ void AccountPanel::OnCalendarChange(wxCalendarEvent& event)
{
UpdateStats();
}
void AccountPanel::OnCheckMode(wxCommandEvent& event)
{
UpdateStats();
}

View File

@ -70,6 +70,7 @@ class AccountPanel: public wxScrolledWindow
wxGrid *_statsGrid, *_accountsGrid;
PiePlot* _pie;
double *_categoriesValues;
wxCheckBox *_checkCheckMode;
std::map<wxString, int> _categoriesIndexes;
std::vector<Operation>* _curOperations;
wxString* _categories, *_accounts;
@ -82,6 +83,7 @@ class AccountPanel: public wxScrolledWindow
void UpdateStats();
void InsertOperation(User* user, Operation* op, int line, bool fix);
void GetTreeSelection(int* month, int* year);
void OnCheckMode(wxCommandEvent& event);
DECLARE_EVENT_TABLE();
};

View File

@ -149,6 +149,7 @@ void wxUI::ChangeUser()
void wxUI::LoadUser()
{
User* user = _kiss->GetUser();
wxShowEvent event;
if (_curPanel)
{
@ -177,6 +178,7 @@ void wxUI::LoadUser()
_preferencesPanel = new PreferencesPanel(_kiss, this);
ShowPanel(_accountPanel);
_accountPanel->OnShow(event);
}
void wxUI::ShowPanel(wxPanel* panel)