Exemplo n.º 1
0
        public static List <Reporte_Ventas> BuscarProductosMasVendidos()
        {
            connection.Close();
            connection.Open();
            List <Reporte_Ventas> _listaventas = new List <Reporte_Ventas>();
            MySqlCommand          cmd          = new MySqlCommand();

            cmd.Connection = connection;
            DataTable Tabla = new DataTable();

            MySqlParameter[] oParam  = { };
            string           proceso = "ProductoMasVendido";
            MySqlDataAdapter dt      = new MySqlDataAdapter(proceso, connection);

            dt.SelectCommand.CommandType = CommandType.StoredProcedure;
            dt.SelectCommand.Parameters.AddRange(oParam);
            dt.Fill(Tabla);
            if (Tabla.Rows.Count > 0)
            {
                foreach (DataRow item in Tabla.Rows)
                {
                    Entidades.Reporte_Ventas listaVentas = new Entidades.Reporte_Ventas();
                    listaVentas.DescripcionProducto = item["txDescripcion"].ToString();
                    listaVentas.ProductoMasVendido  = Convert.ToInt32(item["TotalVentas"].ToString());
                    _listaventas.Add(listaVentas);
                }
            }
            connection.Close();
            return(_listaventas);
        }
Exemplo n.º 2
0
        public static List <Reporte_Ventas> BuscarVentasPorMes()
        {
            String Año = DateTime.Now.Year.ToString();

            string   FechaArmadaDesde = "01/01/" + Año;
            DateTime FechaDesde       = Convert.ToDateTime(FechaArmadaDesde);

            string   FechaArmadaHasta = "31/12/" + Año;
            DateTime FechaHasta       = Convert.ToDateTime(FechaArmadaHasta);

            connection.Close();
            connection.Open();
            List <Reporte_Ventas> _listaVentas = new List <Reporte_Ventas>();
            MySqlCommand          cmd          = new MySqlCommand();

            cmd.Connection = connection;
            DataTable Tabla = new DataTable();

            MySqlParameter[] oParam = { new MySqlParameter("FechaDesde_in", FechaDesde),
                                        new MySqlParameter("FechaHasta_in", FechaHasta) };
            string           proceso = "BuscarVentasPorMes";
            MySqlDataAdapter dt      = new MySqlDataAdapter(proceso, connection);

            dt.SelectCommand.CommandType = CommandType.StoredProcedure;
            dt.SelectCommand.Parameters.AddRange(oParam);
            dt.Fill(Tabla);
            if (Tabla.Rows.Count > 0)
            {
                foreach (DataRow item in Tabla.Rows)
                {
                    Entidades.Reporte_Ventas listaVentas = new Entidades.Reporte_Ventas();
                    //listaProveedores.idProveedor = Convert.ToInt32(item["idProducto"].ToString());
                    listaVentas.mes = item["mes"].ToString();
                    if (Convert.ToInt32(item["Ventas"].ToString()) > 0)
                    {
                        listaVentas.TotalVentasPorMes = Convert.ToInt32(item["Ventas"].ToString());
                    }
                    else
                    {
                        listaVentas.TotalVentasPorMes = 0;
                    }
                    _listaVentas.Add(listaVentas);
                }
            }
            connection.Close();
            return(_listaVentas);
        }
Exemplo n.º 3
0
        public static List <Reporte_Ventas> BuscarTodasLasVentas()
        {
            String Año = DateTime.Now.Year.ToString();

            string   FechaArmadaDesde = "01/01/" + Año;
            DateTime FechaDesde       = Convert.ToDateTime(FechaArmadaDesde);

            string   FechaArmadaHasta = "31/12/" + Año;
            DateTime FechaHasta       = Convert.ToDateTime(FechaArmadaHasta);

            connection.Close();
            connection.Open();
            List <Reporte_Ventas> _listaventas = new List <Reporte_Ventas>();
            MySqlCommand          cmd          = new MySqlCommand();

            cmd.Connection = connection;
            DataTable Tabla = new DataTable();

            MySqlParameter[] oParam = { new MySqlParameter("FechaDesde_in", FechaDesde),
                                        new MySqlParameter("FechaHasta_in", FechaHasta) };
            string           proceso = "BuscarTodasLasVentas";
            MySqlDataAdapter dt      = new MySqlDataAdapter(proceso, connection);

            dt.SelectCommand.CommandType = CommandType.StoredProcedure;
            dt.SelectCommand.Parameters.AddRange(oParam);
            dt.Fill(Tabla);
            if (Tabla.Rows.Count > 0)
            {
                foreach (DataRow item in Tabla.Rows)
                {
                    Entidades.Reporte_Ventas listaVentas = new Entidades.Reporte_Ventas();
                    listaVentas.Fecha  = Convert.ToDateTime(item["dtFecha"].ToString());
                    listaVentas.Precio = Convert.ToDecimal(item["txPrecioVentaFinal"].ToString());
                    _listaventas.Add(listaVentas);
                }
            }
            connection.Close();
            return(_listaventas);
        }
Exemplo n.º 4
0
        public static List <Reporte_Ventas> CajaDeVentas()
        {
            connection.Close();
            connection.Open();
            List <Reporte_Ventas> _listaventas = new List <Reporte_Ventas>();
            MySqlCommand          cmd          = new MySqlCommand();

            cmd.Connection = connection;
            DataTable Tabla = new DataTable();

            MySqlParameter[] oParam  = { };
            string           proceso = "CajaDeVentas";
            MySqlDataAdapter dt      = new MySqlDataAdapter(proceso, connection);

            dt.SelectCommand.CommandType = CommandType.StoredProcedure;
            dt.SelectCommand.Parameters.AddRange(oParam);
            dt.Fill(Tabla);
            if (Tabla.Rows.Count > 0)
            {
                foreach (DataRow item in Tabla.Rows)
                {
                    Entidades.Reporte_Ventas listaVentas = new Entidades.Reporte_Ventas();
                    if (item["Total"].ToString() != null && item["Total"].ToString() != "" && Convert.ToDecimal(item["Total"].ToString()) > 0)
                    {
                        listaVentas.CajaDeVentas = Convert.ToDecimal(item["Total"].ToString());
                    }
                    else
                    {
                        listaVentas.CajaDeVentas = 0;
                    }
                    _listaventas.Add(listaVentas);
                }
            }
            connection.Close();
            return(_listaventas);
        }