E172 Rep Indicador Resumen: Agregar tabla de Indicadores agrupada por Proveedor

This commit is contained in:
MLopez
2022-11-30 09:07:29 -07:00
parent 5a38a00399
commit 95d5e901c6
4 changed files with 129 additions and 4 deletions

View File

@@ -3390,6 +3390,26 @@ Public Class ClsCGame
End Function End Function
#End Region
#Region "INDICADORES"
Public Function GetIndicadores(CveEmpresa As Integer) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Citrus_IndicadoresGet")
With SqlAdapter.SelectCommand.Parameters
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
End With
Try
SqlAdapter.Fill(Data)
Retorno = True
Catch ex As Exception
OnError("Ocurrió un error al obtener los indicadores.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
End Try
Return Retorno
End Function
#End Region #End Region
#Region "IDisposable Support" #Region "IDisposable Support"

View File

@@ -1,10 +1,14 @@
Option Explicit On Option Explicit On
Option Strict On Option Strict On
Imports System.Data
Imports System.Xml
Imports System.Diagnostics Imports System.Diagnostics
Imports System.Globalization Imports System.Globalization
Imports System.IO Imports System.IO
Imports System.Threading.Tasks Imports System.Threading.Tasks
Imports Newtonsoft.Json
Imports Extensiones
Partial Class Compras_Compras Partial Class Compras_Compras

View File

@@ -348,7 +348,7 @@
CssClass="table table-striped table-advance table-hover ScrollAD " ShowHeader="True" EmptyDataText="No se encontraron resultados." ShowHeaderWhenEmpty="true" CssClass="table table-striped table-advance table-hover ScrollAD " ShowHeader="True" EmptyDataText="No se encontraron resultados." ShowHeaderWhenEmpty="true"
AutoGenerateColumns="False" AllowPaging="False" ShowFooter="False"> AutoGenerateColumns="False" AllowPaging="False" ShowFooter="False">
<Columns> <Columns>
<asp:BoundField DataField="Gpo" HeaderText="Cliente" /> <asp:BoundField DataField="Gpo" HeaderText="Proveedor" />
<asp:BoundField DataFormatString="{0:n}" DataField="Saldo" ItemStyle-CssClass="margenbound" HeaderText="Saldo" /> <asp:BoundField DataFormatString="{0:n}" DataField="Saldo" ItemStyle-CssClass="margenbound" HeaderText="Saldo" />
</Columns> </Columns>
</asp:GridView> </asp:GridView>
@@ -381,6 +381,66 @@
</div> </div>
</div> </div>
<div class="row">
<div class="col-md-6">
<asp:UpdatePanel ID="UPIndicadores" 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="Span10" runat="server" class="caption-subject bold uppercase">Indicadores 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="GvIndicadores" runat="server" GridLines="None"
CssClass="table table-striped table-advance table-hover ScrollAD " 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:n}" DataField="Cantidad" ItemStyle-CssClass="margenbound" HeaderText="Cantidad" />
<asp:BoundField DataFormatString="{0:n}" DataField="SubTotal" ItemStyle-CssClass="margenbound" HeaderText="SubTotal" />
<asp:BoundField DataFormatString="{0:n}" DataField="PUPromedioKG" ItemStyle-CssClass="margenbound" HeaderText="PUnit/KG" />
<asp:BoundField DataFormatString="{0:n}" DataField="Merma" ItemStyle-CssClass="margenbound" HeaderText="Merma" />
<asp:BoundField DataFormatString="{0:n}" DataField="Saldo" ItemStyle-CssClass="margenbound" HeaderText="Saldo" />
<asp:BoundField DataFormatString="{0:n}" DataField="Abonado" ItemStyle-CssClass="margenbound" HeaderText="Abonado" />
</Columns>
</asp:GridView>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
<%--<div class="col-md-6">
<asp:UpdatePanel ID="UPGraficaIndicadores" 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="Span11" runat="server" class="caption-subject bold uppercase">Indicadores - 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_indicadores"></div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>--%>
</div>
</ContentTemplate> </ContentTemplate>
<Triggers> <Triggers>
<asp:AsyncPostBackTrigger ControlID="btnConsultar" EventName="Click" /> <asp:AsyncPostBackTrigger ControlID="btnConsultar" EventName="Click" />
@@ -435,6 +495,7 @@
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_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_cpxp", { ...chartconfig, dataProvider: json["CPxP"] }); // Cuentas por Pagar x Proveedor
// AmCharts.makeChart("chartdiv_indicadores", { ...chartconfig, dataProvider: json["Indicadores"] }); // Indicadores por Proveedor
document.getElementById('amChartsAttribution').style.visibility = 'visible'; document.getElementById('amChartsAttribution').style.visibility = 'visible';
} }

View File

@@ -77,6 +77,20 @@ Partial Class General_RepIndicadorResumen
ViewState("CPxP") = value ViewState("CPxP") = value
End Set End Set
End Property End Property
Private Property Indicadores As DataTable
Get
If ViewState("Indicadores") Is Nothing Then
Return New DataTable
Else
Return DirectCast(ViewState("Indicadores"), DataTable)
End If
End Get
Set(value As DataTable)
ViewState("Indicadores") = value
End Set
End Property
Private Property DtColor As DataTable Private Property DtColor As DataTable
Get Get
@@ -126,7 +140,8 @@ Partial Class General_RepIndicadorResumen
Dim ObjVentas As New ClsVentas Dim ObjVentas As New ClsVentas
Dim ObjCompras As New ClsCompras Dim ObjCompras As New ClsCompras
Dim ObjMovtos As New ClsMovimientos() Dim ObjMovtos As New ClsMovimientos
Dim ObjCitrus As New ClsCGame
If ObjVentas.GetRepProductosServicios(-1, DdlSubProyecto.SelectedValue.ToEntero, -1, -1, -1, TxtFechaI.Text.Trim(), TxtFechaF.Text.Trim(), MinFecha, MaxFecha, -1, 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 -1, -1, -1, -1, "-1", UsuarioActual.CveEmpresa, 5, CveUsuarioConsulta:=UsuarioActual.CveUsuario, TipoCambio:=1) Then
@@ -177,17 +192,28 @@ Partial Class General_RepIndicadorResumen
CPxP = Nothing CPxP = Nothing
End If End If
If ObjCitrus.GetIndicadores(UsuarioActual.CveEmpresa) Then
Indicadores = ObjCitrus.DtResultados
GvIndicadores.DataSource = Indicadores
Else
GvIndicadores.DataSource = Nothing
Indicadores = Nothing
End If
ObjVentas.Dispose() ObjVentas.Dispose()
ObjCompras.Dispose() ObjCompras.Dispose()
ObjMovtos.Dispose() ObjMovtos.Dispose()
ObjCitrus.Dispose()
GvVxP.DataBind() GvVxP.DataBind()
GvCxP192.DataBind() GvCxP192.DataBind()
GvCxP.DataBind() GvCxP.DataBind()
GvCCxC.DataBind() GvCCxC.DataBind()
GvCPxP.DataBind() GvCPxP.DataBind()
GvIndicadores.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
UPGraficaVxP.Visible = True UPGraficaVxP.Visible = True
Else Else
@@ -213,8 +239,13 @@ Partial Class General_RepIndicadorResumen
Else Else
UPGraficaCPxP.Visible = False UPGraficaCPxP.Visible = False
End If End If
'If GvIndicadores.Rows.Count > 0 Then
' UPGraficaIndicadores.Visible = True
'Else
' UPGraficaIndicadores.Visible = False
'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 GvCxP.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 GvCxP.Rows.Count = 0 AndAlso GvCxP192.Rows.Count = 0 AndAlso GvCCxC.Rows.Count = 0 AndAlso GvCPxP.Rows.Count = 0) Then Exit Sub
GraficasPastel() GraficasPastel()
'GraficasBarras() 'GraficasBarras()
@@ -247,6 +278,13 @@ Partial Class General_RepIndicadorResumen
End If End If
End If End If
End Sub End Sub
Protected Sub GvIndicadores_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvIndicadores.RowDataBound
'If e.Row.RowType = DataControlRowType.DataRow Then
' If e.Row.DBCampo("Orden") = "" Then
' e.Row.CssClass = "Totales"
' End If
'End If
End Sub
Private Sub CreaDataTableColor() Private Sub CreaDataTableColor()
DtColor = New DataTable DtColor = New DataTable
DtColor.Columns.Add("Color") DtColor.Columns.Add("Color")
@@ -447,6 +485,8 @@ Partial Class General_RepIndicadorResumen
Next 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() 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 en 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, .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, .CCxC = New String() {}})