E172 Rep Indicador, CxC recuperado, links en encabezado tabla, grafica recuperado, normalizar moneda en MXN
This commit is contained in:
@@ -83,11 +83,11 @@ Partial Class General_RepIndicadorResumen
|
||||
|
||||
Dim FechaCorte As String = $"31/12/{Now.Year}"
|
||||
|
||||
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
|
||||
ObjMovtos.DtResultados.DefaultView.Sort = "CveMoneda,Saldo DESC"
|
||||
GvCxC.DataSource = ObjMovtos.DtResultados.DefaultView.ToTable
|
||||
End If
|
||||
'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
|
||||
' ObjMovtos.DtResultados.DefaultView.Sort = "CveMoneda,Saldo DESC"
|
||||
' GvCxC.DataSource = ObjMovtos.DtResultados.DefaultView.ToTable
|
||||
'End If
|
||||
|
||||
'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
|
||||
@@ -105,6 +105,9 @@ Partial Class General_RepIndicadorResumen
|
||||
'Gastos (Compras acreedores)
|
||||
ObjCitrus.DTSetResultados.Tables(2).DefaultView.Sort = "Moneda,SubTotal DESC"
|
||||
GvComprasAcreed.DataSource = ObjCitrus.DTSetResultados.Tables(2).DefaultView.ToTable
|
||||
'Cuentas x Cobrar
|
||||
ObjCitrus.DTSetResultados.Tables(3).DefaultView.Sort = "SaldoMN DESC"
|
||||
GvCxC.DataSource = ObjCitrus.DTSetResultados.Tables(3).DefaultView.ToTable
|
||||
End If
|
||||
|
||||
ObjVentas.Dispose()
|
||||
@@ -119,6 +122,7 @@ Partial Class General_RepIndicadorResumen
|
||||
GvCxC.DataBind()
|
||||
If GvCxC.DataSource IsNot Nothing Then
|
||||
GvCxC.HeaderRow.Cells(1).Text = "<a href=""/CxC/RepCxC.aspx"" target=""_blank"">Saldo</a>"
|
||||
GvCxC.HeaderRow.Cells(2).Text = "<a href=""/Ventas/RepRecuperacion.aspx"" target=""_blank"">Recuperado</a>"
|
||||
End If
|
||||
|
||||
'Mostrar gráficos solo si hay datos en su respectiva tabla
|
||||
@@ -139,8 +143,10 @@ Partial Class General_RepIndicadorResumen
|
||||
End If
|
||||
If GvCxC.Rows.Count > 0 Then
|
||||
UPGraficaCxC.Visible = True
|
||||
'UPGraficaCxCRec.Visible = True
|
||||
Else
|
||||
UPGraficaCxC.Visible = False
|
||||
'UPGraficaCxCRec.Visible = False
|
||||
End If
|
||||
If GvCxP.Rows.Count > 0 Then
|
||||
UPGraficaCxP.Visible = True
|
||||
@@ -155,7 +161,7 @@ Partial Class General_RepIndicadorResumen
|
||||
|
||||
'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 GvCxC.Rows.Count = 0 AndAlso GvCxP.Rows.Count = 0) Then Exit Sub
|
||||
GraficasPastel()
|
||||
Graficas()
|
||||
'GraficasBarras()
|
||||
End Sub
|
||||
Protected Sub GvVxP_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvVxP.RowDataBound
|
||||
@@ -191,13 +197,14 @@ Partial Class General_RepIndicadorResumen
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
Protected Sub GvCCxC_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvCxC.RowDataBound
|
||||
Protected Sub GvCxC_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvCxC.RowDataBound
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
If e.Row.DBCampo("Orden") = "" Then
|
||||
If e.Row.DBCampo("CveCliente") = "" 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(0).Text = $"Total {GlobalDTMonedas().FiltraParametros($"CveMoneda = {e.Row.DBCampo("CveMoneda").ToString}").Rows(0)("Moneda").ToString}"
|
||||
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()
|
||||
@@ -273,9 +280,9 @@ Partial Class General_RepIndicadorResumen
|
||||
DtColor.Rows.Add(RowColor)
|
||||
End Sub
|
||||
|
||||
Private Sub GraficasPastel()
|
||||
Private Sub Graficas()
|
||||
|
||||
Dim DtVxP, DtCxP192, DtCxP, DtCxPA, DtCxC As New DataTable
|
||||
Dim DtVxP, DtCxP192, DtCxP, DtCxPA, DtCxC, DtCxCR As New DataTable
|
||||
Dim RowColorIndex As Integer = 0
|
||||
|
||||
'Ventas x Producto
|
||||
@@ -412,7 +419,7 @@ Partial Class General_RepIndicadorResumen
|
||||
})
|
||||
Dim query_cxpa = top_cxpa.Union(group_resto_cxpa)
|
||||
|
||||
'Cuentas por cobrar x Cliente
|
||||
'Cuentas por cobrar x Cliente -- Saldo
|
||||
DtCxC.Reset()
|
||||
DtCxC.Columns.Add("Texto")
|
||||
DtCxC.Columns.Add("Valor")
|
||||
@@ -420,13 +427,13 @@ Partial Class General_RepIndicadorResumen
|
||||
DtCxC.Columns.Add("Unidad")
|
||||
RowColorIndex = 0
|
||||
For Each Dr As DataRow In GvCxC.DataSource.Rows
|
||||
If Not Dr("Orden").ToString = "" Then
|
||||
If Not Dr("CveCliente").ToString = "" Then
|
||||
Dim Row As DataRow = Nothing
|
||||
Row = DtCxC.NewRow()
|
||||
Row("Texto") = Dr("GPO").ToString
|
||||
Row("Valor") = Dr("Saldo").ToString.FormatoNumero
|
||||
Row("Texto") = Dr("RazonSocial").ToString
|
||||
Row("Valor") = Dr("SaldoMN").ToString.FormatoNumero
|
||||
Row("Color") = DtColor.Rows(RowColorIndex)("Color").ToString
|
||||
Row("Unidad") = $"{GlobalDTMonedas().FiltraParametros($"CveMoneda = {Dr("CveMoneda").ToString}").Rows(0)("Abreviatura").ToString}"
|
||||
Row("Unidad") = "MXN" '$"{GlobalDTMonedas().FiltraParametros($"CveMoneda = {Dr("CveMoneda").ToString}").Rows(0)("Abreviatura").ToString}"
|
||||
DtCxC.Rows.Add(Row)
|
||||
RowColorIndex += 1
|
||||
If RowColorIndex = 17 Then
|
||||
@@ -443,12 +450,45 @@ Partial Class General_RepIndicadorResumen
|
||||
.Unidad = "MXN"
|
||||
})
|
||||
Dim query_cxc = top_cxc.Union(group_resto_cxc)
|
||||
|
||||
'Cuentas por cobrar x Cliente -- Recuperado
|
||||
DtCxCR.Reset()
|
||||
DtCxCR.Columns.Add("Texto")
|
||||
DtCxCR.Columns.Add("Valor")
|
||||
DtCxCR.Columns.Add("Color")
|
||||
DtCxCR.Columns.Add("Unidad")
|
||||
RowColorIndex = 0
|
||||
For Each Dr As DataRow In GvCxC.DataSource.Rows
|
||||
If Not Dr("CveCliente").ToString = "" Then
|
||||
Dim Row As DataRow = Nothing
|
||||
Row = DtCxCR.NewRow()
|
||||
Row("Texto") = Dr("RazonSocial").ToString
|
||||
Row("Valor") = Dr("RecuperadoMN").ToString.FormatoNumero
|
||||
Row("Color") = DtColor.Rows(RowColorIndex)("Color").ToString
|
||||
Row("Unidad") = "MXN" '$"{GlobalDTMonedas().FiltraParametros($"CveMoneda = {Dr("CveMoneda").ToString}").Rows(0)("Abreviatura").ToString}"
|
||||
DtCxCR.Rows.Add(Row)
|
||||
RowColorIndex += 1
|
||||
If RowColorIndex = 17 Then
|
||||
RowColorIndex = 0
|
||||
End If
|
||||
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(), .Color = s("Color").ToString(), .Unidad = s("Unidad").ToString()}
|
||||
Dim resto_cxcr = From s In DtCxCR.AsEnumerable().Skip(10) Select New With {.Texto = "Otros", .Valor = s("Valor").ToString().ToDouble(), .Color = s("Color").ToString(), .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),
|
||||
.Color = "#000000",
|
||||
.Unidad = "MXN"
|
||||
})
|
||||
Dim query_cxcr = top_cxcr.Union(group_resto_cxcr)
|
||||
|
||||
'Alert(Newtonsoft.Json.JsonConvert.SerializeObject(CxC.Rows))
|
||||
|
||||
'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
|
||||
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, .CxP192 = query_cxp192, .CxP = query_cxp, .CxPA = query_cxpa, .CxC = query_cxc, .CxCR = query_cxcr})
|
||||
'Dim json As String = Newtonsoft.Json.JsonConvert.SerializeObject(New With {.VxP = query_vxp, .CxC = New String() {}})
|
||||
'Alert(json)
|
||||
RegistraScript($"CargaGraficas({json})", "sdkp24223")
|
||||
|
||||
Reference in New Issue
Block a user