use simple iso string

This commit is contained in:
Martin Brodbeck 2018-08-06 21:31:40 +02:00
parent f45e295c75
commit 1607f8946e
3 changed files with 9 additions and 2 deletions

View file

@ -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; }
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);
}

View file

@ -22,6 +22,7 @@ class Sale : public Entity
ArticlesVec& getArticles();
std::string getTimestamp() const;
std::string getTimestampFormatted() const;
int sumInCents();
std::string sumAsString();

View file

@ -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() << "........... "