Changeset View
Changeset View
Standalone View
Standalone View
kmymoney/plugins/qif/export/mymoneyqifwriter.cpp
Context not available. | |||||
40 | // Project Headers | 40 | // Project Headers | ||
---|---|---|---|---|---|
41 | 41 | | |||
42 | #include "mymoneyfile.h" | 42 | #include "mymoneyfile.h" | ||
43 | #include "mymoneyaccount.h" | ||||
44 | #include "mymoneytransaction.h" | ||||
45 | #include "mymoneytransactionfilter.h" | ||||
46 | #include "mymoneysplit.h" | ||||
47 | #include "mymoneymoney.h" | ||||
48 | #include "mymoneypayee.h" | ||||
49 | #include "mymoneyexception.h" | ||||
43 | 50 | | |||
44 | MyMoneyQifWriter::MyMoneyQifWriter() | 51 | MyMoneyQifWriter::MyMoneyQifWriter() | ||
45 | { | 52 | { | ||
Context not available. | |||||
164 | QString name = acc.name(); | 171 | QString name = acc.name(); | ||
165 | 172 | | |||
166 | s << "N" << leadIn << name << endl; | 173 | s << "N" << leadIn << name << endl; | ||
167 | s << (acc.accountGroup() == MyMoneyAccount::Expense ? "E" : "I") << endl; | 174 | s << (acc.accountGroup() == eMyMoney::Account::Expense ? "E" : "I") << endl; | ||
168 | s << "^" << endl; | 175 | s << "^" << endl; | ||
169 | 176 | | |||
170 | QStringList list = acc.accountList(); | 177 | QStringList list = acc.accountList(); | ||
Context not available. | |||||
216 | if (list.count() > 1) { | 223 | if (list.count() > 1) { | ||
217 | MyMoneySplit sp = t.splitByAccount(accountId, false); | 224 | MyMoneySplit sp = t.splitByAccount(accountId, false); | ||
218 | MyMoneyAccount acc = file->account(sp.accountId()); | 225 | MyMoneyAccount acc = file->account(sp.accountId()); | ||
219 | if (acc.accountGroup() != MyMoneyAccount::Income | 226 | if (acc.accountGroup() != eMyMoney::Account::Income | ||
220 | && acc.accountGroup() != MyMoneyAccount::Expense) { | 227 | && acc.accountGroup() != eMyMoney::Account::Expense) { | ||
221 | s << "L" << m_qifProfile.accountDelimiter()[0] | 228 | s << "L" << m_qifProfile.accountDelimiter()[0] | ||
222 | << MyMoneyFile::instance()->accountToCategory(sp.accountId()) | 229 | << MyMoneyFile::instance()->accountToCategory(sp.accountId()) | ||
223 | << m_qifProfile.accountDelimiter()[1] << endl; | 230 | << m_qifProfile.accountDelimiter()[1] << endl; | ||
Context not available. | |||||
242 | 249 | | |||
243 | s << "S"; | 250 | s << "S"; | ||
244 | MyMoneyAccount acc = file->account(split.accountId()); | 251 | MyMoneyAccount acc = file->account(split.accountId()); | ||
245 | if (acc.accountGroup() != MyMoneyAccount::Income | 252 | if (acc.accountGroup() != eMyMoney::Account::Income | ||
246 | && acc.accountGroup() != MyMoneyAccount::Expense) { | 253 | && acc.accountGroup() != eMyMoney::Account::Expense) { | ||
247 | s << m_qifProfile.accountDelimiter()[0] | 254 | s << m_qifProfile.accountDelimiter()[0] | ||
248 | << file->accountToCategory(split.accountId()) | 255 | << file->accountToCategory(split.accountId()) | ||
249 | << m_qifProfile.accountDelimiter()[1]; | 256 | << m_qifProfile.accountDelimiter()[1]; | ||
Context not available. | |||||
290 | bool noError = true; | 297 | bool noError = true; | ||
291 | QList<MyMoneySplit> lst = t.splits(); | 298 | QList<MyMoneySplit> lst = t.splits(); | ||
292 | QList<MyMoneySplit>::Iterator it; | 299 | QList<MyMoneySplit>::Iterator it; | ||
293 | MyMoneyAccount::_accountTypeE typ; | 300 | eMyMoney::Account typ; | ||
294 | QString chkAccntId; | 301 | QString chkAccntId; | ||
295 | MyMoneyMoney qty; | 302 | MyMoneyMoney qty; | ||
296 | MyMoneyMoney value; | 303 | MyMoneyMoney value; | ||
297 | QMap<MyMoneyAccount::_accountTypeE, QString> map; | 304 | QMap<eMyMoney::Account, QString> map; | ||
298 | 305 | | |||
299 | for (int i = 0; i < lst.count(); i++) { | 306 | for (int i = 0; i < lst.count(); i++) { | ||
300 | QString actionType = lst[i].action(); | 307 | QString actionType = lst[i].action(); | ||
Context not available. | |||||
302 | QString accName = acc.name(); | 309 | QString accName = acc.name(); | ||
303 | typ = acc.accountType(); | 310 | typ = acc.accountType(); | ||
304 | map.insert(typ, lst[i].accountId()); | 311 | map.insert(typ, lst[i].accountId()); | ||
305 | if (typ == MyMoneyAccount::Stock) { | 312 | if (typ == eMyMoney::Account::Stock) { | ||
306 | memo = lst[i].memo(); | 313 | memo = lst[i].memo(); | ||
307 | } | 314 | } | ||
308 | } | 315 | } | ||
Context not available. | |||||
318 | MyMoneyAccount acc = file->account((*it).accountId()); | 325 | MyMoneyAccount acc = file->account((*it).accountId()); | ||
319 | typ = acc.accountType(); | 326 | typ = acc.accountType(); | ||
320 | // | 327 | // | ||
321 | // MyMoneyAccount::Checkings. | 328 | // eMyMoney::Account::Checkings. | ||
322 | // | 329 | // | ||
323 | if ((acc.accountType() == MyMoneyAccount::Checkings) || (acc.accountType() == MyMoneyAccount::Cash)) { | 330 | if ((acc.accountType() == eMyMoney::Account::Checkings) || (acc.accountType() == eMyMoney::Account::Cash)) { | ||
324 | chkAccntId = (*it).accountId(); | 331 | chkAccntId = (*it).accountId(); | ||
325 | chkAccnt = file->account(chkAccntId).name(); | 332 | chkAccnt = file->account(chkAccntId).name(); | ||
326 | } else if (acc.accountType() == MyMoneyAccount::Income) { | 333 | } else if (acc.accountType() == eMyMoney::Account::Income) { | ||
327 | // | 334 | // | ||
328 | // MyMoneyAccount::Income. | 335 | // eMyMoney::Account::Income. | ||
329 | // | 336 | // | ||
330 | } else if (acc.accountType() == MyMoneyAccount::Expense) { | 337 | } else if (acc.accountType() == eMyMoney::Account::Expense) { | ||
331 | // | 338 | // | ||
332 | // MyMoneyAccount::Expense. | 339 | // eMyMoney::Account::Expense. | ||
333 | // | 340 | // | ||
334 | } else if (acc.accountType() == MyMoneyAccount::Stock) { | 341 | } else if (acc.accountType() == eMyMoney::Account::Stock) { | ||
335 | // | 342 | // | ||
336 | // MyMoneyAccount::Stock. | 343 | // eMyMoney::Account::Stock. | ||
337 | // | 344 | // | ||
338 | qty = (*it).shares(); | 345 | qty = (*it).shares(); | ||
339 | value = (*it).value(); | 346 | value = (*it).value(); | ||
Context not available. | |||||
352 | action = "IntIncX"; | 359 | action = "IntIncX"; | ||
353 | } | 360 | } | ||
354 | if ((action == "DivX") || (action == "IntIncX")) { | 361 | if ((action == "DivX") || (action == "IntIncX")) { | ||
355 | if (map.value(MyMoneyAccount::Checkings).isEmpty()) { | 362 | if (map.value(eMyMoney::Account::Checkings).isEmpty()) { | ||
356 | KMessageBox::sorry(0, | 363 | KMessageBox::sorry(0, | ||
357 | QString("<qt>%1</qt>").arg(i18n("Transaction number <b>%1</b> is missing an account assignment.\nTransaction dropped.", count)), | 364 | QString("<qt>%1</qt>").arg(i18n("Transaction number <b>%1</b> is missing an account assignment.\nTransaction dropped.", count)), | ||
358 | i18n("Invalid transaction")); | 365 | i18n("Invalid transaction")); | ||
359 | noError = false; | 366 | noError = false; | ||
360 | return; | 367 | return; | ||
361 | } | 368 | } | ||
362 | MyMoneySplit sp = t.splitByAccount(map.value(MyMoneyAccount::Checkings), true); | 369 | MyMoneySplit sp = t.splitByAccount(map.value(eMyMoney::Account::Checkings), true); | ||
363 | QString txt = sp.value().formatMoney("", 2); | 370 | QString txt = sp.value().formatMoney("", 2); | ||
364 | if (noError) { | 371 | if (noError) { | ||
365 | s += 'T' + txt + '\n'; | 372 | s += 'T' + txt + '\n'; | ||
Context not available. |