-- mejoras

This commit is contained in:
2022-12-07 11:47:30 -07:00
parent e686462186
commit 361051ac09
2 changed files with 72 additions and 148 deletions

View File

@@ -181,16 +181,16 @@ Partial Class General_RepIndicadorResumen
CxP192 = 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, 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
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
'End If
Dim FechaCorte As String = $"31/12/{Now.Year}"
@@ -206,15 +206,15 @@ Partial Class General_RepIndicadorResumen
CCxC = Nothing
End If
If ObjMovtos.GetCxP(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
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
GvCPxP.DataSource = CPxP
GvCxP.DataSource = CPxP
Else
GvCPxP.DataSource = Nothing
GvCxP.DataSource = Nothing
CPxP = Nothing
End If
@@ -227,15 +227,11 @@ Partial Class General_RepIndicadorResumen
' gv1 = Nothing
'End If
If ObjCitrus.GetIndicadores(UsuarioActual.CveEmpresa, TxtFechaI.Text, TxtFechaF.Text) Then
If ObjCitrus.GetIndicadores(UsuarioActual.CveEmpresa, TxtFechaI.Text, TxtFechaF.Text, UsuarioActual.CveUsuario, DdlSubProyecto.SelectedValue.ToEntero) Then
Indicadores = ObjCitrus.DtResultados
Indicadores.DefaultView.Sort = "Saldo DESC"
Indicadores = Indicadores.DefaultView.ToTable
GvIndicadores.DataSource = Indicadores
Else
GvIndicadores.DataSource = Nothing
Indicadores = Nothing
GvCxP192.DataSource = ObjCitrus.DTSetResultados.Tables(0)
GvComprasAcreed.DataSource = ObjCitrus.DTSetResultados.Tables(1)
CxP = ObjCitrus.DTSetResultados.Tables(1)
End If
ObjVentas.Dispose()
@@ -245,11 +241,10 @@ Partial Class General_RepIndicadorResumen
GvVxP.DataBind()
GvCxP192.DataBind()
GvCxP.DataBind()
'GridView1.DataBind()
GvComprasAcreed.DataBind()
GvCCxC.DataBind()
GvCPxP.DataBind()
GvIndicadores.DataBind()
GvCxP.DataBind()
'Mostrar gráficos solo si hay datos en su respectiva tabla
If GvVxP.Rows.Count > 0 Then
@@ -257,10 +252,10 @@ Partial Class General_RepIndicadorResumen
Else
UPGraficaVxP.Visible = False
End If
If GvCxP.Rows.Count > 0 Then
UPGraficaCxP.Visible = True
If GvComprasAcreed.Rows.Count > 0 Then
UPGraficaComprasAcreed.Visible = True
Else
UPGraficaCxP.Visible = False
UPGraficaComprasAcreed.Visible = False
End If
If GvCxP192.Rows.Count > 0 Then
UPGraficaCxP192.Visible = True
@@ -272,7 +267,7 @@ Partial Class General_RepIndicadorResumen
Else
UPGraficaCCxC.Visible = False
End If
If GvCPxP.Rows.Count > 0 Then
If GvCxP.Rows.Count > 0 Then
UPGraficaCPxP.Visible = True
Else
UPGraficaCPxP.Visible = False
@@ -284,7 +279,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 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 GvComprasAcreed.Rows.Count = 0 AndAlso GvCxP192.Rows.Count = 0 AndAlso GvCCxC.Rows.Count = 0 AndAlso GvCxP.Rows.Count = 0) Then Exit Sub
GraficasPastel()
'GraficasBarras()
End Sub
@@ -295,22 +290,21 @@ Partial Class General_RepIndicadorResumen
End If
End If
End Sub
Protected Sub GvCxP_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvCxP.RowDataBound
Protected Sub GvComprasAcreed_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvComprasAcreed.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
'e.Row.Cells(0).Text = e.Row.DBCampo("Orden")
If e.Row.DBCampo("Orden") = "00ND" Then
If e.Row.DBCampo("CveClasificacion") = "" 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
'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 GvCCxC_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvCCxC.RowDataBound
@@ -319,25 +313,19 @@ Partial Class General_RepIndicadorResumen
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}"
' 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
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.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}"
' 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
'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")
@@ -430,7 +418,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("Abreviatura").ToString
'Row("Moneda") = Dr("Abreviatura").ToString
DtVxP.Rows.Add(Row)
RowColorIndex += 1
If RowColorIndex = 17 Then
@@ -438,7 +426,7 @@ Partial Class General_RepIndicadorResumen
End If
End If
Next
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()}
Dim query_vxp = From s In DtVxP.AsEnumerable().Take(20) 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()
@@ -448,13 +436,13 @@ Partial Class General_RepIndicadorResumen
DtCxP.Columns.Add("Moneda")
RowColorIndex = 0
For Each Dr As DataRow In CxP.Rows
If Not Dr("Orden").ToString = "00ND" Then
If Dr("CveClasificacion").ToString <> "" 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("Texto") = Dr("Clasificacion").ToString ' $"{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
Row("Moneda") = Dr("Moneda").ToString
DtCxP.Rows.Add(Row)
RowColorIndex += 1
If RowColorIndex = 17 Then
@@ -462,7 +450,7 @@ Partial Class General_RepIndicadorResumen
End If
End If
Next
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()}
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()}
'Compras x Producto ProveedorClasificacion=192
DtCxP192.Reset()
@@ -486,7 +474,7 @@ Partial Class General_RepIndicadorResumen
End If
End If
Next
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()}
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()}
'Alert(Newtonsoft.Json.JsonConvert.SerializeObject(CCxC.Rows))
@@ -512,7 +500,7 @@ Partial Class General_RepIndicadorResumen
End If
End If
Next
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()}
Dim query_ccxc = From s In DtCCxC.AsEnumerable().Take(20) 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()
@@ -536,7 +524,7 @@ Partial Class General_RepIndicadorResumen
End If
End If
Next
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()}
Dim query_cpxp = From s In DtCPxP.AsEnumerable().Take(20) 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