From: <vo...@us...> - 2011-12-26 12:37:42
|
Revision: 1576 http://moneymanagerex.svn.sourceforge.net/moneymanagerex/?rev=1576&view=rev Author: vomikan Date: 2011-12-26 12:37:35 +0000 (Mon, 26 Dec 2011) Log Message: ----------- Refactoring Modified Paths: -------------- trunk/mmex/src/billsdepositsdialog.cpp trunk/mmex/src/filtertransdialog.cpp trunk/mmex/src/mmcheckingpanel.cpp trunk/mmex/src/mmcheckingpanel.h trunk/mmex/src/mmtransaction.cpp trunk/mmex/src/mmtransaction.h trunk/mmex/src/transactionfilterdialog.cpp trunk/mmex/src/transdialog.cpp trunk/mmex/src/util.cpp trunk/mmex/src/util.h Modified: trunk/mmex/src/billsdepositsdialog.cpp =================================================================== --- trunk/mmex/src/billsdepositsdialog.cpp 2011-12-26 01:00:52 UTC (rev 1575) +++ trunk/mmex/src/billsdepositsdialog.cpp 2011-12-26 12:37:35 UTC (rev 1576) @@ -147,22 +147,7 @@ double transAmount = q1.GetDouble(wxT("TRANSAMOUNT")); toTransAmount_ = q1.GetDouble(wxT("TOTRANSAMOUNT")); - if (statusString == wxT("")) - { - choiceStatus_->SetSelection(DEF_STATUS_NONE); - } - else if (statusString == wxT("R")) - { - choiceStatus_->SetSelection(DEF_STATUS_RECONCILED); - } - else if (statusString == wxT("V")) - { - choiceStatus_->SetSelection(DEF_STATUS_VOID); - } - else if (statusString == wxT("F")) - { - choiceStatus_->SetSelection(DEF_STATUS_FOLLOWUP); - } + choiceStatus_->SetSelection(getTransformedTrxStatus(statusString)); wxString nextOccurrString = q1.GetString(wxT("NEXTOCCURRENCEDATE")); wxString numRepeatStr = q1.GetString(wxT("NUMOCCURRENCES")); Modified: trunk/mmex/src/filtertransdialog.cpp =================================================================== --- trunk/mmex/src/filtertransdialog.cpp 2011-12-26 01:00:52 UTC (rev 1575) +++ trunk/mmex/src/filtertransdialog.cpp 2011-12-26 12:37:35 UTC (rev 1576) @@ -489,29 +489,7 @@ if (statusCheckBox->GetValue()) { - wxString status; - if (choiceStatus->GetSelection() == DEF_STATUS_NONE) - { - status = wxT(""); // nothing yet - } - else if (choiceStatus->GetSelection() == DEF_STATUS_RECONCILED) - { - status = wxT("R"); - } - else if (choiceStatus->GetSelection() == DEF_STATUS_VOID) - { - status = wxT("V"); - } - else if (choiceStatus->GetSelection() == DEF_STATUS_FOLLOWUP) - { - status = wxT("F"); - } - else if (choiceStatus->GetSelection() == DEF_STATUS_DUPLICATE) - { - status = wxT("D"); - } - - if (status != pBankTransaction->status_) + if (getTransformedTrxStatus(choiceStatus->GetSelection()) != pBankTransaction->status_) continue; //skip } Modified: trunk/mmex/src/mmcheckingpanel.cpp =================================================================== --- trunk/mmex/src/mmcheckingpanel.cpp 2011-12-26 01:00:52 UTC (rev 1575) +++ trunk/mmex/src/mmcheckingpanel.cpp 2011-12-26 12:37:35 UTC (rev 1576) @@ -493,10 +493,6 @@ EVT_MENU(MENU_ON_PASTE_TRANSACTION, MyListCtrl::OnPaste) EVT_MENU(MENU_ON_NEW_TRANSACTION, MyListCtrl::OnNewTransaction) - //EVT_KEY_UP(MyListCtrl::OnChar) - // If we use EVT_KEY_DOWN instead of EVT_CHAR, capital versions - // of all characters are always returned. EVT_CHAR also performs - // other necessary keyboard-dependent translations. EVT_CHAR(MyListCtrl::OnChar) END_EVENT_TABLE(); @@ -800,7 +796,7 @@ ID_PANEL_CHECKING_STATIC_DETAILS, wxT(""), wxDefaultPosition, wxSize(200,-1), wxTE_MULTILINE|wxTE_WORDWRAP); itemBoxSizer4->Add(itemStaticText11, 1, wxGROW|wxALL, 5); //Show tips when no transaction selected - Tips(); + showTips(); } //---------------------------------------------------------------------------- @@ -838,10 +834,9 @@ } } else { - //st->SetLabel(wxT ("")); - stm->SetLabel(wxT ("")); + stm->SetLabel(wxT("")); enableEditDeleteButtons(false); - Tips () ; + showTips() ; } } //---------------------------------------------------------------------------- @@ -987,37 +982,10 @@ return infoStr; } //--------------------------- -void mmCheckingPanel::Tips() +void mmCheckingPanel::showTips() { - const wxString tips[] = { - _("Recommendation: Always backup your .mmb database file regularly."), - _("Recommendation: If upgrading to a new version of MMEX, make sure you backup your .mmb database file before doing so."), - _("Recommendation: Use copy (Ctrl+С) and paste (Ctrl+V) for frequently used transactions."), - _("Tip: Remember to make backups of your .mmb."), - _("Tip: The .mmb file is not encrypted. That means anyone else having the proper know how can actually open the file and read the contents. So make sure that if you are storing any sensitive financial information it is properly guarded."), - _("Tip: To mark a transaction as reconciled, just select the transaction and hit the 'r' or 'R' key. To mark a transaction as unreconciled, just select the transaction and hit the 'u' or 'U' key."), - _("Tip: To mark a transaction as requiring followup, just select the transaction and hit the 'f' or 'F' key."), - _("Tip: MMEX supports printing of all reports that can be viewed. The print options are available under the menu, File->Print."), - _("Tip: You can modify some runtime behavior of MMEX by changing the options in the Options Dialog. "), - _("Tip: To print a statement with transactions from any arbitary set of criteria, use the transaction filter to select the transactions you want and then do a print from the menu."), - _("Tip: Set exchange rate for currencies in case if you have accounts with different currencies."), - - _("Organize Categories Dialog Tip: Pressing the h key will cycle through all categories starting with the letter h"), - _("Organize Categories Dialog Tip: Pressing 2 key combination will cycle through all categories starting with that key combination. Example: Pressing ho will select Homeneeds, Home, House Tax, etc..."), - _("Organize Payees Dialog Tip: Using the % key as a wildcard when using the filter. Example: %c shows Chemist and Doctor, %c%m shows Chemist only."), - - _("Tip to get out of debt: Pay yourself 10% first. Put this into an account that is hard to touch. Make sure it is a chore to get the money out (you have to drive to the bank), so you will only tap it consciously and for major expenses.") , - _("Tip to get out of debt: Establish an emergency fund."), - _("Tip to get out of debt: Stop acquiring new debt."), - _("Tip to get out of debt: Create a realistic budget for your expenses.") , - _("Tip to get out of debt: Spend less than you earn."), - _("Tip to get out of debt: Pay more than the minimum.") - - }; wxStaticText* st = (wxStaticText*)FindWindow(ID_PANEL_CHECKING_STATIC_DETAILS); - int pos = rand() % 20; - // Randomly prints one of the above tips - st->SetLabel(tips[pos]); + st->SetLabel(Tips(wxT("checkingpanel"))); } //---------------------------------------------------------------------------- void mmCheckingPanel::setAccountSummary() Modified: trunk/mmex/src/mmcheckingpanel.h =================================================================== --- trunk/mmex/src/mmcheckingpanel.h 2011-12-26 01:00:52 UTC (rev 1575) +++ trunk/mmex/src/mmcheckingpanel.h 2011-12-26 12:37:35 UTC (rev 1576) @@ -140,7 +140,7 @@ /* updates the checking panel data */ void initVirtualListControl(wxProgressDialog* pgd); - void Tips(); + void showTips(); void updateExtraTransactionData(int selIndex); void saveSettings(); Modified: trunk/mmex/src/mmtransaction.cpp =================================================================== --- trunk/mmex/src/mmtransaction.cpp 2011-12-26 01:00:52 UTC (rev 1575) +++ trunk/mmex/src/mmtransaction.cpp 2011-12-26 12:37:35 UTC (rev 1576) @@ -1068,3 +1068,36 @@ } } +wxString mmSplitTransactionEntries::getSplitedTrxNotes(mmCoreDB* core, int trxID) +{ + int transid = trxID; + wxString infoStr = wxEmptyString; + double amount; + wxString amountStr; + + char sql[]= + "select c.categname || case when sc.subcategname not null then ' : '||sc.subcategname else ''end as CATEG " + ", st.splittransamount as SPLITTRANSAMOUNT " + "from splittransactions_v1 st " + "left join category_v1 c on st.categid=c.categid " + "left join subcategory_v1 sc on st.subcategid=sc.subcategid " + "where st.transid = ? " + "group by st.categid " + "order by c.categname, sc.subcategname"; + + wxSQLite3Statement st = core->db_->PrepareStatement(sql); + st.Bind(1, trxID); + + wxSQLite3ResultSet q1 = st.ExecuteQuery(); + while (q1.NextRow()) + { + infoStr << q1.GetString(wxT("CATEG")); + infoStr << wxT(" = "); + amount = q1.GetDouble(wxT("SPLITTRANSAMOUNT")); + mmex::formatDoubleToCurrencyEdit(amount, amountStr); + infoStr << amountStr << wxT("\n"); + } + st.Finalize(); + return infoStr; +} + Modified: trunk/mmex/src/mmtransaction.h =================================================================== --- trunk/mmex/src/mmtransaction.h 2011-12-26 01:00:52 UTC (rev 1575) +++ trunk/mmex/src/mmtransaction.h 2011-12-26 12:37:35 UTC (rev 1576) @@ -55,21 +55,22 @@ class mmSplitTransactionEntries { public: - mmSplitTransactionEntries() : total_() {} + mmSplitTransactionEntries() : total_() {} - size_t numEntries() const { return entries_.size(); } - double getTotalSplits() const { return total_; } - double getUpdatedTotalSplits(); + size_t numEntries() const { return entries_.size(); } + double getTotalSplits() const { return total_; } + double getUpdatedTotalSplits(); - void addSplit(boost::shared_ptr<mmSplitTransactionEntry> split); - void removeSplit(int splitID); - void removeSplitByIndex(int splitIndex); + void addSplit(boost::shared_ptr<mmSplitTransactionEntry> split); + void removeSplit(int splitID); + void removeSplitByIndex(int splitIndex); - void updateToDB(boost::shared_ptr<wxSQLite3Database>& db, int transID, bool edit); - void loadFromBDDB(mmCoreDB* core, int bdID); + void updateToDB(boost::shared_ptr<wxSQLite3Database>& db, int transID, bool edit); + void loadFromBDDB(mmCoreDB* core, int bdID); - std::vector<boost::shared_ptr<mmSplitTransactionEntry> > entries_; - double total_; + std::vector<boost::shared_ptr<mmSplitTransactionEntry> > entries_; + double total_; + wxString getSplitedTrxNotes(mmCoreDB* core, int trxID); }; class mmBankTransaction : public mmTransaction @@ -89,9 +90,7 @@ boost::shared_ptr<mmCurrency> currencyPtr, bool forceUpdate=false); - void getSplitTransactions(mmCoreDB* core, - mmSplitTransactionEntries* splits); - + void getSplitTransactions(mmCoreDB* core, mmSplitTransactionEntries* splits); boost::shared_ptr<wxSQLite3Database> db_; /* Core Data */ Modified: trunk/mmex/src/transactionfilterdialog.cpp =================================================================== --- trunk/mmex/src/transactionfilterdialog.cpp 2011-12-26 01:00:52 UTC (rev 1575) +++ trunk/mmex/src/transactionfilterdialog.cpp 2011-12-26 12:37:35 UTC (rev 1576) @@ -378,24 +378,7 @@ bool result = false; if ( cbStatus_->GetValue() ) { - wxString statusStr; - int stat = choiceStatus_->GetSelection(); - - if ( stat == DEF_STATUS_NONE ) - statusStr = wxT(""); - - else if( stat == DEF_STATUS_RECONCILED ) - statusStr = wxT("R"); - - else if (stat == DEF_STATUS_VOID ) - statusStr = wxT("V"); - - else if (stat == DEF_STATUS_FOLLOWUP ) - statusStr = wxT("F"); - - else if (stat == DEF_STATUS_DUPLICATE ) - statusStr = wxT("D"); - + wxString statusStr = getTransformedTrxStatus(choiceStatus_->GetSelection()); if (status == statusStr ) { result = true; Modified: trunk/mmex/src/transdialog.cpp =================================================================== --- trunk/mmex/src/transdialog.cpp 2011-12-26 01:00:52 UTC (rev 1575) +++ trunk/mmex/src/transdialog.cpp 2011-12-26 12:37:35 UTC (rev 1576) @@ -180,26 +180,7 @@ edit_currency_rate = toTransAmount_ / transAmount; } - if (statusString == wxT("")) - { - choiceStatus_->SetSelection(DEF_STATUS_NONE); - } - else if (statusString == wxT("R")) - { - choiceStatus_->SetSelection(DEF_STATUS_RECONCILED); - } - else if (statusString == wxT("V")) - { - choiceStatus_->SetSelection(DEF_STATUS_VOID); - } - else if (statusString == wxT("F")) - { - choiceStatus_->SetSelection(DEF_STATUS_FOLLOWUP); - } - else if (statusString == wxT("D")) - { - choiceStatus_->SetSelection(DEF_STATUS_DUPLICATE); - } + choiceStatus_->SetSelection(getTransformedTrxStatus(statusString)); if (transTypeString == TRANS_TYPE_WITHDRAWAL_STR) choiceTrans_->SetSelection(DEF_WITHDRAWAL); @@ -1064,9 +1045,9 @@ wxString transNum = textNumber_->GetValue(); wxString notes = textNotes_->GetValue(); - wxString status = wxT(""); // nothing yet + //wxString status = wxT(""); // nothing yet - if (choiceStatus_->GetSelection() == DEF_STATUS_NONE) + /*if (choiceStatus_->GetSelection() == DEF_STATUS_NONE) { status = wxT(""); // nothing yet } @@ -1085,7 +1066,8 @@ else if (choiceStatus_->GetSelection() == DEF_STATUS_DUPLICATE) { status = wxT("D"); - } + }*/ + wxString status = getTransformedTrxStatus(choiceStatus_->GetSelection()); wxString date1 = dpc_->GetValue().FormatISODate(); Modified: trunk/mmex/src/util.cpp =================================================================== --- trunk/mmex/src/util.cpp 2011-12-26 01:00:52 UTC (rev 1575) +++ trunk/mmex/src/util.cpp 2011-12-26 12:37:35 UTC (rev 1576) @@ -1733,3 +1733,92 @@ return strValue; } + +int getTransformedTrxStatus(wxString in) +{ + int out; + wxString statusStr = in; + if (statusStr == wxT("R")) + { + out=(DEF_STATUS_RECONCILED); + } + else if (statusStr == wxT("V")) + { + out=(DEF_STATUS_VOID); + } + else if (statusStr == wxT("F")) + { + out=(DEF_STATUS_FOLLOWUP); + } + else if (statusStr == wxT("D")) + { + out=(DEF_STATUS_DUPLICATE); + } + else { + out=(DEF_STATUS_NONE); + } + return out; +} +wxString getTransformedTrxStatus(int in) +{ + wxString statusStr = wxEmptyString; + if (in == DEF_STATUS_RECONCILED) + { + statusStr = wxT("R"); + } + else if (in == DEF_STATUS_VOID) + { + statusStr = wxT("V"); + } + else if (in == DEF_STATUS_FOLLOWUP) + { + statusStr = wxT("F"); + } + else if (in == DEF_STATUS_DUPLICATE) + { + statusStr = wxT("D"); + } + else { + statusStr = wxT(""); + } + return statusStr; +} +wxString Tips(wxString type) +{ + wxString tipsStr; + if (type == wxT("checkingpanel")) { + wxString tips[] = { + _("Recommendation: Always backup your .mmb database file regularly."), + _("Recommendation: If upgrading to a new version of MMEX, make sure you backup your .mmb database file before doing so."), + _("Recommendation: Use copy (Ctrl+С) and paste (Ctrl+V) for frequently used transactions."), + _("Tip: Remember to make backups of your .mmb."), + _("Tip: The .mmb file is not encrypted. That means anyone else having the proper know how can actually open the file and read the contents. So make sure that if you are storing any sensitive financial information it is properly guarded."), + _("Tip: To mark a transaction as reconciled, just select the transaction and hit the 'r' or 'R' key. To mark a transaction as unreconciled, just select the transaction and hit the 'u' or 'U' key."), + _("Tip: To mark a transaction as requiring followup, just select the transaction and hit the 'f' or 'F' key."), + _("Tip: MMEX supports printing of all reports that can be viewed. The print options are available under the menu, File->Print."), + _("Tip: You can modify some runtime behavior of MMEX by changing the options in the Options Dialog. "), + _("Tip: To print a statement with transactions from any arbitary set of criteria, use the transaction filter to select the transactions you want and then do a print from the menu."), + _("Tip: Set exchange rate for currencies in case if you have accounts with different currencies."), + + _("Organize Categories Dialog Tip: Pressing the h key will cycle through all categories starting with the letter h"), + _("Organize Categories Dialog Tip: Pressing 2 key combination will cycle through all categories starting with that key combination. Example: Pressing ho will select Homeneeds, Home, House Tax, etc..."), + _("Organize Payees Dialog Tip: Using the % key as a wildcard when using the filter. Example: %c shows Chemist and Doctor, %c%m shows Chemist only."), + + _("Tip to get out of debt: Pay yourself 10% first. Put this into an account that is hard to touch. Make sure it is a chore to get the money out (you have to drive to the bank), so you will only tap it consciously and for major expenses.") , + _("Tip to get out of debt: Establish an emergency fund."), + _("Tip to get out of debt: Stop acquiring new debt."), + _("Tip to get out of debt: Create a realistic budget for your expenses.") , + _("Tip to get out of debt: Spend less than you earn."), + _("Tip to get out of debt: Pay more than the minimum.") + }; + tipsStr = tips[rand() % 20]; + } + else if (type == wxT("assets")) { + tipsStr = _("MMEX allows you to track fixed assets like cars, houses, land and others. Each asset can have its value appreciate by a certain rate per year, depreciate by a certain rate per year, or not change in value. The total assets are added to your total financial worth."); + } + else if (type == wxT("stocks")) { + tipsStr = _("Using MMEX it is possible to track stocks/mutual funds investments."); + } + + return tipsStr; +} Modified: trunk/mmex/src/util.h =================================================================== --- trunk/mmex/src/util.h 2011-12-26 01:00:52 UTC (rev 1575) +++ trunk/mmex/src/util.h 2011-12-26 12:37:35 UTC (rev 1576) @@ -270,6 +270,10 @@ }; // namespace DateTimeProviders +int getTransformedTrxStatus(wxString in); +wxString getTransformedTrxStatus(int in); +wxString Tips(wxString type); + // Validators ----------------------------------------------------- class doubleValidator : public wxTextValidator { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |