-
@@ -398,115 +398,113 @@
-
+ <%--
-
+ --%>
+ <%----%>
+
diff --git a/General/RepIndicadorResumen.aspx.vb b/General/RepIndicadorResumen.aspx.vb
index 230c5c227..37d32ec33 100644
--- a/General/RepIndicadorResumen.aspx.vb
+++ b/General/RepIndicadorResumen.aspx.vb
@@ -6,94 +6,6 @@ Imports MoreLinq
Partial Class General_RepIndicadorResumen
Inherits ClsPaginas
#Region "propiedades"
-
- Private Property VxP As DataTable
- Get
-
- If ViewState("VxP") Is Nothing Then
- Return New DataTable
- Else
- Return DirectCast(ViewState("VxP"), DataTable)
- End If
-
- End Get
- Set(value As DataTable)
- ViewState("VxP") = value
- End Set
- End Property
- Private Property CxP As DataTable
- Get
-
- If ViewState("CxP") Is Nothing Then
- Return New DataTable
- Else
- Return DirectCast(ViewState("CxP"), DataTable)
- End If
-
- End Get
- Set(value As DataTable)
- ViewState("CxP") = value
- End Set
- End Property
- Private Property CxP192 As DataTable
- Get
-
- If ViewState("CxP192") Is Nothing Then
- Return New DataTable
- Else
- Return DirectCast(ViewState("CxP192"), DataTable)
- End If
-
- End Get
- Set(value As DataTable)
- ViewState("CxP192") = value
- End Set
- End Property
-
- Private Property CCxC As DataTable
- Get
-
- If ViewState("CCxC") Is Nothing Then
- Return New DataTable
- Else
- Return DirectCast(ViewState("CCxC"), DataTable)
- End If
-
- End Get
- Set(value As DataTable)
- ViewState("CCxC") = value
- End Set
- End Property
- Private Property CPxP As DataTable
- Get
-
- If ViewState("CPxP") Is Nothing Then
- Return New DataTable
- Else
- Return DirectCast(ViewState("CPxP"), DataTable)
- End If
-
- End Get
- Set(value As DataTable)
- 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
@@ -160,77 +72,35 @@ 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
- VxP = Nothing
- End If
-
- 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
- CxP192 = Nothing
+ ObjVentas.DtResultados.DefaultView.Sort = "CveMoneda,SubTotal DESC"
+ GvVxP.DataSource = ObjVentas.DtResultados.DefaultView.ToTable
End If
'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
- ' CxP = Nothing
+ ' UsuarioActual.CveEmpresa, 5, -1, -1, "-1", "-1", -1, TipoCambio:=1, CveUsuarioConsulta:=UsuarioActual.CveUsuario, CveProveedorClasificacion:=192) Then
+ ' GvCxP192.DataSource = ObjCompras.DtResultados.DefaultView.Sort = "CveMoneda,SubTotal DESC"
'End If
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
-
- CCxC = ObjMovtos.DtResultados
- CCxC.DefaultView.Sort = "CveMoneda,Saldo DESC"
- CCxC = CCxC.DefaultView.ToTable
- GvCCxC.DataSource = CCxC
- Else
- GvCCxC.DataSource = Nothing
- CCxC = Nothing
+ ObjMovtos.DtResultados.DefaultView.Sort = "CveMoneda,Saldo DESC"
+ GvCCxC.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
-
- CPxP = ObjMovtos.DtResultados
- CPxP.DefaultView.Sort = "CveMoneda,Saldo DESC"
- CPxP = CPxP.DefaultView.ToTable
- GvCxP.DataSource = CPxP
- Else
- GvCxP.DataSource = Nothing
- CPxP = Nothing
+ ObjMovtos.DtResultados.DefaultView.Sort = "CveMoneda,Saldo DESC"
+ GvCPxP.DataSource = ObjMovtos.DtResultados.DefaultView.ToTable
End If
- '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, UsuarioActual.CveUsuario, DdlSubProyecto.SelectedValue.ToEntero) Then
-
- GvCxP192.DataSource = ObjCitrus.DTSetResultados.Tables(0)
- GvComprasAcreed.DataSource = ObjCitrus.DTSetResultados.Tables(1)
- CxP = ObjCitrus.DTSetResultados.Tables(1)
+ 'ObjCitrus.DTSetResultados.Tables(0).DefaultView.Sort = "CveMoneda,SubTotal DESC"
+ GvCxP192.DataSource = ObjCitrus.DTSetResultados.Tables(0).DefaultView.ToTable
+ 'ObjCitrus.DTSetResultados.Tables(1).DefaultView.Sort = "CveMoneda,SubTotal DESC"
+ GvComprasAcreed.DataSource = ObjCitrus.DTSetResultados.Tables(1).DefaultView.ToTable
+ 'GvCPxP.DataSource = ObjCitrus.DTSetResultados.Tables(1).DefaultView.ToTable
End If
ObjVentas.Dispose()
@@ -243,7 +113,7 @@ Partial Class General_RepIndicadorResumen
GvComprasAcreed.DataBind()
GvCCxC.DataBind()
'GvCCxC.HeaderRow.Cells(1).Text = "Saldo"
- GvCxP.DataBind()
+ GvCPxP.DataBind()
'Mostrar gráficos solo si hay datos en su respectiva tabla
@@ -267,7 +137,7 @@ Partial Class General_RepIndicadorResumen
Else
UPGraficaCCxC.Visible = False
End If
- If GvCxP.Rows.Count > 0 Then
+ If GvCPxP.Rows.Count > 0 Then
UPGraficaCPxP.Visible = True
Else
UPGraficaCPxP.Visible = False
@@ -279,7 +149,7 @@ Partial Class General_RepIndicadorResumen
'End If
'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 GvCxP.Rows.Count = 0) Then Exit Sub
+ 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
GraficasPastel()
'GraficasBarras()
End Sub
@@ -316,7 +186,7 @@ Partial Class General_RepIndicadorResumen
' e.Row.Cells(2).Text = $"{GlobalDTMonedas().FiltraParametros($"CveMoneda = {e.Row.DBCampo("CveMoneda").ToString}").Rows(0)("Abreviatura").ToString}"
End If
End Sub
- Protected Sub GvCxP_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvCxP.RowDataBound
+ 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"
@@ -411,14 +281,14 @@ Partial Class General_RepIndicadorResumen
DtVxP.Columns.Add("Color")
DtVxP.Columns.Add("Moneda")
RowColorIndex = 0
- For Each Dr As DataRow In VxP.Rows
+ For Each Dr As DataRow In GvVxP.DataSource.Rows
If Not Dr("Orden").ToString = "" Then
Dim Row As DataRow = Nothing
Row = DtVxP.NewRow()
- Row("Texto") = $"{Dr("GPO").ToString} {GlobalDTMonedas().FiltraParametros($"CveMoneda = {Dr("CveMoneda").ToString}").Rows(0)("Abreviatura").ToString}"
+ Row("Texto") = Dr("GPO").ToString
Row("Valor") = Dr("SubTotal").ToString.FormatoNumero
Row("Color") = DtColor.Rows(RowColorIndex)("Color").ToString
- 'Row("Moneda") = Dr("Abreviatura").ToString
+ Row("Moneda") = $"{GlobalDTMonedas().FiltraParametros($"CveMoneda = {Dr("CveMoneda").ToString}").Rows(0)("Abreviatura").ToString}"
DtVxP.Rows.Add(Row)
RowColorIndex += 1
If RowColorIndex = 17 Then
@@ -430,7 +300,7 @@ Partial Class General_RepIndicadorResumen
Dim resto_vxp = From s In DtVxP.AsEnumerable().Skip(10) Select New With {.Texto = "Otros", .Valor = s("Valor").ToString().ToDouble(), .Color = s("Color").ToString(), .Moneda = s("Moneda").ToString()}
Dim group_resto_vxp = resto_vxp.GroupBy(Function(x) x.Texto).[Select](Function(g) New With {
.Texto = "Otros",
- .Valor = g.Sum(Function(x) x.Valor),
+ .Valor = Math.Round(g.Sum(Function(x) x.Valor), 2),
.Color = "#000000",
.Moneda = "MXN"
})
@@ -439,14 +309,14 @@ 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 = resto_vxp.GroupBy(Function(e) New With {Key e.Texto, Key e.Valor, Key e.Color, Key e.Moneda}).ToList()
- 'Compras x Producto TipoProveedor=1
+ 'Compras x Producto TipoProveedor=1 Acreedores (Gastos)
DtCxP.Reset()
DtCxP.Columns.Add("Texto")
DtCxP.Columns.Add("Valor")
DtCxP.Columns.Add("Color")
DtCxP.Columns.Add("Moneda")
RowColorIndex = 0
- For Each Dr As DataRow In CxP.Rows
+ For Each Dr As DataRow In GvComprasAcreed.DataSource.Rows
If Dr("CveClasificacion").ToString <> "" Then
Dim Row As DataRow = Nothing
Row = DtCxP.NewRow()
@@ -461,7 +331,15 @@ Partial Class General_RepIndicadorResumen
End If
End If
Next
- Dim query_cxp = From s In DtCxP.AsEnumerable().Take(20) Select New With {.Texto = s("Texto").ToString(), .Valor = s("Valor").ToString().ToDouble(), .Color = s("Color").ToString(), .Moneda = s("Moneda").ToString()}
+ 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(), .Moneda = s("Moneda").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(), .Moneda = s("Moneda").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",
+ .Moneda = "MXN"
+ })
+ Dim query_cxp = top_cxp.Union(group_resto_cxp)
'Compras x Producto ProveedorClasificacion=192
DtCxP192.Reset()
@@ -470,22 +348,20 @@ Partial Class General_RepIndicadorResumen
DtCxP192.Columns.Add("Color")
DtCxP192.Columns.Add("Moneda")
RowColorIndex = 0
- For Each Dr As DataRow In CxP192.Rows
- 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("Abreviatura").ToString
- DtCxP192.Rows.Add(Row)
- RowColorIndex += 1
- If RowColorIndex = 17 Then
- RowColorIndex = 0
- End If
+ For Each Dr As DataRow In GvCxP192.DataSource.Rows
+ Dim Row As DataRow = Nothing
+ Row = DtCxP192.NewRow()
+ Row("Texto") = $"{Dr("RazonSocial").ToString}"
+ Row("Valor") = Dr("SubTotal").ToString.FormatoNumero
+ Row("Color") = DtColor.Rows(RowColorIndex)("Color").ToString
+ 'Row("Moneda") = "MXN"
+ DtCxP192.Rows.Add(Row)
+ RowColorIndex += 1
+ If RowColorIndex = 17 Then
+ RowColorIndex = 0
End If
Next
- Dim query_cxp192 = From s In DtCxP192.AsEnumerable().Take(20) 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(10) 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))
@@ -496,7 +372,7 @@ Partial Class General_RepIndicadorResumen
DtCCxC.Columns.Add("Color")
DtCCxC.Columns.Add("Moneda")
RowColorIndex = 0
- For Each Dr As DataRow In CCxC.Rows
+ For Each Dr As DataRow In GvCCxC.DataSource.Rows
If Not Dr("Orden").ToString = "" Then
Dim Row As DataRow = Nothing
Row = DtCCxC.NewRow()
@@ -520,7 +396,7 @@ Partial Class General_RepIndicadorResumen
DtCPxP.Columns.Add("Color")
DtCPxP.Columns.Add("Moneda")
RowColorIndex = 0
- For Each Dr As DataRow In CPxP.Rows
+ For Each Dr As DataRow In GvCPxP.DataSource.Rows
If Not Dr("Orden").ToString = "" Then
Dim Row As DataRow = Nothing
Row = DtCPxP.NewRow()
@@ -543,8 +419,8 @@ Partial Class General_RepIndicadorResumen
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)
- RegistraScript($"CargaGraficasPastel({json})", "22")
- RegistraScript($"CargaGraficasBarras({json})", "223")
+ RegistraScript($"CargaGraficasBarras({json})", "sdkp24223")
+ 'RegistraScript($"CargaGraficasPastel({json})", "22")
UPPMov.Update()
End Sub
Private Sub GraficasBarras()