diff --git a/General/RepIndicadorResumen.aspx b/General/RepIndicadorResumen.aspx index 5d862b711..4d18b8fc9 100644 --- a/General/RepIndicadorResumen.aspx +++ b/General/RepIndicadorResumen.aspx @@ -594,11 +594,11 @@ //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_compproductores").highcharts({ ...chartconfig, series: [{ ...chartconfig.series[0], type: 'pie', data: customAccessor(json["CompProductores"]) }] }) - //$('#' + "chartdiv_compacreed").highcharts({ ...chartconfig, series: [{ ...chartconfig.series[0], data: customAccessor(json["CompAcreed"]) }] }) - //$('#' + "chartdiv_cxp192").highcharts({ ...chartconfig, series: [{ ...chartconfig.series[0], data: customAccessor(json["CxP192"]) }] }) - //$('#' + "chartdiv_cxp").highcharts({ ...chartconfig, series: [{ ...chartconfig.series[0], data: customAccessor(json["CxP"]) }] }) - //$('#' + "chartdiv_cxc").highcharts({ ...chartconfig, series: [{ ...chartconfig.series[0], data: customAccessor(json["CxC"]) }, { type: 'line', data: customAccessor(json["CxCR"]) }] }) + $('#' + "chartdiv_compproductores").highcharts({ ...chartconfig, series: [{ ...chartconfig.series[0], type: 'pie', data: customAccessor(json["CompProductores"]) }] }) + $('#' + "chartdiv_compacreed").highcharts({ ...chartconfig, series: [{ ...chartconfig.series[0], data: customAccessor(json["CompAcreed"]) }] }) + $('#' + "chartdiv_cxp192").highcharts({ ...chartconfig, series: [{ ...chartconfig.series[0], data: customAccessor(json["CxP192"]) }] }) + $('#' + "chartdiv_cxp").highcharts({ ...chartconfig, series: [{ ...chartconfig.series[0], data: customAccessor(json["CxP"]) }] }) + $('#' + "chartdiv_cxc").highcharts({ ...chartconfig, series: [{ ...chartconfig.series[0], data: customAccessor(json["CxC"]) }, { type: 'line', data: customAccessor(json["CxCR"]) }] }) function customAccessor(data) { const newData = []; diff --git a/General/RepIndicadorResumen.aspx.vb b/General/RepIndicadorResumen.aspx.vb index f9b6b8946..91490de0f 100644 --- a/General/RepIndicadorResumen.aspx.vb +++ b/General/RepIndicadorResumen.aspx.vb @@ -192,30 +192,27 @@ Partial Class General_RepIndicadorResumen 'DtVxP.Columns.Add("Color") DtVxP.Columns.Add("Unidad") 'RowColorIndex = 0 - If GvVxP.DataSource IsNot Nothing Then - For Each Dr As DataRow In CType(GvVxP.DataSource, DataTable).FiltraParametros("", "SubTotalMN DESC").Rows - If Not Dr("Orden").ToString = "" Then - Dim Row = DtVxP.NewRow() - Row("Texto") = Dr("GPO").ToString - Row("Valor") = Dr("SubTotalMN").ToString.FormatoNumero - Row("Unidad") = "MXN" '$"{GlobalDTMonedas().FiltraParametros($"CveMoneda = {Dr("CveMoneda").ToString}").Rows(0)("Abreviatura").ToString}" - DtVxP.Rows.Add(Row) - 'RowColorIndex += 1 - 'If RowColorIndex = 17 Then - ' RowColorIndex = 0 - 'End If - End If - Next - End If - - 'Dim vxp = From s In DtVxP.AsEnumerable() Select New With {.Texto = s("Texto").ToString(), .Valor = s("Valor").ToString().ToDouble(), .Unidad = s("Unidad").ToString()} - 'Dim group_vxp = vxp.GroupBy(Function(x) x.Texto).[Select](Function(g) New With { - ' .Texto = g.Key, - ' .Valor = Math.Round(g.Sum(Function(x) x.Valor), 2), - ' .Unidad = "MXN" - '}).ToDataTable - Dim top_vxp = From s In DtVxP.AsEnumerable().Take(10) Select New With {.Texto = s("Texto").ToString(), .Valor = s("Valor").ToString().ToDouble(), .Unidad = s("Unidad").ToString()} - Dim resto_vxp = From s In DtVxP.AsEnumerable().Skip(10) Select New With {.Texto = "Otros", .Valor = s("Valor").ToString().ToDouble(), .Unidad = s("Unidad").ToString()} + For Each Dr As DataRow In CType(GvVxP.DataSource, DataTable).FiltraParametros("", "SubTotalMN DESC").Rows + If Not Dr("Orden").ToString = "" Then + Dim Row = DtVxP.NewRow() + Row("Texto") = Dr("GPO").ToString + Row("Valor") = Dr("SubTotalMN").ToString.FormatoNumero + Row("Unidad") = "MXN" '$"{GlobalDTMonedas().FiltraParametros($"CveMoneda = {Dr("CveMoneda").ToString}").Rows(0)("Abreviatura").ToString}" + DtVxP.Rows.Add(Row) + 'RowColorIndex += 1 + 'If RowColorIndex = 17 Then + ' RowColorIndex = 0 + 'End If + End If + Next + Dim vxp = From s In DtVxP.AsEnumerable() Select New With {.Texto = s("Texto").ToString(), .Valor = s("Valor").ToString().ToDouble(), .Unidad = s("Unidad").ToString()} + Dim group_vxp = vxp.GroupBy(Function(x) x.Texto).[Select](Function(g) New With { + .Texto = g.Key, + .Valor = Math.Round(g.Sum(Function(x) x.Valor), 2), + .Unidad = "MXN" + }).ToDataTable + Dim top_vxp = From s In group_vxp.AsEnumerable().Take(10) Select New With {.Texto = s("Texto").ToString(), .Valor = s("Valor").ToString().ToDouble(), .Unidad = s("Unidad").ToString()} + Dim resto_vxp = From s In group_vxp.AsEnumerable().Skip(10) Select New With {.Texto = "Otros", .Valor = s("Valor").ToString().ToDouble(), .Unidad = s("Unidad").ToString()} Dim group_resto_vxp = resto_vxp.GroupBy(Function(x) x.Texto).[Select](Function(g) New With { .Texto = "Otros", .Valor = Math.Round(g.Sum(Function(x) x.Valor), 2), @@ -238,8 +235,14 @@ Partial Class General_RepIndicadorResumen Row("Unidad") = "Kg" DtCompProductores.Rows.Add(Row) Next - Dim top_comp_productores = From s In DtCompProductores.AsEnumerable().Take(10) Select New With {.Texto = s("Texto").ToString(), .Valor = s("Valor").ToString().ToDouble(), .Unidad = s("Unidad").ToString()} - Dim resto_comp_productores = From s In DtCompProductores.AsEnumerable().Skip(10) Select New With {.Texto = "Otros", .Valor = s("Valor").ToString().ToDouble(), .Unidad = s("Unidad").ToString()} + Dim comp_productores = From s In DtCompProductores.AsEnumerable() Select New With {.Texto = s("Texto").ToString(), .Valor = s("Valor").ToString().ToDouble(), .Unidad = s("Unidad").ToString()} + Dim group_comp_productores = comp_productores.GroupBy(Function(x) x.Texto).[Select](Function(g) New With { + .Texto = g.Key, + .Valor = Math.Round(g.Sum(Function(x) x.Valor), 2), + .Unidad = "MXN" + }).ToDataTable + Dim top_comp_productores = From s In group_comp_productores.AsEnumerable().Take(10) Select New With {.Texto = s("Texto").ToString(), .Valor = s("Valor").ToString().ToDouble(), .Unidad = s("Unidad").ToString()} + Dim resto_comp_productores = From s In group_comp_productores.AsEnumerable().Skip(10) Select New With {.Texto = "Otros", .Valor = s("Valor").ToString().ToDouble(), .Unidad = s("Unidad").ToString()} Dim group_resto_comp_productores = resto_comp_productores.GroupBy(Function(x) x.Texto).[Select](Function(g) New With { .Texto = "Otros", .Valor = Math.Round(g.Sum(Function(x) x.Valor), 2), @@ -261,8 +264,14 @@ Partial Class General_RepIndicadorResumen DtCompAcreed.Rows.Add(Row) End If Next - Dim top_comp_acreed = From s In DtCompAcreed.AsEnumerable().Take(10) Select New With {.Texto = s("Texto").ToString(), .Valor = s("Valor").ToString().ToDouble(), .Unidad = s("Unidad").ToString()} - Dim resto_comp_acreed = From s In DtCompAcreed.AsEnumerable().Skip(10) Select New With {.Texto = "Otros", .Valor = s("Valor").ToString().ToDouble(), .Unidad = s("Unidad").ToString()} + Dim comp_acreed = From s In DtCompAcreed.AsEnumerable() Select New With {.Texto = s("Texto").ToString(), .Valor = s("Valor").ToString().ToDouble(), .Unidad = s("Unidad").ToString()} + Dim group_comp_acreed = comp_acreed.GroupBy(Function(x) x.Texto).[Select](Function(g) New With { + .Texto = g.Key, + .Valor = Math.Round(g.Sum(Function(x) x.Valor), 2), + .Unidad = "MXN" + }).ToDataTable + Dim top_comp_acreed = From s In group_comp_acreed.AsEnumerable().Take(10) Select New With {.Texto = s("Texto").ToString(), .Valor = s("Valor").ToString().ToDouble(), .Unidad = s("Unidad").ToString()} + Dim resto_comp_acreed = From s In group_comp_acreed.AsEnumerable().Skip(10) Select New With {.Texto = "Otros", .Valor = s("Valor").ToString().ToDouble(), .Unidad = s("Unidad").ToString()} Dim group_resto_comp_acreed = resto_comp_acreed.GroupBy(Function(x) x.Texto).[Select](Function(g) New With { .Texto = "Otros", .Valor = Math.Round(g.Sum(Function(x) x.Valor), 2), @@ -284,8 +293,14 @@ Partial Class General_RepIndicadorResumen DtCxC.Rows.Add(Row) End If Next - Dim top_cxc = From s In DtCxC.AsEnumerable().Take(10) Select New With {.Texto = s("Texto").ToString(), .Valor = s("Valor").ToString().ToDouble(), .Unidad = s("Unidad").ToString()} - Dim resto_cxc = From s In DtCxC.AsEnumerable().Skip(10) Select New With {.Texto = "Otros", .Valor = s("Valor").ToString().ToDouble(), .Unidad = s("Unidad").ToString()} + Dim cxc = From s In DtCxC.AsEnumerable() Select New With {.Texto = s("Texto").ToString(), .Valor = s("Valor").ToString().ToDouble(), .Unidad = s("Unidad").ToString()} + Dim group_cxc = cxc.GroupBy(Function(x) x.Texto).[Select](Function(g) New With { + .Texto = g.Key, + .Valor = Math.Round(g.Sum(Function(x) x.Valor), 2), + .Unidad = "MXN" + }).ToDataTable + Dim top_cxc = From s In group_cxc.AsEnumerable().Take(10) Select New With {.Texto = s("Texto").ToString(), .Valor = s("Valor").ToString().ToDouble(), .Unidad = s("Unidad").ToString()} + Dim resto_cxc = From s In group_cxc.AsEnumerable().Skip(10) Select New With {.Texto = "Otros", .Valor = s("Valor").ToString().ToDouble(), .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), @@ -308,8 +323,14 @@ Partial Class General_RepIndicadorResumen DtCxCR.Rows.Add(Row) End If Next - Dim top_cxcr = From s In DtCxCR.AsEnumerable().Take(10) Select New With {.Texto = s("Texto").ToString(), .Valor = s("Valor").ToString().ToDouble(), .Unidad = s("Unidad").ToString()} - Dim resto_cxcr = From s In DtCxCR.AsEnumerable().Skip(10) Select New With {.Texto = "Otros", .Valor = s("Valor").ToString().ToDouble(), .Unidad = s("Unidad").ToString()} + Dim cxcr = From s In DtCxCR.AsEnumerable() Select New With {.Texto = s("Texto").ToString(), .Valor = s("Valor").ToString().ToDouble(), .Unidad = s("Unidad").ToString()} + Dim group_cxcr = cxcr.GroupBy(Function(x) x.Texto).[Select](Function(g) New With { + .Texto = g.Key, + .Valor = Math.Round(g.Sum(Function(x) x.Valor), 2), + .Unidad = "MXN" + }).ToDataTable + Dim top_cxcr = From s In group_cxcr.AsEnumerable().Take(10) Select New With {.Texto = s("Texto").ToString(), .Valor = s("Valor").ToString().ToDouble(), .Unidad = s("Unidad").ToString()} + Dim resto_cxcr = From s In group_cxcr.AsEnumerable().Skip(10) Select New With {.Texto = "Otros", .Valor = s("Valor").ToString().ToDouble(), .Unidad = s("Unidad").ToString()} Dim group_resto_cxcr = resto_cxcr.GroupBy(Function(x) x.Texto).[Select](Function(g) New With { .Texto = "Otros", .Valor = Math.Round(g.Sum(Function(x) x.Valor), 2), @@ -331,8 +352,14 @@ Partial Class General_RepIndicadorResumen DtCxP192.Rows.Add(Row) End If Next - Dim top_cxp192 = From s In DtCxP192.AsEnumerable().Take(10) Select New With {.Texto = s("Texto").ToString(), .Valor = s("Valor").ToString().ToDouble(), .Unidad = s("Unidad").ToString()} - Dim resto_cxp192 = From s In DtCxP192.AsEnumerable().Skip(10) Select New With {.Texto = "Otros", .Valor = s("Valor").ToString().ToDouble(), .Unidad = s("Unidad").ToString()} + Dim cxp192 = From s In DtCxP192.AsEnumerable() Select New With {.Texto = s("Texto").ToString(), .Valor = s("Valor").ToString().ToDouble(), .Unidad = s("Unidad").ToString()} + Dim group_cxp192 = cxp192.GroupBy(Function(x) x.Texto).[Select](Function(g) New With { + .Texto = g.Key, + .Valor = Math.Round(g.Sum(Function(x) x.Valor), 2), + .Unidad = "MXN" + }).ToDataTable + Dim top_cxp192 = From s In group_cxp192.AsEnumerable().Take(10) Select New With {.Texto = s("Texto").ToString(), .Valor = s("Valor").ToString().ToDouble(), .Unidad = s("Unidad").ToString()} + Dim resto_cxp192 = From s In group_cxp192.AsEnumerable().Skip(10) Select New With {.Texto = "Otros", .Valor = s("Valor").ToString().ToDouble(), .Unidad = s("Unidad").ToString()} Dim group_resto_cxp192 = resto_cxp192.GroupBy(Function(x) x.Texto).[Select](Function(g) New With { .Texto = "Otros", .Valor = Math.Round(g.Sum(Function(x) x.Valor), 2), @@ -354,8 +381,14 @@ Partial Class General_RepIndicadorResumen DtCxP.Rows.Add(Row) 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(), .Unidad = s("Unidad").ToString()} - Dim resto_cxp = From s In DtCxP.AsEnumerable().Skip(10) Select New With {.Texto = "Otros", .Valor = s("Valor").ToString().ToDouble(), .Unidad = s("Unidad").ToString()} + Dim cxp = From s In DtCxP.AsEnumerable() Select New With {.Texto = s("Texto").ToString(), .Valor = s("Valor").ToString().ToDouble(), .Unidad = s("Unidad").ToString()} + Dim group_cxp = cxp.GroupBy(Function(x) x.Texto).[Select](Function(g) New With { + .Texto = g.Key, + .Valor = Math.Round(g.Sum(Function(x) x.Valor), 2), + .Unidad = "MXN" + }).ToDataTable + Dim top_cxp = From s In group_cxp.AsEnumerable().Take(10) Select New With {.Texto = s("Texto").ToString(), .Valor = s("Valor").ToString().ToDouble(), .Unidad = s("Unidad").ToString()} + Dim resto_cxp = From s In group_cxp.AsEnumerable().Skip(10) Select New With {.Texto = "Otros", .Valor = s("Valor").ToString().ToDouble(), .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),