Documentos de Académico
Documentos de Profesional
Documentos de Cultura
h"
#include "Windows.h"
#include <iostream>
#include <cstdlib>
#include <string>
#include <ctime>
#include <iomanip>
struct Comprador {
string nombre;
string apellidos;
string direccion;
};
struct Producto {
string codigo;
string descripcion;
double precio;
};
struct Fecha {
int dia;
int mes;
int anho;
int hor;
int min;
};
struct Detalle {
Producto prod;
int cantidad;
double costo;
};
struct Venta {
Fecha f;
Comprador comp;
double total;
double igv;
int nProds ;
Detalle prod[128];
int tipoMoneda ;
};
Venta venta[128];
int nVentas = 0;
Producto prod[128];
int nProds = 0;
string verFecha(Fecha f) {
return "" + to_string(f.dia) + "-" + to_string(f.mes) + "-" +
to_string(f.anho) + " "
+ to_string(f.hor) + ":" + to_string(f.min);
}
localtime_s(&now, &t);
venta[idx].f.min = now.tm_min;
venta[idx].f.hor = now.tm_hour;
venta[idx].f.dia = now.tm_mday;
venta[idx].f.mes = now.tm_mon + 1;
venta[idx].f.anho = now.tm_year + 1900;
}
char menu() {
system("CLS");
char op;
if (!hayVenta)
cout << " 1. Nueva venta." << endl;
else
cout << " 1. Ver venta actual." << endl;
cout << " 2. Historial de Ventas." << endl;
cout << " 3. Nuevo producto." << endl;
cout << " 4. Ver productos." << endl;
cout << " 5. Cambiar IGV." << endl;
cout << " 6. Salir." << endl << endl;
return op;
}
int op;
void verVentas() {
system("CLS");
int op, nro;
void nuevoProducto() {
system("CLS");
cin.ignore();
cout << " Descripcion: ";
getline(cin, prod[nProds].descripcion);
nProds++;
}
void nuevaVenta() {
system("CLS");
cin.ignore();
cout << "Datos del Comprador: " << endl;
cout << " Apellidos: ";
getline(cin, venta[nVentas].comp.apellidos);
venta[nVentas].total = 0;
venta[nVentas].igv = IGV;
nVentas++;
hayVenta = true;
void verProductos() {
system("CLS");
if (hayVenta) {
cout << endl << " Deseas seleccionar producto? (SI = 1 / No = 0) : ";
cin >> op;
if (op) {
cout << " Ingrese codigo: ";
cin >> codigo;
int idx = buscarProducto(codigo);
if (idx != -1) {
cout << " Ingrese cantidad: ";
cin >> cant;
int i = buscarProducto(nVentas - 1, codigo);
double v = cant * prod[idx].precio;
if (i == -1) {
venta[nVentas - 1].prod[venta[nVentas -
1].nProds].prod = prod[idx];
venta[nVentas - 1].prod[venta[nVentas -
1].nProds].cantidad = cant;
venta[nVentas - 1].prod[venta[nVentas -
1].nProds].costo = v;
venta[nVentas - 1].nProds++;
}
else {
venta[nVentas - 1].prod[i].cantidad += cant;
venta[nVentas - 1].prod[i].costo += v;
}
venta[nVentas - 1].total += (1.0 + venta[nVentas - 1].igv
/ 100.0) * v;
}
}
}
cout << endl;
system("PAUSE");
}
void cambiarIGV() {
system("CLS");
cout << " Valor IGV actual: " << IGV << "%" << endl;
cout << " Nuevo valor (%) : ";
cin >> IGV;
}
int main() {
char op;
return 0;
}