Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Extra libraries, Code snippets, applications etc. » U++ users applications in progress and useful code snippets, including reference examples! » HomeBudget example bug
HomeBudget example bug [message #19787] Tue, 20 January 2009 02:44 Go to previous message
Shire is currently offline  Shire
Messages: 41
Registered: September 2006
Location: Russia, Yamal peninsula
Member
When application setup, months list is correctly initialized by months of current year.

void HomeBudget::Setup()
{
...
	Date dt = GetSysDate();
	dt.day = 1;
...
	GenMonthList(dt.year);


But when selected one of months in month grid, months is reinitialized by year of selection:

void HomeBudget::ChangeDate()
{
	dtid = month(ID);
	LoadMoney(dtid);
	UpdateSummary();
	GenMonthList(((Date) month(DT)).year);
}


After new year, DropGrid months will never be initialized by current year.

I made corrections in GenMonthList:
void HomeBudget::GenMonthList(int year)
{
	months.Clear();
	int curr_year = GetSysDate().year;
	int scan_year = min(year,curr_year) - 1;
	int max_year = max(year,curr_year);
	for(int scan_year = min(year,curr_year) - 1; scan_year <= max_year; scan_year++)
		for(int i = 0; i < 12; i++)
			months.Add(Date(scan_year, i + 1, 1), Format("%Month %.4d", i + 1, scan_year));
}

Now DropGrid includes months of years from given-1 to current.

Also example does not use table indexes. This is not good.
TABLE_(CATEGORIES)
	INT 	(ID) PRIMARY_KEY
	INT_    (GR_ID) INDEX
...
TABLE_(MONEY)
	INT  (ID) PRIMARY_KEY
	INT_ (DT_ID) INDEX
	INT_ (CAT_ID) INDEX


Other small changes (russian translation, layout fix, and other) are in attach.
 
Read Message
Read Message
Read Message
Previous Topic: Uploading files via FTP
Next Topic: Register new file types under windows
Goto Forum:
  


Current Time: Sun May 05 19:10:48 CEST 2024

Total time taken to generate the page: 0.02125 seconds