kima2/src/core/article.cpp

39 lines
1.1 KiB
C++
Raw Normal View History

2018-07-09 16:06:27 +02:00
#include "article.h"
2019-10-09 10:36:51 +02:00
#include "seller.h"
#include "utils.h"
2018-07-09 16:06:27 +02:00
2018-07-23 14:25:18 +02:00
#include <iomanip>
#include <sstream>
2018-07-21 19:24:56 +02:00
Article::Article(int price) : price_(price) {}
2018-07-09 16:06:27 +02:00
2018-07-11 12:52:57 +02:00
void Article::setArticleNo(int articleNo) { articleNo_ = articleNo; }
2018-07-09 16:06:27 +02:00
2018-07-11 12:52:57 +02:00
void Article::setPrice(int price) { price_ = price; }
2018-07-09 16:06:27 +02:00
2018-07-11 12:52:57 +02:00
void Article::setDescription(const std::string& description) { description_ = description; }
2018-07-12 14:37:56 +02:00
void Article::setSale(Sale* salePtr) { salePtr_ = salePtr; }
void Article::setSeller(Seller* sellerPtr) { sellerPtr_ = sellerPtr; }
2018-07-11 12:52:57 +02:00
2018-07-12 12:06:55 +02:00
bool Article::isSold() { return salePtr_ ? true : false; }
std::string Article::getDescription() { return description_; }
2018-07-12 14:37:56 +02:00
Seller* Article::getSeller() { return sellerPtr_; }
2018-07-25 16:04:45 +02:00
Sale* Article::getSale() { return salePtr_; }
2018-07-12 13:36:13 +02:00
2018-07-20 11:52:26 +02:00
int Article::getPrice() const { return price_; }
2018-07-13 13:04:30 +02:00
2019-10-07 14:08:01 +02:00
std::string Article::getPriceAsString() const { return formatCentAsEuroString(price_); }
2018-07-23 14:25:18 +02:00
2018-07-30 14:43:02 +02:00
int Article::getArticleNo() const { return articleNo_; }
std::string Article::getCompleteArticleNo() const
{
std::stringstream artNoStream;
artNoStream << sourceNo_ << "K" << std::setfill('0') << std::setw(5) << articleNo_;
return artNoStream.str();
2019-10-09 10:36:51 +02:00
}