diff --git a/Ventas/DashboardVentas.aspx b/Ventas/DashboardVentas.aspx
index d45d29431..c4b4ac610 100644
--- a/Ventas/DashboardVentas.aspx
+++ b/Ventas/DashboardVentas.aspx
@@ -117,8 +117,10 @@
+
+
-

+ <%--

--%>
@@ -251,7 +253,7 @@
-
+ <%--
@@ -346,6 +348,123 @@
// "enabled": true
// }
//});
+ }--%>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Ventas/DashboardVentas.aspx.vb b/Ventas/DashboardVentas.aspx.vb
index 92680092c..34f3fe41a 100644
--- a/Ventas/DashboardVentas.aspx.vb
+++ b/Ventas/DashboardVentas.aspx.vb
@@ -2,6 +2,7 @@
Imports System.Activities.Statements
Imports System.Data
Imports Extensiones
+Imports Newtonsoft.Json.Linq
Partial Class Ventas_DashboardVentas
Inherits ClsPaginas
@@ -183,7 +184,7 @@ Partial Class Ventas_DashboardVentas
GvVentasClasificacionxMes.DataBind()
GvVentasAcumulado.DataBind()
- CargaGraficas(DtVentasGrafica)
+ CargaGraficaNEW(DtVentasGrafica)
'Dim Ano3 = DateTime.Now.Year.ToString()
'Dim Ano2 = (DateTime.Now.Year - 1).ToString()
@@ -212,42 +213,31 @@ Partial Class Ventas_DashboardVentas
End Sub
- Private Sub CargaGraficas(ByVal DtVentas As DataTable)
- MuestraGrafica(div_ventas, DtVentas, "Ano", "Total", "", "", "gh2", "")
- End Sub
+ Private Sub CargaGraficaNEW(ByVal D_T_Datos As DataTable)
+ Dim jsonData As JArray = New JArray()
- Private Sub MuestraGrafica(ByVal divcontainer As HtmlGenericControl, ByVal DTDatos As DataTable, ByVal ColTitle As String, ByVal ColValue As String, ByVal Titulo As String, ByVal SubTitulo As String, ByVal Optional Indicador As String = "gh", ByVal Optional XReferencia As String = "", ByVal Optional YReferencia As String = "")
- Dim Info As String = ""
- Dim SBJSScript As StringBuilder = New StringBuilder()
+ For x As Integer = 1 To 12
+ Dim Mes As String = D_T_Datos.Columns(x).ColumnName
+ Dim obj As JObject = New JObject()
+ obj.Add(New JProperty("mes", Mes))
- If DTDatos.Rows.Count > 0 Then
-
- 'For Each DbRow As DataRow In DTDatos.Rows
- ' Info = String.Format("{2}['{1}',{0}],", DbRow("TotalAno1"), DbRow(ColTitle), Info)
- ' Info = String.Format("{2}['{1}',{0}],", DbRow("TotalAno2"), DbRow(ColTitle), Info)
- ' Info = String.Format("{2}['{1}',{0}],", DbRow("TotalAno3"), DbRow(ColTitle), Info)
- ' Info = String.Format("{2}['{1}',{0}],", DbRow("TotalAno3Presupuesto"), DbRow(ColTitle), Info)
- 'Next
-
- 'For Each DbRow As DataRow In DTDatos.Rows
- ' Info = String.Format("{2}['{1}',{0}],", DbRow("TotalAno1"), DateTime.Now.Year - 2, Info)
- ' Info = String.Format("{2}['{1}',{0}],", DbRow("TotalAno2"), DateTime.Now.Year - 1, Info)
- ' Info = String.Format("{2}['{1}',{0}],", DbRow("TotalAno3"), DateTime.Now.Year, Info)
- ' Info = String.Format("{2}['{1}',{0}],", DbRow("TotalAno3Presupuesto"), $"PRESUPUESTO {Now.Year}", Info)
- 'Next
-
- For Each DbRow As DataRow In DTDatos.Rows
- Info = String.Format("{2}['{1}',{0}],", DbRow(ColValue), DbRow(ColTitle), Info)
+ For y As Integer = 0 To D_T_Datos.Rows.Count - 1
+ obj.Add(New JProperty(D_T_Datos.Rows(y)(0).ToString(), D_T_Datos.Rows(y)(x).ToString()))
Next
- If Info.Length > 0 Then
- 'Info = Info.Remove(Info.Length - 1, 1)
- SBJSScript.AppendFormat("graficahighcharts('{0}','{1}','{2}','{3}',[{4}],1,'{5}');", divcontainer.ClientID, Titulo, SubTitulo, YReferencia, Info, XReferencia)
- End If
- Else
- SBJSScript.AppendFormat("graficahighcharts('{0}','{1}','{2}','{3}',[{4}],1,'{5}');", divcontainer.ClientID, Titulo, SubTitulo, YReferencia, " ", XReferencia)
- End If
+ jsonData.Add(obj)
+ Next
- RegistraScript(SBJSScript.ToString(), Indicador)
+ Dim jsonSeries As JArray = New JArray()
+
+ For y As Integer = 0 To D_T_Datos.Rows.Count - 1
+ Dim obj As JObject = New JObject(New JProperty(D_T_Datos.Rows(y)(0).ToString(), D_T_Datos.Rows(y)(0).ToString()))
+ jsonSeries.Add(obj)
+ Next
+
+ Dim jsdatos As String = jsonData.ToString()
+ Dim jsseries As String = jsonSeries.ToString()
+ RegistraScript($"generaGrafico({jsdatos},{jsseries});")
End Sub
+
End Class