From: <vo...@us...> - 2012-07-10 17:54:03
|
Revision: 2720 http://moneymanagerex.svn.sourceforge.net/moneymanagerex/?rev=2720&view=rev Author: vomikan Date: 2012-07-10 17:53:57 +0000 (Tue, 10 Jul 2012) Log Message: ----------- update Modified Paths: -------------- branches/0.9.9.0/mmex/src/qifimport.cpp Modified: branches/0.9.9.0/mmex/src/qifimport.cpp =================================================================== --- branches/0.9.9.0/mmex/src/qifimport.cpp 2012-07-10 15:13:36 UTC (rev 2719) +++ branches/0.9.9.0/mmex/src/qifimport.cpp 2012-07-10 17:53:57 UTC (rev 2720) @@ -782,10 +782,10 @@ if (scd.ShowModal() == wxID_OK) items_index = scd.GetSelections(); if (items_index.IsEmpty()) return; - const wxString chooseExt = _("QIF Files"); + const wxString choose_ext = _("QIF Files"); wxString fileName = wxFileSelector(_("Choose QIF data file to Export"), wxEmptyString, wxEmptyString, wxEmptyString, - chooseExt + wxT(" (*.qif)|*.qif;*.QIF"), wxFD_SAVE | wxFD_OVERWRITE_PROMPT); + choose_ext + wxT(" (*.qif)|*.qif;*.QIF"), wxFD_SAVE | wxFD_OVERWRITE_PROMPT); if (fileName.IsEmpty()) return; correctEmptyFileExt(wxT("qif"), fileName); @@ -824,8 +824,10 @@ } } } + //Export transactions long numRecords = 0; + if (exp_transactions) { static const char sql[] = @@ -836,7 +838,7 @@ "TRANSACTIONNUMBER, NOTES, TOACCOUNTID, ACCOUNTID " "FROM checkingaccount_v1 " "WHERE ACCOUNTID = ? OR TOACCOUNTID = ?" - "ORDER BY transdate"; + "ORDER BY transdate, transid"; wxSQLite3Statement st = db_->PrepareStatement(sql); st.Bind(1, fromAccountID); @@ -876,18 +878,16 @@ wxString transNum = q1.GetString(wxT("TRANSACTIONNUMBER")); wxString categ = core->getCategoryName(q1.GetInt(wxT("CATEGID"))); - wxString subcateg = mmDBWrapper::getSubCategoryName(db_, + const wxString subcateg = mmDBWrapper::getSubCategoryName(db_, q1.GetInt(wxT("CATEGID")), q1.GetInt(wxT("SUBCATEGID"))); wxString notes = (q1.GetString(wxT("NOTES"))); notes.Replace(wxT("''"), wxT("'")); // notes.Replace(wxT("\n"), wxT(" ")); - wxString subcategStr = wxT ("") ; if (type == wxT("Transfer")) { - subcategStr = type; int tAccountID = q1.GetInt(wxT("TOACCOUNTID")); int fAccountID = q1.GetInt(wxT("ACCOUNTID")); @@ -895,28 +895,28 @@ wxString toAccount = core->getAccountName(tAccountID); if (tAccountID == fromAccountID) { - payee = fromAccount; + payee = wxString::Format(wxT("[%s]"), fromAccount.c_str()); amount = toamount; } else if (fAccountID == fromAccountID) { - payee = toAccount; - amount = wxT ('-') + amount; + payee = wxString::Format(wxT("[%s]"), toAccount.c_str()); + amount.Prepend(wxT ('-')); } } - else - { - subcategStr << categ << (subcateg != wxT("") ? wxT(":") : wxT("")) << subcateg; - } + else if (type == wxT("Withdrawal")) + amount.Prepend(wxT ('-')); + + categ =+ (subcateg.IsEmpty() ? wxT("") : wxString(wxT(":"))<< subcateg); - text << wxT('D') << dateString << endl - << wxT('T') << (type == wxT("Withdrawal") ? wxT("-") : wxT("")) << amount << endl; + text << wxT('D') << dateString << endl; + text << wxT('T') << amount << endl; if (type != wxT("Transfer")) text << wxT('P') << payee << endl; if (!transNum.IsEmpty()) text << wxT('N') << transNum << endl; //Category or Transfer - wxString t = (type == wxT("Transfer") ? wxString::Format(wxT("[%s]"), payee.c_str()) : subcategStr); - if (!t.IsEmpty()) - text << wxT('L') << t << endl; + wxString l = (type == wxT("Transfer") ? payee : categ); + if (!l.IsEmpty()) + text << wxT('L') << l << endl; if (!notes.IsEmpty()) text << wxT('M') << notes << endl; @@ -935,17 +935,13 @@ while (q2.NextRow()) { - wxString split_amount, split_type; - split_type = type; + wxString split_amount; value = q2.GetDouble(wxT("SPLITTRANSAMOUNT"));\ - if (value < 0.0) { + if (type == wxT("Withdrawal")) value = -value; - split_type = type == wxT("Withdrawal") ? wxT("Deposit") : wxT("Withdrawal"); - } mmex::formatDoubleToCurrencyEdit(value, split_amount); - if (split_type == wxT("Deposit")) split_amount.Prepend(wxT("-")); wxString split_categ = core->getCategoryName(q2.GetInt(wxT("CATEGID"))); const wxString split_subcateg = mmDBWrapper::getSubCategoryName(db_, @@ -954,11 +950,10 @@ text << wxT('S') << split_categ << endl; text << wxT('$') << split_amount << endl; // E Split memo — any text to go with this split item. - //I saggest Category:Subcategory = Amount for earch line + // Category:Subcategory Amount for earch line will be here text << wxT('E') << split_categ << wxT(" ") << split_amount << endl; } - q2.Finalize(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |