removed tabs
This commit is contained in:
parent
c635cd9221
commit
0558fb8fd7
@ -213,14 +213,27 @@ void invoices_ordered_by_month()
|
|||||||
system("cls");
|
system("cls");
|
||||||
cout << "Alle Rechnungen nach Monat sortiert" << endl;
|
cout << "Alle Rechnungen nach Monat sortiert" << endl;
|
||||||
cout << "------------------------------------" << endl;
|
cout << "------------------------------------" << endl;
|
||||||
auto temp = list<invoice>(invoices);
|
//<month, <category, amount>>
|
||||||
temp.sort(compare_month_ascending);
|
map<int, map<int, double>> month_category_amount;
|
||||||
for (auto invoice : temp)
|
for (auto invoice : invoices)
|
||||||
{
|
{
|
||||||
cout << " Rechnung: " << invoice.get_number() << endl;
|
month_category_amount[invoice.get_month()][invoice.get_category()] += invoice.get_amount();
|
||||||
cout << " Betrag: " << invoice.get_amount() << " Euro" << endl;
|
}
|
||||||
cout << " Monat: " << invoice::months[invoice.get_month()] << endl;
|
|
||||||
cout << " Kategorie: " << invoice::categories[invoice.get_category()] << endl;
|
for (auto month_pair : month_category_amount)
|
||||||
|
{
|
||||||
|
auto sum = 0.0;
|
||||||
|
cout << invoice::months[month_pair.first] << endl;
|
||||||
|
cout << "------------------------------------" << endl;
|
||||||
|
for (const auto category_amount : month_pair.second)
|
||||||
|
{
|
||||||
|
cout << invoice::categories[category_amount.first] << ": " << category_amount.second << " Euro" << endl;
|
||||||
|
sum += category_amount.second;
|
||||||
|
}
|
||||||
|
cout << endl;
|
||||||
|
cout << "Gesamt: " << sum << " Euro";
|
||||||
|
if (sum > 500) cout << " Mehr ausgegeben als geplant!!!";
|
||||||
|
cout << endl;
|
||||||
cout << "------------------------------------" << endl;
|
cout << "------------------------------------" << endl;
|
||||||
}
|
}
|
||||||
system("pause");
|
system("pause");
|
||||||
@ -274,7 +287,8 @@ int get_month()
|
|||||||
cout << ++index << ": " << month << endl;
|
cout << ++index << ": " << month << endl;
|
||||||
}
|
}
|
||||||
const auto answer = ask_question<unsigned int>("");
|
const auto answer = ask_question<unsigned int>("");
|
||||||
if (answer > 0 && answer <= 12)
|
const auto size = static_cast<int>(sizeof(invoice::months) / sizeof(*invoice::months));
|
||||||
|
if (answer > 0 && answer <= size)
|
||||||
{
|
{
|
||||||
return answer - 1;
|
return answer - 1;
|
||||||
}
|
}
|
||||||
@ -293,7 +307,8 @@ int get_category()
|
|||||||
cout << ++index << ": " << category << endl;
|
cout << ++index << ": " << category << endl;
|
||||||
}
|
}
|
||||||
const auto answer = ask_question<int>("");
|
const auto answer = ask_question<int>("");
|
||||||
if (answer > 0 && answer <= 8)
|
const auto size = static_cast<int>(sizeof(invoice::categories) / sizeof(*invoice::categories));
|
||||||
|
if (answer > 0 && answer <= size)
|
||||||
{
|
{
|
||||||
return answer - 1;
|
return answer - 1;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user