diff --git a/README.md b/README.md index ababf43..d405e0c 100644 --- a/README.md +++ b/README.md @@ -60,7 +60,7 @@ I plan to make precompiled binaries for Linux and Windows. Maybe I will put it o If you want to contribute to the project, you can do it by some of the following: ## Checks from different countries -I live in Russia and only know how Russian state checks system works. If you live in another country and want to help me with adding support to checks from you country - feel free to contact me! +I live in Russia and only know how Russian state checks system works. If you live in another country and want to help me with adding support to checks from your country - feel free to contact me! ## Issues and PRs If you have found a bug, or want to suggest a feature - don't hesitate to open an issue / PR! diff --git a/outputdialog.cpp b/outputdialog.cpp index eba0b2c..014adbe 100644 --- a/outputdialog.cpp +++ b/outputdialog.cpp @@ -75,38 +75,35 @@ void OutputDialog::on_buttonBox_accepted() { for (auto goods : this->check.get_goods()) { for (auto &column : this->options.get_columns()) { - std::string output_str; - switch (column.type) { case ColumnType::goods_name: - output_str = goods.get_name(); + output_file << goods.get_name(); break; case ColumnType::goods_price_per_unit: - output_str = std::to_string(goods.get_price_per_unit()); + output_file << std::fixed << std::setprecision(2) << goods.get_price_per_unit(); break; case ColumnType::goods_quantity: - output_str = std::to_string(goods.get_quantity()); + output_file << std::fixed << std::setprecision(2) << goods.get_quantity(); break; case ColumnType::goods_net_weight: - output_str = "TODO"; + output_file << "TODO"; // TODO break; case ColumnType::goods_total: - output_str = std::to_string(goods.calculate_total_price()); + output_file << std::fixed << std::setprecision(2) << goods.calculate_total_price(); break; } if (column.position != this->options.get_columns().size()) { - output_str += ","; + output_file << ","; } else { - output_str += "\n"; + output_file << "\n"; } - output_file << output_str; } } if (this->options.get_print_total()) { - output_file << "Total: " << std::to_string(check.calculae_total_price()); + output_file << "Total: " << std::fixed << std::setprecision(2) << check.calculae_total_price(); } output_file.close();