kima2/src/core/sale.h

38 lines
751 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:
void addArticle(Article* articlePtr);
void setTimestamp(const std::string& timestamp);
ArticlesVec& getArticles();
std::string getTimestamp() const;
std::string getTimestampFormatted() const;
int sumInCents();
std::string sumAsString();
void removeArticle(const Article* articlePtr);
private:
std::string timestamp_{
boost::posix_time::to_iso_extended_string(boost::posix_time::second_clock::local_time())};
mutable ArticlesVec articles_{};
};
#endif