From 2d83db0b82d799afc879e4a9cc07451850d1b880 Mon Sep 17 00:00:00 2001 From: MLopez Date: Wed, 30 Nov 2022 14:12:10 -0700 Subject: [PATCH] =?UTF-8?q?E172=20Rep=20Indicador=20Resumen:=20Afinar=20in?= =?UTF-8?q?formaci=C3=B3n=20de=20las=20tablas=20-Los=20saldos=20y=20totale?= =?UTF-8?q?s=20ahora=20se=20muestran=20como=20campos=20de=20moneda=20para?= =?UTF-8?q?=20distinguirlos=20mejor=20de=20las=20cantidades=20-El=20tipo?= =?UTF-8?q?=20de=20moneda=20por=20entrada=20ahora=20se=20visualiza=20en=20?= =?UTF-8?q?las=20tablas=20-Las=20tablas=20ahora=20se=20ordenan=20por=20sub?= =?UTF-8?q?total=20y=20moneda=20o=20saldo=20y=20moneda=20-Las=20gr=C3=A1fi?= =?UTF-8?q?cas=20ahora=20solo=20grafican=20el=20Top=2025=20de=20cada=20tab?= =?UTF-8?q?la?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cambios en BD [SIG_Resp_MLR]: - Se modificó PA_Citrus_IndicadoresGet - +2 param: @FechaI @FechaF - Ahora filtra por CveTipoProveedor = 192 (Productor) - Se modificó PA_Vta_GetRepPS + columna Abreviatura, los totales usan la Abreviatura ahora en vez de Moneda --- App_Code/ClsCGame.vb | 4 +- General/RepIndicadorResumen.aspx | 33 +++++++----- General/RepIndicadorResumen.aspx.vb | 83 +++++++++++++++++++++++------ 3 files changed, 92 insertions(+), 28 deletions(-) diff --git a/App_Code/ClsCGame.vb b/App_Code/ClsCGame.vb index 7622d3cae..25c25c7a7 100644 --- a/App_Code/ClsCGame.vb +++ b/App_Code/ClsCGame.vb @@ -3394,11 +3394,13 @@ Public Class ClsCGame #Region "INDICADORES" - Public Function GetIndicadores(CveEmpresa As Integer) As Boolean + Public Function GetIndicadores(CveEmpresa As Integer, FechaI As Date, FechaF As Date) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Citrus_IndicadoresGet") With SqlAdapter.SelectCommand.Parameters .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@FechaI", SqlDbType.Date).Value = FechaI + .Add("@FechaF", SqlDbType.Date).Value = FechaF End With Try SqlAdapter.Fill(Data) diff --git a/General/RepIndicadorResumen.aspx b/General/RepIndicadorResumen.aspx index 1fb38f090..bbe65bf2a 100644 --- a/General/RepIndicadorResumen.aspx +++ b/General/RepIndicadorResumen.aspx @@ -127,7 +127,8 @@ - + + @@ -183,9 +184,14 @@ - + + + <%-- + --%> @@ -239,7 +245,8 @@ - + + @@ -294,7 +301,8 @@ AutoGenerateColumns="False" AllowPaging="False" ShowFooter="False"> - + + @@ -349,7 +357,8 @@ AutoGenerateColumns="False" AllowPaging="False" ShowFooter="False"> - + + @@ -388,7 +397,7 @@
- Indicadores por Proveedor + Indicadores por Proveedor Productor
@@ -405,11 +414,11 @@ - - + + - - + +
@@ -423,7 +432,7 @@
- Indicadores - Gráfica + Indicadores por Proveedor Productor- Gráfica
@@ -495,7 +504,7 @@ 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_indicadores", { ...chartconfig, dataProvider: json["Indicadores"] }); // Indicadores por Proveedor + // AmCharts.makeChart("chartdiv_indicadores", { ...chartconfig, dataProvider: json["Indicadores"] }); // Indicadores por Proveedor Productor document.getElementById('amChartsAttribution').style.visibility = 'visible'; } diff --git a/General/RepIndicadorResumen.aspx.vb b/General/RepIndicadorResumen.aspx.vb index f25a5be80..29e79f3e9 100644 --- a/General/RepIndicadorResumen.aspx.vb +++ b/General/RepIndicadorResumen.aspx.vb @@ -77,6 +77,22 @@ Partial Class General_RepIndicadorResumen ViewState("CPxP") = value End Set End Property +#If False Then + Private Property gv1 As DataTable + Get + + If ViewState("gv1") Is Nothing Then + Return New DataTable + Else + Return DirectCast(ViewState("gv1"), DataTable) + End If + + End Get + Set(value As DataTable) + ViewState("gv1") = value + End Set + End Property +#End If Private Property Indicadores As DataTable Get @@ -146,6 +162,8 @@ Partial Class General_RepIndicadorResumen If ObjVentas.GetRepProductosServicios(-1, DdlSubProyecto.SelectedValue.ToEntero, -1, -1, -1, TxtFechaI.Text.Trim(), TxtFechaF.Text.Trim(), MinFecha, MaxFecha, -1, -1, -1, -1, -1, "-1", UsuarioActual.CveEmpresa, 5, CveUsuarioConsulta:=UsuarioActual.CveUsuario, TipoCambio:=1) Then VxP = ObjVentas.DtResultados + VxP.DefaultView.Sort = "CveMoneda,SubTotal DESC" + VxP = VxP.DefaultView.ToTable GvVxP.DataSource = VxP Else GvVxP.DataSource = Nothing @@ -155,6 +173,8 @@ Partial Class General_RepIndicadorResumen If ObjCompras.GetRepProductosServicios(-1, DdlSubProyecto.SelectedValue.ToEntero, -1, -1, -1, TxtFechaI.Text.Trim(), TxtFechaF.Text.Trim(), -1, -1, -1, UsuarioActual.CveEmpresa, 5, -1, -1, "-1", "-1", -1, TipoCambio:=1, CveUsuarioConsulta:=UsuarioActual.CveUsuario, CveProveedorClasificacion:=192) Then CxP192 = ObjCompras.DtResultados + CxP192.DefaultView.Sort = "CveMoneda,SubTotal DESC" + CxP192 = CxP192.DefaultView.ToTable GvCxP192.DataSource = CxP192 Else GvCxP192.DataSource = Nothing @@ -164,6 +184,8 @@ Partial Class General_RepIndicadorResumen If ObjCompras.GetRepProductosServicios(-1, DdlSubProyecto.SelectedValue.ToEntero, -1, -1, -1, TxtFechaI.Text.Trim(), TxtFechaF.Text.Trim(), -1, -1, -1, UsuarioActual.CveEmpresa, 5, -1, -1, "-1", "-1", -1, TipoCambio:=1, CveUsuarioConsulta:=UsuarioActual.CveUsuario, CveTipoProveedor:=1) Then CxP = ObjCompras.DtResultados + CxP.DefaultView.Sort = "CveMoneda,SubTotal DESC" + CxP = CxP.DefaultView.ToTable GvCxP.DataSource = CxP Else GvCxP.DataSource = Nothing @@ -176,6 +198,8 @@ Partial Class General_RepIndicadorResumen "-1", "-1", "-1", FechaCorte:=FechaCorte.ToDate, CveUsuarioConsulta:=UsuarioActual.CveUsuario) Then CCxC = ObjMovtos.DtResultados + CCxC.DefaultView.Sort = "CveMoneda,Saldo DESC" + CCxC = CCxC.DefaultView.ToTable GvCCxC.DataSource = CCxC Else GvCCxC.DataSource = Nothing @@ -186,15 +210,28 @@ Partial Class General_RepIndicadorResumen "-1", "-1", "-1", FechaCorte:=FechaCorte.ToDate, CveUsuarioConsulta:=UsuarioActual.CveUsuario) Then CPxP = ObjMovtos.DtResultados + CPxP.DefaultView.Sort = "CveMoneda,Saldo DESC" + CPxP = CPxP.DefaultView.ToTable GvCPxP.DataSource = CPxP Else GvCPxP.DataSource = Nothing CPxP = Nothing End If - If ObjCitrus.GetIndicadores(UsuarioActual.CveEmpresa) Then + 'If ObjCompras.GetRepProductosServicios(-1, DdlSubProyecto.SelectedValue.ToEntero, -1, -1, -1, TxtFechaI.Text.Trim(), TxtFechaF.Text.Trim(), -1, -1, -1, + ' UsuarioActual.CveEmpresa, 5, -1, -1, "-1", "-1", -1, TipoCambio:=1, CveUsuarioConsulta:=UsuarioActual.CveUsuario, CveProveedorClasificacion:=192) Then + ' gv1 = ObjCompras.DtResultados + ' GridView1.DataSource = gv1 + 'Else + ' GridView1.DataSource = Nothing + ' gv1 = Nothing + 'End If + + If ObjCitrus.GetIndicadores(UsuarioActual.CveEmpresa, TxtFechaI.Text, TxtFechaF.Text) Then Indicadores = ObjCitrus.DtResultados + Indicadores.DefaultView.Sort = "Saldo DESC" + Indicadores = Indicadores.DefaultView.ToTable GvIndicadores.DataSource = Indicadores Else GvIndicadores.DataSource = Nothing @@ -209,6 +246,7 @@ Partial Class General_RepIndicadorResumen GvVxP.DataBind() GvCxP192.DataBind() GvCxP.DataBind() + 'GridView1.DataBind() GvCCxC.DataBind() GvCPxP.DataBind() GvIndicadores.DataBind() @@ -259,8 +297,19 @@ Partial Class General_RepIndicadorResumen 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.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 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 @@ -269,6 +318,8 @@ Partial Class General_RepIndicadorResumen 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 GvCPxP_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvCPxP.RowDataBound @@ -276,6 +327,8 @@ Partial Class General_RepIndicadorResumen 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 GvIndicadores_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvIndicadores.RowDataBound @@ -377,7 +430,7 @@ Partial Class General_RepIndicadorResumen 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 + Row("Moneda") = Dr("Abreviatura").ToString DtVxP.Rows.Add(Row) RowColorIndex += 1 If RowColorIndex = 17 Then @@ -385,7 +438,7 @@ Partial Class General_RepIndicadorResumen End If End If Next - Dim query_vxp = From s In DtVxP.AsEnumerable() Select New With {.Texto = s("Texto").ToString(), .Valor = s("Valor").ToString().ToDouble(), .Color = s("Color").ToString(), .Moneda = s("Moneda").ToString()} + Dim query_vxp = From s In DtVxP.AsEnumerable().Take(25) Select New With {.Texto = s("Texto").ToString(), .Valor = s("Valor").ToString().ToDouble(), .Color = s("Color").ToString(), .Moneda = s("Moneda").ToString()} 'Compras x Producto TipoProveedor=1 DtCxP.Reset() @@ -395,13 +448,13 @@ Partial Class General_RepIndicadorResumen DtCxP.Columns.Add("Moneda") RowColorIndex = 0 For Each Dr As DataRow In CxP.Rows - If Not Dr("Orden").ToString = "" Then + If Not Dr("Orden").ToString = "00ND" Then Dim Row As DataRow = Nothing Row = DtCxP.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 + Row("Moneda") = Dr("Abreviatura").ToString DtCxP.Rows.Add(Row) RowColorIndex += 1 If RowColorIndex = 17 Then @@ -409,7 +462,7 @@ Partial Class General_RepIndicadorResumen End If End If Next - Dim query_cxp = From s In DtCxP.AsEnumerable() Select New With {.Texto = s("Texto").ToString(), .Valor = s("Valor").ToString().ToDouble(), .Color = s("Color").ToString(), .Moneda = s("Moneda").ToString()} + Dim query_cxp = From s In DtCxP.AsEnumerable().Take(25) Select New With {.Texto = s("Texto").ToString(), .Valor = s("Valor").ToString().ToDouble(), .Color = s("Color").ToString(), .Moneda = s("Moneda").ToString()} 'Compras x Producto ProveedorClasificacion=192 DtCxP192.Reset() @@ -419,13 +472,13 @@ Partial Class General_RepIndicadorResumen DtCxP192.Columns.Add("Moneda") RowColorIndex = 0 For Each Dr As DataRow In CxP192.Rows - If Not Dr("Orden").ToString = "" Then + If Not Dr("Orden").ToString = "00ND" Then Dim Row As DataRow = Nothing Row = DtCxP192.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 + Row("Moneda") = Dr("Abreviatura").ToString DtCxP192.Rows.Add(Row) RowColorIndex += 1 If RowColorIndex = 17 Then @@ -433,7 +486,7 @@ Partial Class General_RepIndicadorResumen End If End If Next - Dim query_cxp192 = From s In DtCxP192.AsEnumerable() Select New With {.Texto = s("Texto").ToString(), .Valor = s("Valor").ToString().ToDouble(), .Color = s("Color").ToString(), .Moneda = s("Moneda").ToString()} + Dim query_cxp192 = From s In DtCxP192.AsEnumerable().Take(25) Select New With {.Texto = s("Texto").ToString(), .Valor = s("Valor").ToString().ToDouble(), .Color = s("Color").ToString(), .Moneda = s("Moneda").ToString()} 'Alert(Newtonsoft.Json.JsonConvert.SerializeObject(CCxC.Rows)) @@ -451,7 +504,7 @@ Partial Class General_RepIndicadorResumen 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("Moneda") = Dr("Moneda").ToString + Row("Moneda") = $"{GlobalDTMonedas().FiltraParametros($"CveMoneda = {Dr("CveMoneda").ToString}").Rows(0)("Abreviatura").ToString}" DtCCxC.Rows.Add(Row) RowColorIndex += 1 If RowColorIndex = 17 Then @@ -459,7 +512,7 @@ Partial Class General_RepIndicadorResumen End If End If Next - Dim query_ccxc = From s In DtCCxC.AsEnumerable() Select New With {.Texto = s("Texto").ToString(), .Valor = s("Valor").ToString().ToDouble(), .Color = s("Color").ToString(), .Moneda = s("Moneda").ToString()} + Dim query_ccxc = From s In DtCCxC.AsEnumerable().Take(25) Select New With {.Texto = s("Texto").ToString(), .Valor = s("Valor").ToString().ToDouble(), .Color = s("Color").ToString(), .Moneda = s("Moneda").ToString()} 'Cuentas por pagar x Proveedor DtCPxP.Reset() @@ -475,7 +528,7 @@ Partial Class General_RepIndicadorResumen 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("Moneda") = Dr("Moneda").ToString + Row("Moneda") = $"{GlobalDTMonedas().FiltraParametros($"CveMoneda = {Dr("CveMoneda").ToString}").Rows(0)("Abreviatura").ToString}" DtCPxP.Rows.Add(Row) RowColorIndex += 1 If RowColorIndex = 17 Then @@ -483,11 +536,11 @@ Partial Class General_RepIndicadorResumen End If End If Next - Dim query_cpxp = From s In DtCPxP.AsEnumerable() Select New With {.Texto = s("Texto").ToString(), .Valor = s("Valor").ToString().ToDouble(), .Color = s("Color").ToString(), .Moneda = s("Moneda").ToString()} + Dim query_cpxp = From s In DtCPxP.AsEnumerable().Take(25) Select New With {.Texto = s("Texto").ToString(), .Valor = s("Valor").ToString().ToDouble(), .Color = s("Color").ToString(), .Moneda = s("Moneda").ToString()} 'TODO: Indicadores x Proveedor -- Determinar qué poner en la gráfica con E172 - 'Serializar datos agrupándolos en 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, .CCxC = New String() {}}) 'Alert(json)