E172 Rep Indicadores - Distinguir CxP entre productor y no productor

-Reacomodar orden de las gráficas
This commit is contained in:
MLopez
2022-12-12 18:31:06 -07:00
parent 1c3aa45eed
commit bc1a168723
2 changed files with 196 additions and 217 deletions

View File

@@ -220,6 +220,61 @@
</div> </div>
</div> </div>
<div class="row">
<div class="col-md-6">
<asp:UpdatePanel ID="UPTablaCxP" runat="server" class="portlet light xspadding bordered " align="left" style="" UpdateMode="Conditional">
<ContentTemplate>
<div class="portlet-title">
<div class="caption font-green">
<i class="icon-pin font-green"></i>
<span id="Span6" runat="server" class="caption-subject bold uppercase">Compras no productores</span>
</div>
<div class="actions">
<div class="btn-group">
</div>
</div>
<div class="tools">
<a href="javascript:;" class="collapse"></a>
</div>
</div>
<div class="portlet-body formnombottom">
<asp:GridView ID="GvCxP" runat="server" GridLines="None"
CssClass="table table-striped table-advance table-hover ScrollAD Widthall " ShowHeader="True" EmptyDataText="No se encontraron resultados." ShowHeaderWhenEmpty="true"
AutoGenerateColumns="False" AllowPaging="False" ShowFooter="False">
<Columns>
<asp:BoundField DataField="RazonSocial" HeaderText="Proveedor" />
<asp:BoundField DataFormatString="{0:c}" DataField="Saldo" ItemStyle-CssClass="margenbound" HeaderText="Saldo" />
</Columns>
</asp:GridView>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
<div class="col-md-6">
<asp:UpdatePanel ID="UPGraficaCxP" runat="server" class="portlet light xspadding bordered " align="center" style="" UpdateMode="Conditional" Visible="false">
<ContentTemplate>
<div class="portlet-title">
<div class="caption font-green">
<i class="icon-pin font-green"></i>
<span id="Span7" runat="server" class="caption-subject bold uppercase">Compras no productores - Gráfica </span>
</div>
<div class="actions">
<div class="btn-group">
</div>
</div>
<div class="tools">
<a href="javascript:;" class="collapse"></a>
</div>
</div>
<div class="portlet-body formnombottom">
<div id="chartdiv_cxp"></div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
<div class="row"> <div class="row">
<div class="col-md-6"> <div class="col-md-6">
<asp:UpdatePanel ID="UPTablaComprasAcreed" runat="server" class="portlet light xspadding bordered " align="left" UpdateMode="Conditional"> <asp:UpdatePanel ID="UPTablaComprasAcreed" runat="server" class="portlet light xspadding bordered " align="left" UpdateMode="Conditional">
@@ -269,7 +324,7 @@
</div> </div>
</div> </div>
<div class="portlet-body formnombottom"> <div class="portlet-body formnombottom">
<div id="chartdiv_cxp"></div> <div id="chartdiv_cxpa"></div>
</div> </div>
</ContentTemplate> </ContentTemplate>
</asp:UpdatePanel> </asp:UpdatePanel>
@@ -278,7 +333,7 @@
<div class="row"> <div class="row">
<div class="col-md-6"> <div class="col-md-6">
<asp:UpdatePanel ID="UPTablaCCxC" runat="server" class="portlet light xspadding bordered " align="left" style="" UpdateMode="Conditional"> <asp:UpdatePanel ID="UPTablaCxC" runat="server" class="portlet light xspadding bordered " align="left" style="" UpdateMode="Conditional">
<ContentTemplate> <ContentTemplate>
<div class="portlet-title"> <div class="portlet-title">
<div class="caption font-green"> <div class="caption font-green">
@@ -294,7 +349,7 @@
</div> </div>
</div> </div>
<div class="portlet-body formnombottom"> <div class="portlet-body formnombottom">
<asp:GridView ID="GvCCxC" runat="server" GridLines="None" <asp:GridView ID="GvCxC" runat="server" GridLines="None"
CssClass="table table-striped table-advance table-hover ScrollAD Widthall " ShowHeader="True" EmptyDataText="No se encontraron resultados." ShowHeaderWhenEmpty="true" CssClass="table table-striped table-advance table-hover ScrollAD Widthall " ShowHeader="True" EmptyDataText="No se encontraron resultados." ShowHeaderWhenEmpty="true"
AutoGenerateColumns="False" AllowPaging="False" ShowFooter="False"> AutoGenerateColumns="False" AllowPaging="False" ShowFooter="False">
<Columns> <Columns>
@@ -308,7 +363,7 @@
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
<asp:UpdatePanel ID="UPGraficaCCxC" runat="server" class="portlet light xspadding bordered " align="center" style="" UpdateMode="Conditional" Visible="false"> <asp:UpdatePanel ID="UPGraficaCxC" runat="server" class="portlet light xspadding bordered " align="center" style="" UpdateMode="Conditional" Visible="false">
<ContentTemplate> <ContentTemplate>
<div class="portlet-title"> <div class="portlet-title">
<div class="caption font-green"> <div class="caption font-green">
@@ -324,62 +379,7 @@
</div> </div>
</div> </div>
<div class="portlet-body formnombottom"> <div class="portlet-body formnombottom">
<div id="chartdiv_ccxc"></div> <div id="chartdiv_cxc"></div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
<div class="row">
<div class="col-md-6">
<asp:UpdatePanel ID="UPTablaCPxP" runat="server" class="portlet light xspadding bordered " align="left" style="" UpdateMode="Conditional">
<ContentTemplate>
<div class="portlet-title">
<div class="caption font-green">
<i class="icon-pin font-green"></i>
<span id="Span6" runat="server" class="caption-subject bold uppercase">Cuentas por pagar por Proveedor </span>
</div>
<div class="actions">
<div class="btn-group">
</div>
</div>
<div class="tools">
<a href="javascript:;" class="collapse"></a>
</div>
</div>
<div class="portlet-body formnombottom">
<asp:GridView ID="GvCPxP" runat="server" GridLines="None"
CssClass="table table-striped table-advance table-hover ScrollAD Widthall " ShowHeader="True" EmptyDataText="No se encontraron resultados." ShowHeaderWhenEmpty="true"
AutoGenerateColumns="False" AllowPaging="False" ShowFooter="False">
<Columns>
<asp:BoundField DataField="Gpo" HeaderText="Proveedor" />
<asp:BoundField DataFormatString="{0:c}" DataField="Saldo" ItemStyle-CssClass="margenbound" HeaderText="Saldo" />
</Columns>
</asp:GridView>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
<div class="col-md-6">
<asp:UpdatePanel ID="UPGraficaCPxP" runat="server" class="portlet light xspadding bordered " align="center" style="" UpdateMode="Conditional" Visible="false">
<ContentTemplate>
<div class="portlet-title">
<div class="caption font-green">
<i class="icon-pin font-green"></i>
<span id="Span7" runat="server" class="caption-subject bold uppercase">Cuentas por pagar por Proveedor - Gráfica </span>
</div>
<div class="actions">
<div class="btn-group">
</div>
</div>
<div class="tools">
<a href="javascript:;" class="collapse"></a>
</div>
</div>
<div class="portlet-body formnombottom">
<div id="chartdiv_cpxp"></div>
</div> </div>
</ContentTemplate> </ContentTemplate>
</asp:UpdatePanel> </asp:UpdatePanel>
@@ -416,7 +416,7 @@
} }
}); });
function CargaGraficasBarras(json) { function CargaGraficas(json) {
const chartconfig = { const chartconfig = {
chart: { chart: {
@@ -493,15 +493,15 @@
//AmCharts.makeChart("chartdiv_vxp", { ...chartconfig, type: "serial", dataProvider: json["VxP"] }); // Ventas x Producto //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_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_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_cxp").highcharts({ ...chartconfig, series: [{ ...chartconfig.series[0], data: customAccessor(json["CxP"]) }] })
$('#' + "chartdiv_cpxp").highcharts({ ...chartconfig, series: [{ ...chartconfig.series[0], data: customAccessor(json["CPxP"]) }] }) $('#' + "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_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_cxc", { ...chartconfig, dataProvider: json["CxC"] }); // Cuentas por Cobrar x Cliente
//AmCharts.makeChart("chartdiv_cpxp", { ...chartconfig, dataProvider: json["CPxP"] }); // Cuentas por Pagar x Proveedor //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 //AmCharts.makeChart("chartdiv_indicadores", { ...chartconfig, dataProvider: json["Indicadores"] }); // Indicadores por Proveedor Productor
function customAccessor(data) { function customAccessor(data) {

View File

@@ -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, 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 "-1", "-1", "-1", FechaCorte:=FechaCorte.ToDate, CveUsuarioConsulta:=UsuarioActual.CveUsuario) Then
ObjMovtos.DtResultados.DefaultView.Sort = "CveMoneda,Saldo DESC" ObjMovtos.DtResultados.DefaultView.Sort = "CveMoneda,Saldo DESC"
GvCCxC.DataSource = ObjMovtos.DtResultados.DefaultView.ToTable GvCxC.DataSource = ObjMovtos.DtResultados.DefaultView.ToTable
End If End If
If ObjMovtos.GetCxP(MinFecha, TxtFechaF.Text, -1, DdlSubProyecto.SelectedValue.ToEntero, -1, -1, -1, -1, -1, UsuarioActual.CveEmpresa, 5, -1, 1, '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 ' FechaCorte:=FechaCorte.ToDate, CveUsuarioConsulta:=UsuarioActual.CveUsuario) Then
ObjMovtos.DtResultados.DefaultView.Sort = "CveMoneda,Saldo DESC" ' ObjMovtos.DtResultados.DefaultView.Sort = "CveMoneda,Saldo DESC"
GvCPxP.DataSource = ObjMovtos.DtResultados.DefaultView.ToTable ' GvCPxP.DataSource = ObjMovtos.DtResultados.DefaultView.ToTable
End If 'End If
If ObjCitrus.GetIndicadores(UsuarioActual.CveEmpresa, TxtFechaI.Text, TxtFechaF.Text, UsuarioActual.CveUsuario, DdlSubProyecto.SelectedValue.ToEntero) Then 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" ObjCitrus.DTSetResultados.Tables(0).DefaultView.Sort = "Cantidad DESC"
GvCxP192.DataSource = ObjCitrus.DTSetResultados.Tables(0).DefaultView.ToTable GvCxP192.DataSource = ObjCitrus.DTSetResultados.Tables(0).DefaultView.ToTable
ObjCitrus.DTSetResultados.Tables(1).DefaultView.Sort = "Moneda,SubTotal DESC" 'CxP NO productores
GvComprasAcreed.DataSource = ObjCitrus.DTSetResultados.Tables(1).DefaultView.ToTable 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 End If
ObjVentas.Dispose() ObjVentas.Dispose()
@@ -108,13 +113,13 @@ Partial Class General_RepIndicadorResumen
ObjCitrus.Dispose() ObjCitrus.Dispose()
GvVxP.DataBind() GvVxP.DataBind()
GvCxP192.DataBind() GvCxP192.DataBind() 'Compras Productores
GvCxP.DataBind() 'Compras NO productores
GvComprasAcreed.DataBind() GvComprasAcreed.DataBind()
GvCCxC.DataBind() GvCxC.DataBind()
If GvCCxC.DataSource IsNot Nothing Then If GvCxC.DataSource IsNot Nothing Then
GvCCxC.HeaderRow.Cells(1).Text = "<a href=""/CxC/RepCxC.aspx"" target=""_blank"">Saldo</a>" GvCxC.HeaderRow.Cells(1).Text = "<a href=""/CxC/RepCxC.aspx"" target=""_blank"">Saldo</a>"
End If End If
GvCPxP.DataBind()
'Mostrar gráficos solo si hay datos en su respectiva tabla 'Mostrar gráficos solo si hay datos en su respectiva tabla
If GvVxP.Rows.Count > 0 Then If GvVxP.Rows.Count > 0 Then
@@ -132,15 +137,15 @@ Partial Class General_RepIndicadorResumen
Else Else
UPGraficaCxP192.Visible = False UPGraficaCxP192.Visible = False
End If End If
If GvCCxC.Rows.Count > 0 Then If GvCxC.Rows.Count > 0 Then
UPGraficaCCxC.Visible = True UPGraficaCxC.Visible = True
Else Else
UPGraficaCCxC.Visible = False UPGraficaCxC.Visible = False
End If End If
If GvCPxP.Rows.Count > 0 Then If GvCxP.Rows.Count > 0 Then
UPGraficaCPxP.Visible = True UPGraficaCxP.Visible = True
Else Else
UPGraficaCPxP.Visible = False UPGraficaCxP.Visible = False
End If End If
'If GvIndicadores.Rows.Count > 0 Then 'If GvIndicadores.Rows.Count > 0 Then
' UPGraficaIndicadores.Visible = True ' UPGraficaIndicadores.Visible = True
@@ -149,7 +154,7 @@ Partial Class General_RepIndicadorResumen
'End If 'End If
'Si no había datos en ninguna tabla no cargar función de gráficos '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() GraficasPastel()
'GraficasBarras() 'GraficasBarras()
End Sub End Sub
@@ -160,6 +165,24 @@ Partial Class General_RepIndicadorResumen
End If End If
End If End If
End Sub 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 Protected Sub GvComprasAcreed_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvComprasAcreed.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then If e.Row.RowType = DataControlRowType.DataRow Then
'e.Row.Cells(0).Text = e.Row.DBCampo("Orden") 'e.Row.Cells(0).Text = e.Row.DBCampo("Orden")
@@ -168,16 +191,7 @@ Partial Class General_RepIndicadorResumen
End If End If
End If End If
End Sub End Sub
Protected Sub GvCxP192_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvCxP192.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
'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
If e.Row.RowType = DataControlRowType.DataRow Then If e.Row.RowType = DataControlRowType.DataRow Then
If e.Row.DBCampo("Orden") = "" Then If e.Row.DBCampo("Orden") = "" Then
e.Row.CssClass = "Totales" 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}" ' e.Row.Cells(2).Text = $"{GlobalDTMonedas().FiltraParametros($"CveMoneda = {e.Row.DBCampo("CveMoneda").ToString}").Rows(0)("Abreviatura").ToString}"
End If End If
End Sub 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() Private Sub CreaDataTableColor()
DtColor = New DataTable DtColor = New DataTable
DtColor.Columns.Add("Color") DtColor.Columns.Add("Color")
@@ -271,7 +275,7 @@ Partial Class General_RepIndicadorResumen
Private Sub GraficasPastel() 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 Dim RowColorIndex As Integer = 0
'Ventas x Producto 'Ventas x Producto
@@ -296,6 +300,13 @@ Partial Class General_RepIndicadorResumen
End If End If
End If End If
Next 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 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 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 { 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 = 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() '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) 'Compras ProveedorClasificacion=192
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
DtCxP192.Reset() DtCxP192.Reset()
DtCxP192.Columns.Add("Texto") DtCxP192.Columns.Add("Texto")
DtCxP192.Columns.Add("Valor") DtCxP192.Columns.Add("Valor")
@@ -371,108 +350,108 @@ Partial Class General_RepIndicadorResumen
}) })
Dim query_cxp192 = top_cxp192.Union(group_resto_cxp192) 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 'Cuentas por cobrar x Cliente
DtCCxC.Reset() DtCxC.Reset()
DtCCxC.Columns.Add("Texto") DtCxC.Columns.Add("Texto")
DtCCxC.Columns.Add("Valor") DtCxC.Columns.Add("Valor")
DtCCxC.Columns.Add("Color") DtCxC.Columns.Add("Color")
DtCCxC.Columns.Add("Unidad") DtCxC.Columns.Add("Unidad")
RowColorIndex = 0 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 If Not Dr("Orden").ToString = "" Then
Dim Row As DataRow = Nothing Dim Row As DataRow = Nothing
Row = DtCCxC.NewRow() Row = DtCxC.NewRow()
Row("Texto") = Dr("GPO").ToString Row("Texto") = Dr("GPO").ToString
Row("Valor") = Dr("Saldo").ToString.FormatoNumero Row("Valor") = Dr("Saldo").ToString.FormatoNumero
Row("Color") = DtColor.Rows(RowColorIndex)("Color").ToString Row("Color") = DtColor.Rows(RowColorIndex)("Color").ToString
Row("Unidad") = $"{GlobalDTMonedas().FiltraParametros($"CveMoneda = {Dr("CveMoneda").ToString}").Rows(0)("Abreviatura").ToString}" Row("Unidad") = $"{GlobalDTMonedas().FiltraParametros($"CveMoneda = {Dr("CveMoneda").ToString}").Rows(0)("Abreviatura").ToString}"
DtCCxC.Rows.Add(Row) DtCxC.Rows.Add(Row)
RowColorIndex += 1 RowColorIndex += 1
If RowColorIndex = 17 Then If RowColorIndex = 17 Then
RowColorIndex = 0 RowColorIndex = 0
End If End If
End If End If
Next 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 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_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 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_ccxc = resto_ccxc.GroupBy(Function(x) x.Texto).[Select](Function(g) New With { Dim group_resto_cxc = resto_cxc.GroupBy(Function(x) x.Texto).[Select](Function(g) New With {
.Texto = "Otros", .Texto = "Otros",
.Valor = Math.Round(g.Sum(Function(x) x.Valor), 2), .Valor = Math.Round(g.Sum(Function(x) x.Valor), 2),
.Color = "#000000", .Color = "#000000",
.Unidad = "MXN" .Unidad = "MXN"
}) })
Dim query_ccxc = top_ccxc.Union(group_resto_ccxc) Dim query_cxc = top_cxc.Union(group_resto_cxc)
'Alert(Newtonsoft.Json.JsonConvert.SerializeObject(CxC.Rows))
'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)
'TODO: Indicadores x Proveedor -- Determinar qué poner en la gráfica con E172 '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 '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, .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, .CCxC = New String() {}}) 'Dim json As String = Newtonsoft.Json.JsonConvert.SerializeObject(New With {.VxP = query_vxp, .CxC = New String() {}})
'Alert(json) 'Alert(json)
RegistraScript($"CargaGraficasBarras({json})", "sdkp24223") RegistraScript($"CargaGraficas({json})", "sdkp24223")
'RegistraScript($"CargaGraficasPastel({json})", "22")
UPPMov.Update() UPPMov.Update()
End Sub 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 End Class