Changeset View
Changeset View
Standalone View
Standalone View
kmymoney/reports/querytable.cpp
Show First 20 Lines • Show All 253 Lines • ▼ Show 20 Line(s) | 252 | { | |||
---|---|---|---|---|---|
254 | // directly in ctors somehow does not work for me (ipwizard)) | 254 | // directly in ctors somehow does not work for me (ipwizard)) | ||
255 | // TODO: remove the init() method and move the code back to the ctor | 255 | // TODO: remove the init() method and move the code back to the ctor | ||
256 | init(); | 256 | init(); | ||
257 | } | 257 | } | ||
258 | 258 | | |||
259 | void QueryTable::init() | 259 | void QueryTable::init() | ||
260 | { | 260 | { | ||
261 | switch (m_config.rowType()) { | 261 | switch (m_config.rowType()) { | ||
262 | case MyMoneyReport::eAccountByTopAccount: | 262 | case MyMoneyReport::Row::AccountByTopAccount: | ||
263 | case MyMoneyReport::eEquityType: | 263 | case MyMoneyReport::Row::EquityType: | ||
264 | case MyMoneyReport::eAccountType: | 264 | case MyMoneyReport::Row::AccountType: | ||
265 | case MyMoneyReport::eInstitution: | 265 | case MyMoneyReport::Row::Institution: | ||
266 | constructAccountTable(); | 266 | constructAccountTable(); | ||
267 | m_columns = "account"; | 267 | m_columns = "account"; | ||
268 | break; | 268 | break; | ||
269 | 269 | | |||
270 | case MyMoneyReport::eAccount: | 270 | case MyMoneyReport::Row::Account: | ||
271 | constructTransactionTable(); | 271 | constructTransactionTable(); | ||
272 | m_columns = "accountid,postdate"; | 272 | m_columns = "accountid,postdate"; | ||
273 | break; | 273 | break; | ||
274 | 274 | | |||
275 | case MyMoneyReport::ePayee: | 275 | case MyMoneyReport::Row::Payee: | ||
276 | case MyMoneyReport::eTag: | 276 | case MyMoneyReport::Row::Tag: | ||
277 | case MyMoneyReport::eMonth: | 277 | case MyMoneyReport::Row::Month: | ||
278 | case MyMoneyReport::eWeek: | 278 | case MyMoneyReport::Row::Week: | ||
279 | constructTransactionTable(); | 279 | constructTransactionTable(); | ||
280 | m_columns = "postdate,account"; | 280 | m_columns = "postdate,account"; | ||
281 | break; | 281 | break; | ||
282 | case MyMoneyReport::eCashFlow: | 282 | case MyMoneyReport::Row::CashFlow: | ||
283 | constructSplitsTable(); | 283 | constructSplitsTable(); | ||
284 | m_columns = "postdate"; | 284 | m_columns = "postdate"; | ||
285 | break; | 285 | break; | ||
286 | default: | 286 | default: | ||
287 | constructTransactionTable(); | 287 | constructTransactionTable(); | ||
288 | m_columns = "postdate"; | 288 | m_columns = "postdate"; | ||
289 | } | 289 | } | ||
290 | 290 | | |||
291 | // Sort the data to match the report definition | 291 | // Sort the data to match the report definition | ||
292 | m_subtotal = "value"; | 292 | m_subtotal = "value"; | ||
293 | 293 | | |||
294 | switch (m_config.rowType()) { | 294 | switch (m_config.rowType()) { | ||
295 | case MyMoneyReport::eCashFlow: | 295 | case MyMoneyReport::Row::CashFlow: | ||
296 | m_group = "categorytype,topcategory,category"; | 296 | m_group = "categorytype,topcategory,category"; | ||
297 | break; | 297 | break; | ||
298 | case MyMoneyReport::eCategory: | 298 | case MyMoneyReport::Row::Category: | ||
299 | m_group = "categorytype,topcategory,category"; | 299 | m_group = "categorytype,topcategory,category"; | ||
300 | break; | 300 | break; | ||
301 | case MyMoneyReport::eTopCategory: | 301 | case MyMoneyReport::Row::TopCategory: | ||
302 | m_group = "categorytype,topcategory"; | 302 | m_group = "categorytype,topcategory"; | ||
303 | break; | 303 | break; | ||
304 | case MyMoneyReport::eTopAccount: | 304 | case MyMoneyReport::Row::TopAccount: | ||
305 | m_group = "topaccount,account"; | 305 | m_group = "topaccount,account"; | ||
306 | break; | 306 | break; | ||
307 | case MyMoneyReport::eAccount: | 307 | case MyMoneyReport::Row::Account: | ||
308 | m_group = "account"; | 308 | m_group = "account"; | ||
309 | break; | 309 | break; | ||
310 | case MyMoneyReport::eAccountReconcile: | 310 | case MyMoneyReport::Row::AccountReconcile: | ||
311 | m_group = "account,reconcileflag"; | 311 | m_group = "account,reconcileflag"; | ||
312 | break; | 312 | break; | ||
313 | case MyMoneyReport::ePayee: | 313 | case MyMoneyReport::Row::Payee: | ||
314 | m_group = "payee"; | 314 | m_group = "payee"; | ||
315 | break; | 315 | break; | ||
316 | case MyMoneyReport::eTag: | 316 | case MyMoneyReport::Row::Tag: | ||
317 | m_group = "tag"; | 317 | m_group = "tag"; | ||
318 | break; | 318 | break; | ||
319 | case MyMoneyReport::eMonth: | 319 | case MyMoneyReport::Row::Month: | ||
320 | m_group = "month"; | 320 | m_group = "month"; | ||
321 | break; | 321 | break; | ||
322 | case MyMoneyReport::eWeek: | 322 | case MyMoneyReport::Row::Week: | ||
323 | m_group = "week"; | 323 | m_group = "week"; | ||
324 | break; | 324 | break; | ||
325 | case MyMoneyReport::eAccountByTopAccount: | 325 | case MyMoneyReport::Row::AccountByTopAccount: | ||
326 | m_group = "topaccount"; | 326 | m_group = "topaccount"; | ||
327 | break; | 327 | break; | ||
328 | case MyMoneyReport::eEquityType: | 328 | case MyMoneyReport::Row::EquityType: | ||
329 | m_group = "equitytype"; | 329 | m_group = "equitytype"; | ||
330 | break; | 330 | break; | ||
331 | case MyMoneyReport::eAccountType: | 331 | case MyMoneyReport::Row::AccountType: | ||
332 | m_group = "type"; | 332 | m_group = "type"; | ||
333 | break; | 333 | break; | ||
334 | case MyMoneyReport::eInstitution: | 334 | case MyMoneyReport::Row::Institution: | ||
335 | m_group = "institution,topaccount"; | 335 | m_group = "institution,topaccount"; | ||
336 | break; | 336 | break; | ||
337 | default: | 337 | default: | ||
338 | throw MYMONEYEXCEPTION("QueryTable::QueryTable(): unhandled row type"); | 338 | throw MYMONEYEXCEPTION("QueryTable::QueryTable(): unhandled row type"); | ||
339 | } | 339 | } | ||
340 | 340 | | |||
341 | QString sort; | 341 | QString sort; | ||
342 | switch (m_config.rowType()) { | 342 | switch (m_config.rowType()) { | ||
343 | case MyMoneyReport::eMonth: | 343 | case MyMoneyReport::Row::Month: | ||
344 | case MyMoneyReport::eWeek: | 344 | case MyMoneyReport::Row::Week: | ||
345 | sort = m_group + "sort," + m_columns + ",id,rank"; | 345 | sort = m_group + "sort," + m_columns + ",id,rank"; | ||
346 | break; | 346 | break; | ||
347 | 347 | | |||
348 | default: | 348 | default: | ||
349 | sort = m_group + ',' + m_columns + ",id,rank"; | 349 | sort = m_group + ',' + m_columns + ",id,rank"; | ||
350 | break; | 350 | break; | ||
351 | } | 351 | } | ||
352 | 352 | | |||
353 | switch (m_config.rowType()) { | 353 | switch (m_config.rowType()) { | ||
354 | case MyMoneyReport::eAccountByTopAccount: | 354 | case MyMoneyReport::Row::AccountByTopAccount: | ||
355 | case MyMoneyReport::eEquityType: | 355 | case MyMoneyReport::Row::EquityType: | ||
356 | case MyMoneyReport::eAccountType: | 356 | case MyMoneyReport::Row::AccountType: | ||
357 | case MyMoneyReport::eInstitution: | 357 | case MyMoneyReport::Row::Institution: | ||
358 | m_columns = "account"; | 358 | m_columns = "account"; | ||
359 | break; | 359 | break; | ||
360 | 360 | | |||
361 | default: | 361 | default: | ||
362 | m_columns = "postdate"; | 362 | m_columns = "postdate"; | ||
363 | } | 363 | } | ||
364 | 364 | | |||
365 | unsigned qc = m_config.queryColumns(); | 365 | unsigned qc = m_config.queryColumns(); | ||
▲ Show 20 Lines • Show All 44 Lines • ▼ Show 20 Line(s) | 402 | { | |||
410 | report.setConsiderCategory(true); | 410 | report.setConsiderCategory(true); | ||
411 | 411 | | |||
412 | bool use_transfers; | 412 | bool use_transfers; | ||
413 | bool use_summary; | 413 | bool use_summary; | ||
414 | bool hide_details; | 414 | bool hide_details; | ||
415 | bool tag_special_case = false; | 415 | bool tag_special_case = false; | ||
416 | 416 | | |||
417 | switch (m_config.rowType()) { | 417 | switch (m_config.rowType()) { | ||
418 | case MyMoneyReport::eCategory: | 418 | case MyMoneyReport::Row::Category: | ||
419 | case MyMoneyReport::eTopCategory: | 419 | case MyMoneyReport::Row::TopCategory: | ||
420 | use_summary = false; | 420 | use_summary = false; | ||
421 | use_transfers = false; | 421 | use_transfers = false; | ||
422 | hide_details = false; | 422 | hide_details = false; | ||
423 | break; | 423 | break; | ||
424 | case MyMoneyReport::ePayee: | 424 | case MyMoneyReport::Row::Payee: | ||
425 | use_summary = false; | 425 | use_summary = false; | ||
426 | use_transfers = false; | 426 | use_transfers = false; | ||
427 | hide_details = (m_config.detailLevel() == MyMoneyReport::eDetailNone); | 427 | hide_details = (m_config.detailLevel() == MyMoneyReport::eDetailNone); | ||
428 | break; | 428 | break; | ||
429 | case MyMoneyReport::eTag: | 429 | case MyMoneyReport::Row::Tag: | ||
430 | use_summary = false; | 430 | use_summary = false; | ||
431 | use_transfers = false; | 431 | use_transfers = false; | ||
432 | hide_details = (m_config.detailLevel() == MyMoneyReport::eDetailNone); | 432 | hide_details = (m_config.detailLevel() == MyMoneyReport::eDetailNone); | ||
433 | tag_special_case = true; | 433 | tag_special_case = true; | ||
434 | break; | 434 | break; | ||
435 | default: | 435 | default: | ||
436 | use_summary = true; | 436 | use_summary = true; | ||
437 | use_transfers = true; | 437 | use_transfers = true; | ||
▲ Show 20 Lines • Show All 400 Lines • ▼ Show 20 Line(s) | 447 | for (QList<MyMoneyTransaction>::const_iterator it_transaction = transactions.constBegin(); it_transaction != transactions.constEnd(); ++it_transaction) { | |||
838 | if (loan_special_case) { | 838 | if (loan_special_case) { | ||
839 | m_rows += qA; | 839 | m_rows += qA; | ||
840 | } | 840 | } | ||
841 | } | 841 | } | ||
842 | 842 | | |||
843 | // now run through our accts list and add opening and closing balances | 843 | // now run through our accts list and add opening and closing balances | ||
844 | 844 | | |||
845 | switch (m_config.rowType()) { | 845 | switch (m_config.rowType()) { | ||
846 | case MyMoneyReport::eAccount: | 846 | case MyMoneyReport::Row::Account: | ||
847 | case MyMoneyReport::eTopAccount: | 847 | case MyMoneyReport::Row::TopAccount: | ||
848 | break; | 848 | break; | ||
849 | 849 | | |||
850 | // case MyMoneyReport::eCategory: | 850 | // case MyMoneyReport::eCategory: | ||
851 | // case MyMoneyReport::eTopCategory: | 851 | // case MyMoneyReport::eTopCategory: | ||
852 | // case MyMoneyReport::ePayee: | 852 | // case MyMoneyReport::ePayee: | ||
853 | // case MyMoneyReport::eMonth: | 853 | // case MyMoneyReport::eMonth: | ||
854 | // case MyMoneyReport::eWeek: | 854 | // case MyMoneyReport::eWeek: | ||
855 | default: | 855 | default: | ||
▲ Show 20 Lines • Show All 613 Lines • ▼ Show 20 Line(s) | 1237 | for (QList<MyMoneyTransaction>::const_iterator it_transaction = transactions.constBegin(); it_transaction != transactions.constEnd(); ++it_transaction) { | |||
1469 | if (loan_special_case) { | 1469 | if (loan_special_case) { | ||
1470 | m_rows += qA; | 1470 | m_rows += qA; | ||
1471 | } | 1471 | } | ||
1472 | } | 1472 | } | ||
1473 | 1473 | | |||
1474 | // now run through our accts list and add opening and closing balances | 1474 | // now run through our accts list and add opening and closing balances | ||
1475 | 1475 | | |||
1476 | switch (m_config.rowType()) { | 1476 | switch (m_config.rowType()) { | ||
1477 | case MyMoneyReport::eAccount: | 1477 | case MyMoneyReport::Row::Account: | ||
1478 | case MyMoneyReport::eTopAccount: | 1478 | case MyMoneyReport::Row::TopAccount: | ||
1479 | break; | 1479 | break; | ||
1480 | 1480 | | |||
1481 | // case MyMoneyReport::eCategory: | 1481 | // case MyMoneyReport::eCategory: | ||
1482 | // case MyMoneyReport::eTopCategory: | 1482 | // case MyMoneyReport::eTopCategory: | ||
1483 | // case MyMoneyReport::ePayee: | 1483 | // case MyMoneyReport::ePayee: | ||
1484 | // case MyMoneyReport::eMonth: | 1484 | // case MyMoneyReport::eMonth: | ||
1485 | // case MyMoneyReport::eWeek: | 1485 | // case MyMoneyReport::eWeek: | ||
1486 | default: | 1486 | default: | ||
▲ Show 20 Lines • Show All 85 Lines • Show Last 20 Lines |