use simple iso string
This commit is contained in:
parent
f45e295c75
commit
1607f8946e
3 changed files with 9 additions and 2 deletions
|
@ -37,3 +37,9 @@ std::string Sale::sumAsString() { return formatCentAsEuroString(sumInCents()); }
|
||||||
std::string Sale::getTimestamp() const { return timestamp_; }
|
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);
|
||||||
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@ class Sale : public Entity
|
||||||
|
|
||||||
ArticlesVec& getArticles();
|
ArticlesVec& getArticles();
|
||||||
std::string getTimestamp() const;
|
std::string getTimestamp() const;
|
||||||
|
std::string getTimestampFormatted() const;
|
||||||
int sumInCents();
|
int sumInCents();
|
||||||
std::string sumAsString();
|
std::string sumAsString();
|
||||||
|
|
||||||
|
|
|
@ -144,7 +144,7 @@ void PosPrinter::printSaleReceipt(Sale* sale)
|
||||||
std::stringstream commandStream;
|
std::stringstream commandStream;
|
||||||
printHeader();
|
printHeader();
|
||||||
commandStream << Command::RESET << Command::ENCODING << Command::RIGHT_ALIGN;
|
commandStream << Command::RESET << Command::ENCODING << Command::RIGHT_ALIGN;
|
||||||
commandStream << sale->getTimestamp() << "\n\n";
|
commandStream << sale->getTimestampFormatted() << "\n\n";
|
||||||
commandStream << Command::LEFT_ALIGN;
|
commandStream << Command::LEFT_ALIGN;
|
||||||
for (const auto& article : sale->getArticles()) {
|
for (const auto& article : sale->getArticles()) {
|
||||||
commandStream << "Art. " << article->getCompleteArticleNo() << "........... "
|
commandStream << "Art. " << article->getCompleteArticleNo() << "........... "
|
||||||
|
|
Loading…
Reference in a new issue