diff --git a/App_Code/ClsCGame.vb b/App_Code/ClsCGame.vb
index ce78e577c..7622d3cae 100644
--- a/App_Code/ClsCGame.vb
+++ b/App_Code/ClsCGame.vb
@@ -3390,6 +3390,26 @@ Public Class ClsCGame
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
#Region "IDisposable Support"
diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb
index 52b8f4eff..e7ae66cd7 100644
--- a/Compras/Compras.aspx.vb
+++ b/Compras/Compras.aspx.vb
@@ -1,10 +1,14 @@
Option Explicit On
Option Strict On
+Imports System.Data
+Imports System.Xml
Imports System.Diagnostics
Imports System.Globalization
Imports System.IO
Imports System.Threading.Tasks
+Imports Newtonsoft.Json
+Imports Extensiones
Partial Class Compras_Compras
diff --git a/General/RepIndicadorResumen.aspx b/General/RepIndicadorResumen.aspx
index 150701480..1fb38f090 100644
--- a/General/RepIndicadorResumen.aspx
+++ b/General/RepIndicadorResumen.aspx
@@ -348,7 +348,7 @@
CssClass="table table-striped table-advance table-hover ScrollAD " ShowHeader="True" EmptyDataText="No se encontraron resultados." ShowHeaderWhenEmpty="true"
AutoGenerateColumns="False" AllowPaging="False" ShowFooter="False">
-
+
@@ -381,6 +381,66 @@
+
+
+
+
+
+
+
+ Indicadores por Proveedor
+
+
+
+
+
+
+
+
+
+ <%--
+
+
+
+
+
+ Indicadores - Gráfica
+
+
+
+
+
+
+
+
--%>
+
+
@@ -435,6 +495,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
document.getElementById('amChartsAttribution').style.visibility = 'visible';
}
diff --git a/General/RepIndicadorResumen.aspx.vb b/General/RepIndicadorResumen.aspx.vb
index 64dd89557..f25a5be80 100644
--- a/General/RepIndicadorResumen.aspx.vb
+++ b/General/RepIndicadorResumen.aspx.vb
@@ -77,6 +77,20 @@ Partial Class General_RepIndicadorResumen
ViewState("CPxP") = value
End Set
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
Get
@@ -126,7 +140,8 @@ Partial Class General_RepIndicadorResumen
Dim ObjVentas As New ClsVentas
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,
-1, -1, -1, -1, "-1", UsuarioActual.CveEmpresa, 5, CveUsuarioConsulta:=UsuarioActual.CveUsuario, TipoCambio:=1) Then
@@ -177,17 +192,28 @@ Partial Class General_RepIndicadorResumen
CPxP = Nothing
End If
+ If ObjCitrus.GetIndicadores(UsuarioActual.CveEmpresa) Then
+
+ Indicadores = ObjCitrus.DtResultados
+ GvIndicadores.DataSource = Indicadores
+ Else
+ GvIndicadores.DataSource = Nothing
+ Indicadores = Nothing
+ End If
+
ObjVentas.Dispose()
ObjCompras.Dispose()
ObjMovtos.Dispose()
+ ObjCitrus.Dispose()
GvVxP.DataBind()
GvCxP192.DataBind()
GvCxP.DataBind()
GvCCxC.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
UPGraficaVxP.Visible = True
Else
@@ -213,8 +239,13 @@ Partial Class General_RepIndicadorResumen
Else
UPGraficaCPxP.Visible = False
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
GraficasPastel()
'GraficasBarras()
@@ -247,6 +278,13 @@ Partial Class General_RepIndicadorResumen
End If
End If
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()
DtColor = New DataTable
DtColor.Columns.Add("Color")
@@ -447,6 +485,8 @@ Partial Class General_RepIndicadorResumen
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()}
+ '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
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() {}})