-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFactura.cpp
More file actions
executable file
·168 lines (137 loc) · 3.09 KB
/
Factura.cpp
File metadata and controls
executable file
·168 lines (137 loc) · 3.09 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
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
// Created by Hugo.
#include "Factura.h"
using namespace std;
Factura::Factura() : listaProdFactura()
{}
Factura::Factura(Factura &fac) : codigoFactura(fac.codigoFactura), codigoCliente(fac.codigoCliente), rfcCliente(fac.rfcCliente), codigoVenta(fac.codigoVenta),listaProdFactura(fac.listaProdFactura), total(fac.total), iva(fac.iva)
{
}
Factura::Factura(ListProd &lista) : listaProdFactura(lista)
{
}
void Factura::setCodigoFactura(std::string codF)
{
codigoFactura = codF;
}
void Factura::setCodigoCliente(std::string codC)
{
codigoCliente = codC;
///// buscar cliente en la lista de clientes cargada desde menu clientes
/////retrieve el cliente con el codigo == codC
/////usar setear el rfc.
//
//MenuClientes mClientes;
//mClientes.cargarLista();
//ListaClientes listClnts(mClientes.getListaClientesRam());
/////find data nos da el nodo
/////retrieve nos regresa el cliente
/////seteamos el rfc del cliente
//
//Cliente auxCliente;
//auxCliente.setCodigoCliente(codC);
//NodoCliente* auxNodo;
//auxNodo = listClnts.findData(auxCliente);
//Cliente clnt(listClnts.retrieve(auxNodo));
//
//string rfcReal;
//rfcReal = clnt.getRfc();
//
//setRFC(rfcReal);
}
void Factura::setRFC(std::string rfc)
{
rfcCliente = rfc;
}
void Factura::setCodigoVenta(std::string codV)
{
codigoVenta = codV;
}
void Factura::setListaProdFactura(ListProd &lista)
{
listaProdFactura = lista;
}
void Factura::setTotal(float tot)
{
total = tot;
setIva();
}
void Factura::setIva()
{
iva = total*0.16;
}
std::string Factura::getCodigoFactura()
{
return codigoFactura;
}
std::string Factura::getCodCliente()
{
return codigoCliente;
}
std::string Factura::getCodVenta()
{
return codigoVenta;
}
std::string Factura::getRFC()
{
return rfcCliente;
}
ListProd Factura::getListaProdFactura()
{
return listaProdFactura;
}
float Factura::getTotal()
{
return total;
}
float Factura::getIVA()
{
return iva;
}
std::string Factura::toString()
{
string mystr("Codigo:\t");
mystr += codigoFactura;
mystr += "\tCodigo cliente:\t";
mystr += codigoCliente;
mystr += "\nRFC:\t";
mystr += rfcCliente;
mystr += "\tCodigo de venta\t";
mystr += codigoVenta;
mystr += "\n\nLista de productos:\n";
mystr += listaProdFactura.toString();
mystr += "\n\nIVA:\t";
mystr += to_string(iva);
mystr += "\tTotal:\t";
mystr += to_string(total);
return mystr;
}
void Factura::read(string filename) //filename = "factura" + codigo
{
listaProdFactura.read(filename);
}
void Factura::write(string filename)//filename = "factura" + codigo
{
// if (filename == "")
// {
// string mySTR("factura");
// mySTR += codigoFactura;
// mySTR += ".txt";
// listaProdFactura.write(mySTR);
// } else
// {
listaProdFactura.write(filename);
}
Factura &Factura::operator=(Factura &fac)
{
codigoFactura = fac.codigoFactura;
codigoCliente = fac.codigoCliente;
rfcCliente = fac.rfcCliente;
codigoVenta = fac.codigoVenta;
listaProdFactura = fac.listaProdFactura;
total = fac.total;
iva = fac.iva;
}
bool Factura::operator==(Factura &fac)
{
return codigoFactura == fac.codigoFactura;
}