-
Notifications
You must be signed in to change notification settings - Fork 1
/
Hotel.h
252 lines (213 loc) · 10.6 KB
/
Hotel.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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
#ifndef HOTEL_HOTEL_H
#define HOTEL_HOTEL_H
#include <iostream>
#include <list>
#include <string>
#include <cmath>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <vector>
#include <unordered_set>
#include "bst.h"
#include "Reserva.h"
#include "Produto.h"
#include "Quarto.h"
#include "Funcionario.h"
#include "Cliente.h"
#include "Servico.h"
#include "Data.h"
#include "Exceptions.h"
#include "Frota.h"
using namespace std;
class Hotel {
protected:
list <Produto> produtos;
list <Reserva> reservas;
list <Reserva> estadias;
list <Reserva> reservas_atuais;
list <Cliente> clientes;
list <Cliente> clientes_habituais;
list <Quarto> quartos;
list <Funcionario> funcionarios;
list <F_Rececao> funcionarios_rececao;
list <F_Responsavel> funcionarios_responsaveis;
list <F_Limpeza> funcionarios_limpeza;
list <F_Gestor> funcionarios_gestores;
list <Servico> servicos;
list <Reserva *> reservas_totais;
list <Viagem> viagens_realizadas;
public:
Hotel(): frota(Veiculo()) {nome = "Grande Hotel Central";}
Hotel(string nome);
~Hotel() {};
string nome;
const list <Produto> GetProdutos() {return produtos;}
const list <Reserva> GetReservas() {return reservas;}
const list <Reserva> GetReservasAtuais() {return reservas_atuais;}
const list <Reserva> GetEstadias() {return estadias;}
const list <Cliente> GetClientes() {return clientes;}
const list <Quarto> GetQuartos() {return quartos;}
const list <Funcionario> GetFuncionarios() {return funcionarios;}
const list <F_Rececao> GetFuncionariosRececao() {return funcionarios_rececao;}
const list <F_Responsavel> GetFuncionariosResponsaveis() {return funcionarios_responsaveis;}
const list <F_Limpeza> GetFuncionariosLimpeza() {return funcionarios_limpeza;}
const list <F_Gestor> GetFuncionariosGestores() {return funcionarios_gestores;}
const list <Servico> GetServicos() {return servicos;}
const list <Viagem> GetViagens() {return viagens_realizadas;}
const list <Cliente *> GetClientesnoHotel();
const list <Cliente> GetClientesHabituais() {return clientes_habituais;}
bool AddProduto(Produto produto);
bool AddReserva(Reserva reserva);
void PopReserva(int idnum);
bool AddReservasAtuais(Reserva reserva);
bool AddEstadia(Reserva reserva);
bool AddCliente(Cliente cliente);
bool AddQuarto(Quarto quarto);
bool AddFuncionario(Funcionario funcionario);
bool AddFuncionarioRececao(F_Rececao funcionario_rec);
bool AddFuncionarioResponsavel(F_Responsavel funcionario_resp);
bool AddFuncionarioLimpeza(F_Limpeza funcionario_limpeza);
bool AddFuncionarioGestor(F_Gestor funcionario_gestor);
bool AddServico(Servico servico);
bool AddViagem(Viagem viagem);
bool AddCompra(Compra compra);
bool DeleteCompra(int id);
bool DeleteCompra(Compra compra) {return DeleteCompra(compra.ID());}
bool FazerCompra_NovoProduto(int id, string nome_prod, int numero_prod, tipo_produto tprod, nota_avaliacao qualidade, float preco, int stock, string fornecedor, int quantidade);
bool FazerCompra_NovoProduto(int id, Produto produto, string fornecedor, int quantidade);
bool FazerCompra(int id, int numero_prod, string fornecedor, int quantidade);
bool FazerCompra(int id, list <Produto> lprodutos, int numero_prod, string fornecedor, int quantidade);
priority_queue<Compra> GetComprasStocks(int stock_min, int stock_max);
Compra EscolherCompra(F_Gestor fgestor, int stock_min, int stock_max);
Compra EscolherCompra(int id_func, int stock_min, int stock_max);
void MudarRating(int id, nota_avaliacao new_rating);
bool Reservar(Cliente &cliente, int idnumero, data data_inicial, data data_final, int lugaresperados, vector <int> numquartos);
bool Reservar(int nif, int idnumero, data data_inicial, data data_final, int lugaresperados, vector <int> numquartos);
void CancelarReserva(Cliente &cliente, int idreserva);
void CancelarReserva(int nif, int idreserva);
void CheckIn(Cliente &cliente);
void CheckIn(int nif);
void CheckOut(Cliente &cliente);
void CheckOut(int nif);
const list <Funcionario> Pesquisa_F_Salario(bool inverso);
const list <Funcionario> Pesquisa_F_Cargo();
const list <Reserva> RestringirClientesNovos(bool clientes_novos);
const list <Reserva> RestringirClientesNovos(bool clientes_novos, list<Reserva> creservas);
const list <Reserva *> P_RestringirClientesNovos(bool clientes_novos, list<Reserva *> creservas);
const list <Reserva> Pesquisa_Reservas_Duracao(bool inverso, bool clientes_novos, bool clientes_novos_primeiro);
const list <Reserva> Pesquisa_Reservas_Preco(bool inverso, bool clientes_novos, bool clientes_novos_primeiro);
const list <Reserva> Pesquisa_Reservas_DataI(bool inverso, bool clientes_novos, bool clientes_novos_primeiro);
const list <Reserva> Pesquisa_Reservas_DataI(bool inverso, bool clientes_novos, bool clientes_novos_primeiro, list <Reserva> creservas);
const list <Reserva *> P_Pesquisa_Reservas_DataI(bool inverso, bool clientes_novos, bool clientes_novos_primeiro, list<Reserva *> creservas);
const list <Reserva> Pesquisa_Reservas_DataF(bool inverso, bool clientes_novos, bool clientes_novos_primeiro);
const list <Reserva> Pesquisa_Reservas_DataF(bool inverso, bool clientes_novos, bool clientes_novos_primeiro, list <Reserva> creservas);
const list <Reserva *> P_Pesquisa_Reservas_DataF(bool inverso, bool clientes_novos, bool clientes_novos_primeiro, list <Reserva *> creservas);
list <Reserva *> ReservasSobrepostas(data datai, data dataf);
list <Reserva *> Reservas_Fin(int mesp, int anop);
list <Servico *> Servicos_Fin(int mesp, int anop);
list <Quarto *> Quartos_Disponiveis(data data_inicial, data data_final);
float CustosTotais(float impostos, float despesasfixas);
data DiaFinal(int mesp, int anop);
float RendimentosTotais(int mes, int ano);
float BalancoFin(int mes, int ano, float impostos, float despesasfixas);
tipo_cargo EscolherCargo();
tipo_turno EscolherTurno();
int EscolherPiso();
void Contratar(string nome, int nif, tipo_cargo cargo);
void Contratar(string nome, int nif);
void Despedir(int nif);
void AddAnoServico(int idf);
void SetSalario(int idf, float novosalario);
bool PrestarServico(Cliente &cliente, Servico servico);
bool PrestarServico(int nif, Servico servico);
bool PrestarServico(int nif, string nome, int idnumero, data data_realizacao, float taxa);
bool PrestarServico(int nif, string nome, int idnumero, data data_realizacao, float taxa, vector <int> funcsnif);
bool PrestarServico(int nif, string nome, int idnumero, data data_realizacao, float taxa, vector <int> numprods, float margem_lucro);
bool PrestarServico(int nif, string nome, int idnumero, data data_realizacao, float taxa, vector <int> funcsnif, vector <int> numprods, float margem_lucro);
void Promocoes(F_Gestor fgestor, vector<int> numquartos);
Produto EscolherProduto(F_Gestor fgestor, vector<int> numprodutos);
Produto EscolherProduto(F_Gestor fgestor, list<Produto *> lprodutos);
void ImportarQuartos(string localizacao);
void ImportarClientes(string localizacao);
void ImportarFuncionarios(string localizacao);
void ImportarProdutos(string localizacao);
void ImportarReservas(string localizacao);
void ImportarServicos(string localizacao);
void ImportarVeiculos(string localizacao);
void ImportarCompras(string localizacao);
void EscreverHotel(string nomeficheiro);
template <class T>
int EncontrarIndex(vector <T> v, T elemento);
template <class T>
void ApagarElementoV(vector <T> v, int index) {v.erase(v.begin() + index);}
template <class T>
void ApagarElementoL(list <T> l, T elemento);
template <class T>
void ApagarElementoID(list <T> &l, int id){
for(auto it = l.begin(); it != l.end(); it++){
if((*it).ID() == id){
it = l.erase(it);
break;
}
}
}
void ApagarCliente(int id) {return ApagarElementoID(clientes, id);}
void ApagarQuarto(int id) {return ApagarElementoID(quartos, id);}
void ApagarProduto(int id) {return ApagarElementoID(produtos, id);}
int EncontrarIndexReserva(vector <Reserva> vr, Reserva r);
int EncontrarIndexReserva(vector <Reserva *> vr, Reserva *r);
void ApagarReservaL(list <Reserva> &lr, Reserva r);
void ApagarReservaL(list <Reserva *> &lr, Reserva r);
template <class T>
vector<T> LtoV(const list <T> &l);
template <class T>
list<T> VtoL(const vector <T> &v);
list <Reserva *> PointerListReserva(list <Reserva> l);
list <Funcionario *> PointerListFunc(list <Funcionario> l);
list <Quarto *> PointerListQuarto(list <Quarto> l);
list <Cliente *> PointerListCliente(list <Cliente> l);
list <Produto *> PointerListProduto(list <Produto> l);
list <Reserva> ListReserva(list <Reserva *> pl);
list <Funcionario> ListFunc(list <Funcionario *> pl);
list <Quarto> ListQuarto(list <Quarto *> pl);
list <Cliente> ListCliente(list <Cliente *> pl);
list <Produto> ListProduto(list <Produto *> pl);
void UpdateReservasTotais();
struct ClienteHash //new
{
int operator() (const Cliente& c) const
{
int v = 0;
v = 37 * c.getName()[0];
return v;
}
bool operator() (const Cliente& c1, const Cliente& c2) const
{
if (c1.getNif() == c2.getNif()) return true;
else return false;
}
};
typedef unordered_set<Cliente, ClienteHash, ClienteHash> tabHclientes;
tabHclientes clientes_usuais;
list <Cliente *> GetClientesInicial(char inicial, bool usual);
void PromoIniciais(char p_inicial, char s_inicial);
priority_queue<Compra> compras;
priority_queue<Compra> GetCompras() {return compras;}
Compra PesquisaCompra(int id);
BST<Veiculo> frota;
BST<Veiculo> GetFrota() const;
int numVeiculos() const;
bool addVeiculo(string smatricula, double kms, int lugares, string marca);
bool addVeiculo(string smatricula, double kms, int lugares);
bool addVeiculo(matricula matricula, double kms, int lugares, string marca);
bool addVeiculo(matricula matricula, double kms, int lugares);
bool addVeiculo(Veiculo veiculo);
void alugarFrota(const vector<Veiculo>& rFrota);
void devolveVeiculo(matricula matricula);
Veiculo* pesquisaVeiculo(matricula matricula);
Veiculo* menorKm();
bool Viajar(Cliente cliente, double distancia, string ponto_partida, string destino, int id);
bool Viajar(Cliente cliente, double distancia, int id);
};
#endif //HOTEL_HOTEL_H