KIMA2 ist ein kleines Kassenprogramm für Kindersachenmärkte. https://www.rustysoft.de/?01_kima2
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

69 lines
1.8 KiB

#ifndef MARKETPLACE_H
#define MARKETPLACE_H
#include "article.h"
#include "sale.h"
#include "seller.h"
#include <vector>
class ExcelReader;
namespace
{
using SellersVec = std::vector<std::unique_ptr<Seller>>;
using SalesVec = std::vector<std::unique_ptr<Sale>>;
using BasketVec = std::vector<std::unique_ptr<Article>>;
} // namespace
class Marketplace
{
public:
Marketplace();
void storeToDb(bool onlyDelete = false);
void loadFromDb();
SellersVec& getSellers();
SalesVec& getSales();
int getNextSellerNo();
int getNextArticleNo();
int getNumSellersDelete();
int getNumArticlesSold();
BasketVec& getBasket();
int getBasketSumInCent();
std::string getBasketSumAsString();
void sortSellers();
Seller* findSellerWithSellerNo(int sellerNo);
Seller* findSellerWithUuid(const std::string& uuid);
void addArticleToBasket(std::unique_ptr<Article> article);
size_t basketSize();
void finishCurrentSale(std::unique_ptr<Sale> sale);
void removeSale(boost::uuids::uuid uuid);
void setSalesToDelete(int cashPointNo);
int getOverallSumInCent();
std::string getOverallSumAsString();
int getOverallPaymentInCent(int percent, int maxFee);
std::string getOverallPaymentAsString(int percent, int maxFee);
std::string getOverallRevenueAsString(int percent, int maxFee);
void clear();
void exportReportToCSV(const std::string& filename, int feeInPercent, int maxFeeInEuro);
friend class ExcelReader;
private:
SellersVec sellers_;
SalesVec sales_;
BasketVec basket_;
};
double marketFee(int sumInCent, int percent, int maxFeeInCent);
std::string marketFeeAsString(int sumInCent, int percent, int maxFeeInCent);
std::string paymentAsString(int sumInCent, int percent, int maxFeeInCent);
std::string escapeCsvValue(const std::string& value, const char delimiter);
#endif