diff --git a/src/core/sale.cpp b/src/core/sale.cpp index 075df3c..ae3f143 100644 --- a/src/core/sale.cpp +++ b/src/core/sale.cpp @@ -36,4 +36,10 @@ std::string Sale::sumAsString() { return formatCentAsEuroString(sumInCents()); } std::string Sale::getTimestamp() const { return timestamp_; } -void Sale::setTimestamp(const std::string& timestamp) { timestamp_ = timestamp; } \ No newline at end of file +void Sale::setTimestamp(const std::string& timestamp) { timestamp_ = timestamp; } + +std::string Sale::getTimestampFormatted() const +{ + boost::posix_time::ptime time = boost::posix_time::from_iso_extended_string(timestamp_); + return boost::posix_time::to_simple_string(time); +} diff --git a/src/core/sale.h b/src/core/sale.h index b44ff92..c6de317 100644 --- a/src/core/sale.h +++ b/src/core/sale.h @@ -22,6 +22,7 @@ class Sale : public Entity ArticlesVec& getArticles(); std::string getTimestamp() const; + std::string getTimestampFormatted() const; int sumInCents(); std::string sumAsString(); diff --git a/src/printer/posprinter.cpp b/src/printer/posprinter.cpp index 732a519..1c07c1a 100644 --- a/src/printer/posprinter.cpp +++ b/src/printer/posprinter.cpp @@ -144,7 +144,7 @@ void PosPrinter::printSaleReceipt(Sale* sale) std::stringstream commandStream; printHeader(); commandStream << Command::RESET << Command::ENCODING << Command::RIGHT_ALIGN; - commandStream << sale->getTimestamp() << "\n\n"; + commandStream << sale->getTimestampFormatted() << "\n\n"; commandStream << Command::LEFT_ALIGN; for (const auto& article : sale->getArticles()) { commandStream << "Art. " << article->getCompleteArticleNo() << "........... "