Simplify UpdateNextMonths function
Add "create_if_not_exsits" to Database::GetAccountAmount
This commit is contained in:
@@ -379,7 +379,7 @@ void Database::LoadYear(User* user, int year)
|
||||
query.clear();
|
||||
}
|
||||
|
||||
int Database::GetAccountAmount(int id, int month, int year, bool* had_value)
|
||||
int Database::GetAccountAmount(int id, int month, int year, bool* had_value, bool create_if_not_exsits)
|
||||
{
|
||||
QSqlRecord set;
|
||||
QString req;
|
||||
@@ -400,7 +400,8 @@ int Database::GetAccountAmount(int id, int month, int year, bool* had_value)
|
||||
}
|
||||
else
|
||||
{
|
||||
SetAccountAmount(id, month, year, 0);
|
||||
if (create_if_not_exsits)
|
||||
SetAccountAmount(id, month, year, 0);
|
||||
if (had_value)
|
||||
*had_value = false;
|
||||
}
|
||||
|
@@ -113,7 +113,7 @@ public:
|
||||
int MetaAmount(int id);
|
||||
int MetaPositiveAmount(int id);
|
||||
|
||||
int GetAccountAmount(int id, int month, int year, bool* had_value=0);
|
||||
int GetAccountAmount(int id, int month, int year, bool* had_value=0, bool create_if_not_exsits=true);
|
||||
void SetAccountAmount(int accountId, int month, int year, int amount);
|
||||
int CalcAccountAmount(int id, int month, int year, bool* had_values);
|
||||
|
||||
|
Reference in New Issue
Block a user