Example #1
0
        private void loadInformeListadoProd(object sender, EventArgs e)
        {
            helpers ayudante = new helpers();
            string  sql      = @"SELECT idProducto, nombreProducto, descripcionProducto, cantidadStock, ('$' + CONVERT(VARCHAR, precioUnitario)) as precioUnitario, stockMinimo, idCategoria FROM productos;";

            ayudante.cargarReporte(sql, "datosProductos", informeListadoProd);
        }
Example #2
0
        private void reportViewer1_Load(object sender, EventArgs e)
        {
            helpers ayudante = new helpers();
            string  sql      = @"SELECT v.idProducto , p.nombreProducto FROM detalleVentas v JOIN productos p ON v.idProducto = p.idProducto;";

            ayudante.cargarReporte(sql, "DataSet1", reportViewer1);
        }
Example #3
0
        private void loadEstadProductosPorCategoria(object sender, EventArgs e)
        {
            helpers ayudante = new helpers();
            string  sql      = @"SELECT p.idProducto, p.idCategoria, c.nombreCategoria as stockMinimo FROM productos p JOIN categoriasProductos c ON p.idCategoria = c.idCategoria;";

            ayudante.cargarReporte(sql, "DataSet1", estadProductosPorCategoria);
        }
Example #4
0
        private void estadCantidadVentasMensuales_Load(object sender, EventArgs e)
        {
            helpers ayudante = new helpers();
            string  sql      = @"SELECT MONTH(ventas.fechaHora) as nroCliente, ventas.idFactura FROM ventas WHERE YEAR(ventas.fechaHora) = '" + DateTime.Now.Year.ToString() + "' ORDER BY MONTH(ventas.fechaHora);";

            ayudante.cargarReporte(sql, "DataSet1", estadCantidadVentasMensuales);
        }
Example #5
0
        private void loadEstadGananciaApilada(object sender, EventArgs e)
        {
            helpers ayudante = new helpers();
            string  sql      = @"SELECT * FROM estadisticaVentasApiladas ORDER BY mes;";

            ayudante.cargarReporte(sql, "vistaVentaApilada", estadGananciaApilada);
        }
Example #6
0
        private void reportViewer1_Load(object sender, EventArgs e)
        {
            helpers ayudante = new helpers();
            string  sql      = @"SELECT e.nombre , e.sigueTrabajando FROM empleados e;";

            ayudante.cargarReporte(sql, "DataSet1", reportViewer1);
        }
Example #7
0
        private void loadEstadClientesPorLocalidades(object sender, EventArgs e)
        {
            helpers ayudante = new helpers();
            string  sql      = @"SELECT c.nroCliente, l.nombre as nombre  FROM clientesMayoristas c JOIN localidades l ON c.codPostal = l.codPostal;";

            ayudante.cargarReporte(sql, "DataSet1", estadClientesPorLocalidades);
        }
Example #8
0
        private void LoadInformeClientesMay(object sender, EventArgs e)
        {
            helpers ayudante = new helpers();
            string  sql      = @"SELECT c.nroCliente, c.nombre, c.apellido, c.calle, c.nroCalle, c.codPostal, t.nombreTipoDoc as tipoDocumento, c.nroDocumento, c.email, c.telefono 
            FROM clientesMayoristas c JOIN tipoDocumento t ON c.tipoDocumento = t.idTipoDoc;";

            ayudante.cargarReporte(sql, "DataSet1", informeClientesMay);
        }
Example #9
0
        private void loadInformeProdFaltantes(object sender, EventArgs e)
        {
            helpers ayudante = new helpers();
            string  sql      = @"SELECT idProducto, nombreProducto, descripcionProducto, stockMinimo, cantidadStock, (stockMinimo - cantidadStock) AS idCategoria 
FROM productos WHERE (stockMinimo - cantidadStock) > 0;";

            ayudante.cargarReporte(sql, "DataSet1", informeProdFaltantes);
        }
Example #10
0
        private void loadEstadTiposPagosAnuales(object sender, EventArgs e)
        {
            helpers ayudante = new helpers();
            string  sql      = @"SELECT v.idFactura, t.nombreTipoPago as nroCliente FROM ventas v JOIN tiposPagos t ON v.tipoPago = t.idTipoPago 
            WHERE YEAR(v.fechaHora) = '" + DateTime.Now.Year.ToString() + "';";

            ayudante.cargarReporte(sql, "DataSet1", estadTiposPagosAnuales);
        }
Example #11
0
        private void loadInformeDiarioGanan(object sender, EventArgs e)
        {
            helpers ayudante = new helpers();
            string  sql      = @"SELECT idFactura, importeTotal, ROUND(importeTotal * 0.21, 2) as idEmpleado, 
            ROUND(importeTotal * 0.79, 2) as tipoPago FROM ventas WHERE CONVERT(DATE, fechaHora) = '" + ayudante.insertarFechaConFormato(DateTime.Now.ToString("dd/MM/yyyy")) + "';";

            ayudante.cargarReporte(sql, "DataSet1", informeDiarioGanan);
        }
Example #12
0
        private void loadEstadVentasPorLocalidades(object sender, EventArgs e)
        {
            helpers ayudante = new helpers();
            string  sql      = @"SELECT v.idFactura, l.nombre AS nroCliente FROM ventas v 
            JOIN clientesMayoristas c ON v.nroCliente = c.nroCliente 
            JOIN localidades l ON l.codPostal = c.codPostal;";

            ayudante.cargarReporte(sql, "DataSet1", estadVentasPorLocalidades);
        }
Example #13
0
        private void LoadInformeEmplead(object sender, EventArgs e)
        {
            helpers ayudante = new helpers();
            string  sql      = @"SELECT e.idEmpleado, e.usuario, e.nombre, e.apellido, CONVERT(DATE, e.fechaNacimiento) as fechaNacimiento, CONVERT(DATE, e.fechaIngreso) as fechaIngreso, 'SI' as sigueTrabajando, p.nombrePerfil as idPerfil from empleados e join perfil p ON e.idPerfil = p.idPerfil WHERE sigueTrabajando = 1
            UNION
            SELECT e.idEmpleado, e.usuario, e.nombre, e.apellido, CONVERT(DATE, e.fechaNacimiento) as fechaNacimiento, CONVERT(DATE, e.fechaIngreso) as fechaIngreso, 'NO' as sigueTrabajando, p.nombrePerfil as idPerfil from empleados e join perfil p ON e.idPerfil = p.idPerfil WHERE sigueTrabajando = 0";

            ayudante.cargarReporte(sql, "DataSet1", informeEmplead);
        }
Example #14
0
        private void LoadInformeClientesMayMenor(object sender, EventArgs e)
        {
            helpers ayudante = new helpers();
            string  sql      = @"SELECT TOP 25 c.nroCliente, c.nombre, c.apellido, COUNT(v.idFactura) AS nroCalle, SUM(v.importeTotal) AS codPostal 
            FROM clientesMayoristas c JOIN ventas v ON v.nroCliente = c.nroCliente 
            GROUP BY c.nroCliente, c.nombre, c.apellido ORDER BY SUM(v.importeTotal);";

            ayudante.cargarReporte(sql, "DataSet1", informeClientesMayMenor);
        }
Example #15
0
        private void loadInformeProdMasVendidos(object sender, EventArgs e)
        {
            helpers ayudante = new helpers();
            string  sql      = @"SELECT TOP 20 p.idProducto, p.nombreProducto, p.descripcionProducto, SUM(d.cantidad) AS stockMinimo
            FROM productos p JOIN detalleVentas d ON p.idProducto = d.idProducto 
            GROUP BY p.idProducto, p.nombreProducto, p.descripcionProducto 
            ORDER BY SUM(d.cantidad) DESC;";

            ayudante.cargarReporte(sql, "fullDataSet", informeProdMasVendidos);
        }
Example #16
0
        private void consultar(object sender, EventArgs e)
        {
            if (empleados.Count == 0)
            {
                MessageBox.Show("Debes agregar empleados!");
                return;
            }

            string listaEmpleados = "";

            for (int i = 0; i < empleados.Count; i++)
            {
                if (i == empleados.Count - 1)
                {
                    listaEmpleados += "'" + empleados[i] + "'";
                }
                else
                {
                    listaEmpleados += "'" + empleados[i] + "',";
                }
            }

            helpers ayudante = new helpers();
            string  sql      = @"SELECT e.idEmpleado, e.usuario FROM empleados e JOIN ventas v ON v.idEmpleado = e.idEmpleado
            WHERE e.nombre IN(" + listaEmpleados + ")";

            if (txtMes.Text.Length == 0 && txtAnio.Text.Length == 0)
            {
                sql += " AND MONTH(v.fechaHora) = " + DateTime.Now.Month.ToString() + " AND YEAR(v.fechaHora) = " + DateTime.Now.Year.ToString() + ";";
            }
            else if (txtMes.Text.Length > 0 && txtAnio.Text.Length == 0)
            {
                MessageBox.Show("Debes introducir un año");
                return;
            }
            else if (txtMes.Text.Length == 0 && txtAnio.Text.Length > 0)
            {
                if (!ayudante.esAnioValido(Int32.Parse(txtAnio.Text)))
                {
                    MessageBox.Show("El año o el mes son invalidos");
                    return;
                }
                sql += "AND YEAR(v.fechaHora) = " + txtAnio.Text + ";";
            }
            else
            {
                if (!ayudante.esAnioValido(Int32.Parse(txtAnio.Text)) || !ayudante.esMesValido(Int32.Parse(txtMes.Text)))
                {
                    MessageBox.Show("El año o el mes son invalidos");
                    return;
                }
                sql += " AND MONTH(v.fechaHora) = " + txtMes.Text + " AND YEAR(v.fechaHora) = " + txtAnio.Text + ";";
            }
            ayudante.cargarReporte(sql, "DataSet1", estadVentasPorEmpleado);
        }
Example #17
0
        private void LoadInformeTotalVentasPorCat(object sender, EventArgs e)
        {
            helpers ayudante = new helpers();
            string  sql      = @"SELECT c.nombreCategoria AS idDetalleVenta, SUM(d.cantidad) AS idFactura, COUNT(v.idFactura) AS idProducto, SUM(v.importeTotal) AS precioUnitario
            FROM categoriasProductos c JOIN productos p ON c.idCategoria = p.idCategoria 
            JOIN detalleVentas d ON d.idProducto = p.idProducto
            JOIN ventas v ON v.idFactura = d.idFactura
            GROUP BY c.nombreCategoria;";

            ayudante.cargarReporte(sql, "DataSet1", InformeTotalVentasPorCat);
        }
Example #18
0
        private void consultar(object sender, EventArgs e)
        {
            helpers ayudante = new helpers();

            if (!ayudante.esAnioValido(Int32.Parse(txtAnio.Text)))
            {
                MessageBox.Show("Ingrese un año valido!");
                return;
            }
            string sql = @"SELECT MONTH(ventas.fechaHora) as nroCliente, ventas.idFactura FROM ventas WHERE YEAR(ventas.fechaHora) = '" + txtAnio.Text + "' ORDER BY MONTH(ventas.fechaHora);";

            ayudante.cargarReporte(sql, "DataSet1", estadCantidadVentasMensuales);
        }
Example #19
0
        private void consultar(object sender, EventArgs e)
        {
            helpers ayudante = new helpers();

            if (txtAnio.Text.Length == 0 || !ayudante.esAnioValido(Int32.Parse(txtAnio.Text)))
            {
                MessageBox.Show("El año es invalido!");
                return;
            }
            string sql = @"SELECT * FROM estadisticaGananciaAnual WHERE anio = " + txtAnio.Text + " OR anio IS NULL;";

            ayudante.cargarReporte(sql, "dsGananciaMensual", estadGananciasAnuales);
        }
Example #20
0
        private void consultar(object sender, EventArgs e)
        {
            helpers ayudante = new helpers();

            if (!ayudante.esFechaValida(txtFecha.Text))
            {
                MessageBox.Show("Fecha invalida!");
                return;
            }
            string sql = @"SELECT idFactura, importeTotal, ROUND(importeTotal * 0.21, 2) as idEmpleado, 
            ROUND(importeTotal * 0.79, 2) as tipoPago FROM ventas WHERE CONVERT(DATE, fechaHora) = '" + ayudante.insertarFechaConFormato(txtFecha.Text) + "';";

            ayudante.cargarReporte(sql, "DataSet1", informeDiarioGanan);
        }
Example #21
0
        private void consultar(object sender, EventArgs e)
        {
            helpers ayudante = new helpers();

            if (txtAnio.Text.Length == 0 || !ayudante.esAnioValido(Int32.Parse(txtAnio.Text)))
            {
                MessageBox.Show("Ingrese un año valido!");
                return;
            }
            string sql = @"SELECT v.idFactura, t.nombreTipoPago as nroCliente FROM ventas v JOIN tiposPagos t ON v.tipoPago = t.idTipoPago 
            WHERE YEAR(v.fechaHora) = '" + txtAnio.Text + "'";

            if (txtMes.Text.Length > 0 && ayudante.esMesValido(Int32.Parse(txtMes.Text)))
            {
                sql += " AND MONTH(v.fechaHora) = '" + txtMes.Text + "';";
            }
            ayudante.cargarReporte(sql, "DataSet1", estadTiposPagosAnuales);
        }
Example #22
0
        private void consultarVentasMensuales(object sender, EventArgs e)
        {
            helpers ayudante = new helpers();

            if (!ayudante.esAnioValido(Int32.Parse(txtAnio.Text)) || !ayudante.esMesValido(Int32.Parse(txtMes.Text)))
            {
                MessageBox.Show("Año o mes invalido!");
                return;
            }
            string sql = @"SELECT e.idEmpleado, e.nombre, e.apellido, SUM(d.cantidad) as usuario, 
            (SELECT COUNT(*) FROM detalleVentas de JOIN ventas ve ON de.idFactura = ve.idFactura WHERE idDetalleVenta = 1 AND e.idEmpleado = ve.idEmpleado AND MONTH(ve.fechaHora) = '" + txtMes.Text + @"' AND YEAR(ve.fechaHora) = '" + txtAnio.Text +
                         @"') as contrasenia,
            (SELECT SUM(ventas.importeTotal) FROM ventas WHERE ventas.idEmpleado = e.idEmpleado AND MONTH(ventas.fechaHora) = '" + txtMes.Text + @"' AND YEAR(ventas.fechaHora) = '" + txtAnio.Text +
                         @"') AS sigueTrabajando
            FROM empleados e JOIN ventas v ON e.idEmpleado = v.idEmpleado 
            JOIN detalleVentas d ON v.idFactura = d.idFactura
            WHERE MONTH(v.fechaHora) = '" + txtMes.Text + @"' AND YEAR(v.fechaHora) = '" + txtAnio.Text +
                         @"' GROUP BY e.idEmpleado, e.nombre, e.apellido";

            ayudante.cargarReporte(sql, "DataSet1", informeMensVentas);
        }