-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVenta.cpp
More file actions
105 lines (82 loc) · 1.92 KB
/
Venta.cpp
File metadata and controls
105 lines (82 loc) · 1.92 KB
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
#include "Venta.h"
Venta::Venta() : listaProdVenta()
{}
Venta::Venta(Venta &v) : codigoVenta(v.codigoVenta), codigoCliente(v.codigoCliente), codigoEmpleado(v.codigoEmpleado),
listaProdVenta(v.listaProdVenta), total(v.total)
{}
Venta::Venta(ListProd &listaProductos) : listaProdVenta(listaProductos)
{}
void Venta::setCodigoVenta(std::string codV)
{
codigoVenta = codV;
}
void Venta::setCodigoCliente(std::string codC)
{
codigoCliente = codC;
}
void Venta::setCodigoEmpleado(std::string codE)
{
codigoEmpleado = codE;
}
void Venta::setTotal(float t)
{
total = t;
}
void Venta::setListaProductosVenta(ListProd &lista)
{
listaProdVenta = lista;
}
std::string Venta::getCodigoVenta()
{
return codigoVenta;
}
std::string Venta::getCodigoCliente()
{
return codigoCliente;
}
std::string Venta::getCodigoEmpleado()
{
return codigoEmpleado;
}
float Venta::getTotal()
{
return total;
}
ListProd Venta::getListaProductosVenta()
{
return listaProdVenta;
}
std::string Venta::toString()
{
std::string mystr("Codigo de venta:");
mystr += codigoVenta;
mystr += "\tCodigo cliente:\t";
mystr += codigoCliente;
mystr += "\tCodigo de empleado:\t";
mystr += codigoEmpleado;
mystr += "\n\nLista de productos:\n";
mystr += listaProdVenta.toString();
mystr += "\tTotal:\t";
mystr += std::to_string(total);
return mystr;
}
Venta &Venta::operator=(Venta &v)
{
codigoVenta = v.codigoVenta;
codigoCliente = v.codigoCliente;
codigoEmpleado = v.codigoEmpleado;
listaProdVenta = v.listaProdVenta;
total = v.total;
}
void Venta::readListaProductos(std::string fileName) //filename = "venta" + codigoVenta
{
listaProdVenta.read(fileName);
}
void Venta::writeListaProductos(std::string fileName) //filename = "venta" + codigoVenta
{
listaProdVenta.write(fileName);
}
bool Venta::operator==(Venta &v)
{
return v.codigoVenta == codigoVenta;
}