diff --git a/WebLab/Estadisticas/Grafico.aspx b/WebLab/Estadisticas/Grafico.aspx index 1abc6726..28de765c 100644 --- a/WebLab/Estadisticas/Grafico.aspx +++ b/WebLab/Estadisticas/Grafico.aspx @@ -5,14 +5,43 @@ Estadisticas SIL - + <%-- --%> + +
-
- - -
+
+ + +
+ diff --git a/WebLab/Estadisticas/Grafico.aspx.cs b/WebLab/Estadisticas/Grafico.aspx.cs index f61857b5..c6e80061 100644 --- a/WebLab/Estadisticas/Grafico.aspx.cs +++ b/WebLab/Estadisticas/Grafico.aspx.cs @@ -6,18 +6,29 @@ using System.Web.UI.WebControls; using System.Data; using InfoSoftGlobal; +using System.Web.Script.Serialization; namespace WebLab.Estadisticas { public partial class Grafico : System.Web.UI.Page { + public string LabelsJson { get; set; } + public string DatosJson { get; set; } + public string TipoGrafico { get; set; } + public string TituloJson { get; set; } protected void Page_Load(object sender, EventArgs e) { - if (int.Parse(Request["tipo"].ToString())!=2) + //src="Grafico.aspx?valores=' + valores + '&tipo=0&tipoGrafico=' + tipoGrafico + '" + //if (int.Parse(Request["tipo"].ToString()) != 2) - FCLiteral.Text = mostrarGrafico(int.Parse(Request["tipo"].ToString())); - else - FCLiteral.Text = mostrarGrafico2(); ; + // FCLiteral.Text = mostrarGrafico(int.Parse(Request["tipo"].ToString())); + //else + // FCLiteral.Text = mostrarGrafico2(); + + if (!IsPostBack) + { + mostrarGraficoNuevo(int.Parse(Request["tipo"].ToString())); + } } private string mostrarGrafico2() @@ -121,6 +132,53 @@ private string mostrarGrafico(int p) return FusionCharts.RenderChart(s_tipografico, p.ToString(), strXML, p.ToString(), s_ancho, s_alto, false, false); } - + private void mostrarGraficoNuevo(int p) + { + string tipo = ""; + string s_tipo = ""; + List labels = new List(); + List datos = new List(); + + + if (p == 0) + s_tipo = "Casos por tipo de muestra"; + else + { + if (p == 3) + s_tipo = "Casos por Resultados Obtenidos"; + else + s_tipo = "Aislamientos"; + } + + + if (Request["tipoGrafico"] != null) + { + if (Request["tipoGrafico"] == "barra") + tipo = "bar"; + else + tipo = "pie"; + } + + if (!string.IsNullOrEmpty(Request["valores"].ToString())) + { + string[] arr = Request["valores"].ToString().Split((";").ToCharArray()); + + foreach (string item in arr) + { + string[] items = item.Split('|'); + string label = items[0]; + int valor = int.Parse(items[1]); + + labels.Add(label); + datos.Add(valor); + } + } + + var js = new JavaScriptSerializer(); + LabelsJson = js.Serialize(labels); + DatosJson = js.Serialize(datos); + TipoGrafico = js.Serialize(tipo); + TituloJson = js.Serialize(s_tipo); + } } } \ No newline at end of file diff --git a/WebLab/Estadisticas/Grafico.aspx.designer.cs b/WebLab/Estadisticas/Grafico.aspx.designer.cs index bc4b3105..2e1b9b41 100644 --- a/WebLab/Estadisticas/Grafico.aspx.designer.cs +++ b/WebLab/Estadisticas/Grafico.aspx.designer.cs @@ -7,11 +7,13 @@ // //------------------------------------------------------------------------------ -namespace WebLab.Estadisticas { - - - public partial class Grafico { - +namespace WebLab.Estadisticas +{ + + + public partial class Grafico + { + /// /// form1 control. /// @@ -20,7 +22,7 @@ public partial class Grafico { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlForm form1; - + /// /// FCLiteral control. /// @@ -29,5 +31,14 @@ public partial class Grafico { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Literal FCLiteral; + + /// + /// miGrafico control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlGenericControl miGrafico; } } diff --git a/WebLab/Estadisticas/ReporteMicrobiologia.aspx.cs b/WebLab/Estadisticas/ReporteMicrobiologia.aspx.cs index 4a72bc94..6ad856a0 100644 --- a/WebLab/Estadisticas/ReporteMicrobiologia.aspx.cs +++ b/WebLab/Estadisticas/ReporteMicrobiologia.aspx.cs @@ -169,7 +169,7 @@ private void MostrarReporteGeneral() gvTipoMuestra.DataSource =dtTipoMuestra; gvTipoMuestra.DataBind(); - + HFTipoMuestra.Value = getValoresTipoMuestra(); //////////////////////Solapa microorganismos @@ -237,19 +237,19 @@ private void MostrarReporteGeneral() private string getValoresMicroorganismos() { string s_valores = ""; - + for (int i = 0; i < gvMicroorganismos.Rows.Count; i++) { string s_nombre = gvMicroorganismos.Rows[i].Cells[0].Text.Replace(";", ""); s_nombre = s_nombre.Replace("&#", ""); - + if (s_valores == "") - s_valores = "name='" + s_nombre + "' value='" + gvMicroorganismos.Rows[i].Cells[1].Text + "'"; + s_valores = s_nombre + "|" + gvMicroorganismos.Rows[i].Cells[1].Text ; else - s_valores += ";" + "name='" + s_nombre + "' value='" + gvMicroorganismos.Rows[i].Cells[1].Text + "'"; + s_valores += ";" + s_nombre + "|" + gvMicroorganismos.Rows[i].Cells[1].Text ; } - + return s_valores; } @@ -257,15 +257,17 @@ private string getValoresTipoMuestra() { string s_valores = ""; - for (int i = 0; i < gvTipoMuestra.Rows.Count; i++) - { - string s_nombre = gvTipoMuestra.Rows[i].Cells[0].Text.Replace(";", ""); - s_nombre = s_nombre.Replace("&#", ""); - if (s_valores=="") - s_valores = "name='" + s_nombre + "' value='" + gvTipoMuestra.Rows[i].Cells[1].Text + "'"; - else - s_valores += ";" + "name='" + s_nombre + "' value='" + gvTipoMuestra.Rows[i].Cells[1].Text + "'"; - } + for (int i = 0; i < gvTipoMuestra.Rows.Count; i++) + { + string s_nombre = gvTipoMuestra.Rows[i].Cells[0].Text.Replace(";", ""); + s_nombre = s_nombre.Replace("&#", ""); + + if (s_valores == "") + s_valores = s_nombre + "|" + gvTipoMuestra.Rows[i].Cells[1].Text; + else + s_valores += ";" + s_nombre + "|" + gvTipoMuestra.Rows[i].Cells[1].Text; + + } return s_valores; } @@ -561,7 +563,7 @@ private void ExportarExcelTipoMuestra() Response.Write(sb.ToString()); Response.End(); } - + protected void ddlAnalisis_SelectedIndexChanged(object sender, EventArgs e) { // gvTipoMuestra.DataSource = GetDatosEstadistica("GV");