-
Notifications
You must be signed in to change notification settings - Fork 1
/
Common.h
142 lines (124 loc) · 2.98 KB
/
Common.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
#ifndef COMMON_H
#define COMMON_H
#include <QDate>
#include <QString>
#include <QTime>
namespace Common {
enum class FuelType
{
ON,
OO,
PB95,
PB98,
ERR
};
enum class FuelTankType
{
ON,
ON1,
ON2,
ON3,
OO,
PB95,
PB98,
ERR
};
static QString URL = "https://www.orlen.pl/PL/DlaBiznesu/HurtoweCenyPaliw/Strony/default.aspx";
static QString chartsPricesDataPath = "stacja-paliwowa/FuelPricesChartData/";
QString getFuelTypeName(const FuelType& type);
FuelType getFuelTypeEnum(QString type);
QString getFuelTankTypeName(const FuelTankType& type);
FuelTankType getFuelTankEnum(QString type);
struct OrderParametersOutput
{
QTime mTravelTime;
uint mTotalPrice;
double mPricePerLiter;
double mDistance;
uint mIncome;
OrderParametersOutput() {}
OrderParametersOutput(QTime travelTime, uint totalPrice, double margin, double distance,
uint income)
: mTravelTime(travelTime)
, mTotalPrice(totalPrice)
, mPricePerLiter(margin)
, mDistance(distance)
, mIncome(income)
{
}
};
struct CustomerStruct
{
QString name;
QString city;
QString street;
QString propertyNumber;
uint id;
CustomerStruct(QString name = nullptr, QString city = nullptr, QString street = nullptr,
QString propertyNumber = nullptr, uint id = 0)
: name(name)
, city(city)
, street(street)
, propertyNumber(propertyNumber)
, id(id)
{
}
};
struct OrdersStruct
{
uint amount;
QDate date;
double totalPrice;
CustomerStruct customer;
FuelType fuelType;
uint establishedProfit;
OrdersStruct(uint amout = 0, QDate date = QDate().currentDate(), double totalPrice = 0,
CustomerStruct customer = CustomerStruct(), FuelType fuelType = FuelType::ERR,
uint establishedProfit = 0)
: amount(amout)
, date(date)
, totalPrice(totalPrice)
, customer(customer)
, fuelType(fuelType)
, establishedProfit(establishedProfit)
{
}
};
struct DistancesStruct
{
uint a;
uint b;
uint time;
DistancesStruct(uint a = 0, uint b = 0, uint time = 0)
: a(a)
, b(b)
, time(time)
{
}
};
struct PetrolInfoStruct
{
double price;
QDate date;
FuelType fuelType;
PetrolInfoStruct(double price = 0, QDate date = QDate().currentDate(),
FuelType fuelType = FuelType::ERR)
: price(price)
, date(date)
, fuelType(fuelType)
{
}
};
struct PurchaseStruct
{
QDate date;
QString nameOfProduct;
PurchaseStruct(QDate date = QDate().currentDate(), QString nameOfProduct = QString())
: date(date)
, nameOfProduct(nameOfProduct)
{
}
};
const CustomerStruct Benzol("Benzol", "Myślibórz", "Królewiecka", "1", 1);
} // namespace Common
#endif // COMMON_H