-
Notifications
You must be signed in to change notification settings - Fork 0
/
OrdenCompra.cpp
executable file
·110 lines (76 loc) · 2.41 KB
/
OrdenCompra.cpp
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
#include "OrdenCompra.h"
using namespace std;
OrdenCompra::OrdenCompra() : listaProdOrdenCompra()
{
}
OrdenCompra::OrdenCompra(OrdenCompra &pedido) : code(pedido.code), userCode(pedido.userCode), codigoProveedor(pedido.codigoProveedor), listaProdOrdenCompra(pedido.listaProdOrdenCompra), totalPedido(pedido.totalPedido)
{
}
OrdenCompra::OrdenCompra(ListProd& lista) : listaProdOrdenCompra(lista)
{
}
void OrdenCompra::setCode(string codigo) {
code = codigo;
}
void OrdenCompra::setUserCode(string code) {
userCode = code;
}
void OrdenCompra::setCodigoProveedor(string code) {
codigoProveedor = code;
}
void OrdenCompra::setListaProdOrdenCompra(ListProd& lista) {
listaProdOrdenCompra = lista;
}
void OrdenCompra::setTotalPedido(float total) {
totalPedido = total;
}
std::string OrdenCompra::getCode() {
return code;
}
std::string OrdenCompra::getUserCode() {
return userCode;
}
std::string OrdenCompra::getProvCode() {
return codigoProveedor;
}
ListProd OrdenCompra::getListaProdOrdenCompra() {
return listaProdOrdenCompra; // & ?
}
float OrdenCompra::getTotalPedido() {
return totalPedido;
}
void OrdenCompra::read(std::string filename) {
listaProdOrdenCompra.read(filename);
cout << "Se leyo la lista de productos de la orden de compra: " << code << endl;
}
void OrdenCompra::write(std::string filename) { //filename = code
listaProdOrdenCompra.write(filename);
cout << "Se escribio la lista de productos de la orden de compra: " << code << endl;
}
std::string OrdenCompra::toString() {
char data[10];
sprintf(data, "%f", totalPedido);
string ordenString("");
ordenString += "\nCodigo de orden de pago: ";
ordenString += code;
ordenString += "\nCodigo de usuario que realizo la orden: ";
ordenString += userCode;
ordenString += "\nCodigo del proveedor: ";
ordenString += codigoProveedor;
ordenString += "\nLista de productos en la orden:\n\n";
ordenString += listaProdOrdenCompra.toString();
ordenString += "\n\n\t\tTOTAL: ";
ordenString += data;
ordenString += " $\n";
return ordenString;
}
OrdenCompra &OrdenCompra::operator=(OrdenCompra &pedido) {
code = pedido.code;
codigoProveedor = pedido.codigoProveedor;
listaProdOrdenCompra = pedido.listaProdOrdenCompra;
userCode = pedido.userCode;
totalPedido = pedido.totalPedido;
}
bool OrdenCompra::operator==(OrdenCompra &pedido) {
return pedido.code == code;
}