import React, { useState, useEffect } from 'react'; import { PlusCircle, Trash2, Edit3, Calendar, Calculator, Save, DollarSign, TrendingUp, History, AlertCircle } from 'lucide-react'; // Paleta de colores basada en el logo const COLORS = { blue: '#0066cc', red: '#e62e2d', yellow: '#ffcc00', green: '#28a745', dark: '#212529', light: '#f8f9fa' }; const DENOMINACIONES = [ { valor: 1000, tipo: 'billete' }, { valor: 500, tipo: 'billete' }, { valor: 200, tipo: 'billete' }, { valor: 100, tipo: 'billete' }, { valor: 50, tipo: 'billete' }, { valor: 20, tipo: 'billete' }, { valor: 10, tipo: 'billete' }, { valor: 5, tipo: 'moneda' }, { valor: 1, tipo: 'moneda' }, { valor: 0.50, tipo: 'moneda' }, { valor: 0.25, tipo: 'moneda' }, { valor: 0.10, tipo: 'moneda' }, { valor: 0.05, tipo: 'moneda' } ]; export default function App() { const [view, setView] = useState('ventas'); // 'ventas', 'cierre', 'historial' const [ventas, setVentas] = useState([]); const [descripcion, setDescripcion] = useState(''); const [monto, setMonto] = useState(''); const [selectedDate, setSelectedDate] = useState(new Date().toISOString().split('T')[0]); const [conteo, setConteo] = useState({}); // Simulación de carga de datos iniciales useEffect(() => { const mockVentas = [ { id: 1, descripcion: 'Impresión BN x10', monto: 30, fecha: new Date().toISOString().split('T')[0] }, { id: 2, descripcion: 'Trámite en línea', monto: 150, fecha: new Date().toISOString().split('T')[0] }, ]; setVentas(mockVentas); }, []); // Lógica de Ventas const agregarVenta = (e) => { e.preventDefault(); if (!descripcion || !monto) return; const nuevaVenta = { id: Date.now(), descripcion, monto: parseFloat(monto), fecha: new Date().toISOString().split('T')[0] }; setVentas([...ventas, nuevaVenta]); setDescripcion(''); setMonto(''); }; const eliminarVenta = (id) => { setVentas(ventas.filter(v => v.id !== id)); }; const totalDia = ventas .filter(v => v.fecha === selectedDate) .reduce((acc, curr) => acc + curr.monto, 0); // Lógica de Cierre const handleConteoChange = (valor, cantidad) => { setConteo({ ...conteo, [valor]: parseInt(cantidad) || 0 }); }; const totalFisico = Object.entries(conteo).reduce((acc, [valor, cant]) => acc + (parseFloat(valor) * cant), 0); return (
{/* Header Estilo Logo */}
{/* Representación visual del logo con círculos de colores */}

Ciber

Multiservicios Blandón

{/* VISTA: VENTAS Y REGISTRO */} {view === 'ventas' && (
{/* Registro de Venta */}

Registrar Venta

setDescripcion(e.target.value)} />
setMonto(e.target.value)} />
{/* Saldo de Hoy */}

Saldo que llevo hoy

C$ {totalDia.toFixed(2)}

{/* Listado de Ventas */}

Ventas Registradas (Hoy)

{ventas.length} Transacciones
{ventas.length > 0 ? ( ventas.map((v) => ( )) ) : ( )}
Descripción Monto Acciones
{v.descripcion} C$ {v.monto.toFixed(2)}
No hay ventas registradas hoy
)} {/* VISTA: CIERRE DE CAJA (Calculadora Nicaragua) */} {view === 'cierre' && (

Conteo de Dinero (Córdobas)

Total en Ventas

C$ {totalDia.toFixed(2)}

{/* Billetes */}

Billetes

{DENOMINACIONES.filter(d => d.tipo === 'billete').map(d => (
C$ {d.valor}
handleConteoChange(d.valor, e.target.value)} />
= {(conteo[d.valor] || 0) * d.valor}
))}
{/* Monedas */}

Monedas

{DENOMINACIONES.filter(d => d.tipo === 'moneda').map(d => (
C$ {d.valor.toFixed(2)}
handleConteoChange(d.valor, e.target.value)} />
= {((conteo[d.valor] || 0) * d.valor).toFixed(2)}
))}

Suma Total Física:

C$ {totalFisico.toFixed(2)}

{totalFisico - totalDia === 0 ? '¡Caja Cuadrada!' : `Diferencia: C$ ${(totalFisico - totalDia).toFixed(2)}`}
)} {/* VISTA: HISTORIAL */} {view === 'historial' && (

Consultar Fecha

Busca ventas de días anteriores

setSelectedDate(e.target.value)} />

Resumen del día seleccionado

C$ {totalDia.toFixed(2)}

{/* Si no hay ventas, mostramos el aviso que pediste */} {totalDia === 0 && (

No se registraron ventas

No se encontraron movimientos financieros para la fecha seleccionada: {selectedDate}

)} {totalDia > 0 && (
{ventas.filter(v => v.fecha === selectedDate).map(v => ( ))}
Descripción Monto Hora/Estado
{v.descripcion} C$ {v.monto.toFixed(2)} Completado
)}
)}
); }