From 28723595822268551d3e050c3a83bf6ca5e17dd5 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Sun, 18 Dec 2011 18:10:39 -0600 Subject: Rename old tq methods that no longer need a unique name --- kmymoney2/mymoney/mymoneyforecast.cpp | 106 +++++++++++++++++----------------- 1 file changed, 53 insertions(+), 53 deletions(-) (limited to 'kmymoney2/mymoney/mymoneyforecast.cpp') diff --git a/kmymoney2/mymoney/mymoneyforecast.cpp b/kmymoney2/mymoney/mymoneyforecast.cpp index 4365b47..bfecce0 100644 --- a/kmymoney2/mymoney/mymoneyforecast.cpp +++ b/kmymoney2/mymoney/mymoneyforecast.cpp @@ -47,8 +47,8 @@ MyMoneyForecast::MyMoneyForecast() : { setForecastCycles(KMyMoneyGlobalSettings::forecastCycles()); setAccountsCycle(KMyMoneyGlobalSettings::forecastAccountCycle()); - setHistoryStartDate(TQDate::tqcurrentDate().addDays(-forecastCycles()*accountsCycle())); - setHistoryEndDate(TQDate::tqcurrentDate().addDays(-1)); + setHistoryStartDate(TQDate::currentDate().addDays(-forecastCycles()*accountsCycle())); + setHistoryEndDate(TQDate::currentDate().addDays(-1)); setForecastDays(KMyMoneyGlobalSettings::forecastDays()); setBeginForecastDay(KMyMoneyGlobalSettings::beginForecastDay()); setForecastMethod(KMyMoneyGlobalSettings::forecastMethod()); @@ -75,12 +75,12 @@ void MyMoneyForecast::doForecast() //initialize global variables setForecastDays(fDays); - setForecastStartDate(TQDate::tqcurrentDate().addDays(1)); - setForecastEndDate(TQDate::tqcurrentDate().addDays(fDays)); + setForecastStartDate(TQDate::currentDate().addDays(1)); + setForecastEndDate(TQDate::currentDate().addDays(fDays)); setAccountsCycle(fAccCycle); setForecastCycles(fCycles); setHistoryStartDate(forecastCycles() * accountsCycle()); - setHistoryEndDate(TQDate::tqcurrentDate().addDays(-1)); //yesterday + setHistoryEndDate(TQDate::currentDate().addDays(-1)); //yesterday //clear all data before calculating m_accountListPast.clear(); @@ -343,14 +343,14 @@ MyMoneyMoney MyMoneyForecast::calculateAccountTrend(const MyMoneyAccount& acc, i //If it is a new account, we don't take into account the first day //because it is usually a weird one and it would mess up the trend - if(openingDate.daysTo(TQDate::tqcurrentDate())price ( undersecurity.id(), undersecurity.tradingCurrency(), it_day ); if ( price.isValid() ) @@ -651,7 +651,7 @@ void MyMoneyForecast::addScheduledTransactions (void) TQValueList schedule; schedule = file->scheduleList("", MyMoneySchedule::TYPE_ANY, MyMoneySchedule::OCCUR_ANY, MyMoneySchedule::STYPE_ANY, - TQDate::tqcurrentDate(), forecastEndDate()); + TQDate::currentDate(), forecastEndDate()); if(schedule.count() > 0) { TQValueList::Iterator it; do { @@ -698,12 +698,12 @@ void MyMoneyForecast::addScheduledTransactions (void) if(isForecastAccount(acc)) { // collect all overdues on the first day TQDate forecastDate = nextDate; - if(TQDate::tqcurrentDate() >= nextDate) - forecastDate = TQDate::tqcurrentDate().addDays(1); + if(TQDate::currentDate() >= nextDate) + forecastDate = TQDate::currentDate().addDays(1); dailyBalances balance; balance = m_accountList[acc.id()]; - for(TQDate f_day = TQDate::tqcurrentDate(); f_day < forecastDate; ) { + for(TQDate f_day = TQDate::currentDate(); f_day < forecastDate; ) { balanceMap[acc.id()] += m_accountList[acc.id()][f_day]; f_day = f_day.addDays(1); } @@ -719,14 +719,14 @@ void MyMoneyForecast::addScheduledTransactions (void) if(isForecastAccount(acc)) { dailyBalances balance; balance = m_accountList[acc.id()]; - //int offset = TQDate::tqcurrentDate().daysTo(nextDate); + //int offset = TQDate::currentDate().daysTo(nextDate); //if(offset <= 0) { // collect all overdues on the first day // offset = 1; //} // collect all overdues on the first day TQDate forecastDate = nextDate; - if(TQDate::tqcurrentDate() >= nextDate) - forecastDate = TQDate::tqcurrentDate().addDays(1); + if(TQDate::currentDate() >= nextDate) + forecastDate = TQDate::currentDate().addDays(1); if(acc.accountType() == MyMoneyAccount::Income) { balance[forecastDate] += ((*it_s).shares() * MyMoneyMoney(-1, 1)); @@ -807,9 +807,9 @@ int MyMoneyForecast::daysToMinimumBalance(const MyMoneyAccount& acc) balance = m_accountList[acc.id()]; - for(TQDate it_day = TQDate::tqcurrentDate() ; it_day <= forecastEndDate(); ) { + for(TQDate it_day = TQDate::currentDate() ; it_day <= forecastEndDate(); ) { if(minBalance > balance[it_day]) { - return TQDate::tqcurrentDate().daysTo(it_day); + return TQDate::currentDate().daysTo(it_day); } it_day = it_day.addDays(1); } @@ -828,20 +828,20 @@ int MyMoneyForecast::daysToZeroBalance(const MyMoneyAccount& acc) balance = m_accountList[acc.id()]; if (acc.accountGroup() == MyMoneyAccount::Asset) { - for (TQDate it_day = TQDate::tqcurrentDate() ; it_day <= forecastEndDate(); ) + for (TQDate it_day = TQDate::currentDate() ; it_day <= forecastEndDate(); ) { if ( balance[it_day] < MyMoneyMoney ( 0, 1 ) ) { - return TQDate::tqcurrentDate().daysTo(it_day); + return TQDate::currentDate().daysTo(it_day); } it_day = it_day.addDays(1); } } else if (acc.accountGroup() == MyMoneyAccount::Liability) { - for (TQDate it_day = TQDate::tqcurrentDate() ; it_day <= forecastEndDate(); ) + for (TQDate it_day = TQDate::currentDate() ; it_day <= forecastEndDate(); ) { if ( balance[it_day] > MyMoneyMoney ( 0, 1 ) ) { - return TQDate::tqcurrentDate().daysTo(it_day); + return TQDate::currentDate().daysTo(it_day); } it_day = it_day.addDays(1); } @@ -882,7 +882,7 @@ MyMoneyMoney MyMoneyForecast::accountTotalVariation(const MyMoneyAccount& acc) { MyMoneyMoney totalVariation; - totalVariation = forecastBalance(acc, forecastEndDate()) - forecastBalance(acc, TQDate::tqcurrentDate()); + totalVariation = forecastBalance(acc, forecastEndDate()) - forecastBalance(acc, TQDate::currentDate()); return totalVariation; } @@ -891,15 +891,15 @@ TQValueList MyMoneyForecast::accountMinimumBalanceDateList(const MyMoney TQValueList minBalanceList; int daysToBeginDay; - daysToBeginDay = TQDate::tqcurrentDate().daysTo(beginForecastDate()); + daysToBeginDay = TQDate::currentDate().daysTo(beginForecastDate()); for(int t_cycle = 0; ((t_cycle * accountsCycle()) + daysToBeginDay) < forecastDays() ; ++t_cycle) { MyMoneyMoney minBalance = forecastBalance(acc, (t_cycle * accountsCycle() + daysToBeginDay)); - TQDate minDate = TQDate::tqcurrentDate().addDays(t_cycle * accountsCycle() + daysToBeginDay); + TQDate minDate = TQDate::currentDate().addDays(t_cycle * accountsCycle() + daysToBeginDay); for(int t_day = 1; t_day <= accountsCycle() ; ++t_day) { if( minBalance > forecastBalance(acc, (t_cycle * accountsCycle()) + daysToBeginDay + t_day) ) { minBalance = forecastBalance(acc, (t_cycle * accountsCycle()) + daysToBeginDay + t_day ); - minDate = TQDate::tqcurrentDate().addDays( (t_cycle * accountsCycle()) + daysToBeginDay + t_day); + minDate = TQDate::currentDate().addDays( (t_cycle * accountsCycle()) + daysToBeginDay + t_day); } } minBalanceList.append(minDate); @@ -912,16 +912,16 @@ TQValueList MyMoneyForecast::accountMaximumBalanceDateList(const MyMoney TQValueList maxBalanceList; int daysToBeginDay; - daysToBeginDay = TQDate::tqcurrentDate().daysTo(beginForecastDate()); + daysToBeginDay = TQDate::currentDate().daysTo(beginForecastDate()); for(int t_cycle = 0; ((t_cycle * accountsCycle()) + daysToBeginDay) < forecastDays() ; ++t_cycle) { MyMoneyMoney maxBalance = forecastBalance(acc, ((t_cycle * accountsCycle()) + daysToBeginDay)); - TQDate maxDate = TQDate::tqcurrentDate().addDays((t_cycle * accountsCycle()) + daysToBeginDay); + TQDate maxDate = TQDate::currentDate().addDays((t_cycle * accountsCycle()) + daysToBeginDay); for(int t_day = 0; t_day < accountsCycle() ; ++t_day) { if( maxBalance < forecastBalance(acc, (t_cycle * accountsCycle()) + daysToBeginDay + t_day) ) { maxBalance = forecastBalance(acc, (t_cycle * accountsCycle()) + daysToBeginDay + t_day ); - maxDate = TQDate::tqcurrentDate().addDays((t_cycle * accountsCycle()) + daysToBeginDay + t_day); + maxDate = TQDate::currentDate().addDays((t_cycle * accountsCycle()) + daysToBeginDay + t_day); } } maxBalanceList.append(maxDate); @@ -947,38 +947,38 @@ int MyMoneyForecast::calculateBeginForecastDay() //if 0, beginDate is current date and forecastDays remains unchanged if(beginDay == 0) { - setBeginForecastDate(TQDate::tqcurrentDate()); + setBeginForecastDate(TQDate::currentDate()); return fDays; } //adjust if beginDay more than days of current month - if(TQDate::tqcurrentDate().daysInMonth() < beginDay) - beginDay = TQDate::tqcurrentDate().daysInMonth(); + if(TQDate::currentDate().daysInMonth() < beginDay) + beginDay = TQDate::currentDate().daysInMonth(); //if beginDay still to come, calculate and return - if(TQDate::tqcurrentDate().day() <= beginDay) { - beginDate = TQDate( TQDate::tqcurrentDate().year(), TQDate::tqcurrentDate().month(), beginDay); - fDays += TQDate::tqcurrentDate().daysTo(beginDate); + if(TQDate::currentDate().day() <= beginDay) { + beginDate = TQDate( TQDate::currentDate().year(), TQDate::currentDate().month(), beginDay); + fDays += TQDate::currentDate().daysTo(beginDate); setBeginForecastDate(beginDate); return fDays; } //adjust beginDay for next month - if(TQDate::tqcurrentDate().addMonths(1).daysInMonth() < beginDay) - beginDay = TQDate::tqcurrentDate().addMonths(1).daysInMonth(); + if(TQDate::currentDate().addMonths(1).daysInMonth() < beginDay) + beginDay = TQDate::currentDate().addMonths(1).daysInMonth(); //if beginDay of next month comes before 1 interval, use beginDay next month - if(TQDate::tqcurrentDate().addDays(accCycle) >= - (TQDate(TQDate::tqcurrentDate().addMonths(1).year(), TQDate::tqcurrentDate().addMonths(1).month(), 1).addDays(beginDay-1) ) ) + if(TQDate::currentDate().addDays(accCycle) >= + (TQDate(TQDate::currentDate().addMonths(1).year(), TQDate::currentDate().addMonths(1).month(), 1).addDays(beginDay-1) ) ) { - beginDate = TQDate(TQDate::tqcurrentDate().addMonths(1).year(), TQDate::tqcurrentDate().addMonths(1).month(), 1).addDays(beginDay-1); - fDays += TQDate::tqcurrentDate().daysTo(beginDate); + beginDate = TQDate(TQDate::currentDate().addMonths(1).year(), TQDate::currentDate().addMonths(1).month(), 1).addDays(beginDay-1); + fDays += TQDate::currentDate().daysTo(beginDate); } else //add intervals to current beginDay and take the first after current date { - beginDay = ((((TQDate::tqcurrentDate().day()-beginDay)/accCycle) + 1) * accCycle) + beginDay; - beginDate = TQDate::tqcurrentDate().addDays(beginDay - TQDate::tqcurrentDate().day()); - fDays += TQDate::tqcurrentDate().daysTo(beginDate); + beginDay = ((((TQDate::currentDate().day()-beginDay)/accCycle) + 1) * accCycle) + beginDay; + beginDate = TQDate::currentDate().addDays(beginDay - TQDate::currentDate().day()); + fDays += TQDate::currentDate().daysTo(beginDate); } setBeginForecastDate(beginDate); @@ -1190,15 +1190,15 @@ void MyMoneyForecast::setStartingBalance(const MyMoneyAccount &acc) //set the default value MyMoneyMoney rate = MyMoneyMoney ( 1, 1 ); //get te - MyMoneyPrice price = file->price ( undersecurity.id(), undersecurity.tradingCurrency(), TQDate::tqcurrentDate() ); + MyMoneyPrice price = file->price ( undersecurity.id(), undersecurity.tradingCurrency(), TQDate::currentDate() ); if ( price.isValid() ) { rate = price.rate ( undersecurity.tradingCurrency() ); } - m_accountList[acc.id()][TQDate::tqcurrentDate()] = file->balance(acc.id(), TQDate::tqcurrentDate()) * rate; + m_accountList[acc.id()][TQDate::currentDate()] = file->balance(acc.id(), TQDate::currentDate()) * rate; } } else { - m_accountList[acc.id()][TQDate::tqcurrentDate()] = file->balance(acc.id(), TQDate::tqcurrentDate()); + m_accountList[acc.id()][TQDate::currentDate()] = file->balance(acc.id(), TQDate::currentDate()); } //if the method is linear regression, we have to add the opening balance to m_accountListPast @@ -1267,8 +1267,8 @@ void MyMoneyForecast::calculateAutoLoan(const MyMoneySchedule& schedule, MyMoney // the payment is overdue then take the current date dueDate = schedule.nextDueDate(); if(acc.interestCalculation() == MyMoneyAccountLoan::paymentReceived) { - if(dueDate < TQDate::tqcurrentDate()) - dueDate = TQDate::tqcurrentDate(); + if(dueDate < TQDate::currentDate()) + dueDate = TQDate::currentDate(); } // we need to calculate the balance at the time the payment is due -- cgit v1.2.1