multi-check system

This commit is contained in:
2025-05-11 00:25:05 +03:00
parent 86a11faf70
commit 463edd3df9
13 changed files with 435 additions and 268 deletions

View File

@@ -1,14 +1,19 @@
#include "check.h"
#include "../goods/goods.h"
#include <iostream>
Check::Check() {}
void Check::add_goods(Goods goods) { this->goods.push_back(goods); }
void Check::add_goods(Goods goods) {
this->goods.push_back(goods);
this->total = this->calculae_total_price();
}
void Check::add_goods(std::vector<Goods> &goods) {
for (auto g : goods) {
for (auto &g : goods) {
this->goods.push_back(g);
}
this->total = this->calculae_total_price();
}
double Check::calculae_total_price() {
@@ -17,7 +22,6 @@ double Check::calculae_total_price() {
for (Goods &g : goods) {
total += g.calculate_total_price();
}
return total;
}
@@ -25,6 +29,64 @@ std::vector<Goods>& Check::get_goods() {
return goods;
}
void Check::set_fn(std::string fn) {
this->fn = fn;
}
void Check::set_fd(std::string fd) {
this->fd = fd;
}
void Check::set_fi(std::string fi) {
this->fi = fi;
}
std::string Check::get_date() {
return date;
}
void Check::set_date(std::string date) {
this->date = date;
}
void Check::set_operation_type(OperationType t) {
this->operation_type = t;
}
double Check::get_total() {
return total;
}
bool Check::operator==(Check &c) {
// std::cout << "Comparing" << std::endl;
// std::cout << this->date << " <>" << c.date << std::endl;
// std::cout << this->fd << " <>" << c.fd << std::endl;
// std::cout << this->fi<< " <>" << c.fi << std::endl;
// std::cout << this->fn<< " <>" << c.fn << std::endl;
// std::cout << this->operation_type << " <>" << c.operation_type << std::endl;
// std::cout << this->total<< " <>" << c.total<< std::endl;
return
this->date == c.date &&
this->fd == c.fd &&
this->fi == c.fi &&
this->fn == c.fn &&
this->operation_type == c.operation_type &&
this->total == c.total;
}
bool Check::operator==(const Check &c) {
// std::cout << "Comparing" << std::endl;
// std::cout << this->date << " <>" << c.date << std::endl;
// std::cout << this->fd << " <>" << c.fd << std::endl;
// std::cout << this->fi<< " <>" << c.fi << std::endl;
// std::cout << this->fn<< " <>" << c.fn << std::endl;
// std::cout << this->operation_type << " <>" << c.operation_type << std::endl;
// std::cout << this->total<< " <>" << c.total<< std::endl;
return
this->date == c.date &&
this->fd == c.fd &&
this->fi == c.fi &&
this->fn == c.fn &&
this->operation_type == c.operation_type &&
this->total == c.total;
}

View File

@@ -43,6 +43,9 @@ public:
std::string get_date();
OperationType get_operationType();
double get_total();
bool operator==(Check &);
bool operator==(const Check &);
};
#endif // CHECK_H