Changeset View
Changeset View
Standalone View
Standalone View
kmymoney/plugins/csvexport/csvwriter.cpp
Context not available. | |||||
35 | // Project Headers | 35 | // Project Headers | ||
---|---|---|---|---|---|
36 | 36 | | |||
37 | #include "mymoneyfile.h" | 37 | #include "mymoneyfile.h" | ||
38 | #include "mymoneytransaction.h" | ||||
39 | #include "mymoneytransactionfilter.h" | ||||
40 | #include "mymoneysplit.h" | ||||
41 | #include "mymoneypayee.h" | ||||
38 | #include "csvexportdlg.h" | 42 | #include "csvexportdlg.h" | ||
39 | #include "csvexporterplugin.h" | 43 | #include "csvexporterplugin.h" | ||
40 | 44 | | |||
Context not available. | |||||
158 | QString name = acc.name(); | 162 | QString name = acc.name(); | ||
159 | 163 | | |||
160 | s << leadIn << name << m_separator; | 164 | s << leadIn << name << m_separator; | ||
161 | s << (acc.accountGroup() == MyMoneyAccount::Expense ? QLatin1Char('E') : QLatin1Char('I')); | 165 | s << (acc.accountGroup() == eMyMoney::Account::Expense ? QLatin1Char('E') : QLatin1Char('I')); | ||
162 | s << endl; | 166 | s << endl; | ||
163 | 167 | | |||
164 | QStringList list = acc.accountList(); | 168 | QStringList list = acc.accountList(); | ||
Context not available. | |||||
302 | QString chkAccnt; | 306 | QString chkAccnt; | ||
303 | QList<MyMoneySplit> lst = t.splits(); | 307 | QList<MyMoneySplit> lst = t.splits(); | ||
304 | QList<MyMoneySplit>::Iterator itSplit; | 308 | QList<MyMoneySplit>::Iterator itSplit; | ||
305 | MyMoneyAccount::_accountTypeE typ; | 309 | eMyMoney::Account typ; | ||
306 | QString chkAccntId; | 310 | QString chkAccntId; | ||
307 | MyMoneyMoney qty; | 311 | MyMoneyMoney qty; | ||
308 | MyMoneyMoney value; | 312 | MyMoneyMoney value; | ||
309 | QMap<MyMoneyAccount::_accountTypeE, QString> map; | 313 | QMap<eMyMoney::Account, QString> map; | ||
310 | 314 | | |||
311 | for (int i = 0; i < lst.count(); i++) { | 315 | for (int i = 0; i < lst.count(); i++) { | ||
312 | MyMoneyAccount acc = file->account(lst[i].accountId()); | 316 | MyMoneyAccount acc = file->account(lst[i].accountId()); | ||
Context not available. | |||||
314 | typ = acc.accountType(); | 318 | typ = acc.accountType(); | ||
315 | map.insert(typ, lst[i].accountId()); | 319 | map.insert(typ, lst[i].accountId()); | ||
316 | 320 | | |||
317 | if (typ == MyMoneyAccount::Stock) { | 321 | if (typ == eMyMoney::Account::Stock) { | ||
318 | switch (lst[i].reconcileFlag()) { | 322 | switch (lst[i].reconcileFlag()) { | ||
319 | case MyMoneySplit::Cleared: | 323 | case MyMoneySplit::Cleared: | ||
320 | strStatus = QLatin1Char('C'); | 324 | strStatus = QLatin1Char('C'); | ||
Context not available. | |||||
340 | for (itSplit = lst.begin(); itSplit != lst.end(); ++itSplit) { | 344 | for (itSplit = lst.begin(); itSplit != lst.end(); ++itSplit) { | ||
341 | MyMoneyAccount acc = file->account((*itSplit).accountId()); | 345 | MyMoneyAccount acc = file->account((*itSplit).accountId()); | ||
342 | // | 346 | // | ||
343 | // MyMoneyAccount::Checkings. | 347 | // eMyMoney::Account::Checkings. | ||
344 | // | 348 | // | ||
345 | if ((acc.accountType() == MyMoneyAccount::Checkings) || (acc.accountType() == MyMoneyAccount::Cash) || (acc.accountType() == MyMoneyAccount::Savings)) { | 349 | if ((acc.accountType() == eMyMoney::Account::Checkings) || (acc.accountType() == eMyMoney::Account::Cash) || (acc.accountType() == eMyMoney::Account::Savings)) { | ||
346 | chkAccntId = (*itSplit).accountId(); | 350 | chkAccntId = (*itSplit).accountId(); | ||
347 | chkAccnt = file->account(chkAccntId).name(); | 351 | chkAccnt = file->account(chkAccntId).name(); | ||
348 | strCheckingAccountName = file->accountToCategory(chkAccntId) + m_separator; | 352 | strCheckingAccountName = file->accountToCategory(chkAccntId) + m_separator; | ||
349 | strAmount = (*itSplit).value().formatMoney("", 2).remove(localeThousands) + m_separator; | 353 | strAmount = (*itSplit).value().formatMoney("", 2).remove(localeThousands) + m_separator; | ||
350 | } else if (acc.accountType() == MyMoneyAccount::Income) { | 354 | } else if (acc.accountType() == eMyMoney::Account::Income) { | ||
351 | // | 355 | // | ||
352 | // MyMoneyAccount::Income. | 356 | // eMyMoney::Account::Income. | ||
353 | // | 357 | // | ||
354 | qty = (*itSplit).shares(); | 358 | qty = (*itSplit).shares(); | ||
355 | value = (*itSplit).value(); | 359 | value = (*itSplit).value(); | ||
356 | strInterest = value.formatMoney("", 2, false) + m_separator; | 360 | strInterest = value.formatMoney("", 2, false) + m_separator; | ||
357 | } else if (acc.accountType() == MyMoneyAccount::Expense) { | 361 | } else if (acc.accountType() == eMyMoney::Account::Expense) { | ||
358 | // | 362 | // | ||
359 | // MyMoneyAccount::Expense. | 363 | // eMyMoney::Account::Expense. | ||
360 | // | 364 | // | ||
361 | qty = (*itSplit).shares(); | 365 | qty = (*itSplit).shares(); | ||
362 | value = (*itSplit).value(); | 366 | value = (*itSplit).value(); | ||
363 | strFees = value.formatMoney("", 2, false) + m_separator; | 367 | strFees = value.formatMoney("", 2, false) + m_separator; | ||
364 | } else if (acc.accountType() == MyMoneyAccount::Stock) { | 368 | } else if (acc.accountType() == eMyMoney::Account::Stock) { | ||
365 | // | 369 | // | ||
366 | // MyMoneyAccount::Stock. | 370 | // eMyMoney::Account::Stock. | ||
367 | // | 371 | // | ||
368 | strMemo = QString("%1" + m_separator).arg((*itSplit).memo()); | 372 | strMemo = QString("%1" + m_separator).arg((*itSplit).memo()); | ||
369 | strMemo.replace(QLatin1Char('\n'), QLatin1Char('~')).remove('\''); | 373 | strMemo.replace(QLatin1Char('\n'), QLatin1Char('~')).remove('\''); | ||
Context not available. | |||||
376 | strAction = QLatin1String("IntIncX"); | 380 | strAction = QLatin1String("IntIncX"); | ||
377 | } | 381 | } | ||
378 | if ((strAction == QLatin1String("DivX")) || (strAction == QLatin1String("IntIncX"))) { | 382 | if ((strAction == QLatin1String("DivX")) || (strAction == QLatin1String("IntIncX"))) { | ||
379 | if ((map.value(MyMoneyAccount::Checkings).isEmpty()) && (map.value(MyMoneyAccount::Cash).isEmpty())) { | 383 | if ((map.value(eMyMoney::Account::Checkings).isEmpty()) && (map.value(eMyMoney::Account::Cash).isEmpty())) { | ||
380 | KMessageBox::sorry(0, i18n("Transaction number '%1' is missing an account assignment.\n" | 384 | KMessageBox::sorry(0, i18n("Transaction number '%1' is missing an account assignment.\n" | ||
381 | "Date '%2', Amount '%3'.\nTransaction dropped.\n", count, t.postDate().toString(Qt::ISODate), strAmount), | 385 | "Date '%2', Amount '%3'.\nTransaction dropped.\n", count, t.postDate().toString(Qt::ISODate), strAmount), | ||
382 | i18n("Invalid transaction")); | 386 | i18n("Invalid transaction")); | ||
Context not available. |