Make commune configurable (Default is still Dettingen)

This commit is contained in:
Martin Brodbeck 2018-10-19 08:48:25 +02:00
parent bc9e395ee9
commit cac9ee9e30
6 changed files with 47 additions and 24 deletions

View file

@ -131,13 +131,13 @@ void PosPrinter::write(const std::string& text)
std::cerr << "Write Error" << std::endl;
}
void PosPrinter::printHeader()
void PosPrinter::printHeader(const std::string& commune)
{
std::stringstream commandStream;
commandStream << Command::RESET << Command::ENCODING << Command::CENTERING
<< Command::FONT_SIZE_BIG;
commandStream << "Kindersachenmarkt\nDettingen\n\n";
commandStream << "Kindersachenmarkt\n" << commune << "\n\n";
commandStream << Command::LEFT_ALIGN << Command::Command::FONT_SIZE_NORMAL;
write(commandStream.str());
@ -154,10 +154,10 @@ void PosPrinter::printTest()
write(commandStream.str());
}
void PosPrinter::printSaleReceipt(Sale* sale)
void PosPrinter::printSaleReceipt(Sale* sale, const std::string& commune)
{
std::stringstream commandStream;
printHeader();
printHeader(commune);
commandStream << Command::RESET << Command::ENCODING << Command::RIGHT_ALIGN;
commandStream << sale->getTimestampFormatted() << "\n\n";
commandStream << Command::LEFT_ALIGN;
@ -172,10 +172,11 @@ void PosPrinter::printSaleReceipt(Sale* sale)
write(commandStream.str());
}
void PosPrinter::printSellerReceipt(Seller* seller, int percent, int maxFeeInCent)
void PosPrinter::printSellerReceipt(Seller* seller, const int percent, const int maxFeeInCent,
const std::string& commune)
{
std::stringstream commandStream;
printHeader();
printHeader(commune);
commandStream << Command::RESET << Command::ENCODING << Command::RIGHT_ALIGN;
std::string timeStr =
boost::posix_time::to_simple_string(boost::posix_time::second_clock::local_time());