41 lines
836 B
C++
41 lines
836 B
C++
#ifndef SALE_H
|
|
#define SALE_H
|
|
|
|
#include "article.h"
|
|
|
|
#include <vector>
|
|
|
|
#include "boost/date_time/posix_time/posix_time.hpp"
|
|
|
|
// class Article;
|
|
|
|
namespace
|
|
{
|
|
using ArticlesVec = std::vector<Article *>;
|
|
}
|
|
|
|
class Sale : public EntityUuid
|
|
{
|
|
public:
|
|
Sale() = default;
|
|
Sale(const Sale &) = delete;
|
|
virtual ~Sale() = default;
|
|
void addArticle(Article *articlePtr);
|
|
void setTimestamp(const std::string ×tamp);
|
|
|
|
ArticlesVec &getArticles();
|
|
std::string getTimestamp() const;
|
|
std::string getTimestampFormatted() const;
|
|
int sumInCents();
|
|
std::string sumAsString();
|
|
|
|
void removeArticle(const Article *articlePtr);
|
|
|
|
private:
|
|
std::string m_timestamp{
|
|
boost::posix_time::to_iso_extended_string(boost::posix_time::second_clock::local_time())};
|
|
mutable ArticlesVec m_articles{};
|
|
};
|
|
|
|
#endif
|