-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathOrder.h
50 lines (44 loc) · 1.21 KB
/
Order.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
#pragma once
#include "Resturant.h"
#include <utility>
using namespace std;
class Order
{
public:
string resturant;
string customerID; //el-user el-3ammal el-order
vector<pair<string, pair<Food, int> > >items; //Category, Food Obj., QuantityOrdered
map<Food, int> curItem;
float totalPrice;
bool state; //either '1' recieved or '0' cancelled
Date ordersDate;
string comment;
string ID, orderid, address; //delivery boy
Order();
Order(string rest, string iD, float price, bool stat, Date dat, string CustID, string comment, vector<pair<string, pair<Food, int> > >item)
{
this->resturant = rest;
this->ID = iD;
this->totalPrice = price;
this->state = stat;
this->ordersDate = dat;
this->customerID = CustID;
this->comment = comment;
this->items = item;
}
void calc(){ //Calculates the total price
totalPrice = 0.0;
for (int i = 0; i < items.size(); i++)
{
totalPrice += (items[i].second.first.price * items[i].second.second);
}
}
void finish()
{ //34an amla items mn item bss
for (map<Food, int>::iterator it = curItem.begin(); it != curItem.end(); it++)
{
pair<Food, int> tmpPair = make_pair(it->first, it->second);
items.push_back(make_pair(it->first.category, tmpPair));
}
}
};