better print seller no on sale receipt

This commit is contained in:
Martin Brodbeck 2018-10-12 11:47:03 +02:00
parent f6528bdf45
commit e9fde76a60
3 changed files with 11 additions and 1 deletions

View file

@ -35,6 +35,15 @@ std::string Seller::getLastName() const { return lastName_; }
int Seller::getSellerNo() const { return sellerNo_; }
std::string Seller::getSellerNoAsString() const
{
std::stringstream selNoStr;
selNoStr << std::setfill('0') << std::setw(3) << sellerNo_;
return selNoStr.str();;
}
std::vector<Article*> Seller::getArticles(bool onlySold) const
{
std::vector<Article*> articles;

View file

@ -28,6 +28,7 @@ class Seller : public Entity
std::string getFirstName() const;
std::string getLastName() const;
int getSellerNo() const;
std::string getSellerNoAsString() const;
int numArticlesOffered() const;
int numArticlesSold() const;
// int numArticlesTotal() const;

View file

@ -161,7 +161,7 @@ void PosPrinter::printSaleReceipt(Sale* sale)
commandStream << sale->getTimestampFormatted() << "\n\n";
commandStream << Command::LEFT_ALIGN;
for (const auto& article : sale->getArticles()) {
commandStream << "Art. " << article->getCompleteArticleNo() << "........... "
commandStream << "Verk.Nr. " << article->getSeller()->getSellerNoAsString() << "........... "
<< article->getPriceAsString() << "\n";
}
commandStream << "\nGesamt................. " << sale->sumAsString() << "\n";