Changeset View
Changeset View
Standalone View
Standalone View
kmymoney/reports/querytabletest.cpp
Show First 20 Lines • Show All 101 Lines • ▼ Show 20 Line(s) | 91 | try { | |||
---|---|---|---|---|---|
102 | TransactionHelper t1y2(QDate(2005, 1, 1), MyMoneySplit::ActionWithdrawal, moSolo, acChecking, acSolo); | 102 | TransactionHelper t1y2(QDate(2005, 1, 1), MyMoneySplit::ActionWithdrawal, moSolo, acChecking, acSolo); | ||
103 | TransactionHelper t2y2(QDate(2005, 5, 1), MyMoneySplit::ActionWithdrawal, moParent1, acCredit, acParent); | 103 | TransactionHelper t2y2(QDate(2005, 5, 1), MyMoneySplit::ActionWithdrawal, moParent1, acCredit, acParent); | ||
104 | TransactionHelper t3y2(QDate(2005, 9, 1), MyMoneySplit::ActionWithdrawal, moParent2, acCredit, acParent); | 104 | TransactionHelper t3y2(QDate(2005, 9, 1), MyMoneySplit::ActionWithdrawal, moParent2, acCredit, acParent); | ||
105 | TransactionHelper t4y2(QDate(2004, 11, 7), MyMoneySplit::ActionWithdrawal, moChild, acCredit, acChild); | 105 | TransactionHelper t4y2(QDate(2004, 11, 7), MyMoneySplit::ActionWithdrawal, moChild, acCredit, acChild); | ||
106 | 106 | | |||
107 | unsigned cols; | 107 | unsigned cols; | ||
108 | 108 | | |||
109 | MyMoneyReport filter; | 109 | MyMoneyReport filter; | ||
110 | filter.setRowType(MyMoneyReport::eCategory); | 110 | filter.setRowType(MyMoneyReport::Row::Category); | ||
111 | cols = MyMoneyReport::QueryColumns::Number | MyMoneyReport::QueryColumns::Payee | MyMoneyReport::QueryColumns::Account; | 111 | cols = MyMoneyReport::QueryColumns::Number | MyMoneyReport::QueryColumns::Payee | MyMoneyReport::QueryColumns::Account; | ||
112 | filter.setQueryColumns(static_cast<MyMoneyReport::QueryColumns::Type>(cols)); // | 112 | filter.setQueryColumns(static_cast<MyMoneyReport::QueryColumns::Type>(cols)); // | ||
113 | filter.setName("Transactions by Category"); | 113 | filter.setName("Transactions by Category"); | ||
114 | XMLandback(filter); | 114 | XMLandback(filter); | ||
115 | QueryTable qtbl_1(filter); | 115 | QueryTable qtbl_1(filter); | ||
116 | 116 | | |||
117 | writeTabletoHTML(qtbl_1, "Transactions by Category.html"); | 117 | writeTabletoHTML(qtbl_1, "Transactions by Category.html"); | ||
118 | 118 | | |||
119 | QList<ListTable::TableRow> rows = qtbl_1.rows(); | 119 | QList<ListTable::TableRow> rows = qtbl_1.rows(); | ||
120 | 120 | | |||
121 | QVERIFY(rows.count() == 12); | 121 | QVERIFY(rows.count() == 12); | ||
122 | QVERIFY(rows[0]["categorytype"] == "Expense"); | 122 | QVERIFY(rows[0]["categorytype"] == "Expense"); | ||
123 | QVERIFY(rows[0]["category"] == "Parent"); | 123 | QVERIFY(rows[0]["category"] == "Parent"); | ||
124 | QVERIFY(rows[0]["postdate"] == "2004-02-01"); | 124 | QVERIFY(rows[0]["postdate"] == "2004-02-01"); | ||
125 | QVERIFY(rows[11]["categorytype"] == "Expense"); | 125 | QVERIFY(rows[11]["categorytype"] == "Expense"); | ||
126 | QVERIFY(rows[11]["category"] == "Solo"); | 126 | QVERIFY(rows[11]["category"] == "Solo"); | ||
127 | QVERIFY(rows[11]["postdate"] == "2005-01-01"); | 127 | QVERIFY(rows[11]["postdate"] == "2005-01-01"); | ||
128 | 128 | | |||
129 | QString html = qtbl_1.renderBody(); | 129 | QString html = qtbl_1.renderBody(); | ||
130 | QVERIFY(searchHTML(html, i18nc("Total balance", "Total") + " Parent") == -(moParent1 + moParent2) * 3); | 130 | QVERIFY(searchHTML(html, i18nc("Total balance", "Total") + " Parent") == -(moParent1 + moParent2) * 3); | ||
131 | QVERIFY(searchHTML(html, i18nc("Total balance", "Total") + " Parent: Child") == -(moChild) * 3); | 131 | QVERIFY(searchHTML(html, i18nc("Total balance", "Total") + " Parent: Child") == -(moChild) * 3); | ||
132 | QVERIFY(searchHTML(html, i18nc("Total balance", "Total") + " Solo") == -(moSolo) * 3); | 132 | QVERIFY(searchHTML(html, i18nc("Total balance", "Total") + " Solo") == -(moSolo) * 3); | ||
133 | QVERIFY(searchHTML(html, i18nc("Total balance", "Total") + " Expense") == -(moParent1 + moParent2 + moSolo + moChild) * 3); | 133 | QVERIFY(searchHTML(html, i18nc("Total balance", "Total") + " Expense") == -(moParent1 + moParent2 + moSolo + moChild) * 3); | ||
134 | QVERIFY(searchHTML(html, i18nc("Grand total balance", "Grand Total")) == -(moParent1 + moParent2 + moSolo + moChild) * 3 + moCheckingOpen + moCreditOpen); | 134 | QVERIFY(searchHTML(html, i18nc("Grand total balance", "Grand Total")) == -(moParent1 + moParent2 + moSolo + moChild) * 3 + moCheckingOpen + moCreditOpen); | ||
135 | filter.setRowType(MyMoneyReport::eTopCategory); | 135 | filter.setRowType(MyMoneyReport::Row::TopCategory); | ||
136 | cols = MyMoneyReport::QueryColumns::Number | MyMoneyReport::QueryColumns::Payee | MyMoneyReport::QueryColumns::Account; | 136 | cols = MyMoneyReport::QueryColumns::Number | MyMoneyReport::QueryColumns::Payee | MyMoneyReport::QueryColumns::Account; | ||
137 | filter.setQueryColumns(static_cast<MyMoneyReport::QueryColumns::Type>(cols)); // | 137 | filter.setQueryColumns(static_cast<MyMoneyReport::QueryColumns::Type>(cols)); // | ||
138 | filter.setName("Transactions by Top Category"); | 138 | filter.setName("Transactions by Top Category"); | ||
139 | XMLandback(filter); | 139 | XMLandback(filter); | ||
140 | QueryTable qtbl_2(filter); | 140 | QueryTable qtbl_2(filter); | ||
141 | 141 | | |||
142 | writeTabletoHTML(qtbl_2, "Transactions by Top Category.html"); | 142 | writeTabletoHTML(qtbl_2, "Transactions by Top Category.html"); | ||
143 | 143 | | |||
Show All 11 Lines | |||||
155 | QVERIFY(rows[11]["postdate"] == "2005-01-01"); | 155 | QVERIFY(rows[11]["postdate"] == "2005-01-01"); | ||
156 | 156 | | |||
157 | html = qtbl_2.renderBody(); | 157 | html = qtbl_2.renderBody(); | ||
158 | QVERIFY(searchHTML(html, i18nc("Total balance", "Total") + " Parent") == -(moParent1 + moParent2 + moChild) * 3); | 158 | QVERIFY(searchHTML(html, i18nc("Total balance", "Total") + " Parent") == -(moParent1 + moParent2 + moChild) * 3); | ||
159 | QVERIFY(searchHTML(html, i18nc("Total balance", "Total") + " Solo") == -(moSolo) * 3); | 159 | QVERIFY(searchHTML(html, i18nc("Total balance", "Total") + " Solo") == -(moSolo) * 3); | ||
160 | QVERIFY(searchHTML(html, i18nc("Total balance", "Total") + " Expense") == -(moParent1 + moParent2 + moSolo + moChild) * 3); | 160 | QVERIFY(searchHTML(html, i18nc("Total balance", "Total") + " Expense") == -(moParent1 + moParent2 + moSolo + moChild) * 3); | ||
161 | QVERIFY(searchHTML(html, i18nc("Grand total balance", "Grand Total")) == -(moParent1 + moParent2 + moSolo + moChild) * 3 + moCheckingOpen + moCreditOpen); | 161 | QVERIFY(searchHTML(html, i18nc("Grand total balance", "Grand Total")) == -(moParent1 + moParent2 + moSolo + moChild) * 3 + moCheckingOpen + moCreditOpen); | ||
162 | 162 | | |||
163 | filter.setRowType(MyMoneyReport::eAccount); | 163 | filter.setRowType(MyMoneyReport::Row::Account); | ||
164 | filter.setName("Transactions by Account"); | 164 | filter.setName("Transactions by Account"); | ||
165 | cols = MyMoneyReport::QueryColumns::Number | MyMoneyReport::QueryColumns::Payee | MyMoneyReport::QueryColumns::Category; | 165 | cols = MyMoneyReport::QueryColumns::Number | MyMoneyReport::QueryColumns::Payee | MyMoneyReport::QueryColumns::Category; | ||
166 | filter.setQueryColumns(static_cast<MyMoneyReport::QueryColumns::Type>(cols)); // | 166 | filter.setQueryColumns(static_cast<MyMoneyReport::QueryColumns::Type>(cols)); // | ||
167 | XMLandback(filter); | 167 | XMLandback(filter); | ||
168 | QueryTable qtbl_3(filter); | 168 | QueryTable qtbl_3(filter); | ||
169 | 169 | | |||
170 | writeTabletoHTML(qtbl_3, "Transactions by Account.html"); | 170 | writeTabletoHTML(qtbl_3, "Transactions by Account.html"); | ||
171 | 171 | | |||
Show All 17 Lines | 182 | #else | |||
189 | QVERIFY(rows[11]["postdate"] == "2005-09-01"); | 189 | QVERIFY(rows[11]["postdate"] == "2005-09-01"); | ||
190 | #endif | 190 | #endif | ||
191 | 191 | | |||
192 | html = qtbl_3.renderBody(); | 192 | html = qtbl_3.renderBody(); | ||
193 | QVERIFY(searchHTML(html, i18nc("Total balance for checking account", "Total") + " Checking Account") == -(moSolo) * 3 + moCheckingOpen); | 193 | QVERIFY(searchHTML(html, i18nc("Total balance for checking account", "Total") + " Checking Account") == -(moSolo) * 3 + moCheckingOpen); | ||
194 | QVERIFY(searchHTML(html, i18nc("Total balance for credit card", "Total") + " Credit Card") == -(moParent1 + moParent2 + moChild) * 3 + moCreditOpen); | 194 | QVERIFY(searchHTML(html, i18nc("Total balance for credit card", "Total") + " Credit Card") == -(moParent1 + moParent2 + moChild) * 3 + moCreditOpen); | ||
195 | QVERIFY(searchHTML(html, i18nc("Grand total balance", "Grand Total")) == -(moParent1 + moParent2 + moSolo + moChild) * 3 + moCheckingOpen + moCreditOpen); | 195 | QVERIFY(searchHTML(html, i18nc("Grand total balance", "Grand Total")) == -(moParent1 + moParent2 + moSolo + moChild) * 3 + moCheckingOpen + moCreditOpen); | ||
196 | 196 | | |||
197 | filter.setRowType(MyMoneyReport::ePayee); | 197 | filter.setRowType(MyMoneyReport::Row::Payee); | ||
198 | filter.setName("Transactions by Payee"); | 198 | filter.setName("Transactions by Payee"); | ||
199 | cols = MyMoneyReport::QueryColumns::Number | MyMoneyReport::QueryColumns::Memo | MyMoneyReport::QueryColumns::Category; | 199 | cols = MyMoneyReport::QueryColumns::Number | MyMoneyReport::QueryColumns::Memo | MyMoneyReport::QueryColumns::Category; | ||
200 | filter.setQueryColumns(static_cast<MyMoneyReport::QueryColumns::Type>(cols)); // | 200 | filter.setQueryColumns(static_cast<MyMoneyReport::QueryColumns::Type>(cols)); // | ||
201 | XMLandback(filter); | 201 | XMLandback(filter); | ||
202 | QueryTable qtbl_4(filter); | 202 | QueryTable qtbl_4(filter); | ||
203 | 203 | | |||
204 | writeTabletoHTML(qtbl_4, "Transactions by Payee.html"); | 204 | writeTabletoHTML(qtbl_4, "Transactions by Payee.html"); | ||
205 | 205 | | |||
Show All 9 Lines | |||||
215 | QVERIFY(rows[11]["payee"] == "Test Payee"); | 215 | QVERIFY(rows[11]["payee"] == "Test Payee"); | ||
216 | QVERIFY(rows[11]["category"] == "Parent"); | 216 | QVERIFY(rows[11]["category"] == "Parent"); | ||
217 | QVERIFY(rows[11]["postdate"] == "2005-09-01"); | 217 | QVERIFY(rows[11]["postdate"] == "2005-09-01"); | ||
218 | 218 | | |||
219 | html = qtbl_4.renderBody(); | 219 | html = qtbl_4.renderBody(); | ||
220 | QVERIFY(searchHTML(html, i18nc("Total balance", "Total") + " Test Payee") == -(moParent1 + moParent2 + moSolo + moChild) * 3); | 220 | QVERIFY(searchHTML(html, i18nc("Total balance", "Total") + " Test Payee") == -(moParent1 + moParent2 + moSolo + moChild) * 3); | ||
221 | QVERIFY(searchHTML(html, i18nc("Grand total balance", "Grand Total")) == -(moParent1 + moParent2 + moSolo + moChild) * 3 + moCheckingOpen + moCreditOpen); | 221 | QVERIFY(searchHTML(html, i18nc("Grand total balance", "Grand Total")) == -(moParent1 + moParent2 + moSolo + moChild) * 3 + moCheckingOpen + moCreditOpen); | ||
222 | 222 | | |||
223 | filter.setRowType(MyMoneyReport::eMonth); | 223 | filter.setRowType(MyMoneyReport::Row::Month); | ||
224 | filter.setName("Transactions by Month"); | 224 | filter.setName("Transactions by Month"); | ||
225 | cols = MyMoneyReport::QueryColumns::Number | MyMoneyReport::QueryColumns::Payee | MyMoneyReport::QueryColumns::Category; | 225 | cols = MyMoneyReport::QueryColumns::Number | MyMoneyReport::QueryColumns::Payee | MyMoneyReport::QueryColumns::Category; | ||
226 | filter.setQueryColumns(static_cast<MyMoneyReport::QueryColumns::Type>(cols)); // | 226 | filter.setQueryColumns(static_cast<MyMoneyReport::QueryColumns::Type>(cols)); // | ||
227 | XMLandback(filter); | 227 | XMLandback(filter); | ||
228 | QueryTable qtbl_5(filter); | 228 | QueryTable qtbl_5(filter); | ||
229 | 229 | | |||
230 | writeTabletoHTML(qtbl_5, "Transactions by Month.html"); | 230 | writeTabletoHTML(qtbl_5, "Transactions by Month.html"); | ||
231 | 231 | | |||
Show All 11 Lines | |||||
243 | QVERIFY(rows[11]["postdate"] == "2005-09-01"); | 243 | QVERIFY(rows[11]["postdate"] == "2005-09-01"); | ||
244 | 244 | | |||
245 | html = qtbl_5.renderBody(); | 245 | html = qtbl_5.renderBody(); | ||
246 | QVERIFY(searchHTML(html, i18nc("Total balance", "Total") + " Month of 2004-01-01") == -moSolo); | 246 | QVERIFY(searchHTML(html, i18nc("Total balance", "Total") + " Month of 2004-01-01") == -moSolo); | ||
247 | QVERIFY(searchHTML(html, i18nc("Total balance", "Total") + " Month of 2004-11-01") == -(moChild) * 3); | 247 | QVERIFY(searchHTML(html, i18nc("Total balance", "Total") + " Month of 2004-11-01") == -(moChild) * 3); | ||
248 | QVERIFY(searchHTML(html, i18nc("Total balance", "Total") + " Month of 2004-05-01") == -moParent1 + moCheckingOpen); | 248 | QVERIFY(searchHTML(html, i18nc("Total balance", "Total") + " Month of 2004-05-01") == -moParent1 + moCheckingOpen); | ||
249 | QVERIFY(searchHTML(html, i18nc("Grand total balance", "Grand Total")) == -(moParent1 + moParent2 + moSolo + moChild) * 3 + moCheckingOpen + moCreditOpen); | 249 | QVERIFY(searchHTML(html, i18nc("Grand total balance", "Grand Total")) == -(moParent1 + moParent2 + moSolo + moChild) * 3 + moCheckingOpen + moCreditOpen); | ||
250 | 250 | | |||
251 | filter.setRowType(MyMoneyReport::eWeek); | 251 | filter.setRowType(MyMoneyReport::Row::Week); | ||
252 | filter.setName("Transactions by Week"); | 252 | filter.setName("Transactions by Week"); | ||
253 | cols = MyMoneyReport::QueryColumns::Number | MyMoneyReport::QueryColumns::Payee | MyMoneyReport::QueryColumns::Category; | 253 | cols = MyMoneyReport::QueryColumns::Number | MyMoneyReport::QueryColumns::Payee | MyMoneyReport::QueryColumns::Category; | ||
254 | filter.setQueryColumns(static_cast<MyMoneyReport::QueryColumns::Type>(cols)); // | 254 | filter.setQueryColumns(static_cast<MyMoneyReport::QueryColumns::Type>(cols)); // | ||
255 | XMLandback(filter); | 255 | XMLandback(filter); | ||
256 | QueryTable qtbl_6(filter); | 256 | QueryTable qtbl_6(filter); | ||
257 | 257 | | |||
258 | writeTabletoHTML(qtbl_6, "Transactions by Week.html"); | 258 | writeTabletoHTML(qtbl_6, "Transactions by Week.html"); | ||
259 | 259 | | |||
▲ Show 20 Lines • Show All 72 Lines • ▼ Show 20 Line(s) | 331 | { | |||
332 | try { | 332 | try { | ||
333 | QString htmlcontext = QString("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\">\n<html><head><link rel=\"stylesheet\" type=\"text/css\" href=\"html/kmymoney.css\"></head><body>\n%1\n</body></html>\n"); | 333 | QString htmlcontext = QString("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\">\n<html><head><link rel=\"stylesheet\" type=\"text/css\" href=\"html/kmymoney.css\"></head><body>\n%1\n</body></html>\n"); | ||
334 | 334 | | |||
335 | // | 335 | // | ||
336 | // No transactions, opening balances only | 336 | // No transactions, opening balances only | ||
337 | // | 337 | // | ||
338 | 338 | | |||
339 | MyMoneyReport filter; | 339 | MyMoneyReport filter; | ||
340 | filter.setRowType(MyMoneyReport::eInstitution); | 340 | filter.setRowType(MyMoneyReport::Row::Institution); | ||
341 | filter.setName("Accounts by Institution (No transactions)"); | 341 | filter.setName("Accounts by Institution (No transactions)"); | ||
342 | XMLandback(filter); | 342 | XMLandback(filter); | ||
343 | QueryTable qtbl_1(filter); | 343 | QueryTable qtbl_1(filter); | ||
344 | 344 | | |||
345 | writeTabletoHTML(qtbl_1, "Accounts by Institution (No transactions).html"); | 345 | writeTabletoHTML(qtbl_1, "Accounts by Institution (No transactions).html"); | ||
346 | 346 | | |||
347 | QList<ListTable::TableRow> rows = qtbl_1.rows(); | 347 | QList<ListTable::TableRow> rows = qtbl_1.rows(); | ||
348 | 348 | | |||
Show All 23 Lines | |||||
372 | TransactionHelper t3q2(QDate(2004, 6, 1), MyMoneySplit::ActionWithdrawal, moParent2, acCredit, acParent); | 372 | TransactionHelper t3q2(QDate(2004, 6, 1), MyMoneySplit::ActionWithdrawal, moParent2, acCredit, acParent); | ||
373 | TransactionHelper t4q2(QDate(2004, 11, 7), MyMoneySplit::ActionWithdrawal, moChild, acCredit, acChild); | 373 | TransactionHelper t4q2(QDate(2004, 11, 7), MyMoneySplit::ActionWithdrawal, moChild, acCredit, acChild); | ||
374 | 374 | | |||
375 | TransactionHelper t1y2(QDate(2005, 1, 1), MyMoneySplit::ActionWithdrawal, moSolo, acChecking, acSolo); | 375 | TransactionHelper t1y2(QDate(2005, 1, 1), MyMoneySplit::ActionWithdrawal, moSolo, acChecking, acSolo); | ||
376 | TransactionHelper t2y2(QDate(2005, 5, 1), MyMoneySplit::ActionWithdrawal, moParent1, acCredit, acParent); | 376 | TransactionHelper t2y2(QDate(2005, 5, 1), MyMoneySplit::ActionWithdrawal, moParent1, acCredit, acParent); | ||
377 | TransactionHelper t3y2(QDate(2005, 9, 1), MyMoneySplit::ActionWithdrawal, moParent2, acCredit, acParent); | 377 | TransactionHelper t3y2(QDate(2005, 9, 1), MyMoneySplit::ActionWithdrawal, moParent2, acCredit, acParent); | ||
378 | TransactionHelper t4y2(QDate(2004, 11, 7), MyMoneySplit::ActionWithdrawal, moChild, acCredit, acChild); | 378 | TransactionHelper t4y2(QDate(2004, 11, 7), MyMoneySplit::ActionWithdrawal, moChild, acCredit, acChild); | ||
379 | 379 | | |||
380 | filter.setRowType(MyMoneyReport::eInstitution); | 380 | filter.setRowType(MyMoneyReport::Row::Institution); | ||
381 | filter.setName("Accounts by Institution (With Transactions)"); | 381 | filter.setName("Accounts by Institution (With Transactions)"); | ||
382 | XMLandback(filter); | 382 | XMLandback(filter); | ||
383 | QueryTable qtbl_2(filter); | 383 | QueryTable qtbl_2(filter); | ||
384 | 384 | | |||
385 | rows = qtbl_2.rows(); | 385 | rows = qtbl_2.rows(); | ||
386 | 386 | | |||
387 | QVERIFY(rows.count() == 2); | 387 | QVERIFY(rows.count() == 2); | ||
388 | QVERIFY(rows[0]["account"] == "Checking Account"); | 388 | QVERIFY(rows[0]["account"] == "Checking Account"); | ||
389 | QVERIFY(MyMoneyMoney(rows[0]["value"]) == (moCheckingOpen - moSolo*3)); | 389 | QVERIFY(MyMoneyMoney(rows[0]["value"]) == (moCheckingOpen - moSolo*3)); | ||
390 | QVERIFY(rows[1]["account"] == "Credit Card"); | 390 | QVERIFY(rows[1]["account"] == "Credit Card"); | ||
391 | QVERIFY(MyMoneyMoney(rows[1]["value"]) == (moCreditOpen - (moParent1 + moParent2 + moChild) * 3)); | 391 | QVERIFY(MyMoneyMoney(rows[1]["value"]) == (moCreditOpen - (moParent1 + moParent2 + moChild) * 3)); | ||
392 | 392 | | |||
393 | html = qtbl_2.renderBody(); | 393 | html = qtbl_2.renderBody(); | ||
394 | QVERIFY(searchHTML(html, i18n("Grand Total")) == moCheckingOpen + moCreditOpen - (moParent1 + moParent2 + moSolo + moChild) * 3); | 394 | QVERIFY(searchHTML(html, i18n("Grand Total")) == moCheckingOpen + moCreditOpen - (moParent1 + moParent2 + moSolo + moChild) * 3); | ||
395 | 395 | | |||
396 | // | 396 | // | ||
397 | // Account TYPES | 397 | // Account TYPES | ||
398 | // | 398 | // | ||
399 | 399 | | |||
400 | filter.setRowType(MyMoneyReport::eAccountType); | 400 | filter.setRowType(MyMoneyReport::Row::AccountType); | ||
401 | filter.setName("Accounts by Type"); | 401 | filter.setName("Accounts by Type"); | ||
402 | XMLandback(filter); | 402 | XMLandback(filter); | ||
403 | QueryTable qtbl_3(filter); | 403 | QueryTable qtbl_3(filter); | ||
404 | 404 | | |||
405 | rows = qtbl_3.rows(); | 405 | rows = qtbl_3.rows(); | ||
406 | 406 | | |||
407 | QVERIFY(rows.count() == 2); | 407 | QVERIFY(rows.count() == 2); | ||
408 | QVERIFY(rows[0]["account"] == "Checking Account"); | 408 | QVERIFY(rows[0]["account"] == "Checking Account"); | ||
Show All 38 Lines | 424 | try { | |||
447 | 447 | | |||
448 | makeEquityPrice(eqStock1, QDate(2004, 10, 1), MyMoneyMoney(100.00)); | 448 | makeEquityPrice(eqStock1, QDate(2004, 10, 1), MyMoneyMoney(100.00)); | ||
449 | 449 | | |||
450 | // | 450 | // | ||
451 | // Investment Transactions Report | 451 | // Investment Transactions Report | ||
452 | // | 452 | // | ||
453 | 453 | | |||
454 | MyMoneyReport invtran_r( | 454 | MyMoneyReport invtran_r( | ||
455 | MyMoneyReport::eTopAccount, | 455 | MyMoneyReport::Row::TopAccount, | ||
456 | MyMoneyReport::QueryColumns::Action | MyMoneyReport::QueryColumns::Shares | MyMoneyReport::QueryColumns::Price, | 456 | MyMoneyReport::QueryColumns::Action | MyMoneyReport::QueryColumns::Shares | MyMoneyReport::QueryColumns::Price, | ||
457 | MyMoneyTransactionFilter::userDefined, | 457 | MyMoneyTransactionFilter::userDefined, | ||
458 | MyMoneyReport::eDetailAll, | 458 | MyMoneyReport::eDetailAll, | ||
459 | i18n("Investment Transactions"), | 459 | i18n("Investment Transactions"), | ||
460 | i18n("Test Report") | 460 | i18n("Test Report") | ||
461 | ); | 461 | ); | ||
462 | invtran_r.setDateFilter(QDate(2004, 1, 1), QDate(2004, 12, 31)); | 462 | invtran_r.setDateFilter(QDate(2004, 1, 1), QDate(2004, 12, 31)); | ||
463 | invtran_r.setInvestmentsOnly(true); | 463 | invtran_r.setInvestmentsOnly(true); | ||
▲ Show 20 Lines • Show All 75 Lines • ▼ Show 20 Line(s) | 537 | #else | |||
539 | QVERIFY(searchHTML(html, i18n("Grand Total")) == MyMoneyMoney(171700.00)); | 539 | QVERIFY(searchHTML(html, i18n("Grand Total")) == MyMoneyMoney(171700.00)); | ||
540 | #endif | 540 | #endif | ||
541 | 541 | | |||
542 | // | 542 | // | ||
543 | // Investment Performance Report | 543 | // Investment Performance Report | ||
544 | // | 544 | // | ||
545 | 545 | | |||
546 | MyMoneyReport invhold_r( | 546 | MyMoneyReport invhold_r( | ||
547 | MyMoneyReport::eAccountByTopAccount, | 547 | MyMoneyReport::Row::AccountByTopAccount, | ||
548 | MyMoneyReport::QueryColumns::Performance, | 548 | MyMoneyReport::QueryColumns::Performance, | ||
549 | MyMoneyTransactionFilter::userDefined, | 549 | MyMoneyTransactionFilter::userDefined, | ||
550 | MyMoneyReport::eDetailAll, | 550 | MyMoneyReport::eDetailAll, | ||
551 | i18n("Investment Performance by Account"), | 551 | i18n("Investment Performance by Account"), | ||
552 | i18n("Test Report") | 552 | i18n("Test Report") | ||
553 | ); | 553 | ); | ||
554 | invhold_r.setDateFilter(QDate(2004, 1, 1), QDate(2004, 10, 1)); | 554 | invhold_r.setDateFilter(QDate(2004, 1, 1), QDate(2004, 10, 1)); | ||
555 | invhold_r.setInvestmentsOnly(true); | 555 | invhold_r.setInvestmentsOnly(true); | ||
▲ Show 20 Lines • Show All 52 Lines • ▼ Show 20 Line(s) | 596 | try { | |||
608 | TransactionHelper t2y2(QDate(2005, 5, 1), MyMoneySplit::ActionWithdrawal, moParent1, acCredit, acParent); | 608 | TransactionHelper t2y2(QDate(2005, 5, 1), MyMoneySplit::ActionWithdrawal, moParent1, acCredit, acParent); | ||
609 | TransactionHelper t3y2(QDate(2005, 9, 1), MyMoneySplit::ActionWithdrawal, moParent2, acCredit, acParent); | 609 | TransactionHelper t3y2(QDate(2005, 9, 1), MyMoneySplit::ActionWithdrawal, moParent2, acCredit, acParent); | ||
610 | TransactionHelper t4y2(QDate(2004, 11, 7), MyMoneySplit::ActionWithdrawal, moChild, acCredit, acChild); | 610 | TransactionHelper t4y2(QDate(2004, 11, 7), MyMoneySplit::ActionWithdrawal, moChild, acCredit, acChild); | ||
611 | 611 | | |||
612 | unsigned cols; | 612 | unsigned cols; | ||
613 | 613 | | |||
614 | MyMoneyReport filter; | 614 | MyMoneyReport filter; | ||
615 | 615 | | |||
616 | filter.setRowType(MyMoneyReport::eAccount); | 616 | filter.setRowType(MyMoneyReport::Row::Account); | ||
617 | filter.setName("Transactions by Account"); | 617 | filter.setName("Transactions by Account"); | ||
618 | cols = MyMoneyReport::QueryColumns::Number | MyMoneyReport::QueryColumns::Payee | MyMoneyReport::QueryColumns::Category | MyMoneyReport::QueryColumns::Balance; | 618 | cols = MyMoneyReport::QueryColumns::Number | MyMoneyReport::QueryColumns::Payee | MyMoneyReport::QueryColumns::Category | MyMoneyReport::QueryColumns::Balance; | ||
619 | filter.setQueryColumns(static_cast<MyMoneyReport::QueryColumns::Type>(cols)); // | 619 | filter.setQueryColumns(static_cast<MyMoneyReport::QueryColumns::Type>(cols)); // | ||
620 | XMLandback(filter); | 620 | XMLandback(filter); | ||
621 | QueryTable qtbl_3(filter); | 621 | QueryTable qtbl_3(filter); | ||
622 | 622 | | |||
623 | writeTabletoHTML(qtbl_3, "Transactions by Account.html"); | 623 | writeTabletoHTML(qtbl_3, "Transactions by Account.html"); | ||
624 | 624 | | |||
▲ Show 20 Lines • Show All 45 Lines • ▼ Show 20 Line(s) | 646 | try { | |||
670 | TransactionHelper t6(closingDate, MyMoneySplit::ActionDeposit, MyMoneyMoney(moTransaction), acCredit, acChecking); | 670 | TransactionHelper t6(closingDate, MyMoneySplit::ActionDeposit, MyMoneyMoney(moTransaction), acCredit, acChecking); | ||
671 | // test that an income/expense transaction that involves a currency exchange is properly reported | 671 | // test that an income/expense transaction that involves a currency exchange is properly reported | ||
672 | TransactionHelper t7(intermediateDate, MyMoneySplit::ActionWithdrawal, MyMoneyMoney(moJpyTransaction), acJpyChecking, acSolo, "JPY"); | 672 | TransactionHelper t7(intermediateDate, MyMoneySplit::ActionWithdrawal, MyMoneyMoney(moJpyTransaction), acJpyChecking, acSolo, "JPY"); | ||
673 | 673 | | |||
674 | unsigned cols; | 674 | unsigned cols; | ||
675 | 675 | | |||
676 | MyMoneyReport filter; | 676 | MyMoneyReport filter; | ||
677 | 677 | | |||
678 | filter.setRowType(MyMoneyReport::eAccount); | 678 | filter.setRowType(MyMoneyReport::Row::Account); | ||
679 | filter.setName("Transactions by Account"); | 679 | filter.setName("Transactions by Account"); | ||
680 | cols = MyMoneyReport::QueryColumns::Number | MyMoneyReport::QueryColumns::Payee | MyMoneyReport::QueryColumns::Category | MyMoneyReport::QueryColumns::Balance; | 680 | cols = MyMoneyReport::QueryColumns::Number | MyMoneyReport::QueryColumns::Payee | MyMoneyReport::QueryColumns::Category | MyMoneyReport::QueryColumns::Balance; | ||
681 | filter.setQueryColumns(static_cast<MyMoneyReport::QueryColumns::Type>(cols)); | 681 | filter.setQueryColumns(static_cast<MyMoneyReport::QueryColumns::Type>(cols)); | ||
682 | // don't convert values to the default currency | 682 | // don't convert values to the default currency | ||
683 | filter.setConvertCurrency(false); | 683 | filter.setConvertCurrency(false); | ||
684 | XMLandback(filter); | 684 | XMLandback(filter); | ||
685 | QueryTable qtbl_3(filter); | 685 | QueryTable qtbl_3(filter); | ||
686 | 686 | | |||
▲ Show 20 Lines • Show All 77 Lines • ▼ Show 20 Line(s) | |||||
764 | { | 764 | { | ||
765 | try { | 765 | try { | ||
766 | TransactionHelper t1q1(QDate(2004, 1, 1), MyMoneySplit::ActionWithdrawal, moSolo, acChecking, acSolo); | 766 | TransactionHelper t1q1(QDate(2004, 1, 1), MyMoneySplit::ActionWithdrawal, moSolo, acChecking, acSolo); | ||
767 | TransactionHelper t2q1(QDate(2004, 2, 1), MyMoneySplit::ActionWithdrawal, moParent1, acChecking, acTax); | 767 | TransactionHelper t2q1(QDate(2004, 2, 1), MyMoneySplit::ActionWithdrawal, moParent1, acChecking, acTax); | ||
768 | 768 | | |||
769 | unsigned cols; | 769 | unsigned cols; | ||
770 | MyMoneyReport filter; | 770 | MyMoneyReport filter; | ||
771 | 771 | | |||
772 | filter.setRowType(MyMoneyReport::eCategory); | 772 | filter.setRowType(MyMoneyReport::Row::Category); | ||
773 | filter.setName("Tax Transactions"); | 773 | filter.setName("Tax Transactions"); | ||
774 | cols = MyMoneyReport::QueryColumns::Number | MyMoneyReport::QueryColumns::Payee | MyMoneyReport::QueryColumns::Account; | 774 | cols = MyMoneyReport::QueryColumns::Number | MyMoneyReport::QueryColumns::Payee | MyMoneyReport::QueryColumns::Account; | ||
775 | filter.setQueryColumns(static_cast<MyMoneyReport::QueryColumns::Type>(cols)); | 775 | filter.setQueryColumns(static_cast<MyMoneyReport::QueryColumns::Type>(cols)); | ||
776 | filter.setTax(true); | 776 | filter.setTax(true); | ||
777 | 777 | | |||
778 | XMLandback(filter); | 778 | XMLandback(filter); | ||
779 | QueryTable qtbl_3(filter); | 779 | QueryTable qtbl_3(filter); | ||
780 | 780 | | |||
Show All 10 Lines |