Skip to content

Commit

Permalink
fix #536
Browse files Browse the repository at this point in the history
  • Loading branch information
guanlisheng committed Sep 11, 2015
1 parent 0546a8c commit 0d0d424
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/reports/summary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ wxString mmReportSummaryByDate::getHTMLText()
return hb.getHTMLText();
}

double mmReportSummaryByDate::GetDailyBalanceAt(const Model_Account::Data *account, wxDateTime date)
double mmReportSummaryByDate::GetDailyBalanceAt(const Model_Account::Data *account, const wxDate& date)
{
double convRate = 1.0;

Expand Down
2 changes: 1 addition & 1 deletion src/reports/summary.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class mmReportSummaryByDate : public mmPrintableBase

typedef std::map<wxDate, double> balanceMap;

double GetDailyBalanceAt(const Model_Account::Data *account, wxDate date);
double GetDailyBalanceAt(const Model_Account::Data *account, const wxDate& date);
};

#endif //_MM_EX_REPORTSUMMARY_H_
16 changes: 4 additions & 12 deletions src/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,19 +274,11 @@ const wxDateTime getUserDefinedFinancialYear(bool prevDayRequired)
if (today.GetMonth() < monthNum) year--;

int dayNum = wxAtoi(mmOptions::instance().financialYearStartDayString_);
if ((dayNum < 1) || (dayNum > 31 )) {
dayNum = 1;
} else if (((monthNum == wxDateTime::Feb) && (dayNum > 28)) ||
(((monthNum == wxDateTime::Sep) || (monthNum == wxDateTime::Apr) ||
(monthNum == wxDateTime::Jun) || (monthNum == wxDateTime::Nov)) && (dayNum > 29)))
{
dayNum = 1;
}

wxDateTime financialYear = wxDateTime(today);
financialYear.SetDay(dayNum);
financialYear.SetMonth((wxDateTime::Month)monthNum);
financialYear.SetYear(year);
if (dayNum <= 0 || dayNum > wxDateTime::GetNumberOfDays((wxDateTime::Month)monthNum, year))
dayNum = 1;

wxDateTime financialYear(dayNum, (wxDateTime::Month)monthNum, year);
if (prevDayRequired)
financialYear.Subtract(wxDateSpan::Day());
return financialYear;
Expand Down

0 comments on commit 0d0d424

Please sign in to comment.