fixed too much precision
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user