This commit is contained in:
2010-06-02 22:14:11 +02:00
parent 045992b69e
commit 33a4f206a8
9 changed files with 234 additions and 57 deletions

View File

@@ -232,3 +232,26 @@ void Database::LoadYear(User* user, int year)
set.Finalize();
}
double Database::GetAccountAmount(wxString id, int month, int year)
{
wxSQLite3ResultSet set;
wxString req;
double res;
req = _("SELECT amount FROM account_amount WHERE account='") + id ;
req += _("' AND month='") + wxString::Format(_("%d"), month);
req += _("' AND year='") + wxString::Format(_("%d"), year);
req += _("'");
EXECUTE_SQL_QUERY(req , set, 0.0);
if (set.NextRow())
res = set.GetDouble(_("amount"));
else
res = 0.0;
set.Finalize();
return res;
}

View File

@@ -23,6 +23,7 @@ class Database
User* LoadUser(wxString name);
void LoadYear(User* user, int year);
double GetAccountAmount(wxString id, int month, int year);
private:
wxSQLite3Database _db;

View File

@@ -32,3 +32,13 @@ int User::GetCategoriesNumber()
{
return _preferences._categories.size();
}
int User::GetAccountsNumber()
{
return _accounts.size();
}
int User::GetOperationsNumber(int month, int year)
{
return (*_operations[year])[month].size();
}

View File

@@ -41,6 +41,8 @@ public:
wxString GetCategoryName(wxString catId);
wxString GetAccountName(wxString accountId);
int GetCategoriesNumber();
int GetAccountsNumber();
int GetOperationsNumber(int month, int year);
};
#endif