Exemplo n.º 1
0
        public ActionResult Reportes(string funcion)
        {
            DataTable reporte = rep.VentasPorMes();

            String[] meses    = new string[reporte.Rows.Count];
            String[] ganancia = new string[reporte.Rows.Count];
            for (int i = 0; i < reporte.Rows.Count; i++)
            {
                meses[i]    = reporte.Rows[i][1].ToString();
                ganancia[i] = reporte.Rows[i][0].ToString();
            }
            object[] grafica = new object[4];
            grafica[0] = meses;
            grafica[1] = ganancia;
            DataTable productos = rep.ProductosMasVendidos();

            String[] cantidad = new string[productos.Rows.Count];
            String[] producto = new string[productos.Rows.Count];
            for (int i = 0; i < productos.Rows.Count; i++)
            {
                cantidad[i] = productos.Rows[i][1].ToString();
                producto[i] = productos.Rows[i][0].ToString();
            }
            grafica[2] = cantidad;
            grafica[3] = producto;
            return(Json(grafica, JsonRequestBehavior.AllowGet));
        }