From bc1a16872312fa600915aa85f9c1e144428556be Mon Sep 17 00:00:00 2001 From: MLopez Date: Mon, 12 Dec 2022 18:31:06 -0700 Subject: [PATCH] =?UTF-8?q?E172=20Rep=20Indicadores=20-=20Distinguir=20CxP?= =?UTF-8?q?=20entre=20productor=20y=20no=20productor=20-Reacomodar=20orden?= =?UTF-8?q?=20de=20las=20gr=C3=A1ficas?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- General/RepIndicadorResumen.aspx | 132 ++++++------- General/RepIndicadorResumen.aspx.vb | 281 +++++++++++++--------------- 2 files changed, 196 insertions(+), 217 deletions(-) diff --git a/General/RepIndicadorResumen.aspx b/General/RepIndicadorResumen.aspx index 54da8233f..bec0e8afd 100644 --- a/General/RepIndicadorResumen.aspx +++ b/General/RepIndicadorResumen.aspx @@ -220,6 +220,61 @@ +
+
+ + +
+
+ + Compras no productores +
+
+
+
+
+
+ +
+
+
+ + + + + + +
+
+
+
+ +
+ + +
+
+ + Compras no productores - Gráfica +
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+
@@ -269,7 +324,7 @@
-
+
@@ -278,7 +333,7 @@
- +
@@ -294,7 +349,7 @@
- @@ -308,7 +363,7 @@
- +
@@ -324,62 +379,7 @@
-
-
-
-
-
-
- -
-
- - -
-
- - Cuentas por pagar por Proveedor -
-
-
-
-
-
- -
-
-
- - - - - - -
-
-
-
- -
- - -
-
- - Cuentas por pagar por Proveedor - Gráfica -
-
-
-
-
-
- -
-
-
-
+
@@ -416,7 +416,7 @@ } }); - function CargaGraficasBarras(json) { + function CargaGraficas(json) { const chartconfig = { chart: { @@ -493,15 +493,15 @@ //AmCharts.makeChart("chartdiv_vxp", { ...chartconfig, type: "serial", dataProvider: json["VxP"] }); // Ventas x Producto $('#' + "chartdiv_vxp").highcharts({ ...chartconfig, series: [{ ...chartconfig.series[0], data: customAccessor(json["VxP"]) }] }) - $('#' + "chartdiv_cxp").highcharts({ ...chartconfig, series: [{ ...chartconfig.series[0], data: customAccessor(json["CxP"]) }] }) $('#' + "chartdiv_cxp192").highcharts({ ...chartconfig, series: [{ ...chartconfig.series[0], type: 'pie', data: customAccessor(json["CxP192"]) }] }) - $('#' + "chartdiv_ccxc").highcharts({ ...chartconfig, series: [{ ...chartconfig.series[0], data: customAccessor(json["CCxC"]) }] }) - $('#' + "chartdiv_cpxp").highcharts({ ...chartconfig, series: [{ ...chartconfig.series[0], data: customAccessor(json["CPxP"]) }] }) + $('#' + "chartdiv_cxp").highcharts({ ...chartconfig, series: [{ ...chartconfig.series[0], data: customAccessor(json["CxP"]) }] }) + $('#' + "chartdiv_cxpa").highcharts({ ...chartconfig, series: [{ ...chartconfig.series[0], data: customAccessor(json["CxPA"]) }] }) + $('#' + "chartdiv_cxc").highcharts({ ...chartconfig, series: [{ ...chartconfig.series[0], data: customAccessor(json["CxC"]) }] }) //AmCharts.makeChart("chartdiv_cxp192", { ...chartconfig, dataProvider: json["CxP192"] }); // Compras x Producto ProveedorClasificacion 192 - //AmCharts.makeChart("chartdiv_ccxc", { ...chartconfig, dataProvider: json["CCxC"] }); // Cuentas por Cobrar x Cliente - //AmCharts.makeChart("chartdiv_cpxp", { ...chartconfig, dataProvider: json["CPxP"] }); // Cuentas por Pagar x Proveedor + //AmCharts.makeChart("chartdiv_cxc", { ...chartconfig, dataProvider: json["CxC"] }); // Cuentas por Cobrar x Cliente + //AmCharts.makeChart("chartdiv_cxp", { ...chartconfig, dataProvider: json["CxP"] }); // Cuentas por Pagar x Proveedor //AmCharts.makeChart("chartdiv_indicadores", { ...chartconfig, dataProvider: json["Indicadores"] }); // Indicadores por Proveedor Productor function customAccessor(data) { diff --git a/General/RepIndicadorResumen.aspx.vb b/General/RepIndicadorResumen.aspx.vb index c9d29639c..5e2c0a4ce 100644 --- a/General/RepIndicadorResumen.aspx.vb +++ b/General/RepIndicadorResumen.aspx.vb @@ -86,20 +86,25 @@ Partial Class General_RepIndicadorResumen If ObjMovtos.GetCxC(TxtFechaI.Text, TxtFechaF.Text, -1, DdlSubProyecto.SelectedValue.ToEntero, -1, -1, -1, "-1", UsuarioActual.CveEmpresa, 5, -1, 1, -1, "-1", "-1", "-1", FechaCorte:=FechaCorte.ToDate, CveUsuarioConsulta:=UsuarioActual.CveUsuario) Then ObjMovtos.DtResultados.DefaultView.Sort = "CveMoneda,Saldo DESC" - GvCCxC.DataSource = ObjMovtos.DtResultados.DefaultView.ToTable + GvCxC.DataSource = ObjMovtos.DtResultados.DefaultView.ToTable End If - If ObjMovtos.GetCxP(MinFecha, TxtFechaF.Text, -1, DdlSubProyecto.SelectedValue.ToEntero, -1, -1, -1, -1, -1, UsuarioActual.CveEmpresa, 5, -1, 1, - FechaCorte:=FechaCorte.ToDate, CveUsuarioConsulta:=UsuarioActual.CveUsuario) Then - ObjMovtos.DtResultados.DefaultView.Sort = "CveMoneda,Saldo DESC" - GvCPxP.DataSource = ObjMovtos.DtResultados.DefaultView.ToTable - End If + 'If ObjMovtos.GetCxP(MinFecha, TxtFechaF.Text, -1, DdlSubProyecto.SelectedValue.ToEntero, -1, -1, -1, -1, -1, UsuarioActual.CveEmpresa, 5, -1, 1, + ' FechaCorte:=FechaCorte.ToDate, CveUsuarioConsulta:=UsuarioActual.CveUsuario) Then + ' ObjMovtos.DtResultados.DefaultView.Sort = "CveMoneda,Saldo DESC" + ' GvCPxP.DataSource = ObjMovtos.DtResultados.DefaultView.ToTable + 'End If If ObjCitrus.GetIndicadores(UsuarioActual.CveEmpresa, TxtFechaI.Text, TxtFechaF.Text, UsuarioActual.CveUsuario, DdlSubProyecto.SelectedValue.ToEntero) Then + 'CxP Productores ObjCitrus.DTSetResultados.Tables(0).DefaultView.Sort = "Cantidad DESC" GvCxP192.DataSource = ObjCitrus.DTSetResultados.Tables(0).DefaultView.ToTable - ObjCitrus.DTSetResultados.Tables(1).DefaultView.Sort = "Moneda,SubTotal DESC" - GvComprasAcreed.DataSource = ObjCitrus.DTSetResultados.Tables(1).DefaultView.ToTable + 'CxP NO productores + ObjCitrus.DTSetResultados.Tables(1).DefaultView.Sort = "Saldo DESC" + GvCxP.DataSource = ObjCitrus.DTSetResultados.Tables(1).DefaultView.ToTable + 'Gastos (Compras acreedores) + ObjCitrus.DTSetResultados.Tables(2).DefaultView.Sort = "Moneda,SubTotal DESC" + GvComprasAcreed.DataSource = ObjCitrus.DTSetResultados.Tables(2).DefaultView.ToTable End If ObjVentas.Dispose() @@ -108,13 +113,13 @@ Partial Class General_RepIndicadorResumen ObjCitrus.Dispose() GvVxP.DataBind() - GvCxP192.DataBind() + GvCxP192.DataBind() 'Compras Productores + GvCxP.DataBind() 'Compras NO productores GvComprasAcreed.DataBind() - GvCCxC.DataBind() - If GvCCxC.DataSource IsNot Nothing Then - GvCCxC.HeaderRow.Cells(1).Text = "Saldo" + GvCxC.DataBind() + If GvCxC.DataSource IsNot Nothing Then + GvCxC.HeaderRow.Cells(1).Text = "Saldo" End If - GvCPxP.DataBind() 'Mostrar gráficos solo si hay datos en su respectiva tabla If GvVxP.Rows.Count > 0 Then @@ -132,15 +137,15 @@ Partial Class General_RepIndicadorResumen Else UPGraficaCxP192.Visible = False End If - If GvCCxC.Rows.Count > 0 Then - UPGraficaCCxC.Visible = True + If GvCxC.Rows.Count > 0 Then + UPGraficaCxC.Visible = True Else - UPGraficaCCxC.Visible = False + UPGraficaCxC.Visible = False End If - If GvCPxP.Rows.Count > 0 Then - UPGraficaCPxP.Visible = True + If GvCxP.Rows.Count > 0 Then + UPGraficaCxP.Visible = True Else - UPGraficaCPxP.Visible = False + UPGraficaCxP.Visible = False End If 'If GvIndicadores.Rows.Count > 0 Then ' UPGraficaIndicadores.Visible = True @@ -149,7 +154,7 @@ Partial Class General_RepIndicadorResumen 'End If 'Si no había datos en ninguna tabla no cargar función de gráficos - If (GvVxP.Rows.Count = 0 AndAlso GvComprasAcreed.Rows.Count = 0 AndAlso GvCxP192.Rows.Count = 0 AndAlso GvCCxC.Rows.Count = 0 AndAlso GvCPxP.Rows.Count = 0) Then Exit Sub + If (GvVxP.Rows.Count = 0 AndAlso GvComprasAcreed.Rows.Count = 0 AndAlso GvCxP192.Rows.Count = 0 AndAlso GvCxC.Rows.Count = 0 AndAlso GvCxP.Rows.Count = 0) Then Exit Sub GraficasPastel() 'GraficasBarras() End Sub @@ -160,6 +165,24 @@ Partial Class General_RepIndicadorResumen End If End If End Sub + Protected Sub GvCxP192_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvCxP192.RowDataBound + 'If e.Row.RowType = DataControlRowType.DataRow Then + ' 'e.Row.Cells(0).Text = e.Row.DBCampo("Orden") + ' 'If e.Row.DBCampo("Orden") = "00ND" Then + ' ' e.Row.CssClass = "Totales" + ' ' e.Row.Cells(0).Text = "Total " + e.Row.DBCampo("Abreviatura") + ' 'End If + 'End If + End Sub + Protected Sub GvCxP_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvCxP.RowDataBound + 'If e.Row.RowType = DataControlRowType.DataRow Then + ' If e.Row.DBCampo("Orden") = "" Then + ' e.Row.CssClass = "Totales" + ' End If + ' 'TODO: Sería mejor usar la Abreviatura de la tabla, pero habría que extender PA_Comp_RepCxP para incluir la columna Abreviatura + ' ' e.Row.Cells(2).Text = $"{GlobalDTMonedas().FiltraParametros($"CveMoneda = {e.Row.DBCampo("CveMoneda").ToString}").Rows(0)("Abreviatura").ToString}" + 'End If + End Sub Protected Sub GvComprasAcreed_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvComprasAcreed.RowDataBound If e.Row.RowType = DataControlRowType.DataRow Then 'e.Row.Cells(0).Text = e.Row.DBCampo("Orden") @@ -168,16 +191,7 @@ Partial Class General_RepIndicadorResumen End If End If End Sub - Protected Sub GvCxP192_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvCxP192.RowDataBound - If e.Row.RowType = DataControlRowType.DataRow Then - 'e.Row.Cells(0).Text = e.Row.DBCampo("Orden") - 'If e.Row.DBCampo("Orden") = "00ND" Then - ' e.Row.CssClass = "Totales" - ' e.Row.Cells(0).Text = "Total " + e.Row.DBCampo("Abreviatura") - 'End If - End If - End Sub - Protected Sub GvCCxC_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvCCxC.RowDataBound + Protected Sub GvCCxC_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvCxC.RowDataBound If e.Row.RowType = DataControlRowType.DataRow Then If e.Row.DBCampo("Orden") = "" Then e.Row.CssClass = "Totales" @@ -186,16 +200,6 @@ Partial Class General_RepIndicadorResumen ' e.Row.Cells(2).Text = $"{GlobalDTMonedas().FiltraParametros($"CveMoneda = {e.Row.DBCampo("CveMoneda").ToString}").Rows(0)("Abreviatura").ToString}" End If End Sub - Protected Sub GvCPxP_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvCPxP.RowDataBound - If e.Row.RowType = DataControlRowType.DataRow Then - If e.Row.DBCampo("Orden") = "" Then - e.Row.CssClass = "Totales" - End If - 'TODO: Sería mejor usar la Abreviatura de la tabla, pero habría que extender PA_Comp_RepCxP para incluir la columna Abreviatura - ' e.Row.Cells(2).Text = $"{GlobalDTMonedas().FiltraParametros($"CveMoneda = {e.Row.DBCampo("CveMoneda").ToString}").Rows(0)("Abreviatura").ToString}" - End If - End Sub - Private Sub CreaDataTableColor() DtColor = New DataTable DtColor.Columns.Add("Color") @@ -271,7 +275,7 @@ Partial Class General_RepIndicadorResumen Private Sub GraficasPastel() - Dim DtVxP, DtCxP, DtCxP192, DtCCxC, DtCPxP As New DataTable + Dim DtVxP, DtCxP192, DtCxP, DtCxPA, DtCxC As New DataTable Dim RowColorIndex As Integer = 0 'Ventas x Producto @@ -296,6 +300,13 @@ Partial Class General_RepIndicadorResumen End If End If Next + 'Dim vxp = From s In DtVxP.AsEnumerable() Select New With {.Texto = s("Texto").ToString(), .Valor = s("Valor").ToString().ToDouble(), .Color = s("Color").ToString(), .Unidad = s("Unidad").ToString()} + 'Dim group_vxp = vxp.GroupBy(Function(x) x.Texto).[Select](Function(g) New With { + ' .Texto = Function(x) x.Texto.ToString, + ' .Valor = Math.Round(Function(x) x.Valor, 2), 'x Tasa de cambio + ' .Color = g.Min(Function(x) x.Color), + ' .Unidad = "MXN" + '}) Dim top_vxp = From s In DtVxP.AsEnumerable().Take(10) Select New With {.Texto = s("Texto").ToString(), .Valor = s("Valor").ToString().ToDouble(), .Color = s("Color").ToString(), .Unidad = s("Unidad").ToString()} Dim resto_vxp = From s In DtVxP.AsEnumerable().Skip(10) Select New With {.Texto = "Otros", .Valor = s("Valor").ToString().ToDouble(), .Color = s("Color").ToString(), .Unidad = s("Unidad").ToString()} Dim group_resto_vxp = resto_vxp.GroupBy(Function(x) x.Texto).[Select](Function(g) New With { @@ -309,39 +320,7 @@ Partial Class General_RepIndicadorResumen 'Dim group_resto_vxp = From e In resto_vxp Group e By e.Texto Into gpo = Group 'Dim group_resto_vxp = resto_vxp.GroupBy(Function(e) New With {Key e.Texto, Key e.Valor, Key e.Color, Key e.Unidad}).ToList() - 'Compras x Producto TipoProveedor=1 Acreedores (Gastos) - DtCxP.Reset() - DtCxP.Columns.Add("Texto") - DtCxP.Columns.Add("Valor") - DtCxP.Columns.Add("Color") - DtCxP.Columns.Add("Unidad") - RowColorIndex = 0 - For Each Dr As DataRow In GvComprasAcreed.DataSource.Rows - If Dr("CveClasificacion").ToString <> "" Then - Dim Row As DataRow = Nothing - Row = DtCxP.NewRow() - Row("Texto") = Dr("Clasificacion").ToString - Row("Valor") = Dr("SubTotal").ToString.FormatoNumero - Row("Color") = DtColor.Rows(RowColorIndex)("Color").ToString - Row("Unidad") = Dr("Moneda").ToString - DtCxP.Rows.Add(Row) - RowColorIndex += 1 - If RowColorIndex = 17 Then - RowColorIndex = 0 - End If - End If - Next - Dim top_cxp = From s In DtCxP.AsEnumerable().Take(10) Select New With {.Texto = s("Texto").ToString(), .Valor = s("Valor").ToString().ToDouble(), .Color = s("Color").ToString(), .Unidad = s("Unidad").ToString()} - Dim resto_cxp = From s In DtCxP.AsEnumerable().Skip(10) Select New With {.Texto = "Otros", .Valor = s("Valor").ToString().ToDouble(), .Color = s("Color").ToString(), .Unidad = s("Unidad").ToString()} - Dim group_resto_cxp = resto_cxp.GroupBy(Function(x) x.Texto).[Select](Function(g) New With { - .Texto = "Otros", - .Valor = Math.Round(g.Sum(Function(x) x.Valor), 2), - .Color = "#000000", - .Unidad = "MXN" - }) - Dim query_cxp = top_cxp.Union(group_resto_cxp) - - 'Compras x Producto ProveedorClasificacion=192 + 'Compras ProveedorClasificacion=192 DtCxP192.Reset() DtCxP192.Columns.Add("Texto") DtCxP192.Columns.Add("Valor") @@ -371,108 +350,108 @@ Partial Class General_RepIndicadorResumen }) Dim query_cxp192 = top_cxp192.Union(group_resto_cxp192) - 'Alert(Newtonsoft.Json.JsonConvert.SerializeObject(CCxC.Rows)) + 'Compras NO proveedor + DtCxP.Reset() + DtCxP.Columns.Add("Texto") + DtCxP.Columns.Add("Valor") + DtCxP.Columns.Add("Color") + DtCxP.Columns.Add("Unidad") + RowColorIndex = 0 + For Each Dr As DataRow In GvCxP.DataSource.Rows + Dim Row As DataRow = Nothing + Row = DtCxP.NewRow() + Row("Texto") = Dr("RazonSocial").ToString + Row("Valor") = Dr("Saldo").ToString.FormatoNumero + Row("Color") = DtColor.Rows(RowColorIndex)("Color").ToString + Row("Unidad") = "MXN" + DtCxP.Rows.Add(Row) + RowColorIndex += 1 + If RowColorIndex = 17 Then + RowColorIndex = 0 + End If + Next + Dim top_cxp = From s In DtCxP.AsEnumerable().Take(10) Select New With {.Texto = s("Texto").ToString(), .Valor = s("Valor").ToString().ToDouble(), .Color = s("Color").ToString(), .Unidad = s("Unidad").ToString()} + Dim resto_cxp = From s In DtCxP.AsEnumerable().Skip(10) Select New With {.Texto = "Otros", .Valor = s("Valor").ToString().ToDouble(), .Color = s("Color").ToString(), .Unidad = s("Unidad").ToString()} + Dim group_resto_cxp = resto_cxp.GroupBy(Function(x) x.Texto).[Select](Function(g) New With { + .Texto = "Otros", + .Valor = Math.Round(g.Sum(Function(x) x.Valor), 2), + .Color = "#000000", + .Unidad = "MXN" + }) + Dim query_cxp = top_cxp.Union(group_resto_cxp) + + 'Compras x Producto TipoProveedor=1 Acreedores (Gastos) + DtCxPA.Reset() + DtCxPA.Columns.Add("Texto") + DtCxPA.Columns.Add("Valor") + DtCxPA.Columns.Add("Color") + DtCxPA.Columns.Add("Unidad") + RowColorIndex = 0 + For Each Dr As DataRow In GvComprasAcreed.DataSource.Rows + If Dr("CveClasificacion").ToString <> "" Then + Dim Row As DataRow = Nothing + Row = DtCxPA.NewRow() + Row("Texto") = Dr("Clasificacion").ToString + Row("Valor") = Dr("SubTotal").ToString.FormatoNumero + Row("Color") = DtColor.Rows(RowColorIndex)("Color").ToString + Row("Unidad") = Dr("Moneda").ToString + DtCxPA.Rows.Add(Row) + RowColorIndex += 1 + If RowColorIndex = 17 Then + RowColorIndex = 0 + End If + End If + Next + Dim top_cxpa = From s In DtCxPA.AsEnumerable().Take(10) Select New With {.Texto = s("Texto").ToString(), .Valor = s("Valor").ToString().ToDouble(), .Color = s("Color").ToString(), .Unidad = s("Unidad").ToString()} + Dim resto_cxpa = From s In DtCxPA.AsEnumerable().Skip(10) Select New With {.Texto = "Otros", .Valor = s("Valor").ToString().ToDouble(), .Color = s("Color").ToString(), .Unidad = s("Unidad").ToString()} + Dim group_resto_cxpa = resto_cxpa.GroupBy(Function(x) x.Texto).[Select](Function(g) New With { + .Texto = "Otros", + .Valor = Math.Round(g.Sum(Function(x) x.Valor), 2), + .Color = "#000000", + .Unidad = "MXN" + }) + Dim query_cxpa = top_cxpa.Union(group_resto_cxpa) 'Cuentas por cobrar x Cliente - DtCCxC.Reset() - DtCCxC.Columns.Add("Texto") - DtCCxC.Columns.Add("Valor") - DtCCxC.Columns.Add("Color") - DtCCxC.Columns.Add("Unidad") + DtCxC.Reset() + DtCxC.Columns.Add("Texto") + DtCxC.Columns.Add("Valor") + DtCxC.Columns.Add("Color") + DtCxC.Columns.Add("Unidad") RowColorIndex = 0 - For Each Dr As DataRow In GvCCxC.DataSource.Rows + For Each Dr As DataRow In GvCxC.DataSource.Rows If Not Dr("Orden").ToString = "" Then Dim Row As DataRow = Nothing - Row = DtCCxC.NewRow() + Row = DtCxC.NewRow() Row("Texto") = Dr("GPO").ToString Row("Valor") = Dr("Saldo").ToString.FormatoNumero Row("Color") = DtColor.Rows(RowColorIndex)("Color").ToString Row("Unidad") = $"{GlobalDTMonedas().FiltraParametros($"CveMoneda = {Dr("CveMoneda").ToString}").Rows(0)("Abreviatura").ToString}" - DtCCxC.Rows.Add(Row) + DtCxC.Rows.Add(Row) RowColorIndex += 1 If RowColorIndex = 17 Then RowColorIndex = 0 End If End If Next - Dim top_ccxc = From s In DtCCxC.AsEnumerable().Take(10) Select New With {.Texto = s("Texto").ToString(), .Valor = s("Valor").ToString().ToDouble(), .Color = s("Color").ToString(), .Unidad = s("Unidad").ToString()} - Dim resto_ccxc = From s In DtCCxC.AsEnumerable().Skip(10) Select New With {.Texto = "Otros", .Valor = s("Valor").ToString().ToDouble(), .Color = s("Color").ToString(), .Unidad = s("Unidad").ToString()} - Dim group_resto_ccxc = resto_ccxc.GroupBy(Function(x) x.Texto).[Select](Function(g) New With { + Dim top_cxc = From s In DtCxC.AsEnumerable().Take(10) Select New With {.Texto = s("Texto").ToString(), .Valor = s("Valor").ToString().ToDouble(), .Color = s("Color").ToString(), .Unidad = s("Unidad").ToString()} + Dim resto_cxc = From s In DtCxC.AsEnumerable().Skip(10) Select New With {.Texto = "Otros", .Valor = s("Valor").ToString().ToDouble(), .Color = s("Color").ToString(), .Unidad = s("Unidad").ToString()} + Dim group_resto_cxc = resto_cxc.GroupBy(Function(x) x.Texto).[Select](Function(g) New With { .Texto = "Otros", .Valor = Math.Round(g.Sum(Function(x) x.Valor), 2), .Color = "#000000", .Unidad = "MXN" }) - Dim query_ccxc = top_ccxc.Union(group_resto_ccxc) - - 'Cuentas por pagar x Proveedor - DtCPxP.Reset() - DtCPxP.Columns.Add("Texto") - DtCPxP.Columns.Add("Valor") - DtCPxP.Columns.Add("Color") - DtCPxP.Columns.Add("Unidad") - RowColorIndex = 0 - For Each Dr As DataRow In GvCPxP.DataSource.Rows - If Not Dr("Orden").ToString = "" Then - Dim Row As DataRow = Nothing - Row = DtCPxP.NewRow() - Row("Texto") = $"{Dr("GPO").ToString} {GlobalDTMonedas().FiltraParametros($"CveMoneda = {Dr("CveMoneda").ToString}").Rows(0)("Abreviatura").ToString}" - Row("Valor") = Dr("Saldo").ToString.FormatoNumero - Row("Color") = DtColor.Rows(RowColorIndex)("Color").ToString - Row("Unidad") = $"{GlobalDTMonedas().FiltraParametros($"CveMoneda = {Dr("CveMoneda").ToString}").Rows(0)("Abreviatura").ToString}" - DtCPxP.Rows.Add(Row) - RowColorIndex += 1 - If RowColorIndex = 17 Then - RowColorIndex = 0 - End If - End If - Next - Dim top_cpxp = From s In DtCPxP.AsEnumerable().Take(10) Select New With {.Texto = s("Texto").ToString(), .Valor = s("Valor").ToString().ToDouble(), .Color = s("Color").ToString(), .Unidad = s("Unidad").ToString()} - Dim resto_cpxp = From s In DtCPxP.AsEnumerable().Skip(10) Select New With {.Texto = "Otros", .Valor = s("Valor").ToString().ToDouble(), .Color = s("Color").ToString(), .Unidad = s("Unidad").ToString()} - Dim group_resto_cpxp = resto_cpxp.GroupBy(Function(x) x.Texto).[Select](Function(g) New With { - .Texto = "Otros", - .Valor = Math.Round(g.Sum(Function(x) x.Valor), 2), - .Color = "#000000", - .Unidad = "MXN" - }) - Dim query_cpxp = top_cpxp.Union(group_resto_cpxp) + Dim query_cxc = top_cxc.Union(group_resto_cxc) + 'Alert(Newtonsoft.Json.JsonConvert.SerializeObject(CxC.Rows)) 'TODO: Indicadores x Proveedor -- Determinar qué poner en la gráfica con E172 'Serializar datos agrupándolos por su respectivo DataTable, todos en un solo JSON - Dim json As String = Newtonsoft.Json.JsonConvert.SerializeObject(New With {.VxP = query_vxp, .CxP = query_cxp, .CxP192 = query_cxp192, .CCxC = query_ccxc, .CPxP = query_cpxp}) - 'Dim json As String = Newtonsoft.Json.JsonConvert.SerializeObject(New With {.VxP = query_vxp, .CCxC = New String() {}}) + Dim json As String = Newtonsoft.Json.JsonConvert.SerializeObject(New With {.VxP = query_vxp, .CxP192 = query_cxp192, .CxP = query_cxp, .CxPA = query_cxpa, .CxC = query_cxc}) + 'Dim json As String = Newtonsoft.Json.JsonConvert.SerializeObject(New With {.VxP = query_vxp, .CxC = New String() {}}) 'Alert(json) - RegistraScript($"CargaGraficasBarras({json})", "sdkp24223") - 'RegistraScript($"CargaGraficasPastel({json})", "22") + RegistraScript($"CargaGraficas({json})", "sdkp24223") UPPMov.Update() End Sub - Private Sub GraficasBarras() - 'Dim Dt As New DataTable() - 'Dt.Columns.Add("Texto") - 'Dt.Columns.Add("Valor") - 'Dt.Columns.Add("Color") - 'Dt.Columns.Add("Moneda") - 'Dim RowColorIndex As Integer = 0 - 'For Each Dr As DataRow In VxC.Rows - ' If Not Dr("Orden").ToString = "" Then - ' Dim Row As DataRow = Nothing - ' Row = Dt.NewRow() - ' Row("Texto") = $"{Dr("GPO").ToString} {GlobalDTMonedas().FiltraParametros($"CveMoneda = {Dr("CveMoneda").ToString}").Rows(0)("Abreviatura").ToString}" - ' Row("Valor") = Dr("SubTotal").ToString.FormatoNumero - ' Row("Color") = DtColor.Rows(RowColorIndex)("Color").ToString - ' Row("Moneda") = Dr("Moneda").ToString - ' Dt.Rows.Add(Row) - ' RowColorIndex += 1 - ' If RowColorIndex = 17 Then - ' RowColorIndex = 0 - ' End If - ' End If - 'Next - - 'Dim query = From s In Dt.AsEnumerable() Select New With {.Texto = s("Texto").ToString(), .Valor = s("Valor").ToString().ToDouble(), .Color = s("Color").ToString(), .Moneda = s("Moneda").ToString()} - 'Dim json As String = Newtonsoft.Json.JsonConvert.SerializeObject(query) - 'RegistraScript($"CargaGraficasBarras({json})", "22") - 'UPPMov.Update() - End Sub End Class