initial commit
This commit is contained in:
parent
b84bc5bff0
commit
6b6dddcaaa
2 changed files with 24 additions and 1 deletions
10
src/core/sale.cpp
Normal file
10
src/core/sale.cpp
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
#include "sale.h"
|
||||||
|
|
||||||
|
#include <numeric>
|
||||||
|
|
||||||
|
int Sale::sumInCents()
|
||||||
|
{
|
||||||
|
int test = std::accumulate(articles_.begin(), articles_.end(), 0,
|
||||||
|
[](int a, Article* b) { return a + b->getPrice(); });
|
||||||
|
return test;
|
||||||
|
}
|
|
@ -1,8 +1,21 @@
|
||||||
#ifndef SALE_H
|
#ifndef SALE_H
|
||||||
#define SALE_H
|
#define SALE_H
|
||||||
|
|
||||||
class Sale : public Entity {
|
#include "article.h"
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include <boost/date_time.hpp>
|
||||||
|
|
||||||
|
class Article;
|
||||||
|
|
||||||
|
class Sale : public Entity
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
int sumInCents();
|
||||||
|
private:
|
||||||
|
boost::posix_time::ptime systemTime_{boost::posix_time::second_clock::local_time()};
|
||||||
|
std::vector<Article*> articles_{};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
Loading…
Reference in a new issue