HomeBudget: Fixed updating categories drop list after removing category, fixed clearing value in money grid after updating category (thanks porto!)

git-svn-id: svn://ultimatepp.org/upp/trunk@2781 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
unodgs 2010-10-13 18:42:17 +00:00
parent 6e8baec884
commit 9c2ff4b2da

View file

@ -295,6 +295,7 @@ void HomeBudget::RemoveGroup()
if(categories.IsEmpty())
{
SQL & Delete(GROUPS).Where(ID == groups(ID));
if(groups.GetCount() == 1)
categories.Disable();
}
@ -465,7 +466,10 @@ void HomeBudget::RemoveCategory()
categories.CancelRemove();
}
else
{
SQL & Delete(CATEGORIES).Where(ID == categories(ID));
UpdateCategories();
}
}
catch(SqlExc &e)
{
@ -746,13 +750,18 @@ void HomeBudget::UpdateValue()
{
if(money.IsEmpty())
return;
try
{
SQL & Select(DEFVALUE).From(CATEGORIES).Where(ID == money.Get(CAT_ID));
SQL & Select(DEFVALUE, PM).From(CATEGORIES).Where(ID == money.Get(CAT_ID));
Value v = SQL.Fetch() ? SQL[0] : Value(0);
money.Set(VALUE, v);
money.Set(PM, GetCategorySign());
Value s = SQL.Fetch() ? SQL[1] : -1;
if(IsNull(money.Get(VALUE)))
money.Set(VALUE, v);
if(IsNull(money.Get(PM)))
money.Set(PM, s);
}
catch(SqlExc &e)
{