2018-07-09 16:06:27 +02:00
|
|
|
#include "article.h"
|
2019-10-09 10:36:51 +02:00
|
|
|
#include "seller.h"
|
2018-08-02 13:06:37 +02:00
|
|
|
#include "utils.h"
|
2018-07-09 16:06:27 +02:00
|
|
|
|
2018-07-23 14:25:18 +02:00
|
|
|
#include <iomanip>
|
|
|
|
#include <sstream>
|
|
|
|
|
2022-07-07 15:03:39 +02:00
|
|
|
Article::Article(int price) : m_price(price) {}
|
2018-07-09 16:06:27 +02:00
|
|
|
|
2022-07-07 15:03:39 +02:00
|
|
|
void Article::setArticleNo(int articleNo) { m_articleNo = articleNo; }
|
2018-07-09 16:06:27 +02:00
|
|
|
|
2022-07-07 15:03:39 +02:00
|
|
|
void Article::setPrice(int price) { m_price = price; }
|
2018-07-09 16:06:27 +02:00
|
|
|
|
2022-07-07 15:21:46 +02:00
|
|
|
void Article::setDescription(const std::string &description) { m_description = description; }
|
2018-07-11 12:52:57 +02:00
|
|
|
|
2022-07-07 15:21:46 +02:00
|
|
|
void Article::setSale(Sale *salePtr) { m_salePtr = salePtr; }
|
2018-07-12 14:37:56 +02:00
|
|
|
|
2022-07-07 15:21:46 +02:00
|
|
|
void Article::setSeller(Seller *sellerPtr) { m_sellerPtr = sellerPtr; }
|
2018-07-11 12:52:57 +02:00
|
|
|
|
2022-07-07 15:03:39 +02:00
|
|
|
bool Article::isSold() { return m_salePtr ? true : false; }
|
2018-07-12 12:06:55 +02:00
|
|
|
|
2022-07-07 15:03:39 +02:00
|
|
|
std::string Article::getDescription() { return m_description; }
|
2018-07-12 12:06:55 +02:00
|
|
|
|
2022-07-07 15:21:46 +02:00
|
|
|
Seller *Article::getSeller() { return m_sellerPtr; }
|
|
|
|
Sale *Article::getSale() { return m_salePtr; }
|
2018-07-12 13:36:13 +02:00
|
|
|
|
2022-07-07 15:03:39 +02:00
|
|
|
int Article::getPrice() const { return m_price; }
|
2018-07-13 13:04:30 +02:00
|
|
|
|
2022-07-07 15:03:39 +02:00
|
|
|
std::string Article::getPriceAsString() const { return formatCentAsEuroString(m_price); }
|
2018-07-23 14:25:18 +02:00
|
|
|
|
2022-07-07 15:03:39 +02:00
|
|
|
int Article::getArticleNo() const { return m_articleNo; }
|
2018-07-30 14:43:02 +02:00
|
|
|
|
|
|
|
std::string Article::getCompleteArticleNo() const
|
|
|
|
{
|
|
|
|
std::stringstream artNoStream;
|
2022-07-07 15:03:39 +02:00
|
|
|
artNoStream << m_sourceNo << "K" << std::setfill('0') << std::setw(5) << m_articleNo;
|
2018-07-30 14:43:02 +02:00
|
|
|
return artNoStream.str();
|
2019-10-09 10:36:51 +02:00
|
|
|
}
|