From 661c0126c7dc4ac7dbc63ae5fc1043a0c06bcc9f Mon Sep 17 00:00:00 2001 From: rrene Date: Fri, 20 Aug 2021 20:34:04 -0700 Subject: [PATCH] Marcas en Reportes de utilidad - globaldtmarcas --- App_Code/ClsPaginas.vb | 27 +++++++++++++++++++++++++++ App_Code/ClsVentas.vb | 9 ++++++--- Ventas/ProductosServicios.aspx.vb | 7 ++----- Ventas/RepVentasUtilidad.aspx | 6 ++++++ Ventas/RepVentasUtilidad.aspx.vb | 9 ++++++++- Ventas/RepVentasUtilidadPadre.aspx | 9 ++++++++- Ventas/RepVentasUtilidadPadre.aspx.vb | 14 ++++++++++---- 7 files changed, 67 insertions(+), 14 deletions(-) diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index 0813cc12b..6f614ab00 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -2356,6 +2356,33 @@ Public Class ClsPaginas End Set End Property + Property GlobalDTGralMarcas(CveEmpresa As Integer, Optional CveMarca As Integer = -1) As DataTable + Get + Dim AppNombre As String = String.Format("GlobalDTGralMarcas-{0}", CveEmpresa) + 'sino existe, recarga los datos + If DirectCast(Application(AppNombre), DataTable) Is Nothing Then + Dim ObjMarcas As New ClsProductosServicios + If ObjMarcas.GetMarcas(CveEmpresa) Then Application(AppNombre) = ObjMarcas.DtResultados Else Application(AppNombre) = Nothing + ObjMarcas.Dispose() + End If + + Dim filtro As New StringBuilder + If CveMarca > 0 Then + filtro.AppendFormat(" CveMarca={0} ", CveMarca) + End If + + Dim Dv As New DataView(DirectCast(Application(AppNombre), DataTable), filtro.ToString, "", DataViewRowState.CurrentRows) + GlobalDTGralMarcas = Dv.ToTable + Dv.Dispose() + + + End Get + Set(value As DataTable) + Dim AppNombre As String = String.Format("GlobalDTGralMarcas-{0}", CveEmpresa) + Application(AppNombre) = value + End Set + End Property + #End Region #Region "***********************************************************************DT PROSPECTOS*************************************************************************************" diff --git a/App_Code/ClsVentas.vb b/App_Code/ClsVentas.vb index cc953d4a8..c0ca015c2 100644 --- a/App_Code/ClsVentas.vb +++ b/App_Code/ClsVentas.vb @@ -2826,7 +2826,7 @@ Public Class ClsVentas Return Retorno End Function - Public Function GetReporteVentasUtilidad(CveVendedor As String, CveCliente As Integer, CveSubProyecto As String, FechaInicio As Date, FechaFin As Date, CveEmpresa As Integer, CvePS As Integer, CveClasificacion As Double) As Boolean + Public Function GetReporteVentasUtilidad(CveVendedor As String, CveCliente As Integer, CveSubProyecto As String, FechaInicio As Date, FechaFin As Date, CveEmpresa As Integer, CvePS As Integer, CveClasificacion As Integer, CveMarca As Integer) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Vta_VentasUtilidadGet") @@ -2839,6 +2839,7 @@ Public Class ClsVentas .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@CvePS", SqlDbType.Int).Value = CvePS .Add("@CveClasificacion", SqlDbType.Int).Value = CveClasificacion + .Add("@CveMarca", SqlDbType.Int).Value = CveMarca End With Try @@ -2853,7 +2854,7 @@ Public Class ClsVentas Return Retorno End Function - Public Function GetReporteVentasUtilidadDetalle(CveVendedor As String, CveVenta As Integer, CveCliente As Integer, CveSubProyecto As String, FechaInicio As Date, FechaFin As Date, CveEmpresa As Integer, CvePS As Integer, CveClasificacion As Double) As Boolean + Public Function GetReporteVentasUtilidadDetalle(CveVendedor As String, CveVenta As Integer, CveCliente As Integer, CveSubProyecto As String, FechaInicio As Date, FechaFin As Date, CveEmpresa As Integer, CvePS As Integer, CveClasificacion As Integer, CveMarca As Integer) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Vta_VentasUtilidadDetalleGet") With SqlAdapter.SelectCommand.Parameters @@ -2866,6 +2867,7 @@ Public Class ClsVentas .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@CvePS", SqlDbType.Int).Value = CvePS .Add("@CveClasificacion", SqlDbType.Int).Value = CveClasificacion + .Add("@CveMarca", SqlDbType.Int).Value = CveMarca End With Try @@ -2883,7 +2885,7 @@ Public Class ClsVentas Return Retorno End Function - Public Function GetReportePadreVentasUtilidad(CveVendedor As String, CveCliente As Integer, CveSubProyecto As String, FechaInicio As Date, FechaFin As Date, CveEmpresa As Integer, Gpo As Integer, CvePS As Integer, CveClasificacion As Double) As Boolean + Public Function GetReportePadreVentasUtilidad(CveVendedor As String, CveCliente As Integer, CveSubProyecto As String, FechaInicio As Date, FechaFin As Date, CveEmpresa As Integer, Gpo As Integer, CvePS As Integer, CveClasificacion As Integer, CveMarca As Integer) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Vta_RepVentasUtilidadGet") @@ -2897,6 +2899,7 @@ Public Class ClsVentas .Add("@Gpo", SqlDbType.Int).Value = Gpo .Add("@CvePS", SqlDbType.Int).Value = CvePS .Add("@CveClasificacion", SqlDbType.Int).Value = CveClasificacion + .Add("@CveMarca", SqlDbType.Int).Value = CveMarca End With Try SqlAdapter.Fill(Data) diff --git a/Ventas/ProductosServicios.aspx.vb b/Ventas/ProductosServicios.aspx.vb index c35cc0d46..b6aa92a44 100644 --- a/Ventas/ProductosServicios.aspx.vb +++ b/Ventas/ProductosServicios.aspx.vb @@ -1801,11 +1801,8 @@ Partial Class ProductosyServicios DivMarca.Visible = True End If - Dim ObjMarcas As New ClsProductosServicios - ObjMarcas.GetMarcas(UsuarioActual.CveEmpresa) - DdlMarca.DataSource = ObjMarcas.DtResultados - DdlMarcaPSDes.DataSource = ObjMarcas.DtResultados - ObjMarcas.Dispose() + DdlMarca.DataSource = GlobalDTGralMarcas(UsuarioActual.CveEmpresa) + DdlMarcaPSDes.DataSource = GlobalDTGralMarcas(UsuarioActual.CveEmpresa) DdlMarca.DataBind() DdlMarcaPSDes.DataBind() End If diff --git a/Ventas/RepVentasUtilidad.aspx b/Ventas/RepVentasUtilidad.aspx index ce157c38a..fe815a36f 100644 --- a/Ventas/RepVentasUtilidad.aspx +++ b/Ventas/RepVentasUtilidad.aspx @@ -191,6 +191,12 @@
+
+ Marca: +
+
+ +
diff --git a/Ventas/RepVentasUtilidad.aspx.vb b/Ventas/RepVentasUtilidad.aspx.vb index cfd0678b8..3368636b7 100644 --- a/Ventas/RepVentasUtilidad.aspx.vb +++ b/Ventas/RepVentasUtilidad.aspx.vb @@ -81,6 +81,10 @@ Partial Class Ventas_RepVentasUtilidad DdlPS.ddl.Items.Insert(0, New ListItem("Todos", "-1")) End If + DdlMarcas.DataSource = GlobalDTGralMarcas(UsuarioActual.CveEmpresa) + DdlMarcas.DataBind() + DdlMarcas.Items.Insert(0, New ListItem("Todas", "-1")) + Dim CveSubProyecto = If(Request("CveSubProyecto") IsNot Nothing, Request("CveSubProyecto").ToString, "-1").ToString Dim CveVendedor = If(Request("CveVendedor") IsNot Nothing AndAlso Request("CveVendedor") <> "", Request("CveVendedor"), "-1").ToString Dim CveCliente = If(Request("CveCliente") IsNot Nothing AndAlso Request("CveCliente") <> "", Request("CveCliente"), "-1").ToString @@ -90,6 +94,7 @@ Partial Class Ventas_RepVentasUtilidad Dim FechaF = If(Request("FechaF") IsNot Nothing, Request("FechaF").ToString, "-1").ToString Dim CveClasificacion = If(Request("CveClasificacion") IsNot Nothing AndAlso Request("CveClasificacion") <> "", Request("CveClasificacion"), "-1").ToString Dim CvePS = If(Request("CvePS") IsNot Nothing AndAlso Request("CvePS") <> "", Request("CvePS"), "-1").ToString + Dim CveMarca = If(Request("CveMarca") IsNot Nothing AndAlso Request("CveMarca") <> "", Request("CveMarca"), "-1").ToString DdlSubProyecto.SelectedValuesIfExistM(CveSubProyecto) DdlVendedor.SelectedValuesIfExistM(CveVendedor) @@ -105,6 +110,8 @@ Partial Class Ventas_RepVentasUtilidad DdlPS.SelectedText = "Todos" End If + DdlMarcas.SelectedValueExist(CveMarca) + txtFechaI.Text = FechaI txtFechaF.Text = FechaF @@ -144,7 +151,7 @@ Partial Class Ventas_RepVentasUtilidad Dim Sucursales As String = IIf(DdlSubProyecto.GetSelectedValuesM = "", "-1", DdlSubProyecto.GetSelectedValuesM).ToString Dim Vendedores As String = IIf(DdlVendedor.GetSelectedValuesM = "", "-1", DdlVendedor.GetSelectedValuesM).ToString - If ObjVentas.GetReporteVentasUtilidad(Vendedores, DdlClientes.SelectedValue.ToEntero, Sucursales, FechaI, FechaF, UsuarioActual.CveEmpresa, DdlPS.SelectedValue.ToEntero, DdlClasificacion.SelectedValue.ToEntero) Then + If ObjVentas.GetReporteVentasUtilidad(Vendedores, DdlClientes.SelectedValue.ToEntero, Sucursales, FechaI, FechaF, UsuarioActual.CveEmpresa, DdlPS.SelectedValue.ToEntero, DdlClasificacion.SelectedValue.ToEntero,) Then DtVentas = ObjVentas.DtResultados GvDatos.DataSource = ObjVentas.DtResultados GvDatos.DataBind() diff --git a/Ventas/RepVentasUtilidadPadre.aspx b/Ventas/RepVentasUtilidadPadre.aspx index 35a9fc4e5..63723e3ea 100644 --- a/Ventas/RepVentasUtilidadPadre.aspx +++ b/Ventas/RepVentasUtilidadPadre.aspx @@ -90,6 +90,7 @@ +
@@ -165,6 +166,12 @@
+
+ Marca: +
+
+ +
@@ -207,7 +214,7 @@ - + diff --git a/Ventas/RepVentasUtilidadPadre.aspx.vb b/Ventas/RepVentasUtilidadPadre.aspx.vb index b4d764d2a..1efac4dcc 100644 --- a/Ventas/RepVentasUtilidadPadre.aspx.vb +++ b/Ventas/RepVentasUtilidadPadre.aspx.vb @@ -86,6 +86,10 @@ Partial Class Ventas_RepVentasUtilidadPadre DdlPS.ddl.Items.Insert(0, New ListItem("Todos", "-1")) End If + DdlMarcas.DataSource = GlobalDTGralMarcas(UsuarioActual.CveEmpresa) + DdlMarcas.DataBind() + DdlMarcas.Items.Insert(0, New ListItem("Todas", "-1")) + LblNeto.Text = "0" LblPorNeto.Text = "0" End Sub @@ -110,7 +114,8 @@ Partial Class Ventas_RepVentasUtilidadPadre Dim ObjVentas As New ClsVentas If ObjVentas.GetReportePadreVentasUtilidad(If(DdlVendedor.GetSelectedValuesM = "", "-1", DdlVendedor.GetSelectedValuesM), DdlClientesWS.SelectedValue.ToEntero, If(DdlSubProyecto.GetSelectedValuesM = "", "-1", DdlSubProyecto.GetSelectedValuesM), txtFechaI.Text.ToDate, txtFechaF.Text.ToDate, - UsuarioActual.CveEmpresa, DdlGrupo.SelectedValue.ToEntero, DdlPS.SelectedValue.ToEntero, DdlClasificacion.SelectedValue.ToEntero) Then + UsuarioActual.CveEmpresa, DdlGrupo.SelectedValue.ToEntero, DdlPS.SelectedValue.ToEntero, DdlClasificacion.SelectedValue.ToEntero, + DdlMarcas.SelectedValue.ToEntero) Then GvDatos.DataSource = ObjVentas.DtResultados DtDatos = ObjVentas.DtResultados End If @@ -225,10 +230,10 @@ Partial Class Ventas_RepVentasUtilidadPadre e.Row.CssClass = "Totales" e.Row.Cells(0).Text = "Total" Dim Css As String = "Texto" - Dim Liga As String = String.Format("/Ventas/RepVentasUtilidad.aspx?FechaI={0}&FechaF={1}&CveSubProyecto={2}&CveCliente={3}&CveVendedor={4}&Gpo={5}&CveGpo={6}&CvePS={7}&CveClasificacion={8}", + Dim Liga As String = String.Format("/Ventas/RepVentasUtilidad.aspx?FechaI={0}&FechaF={1}&CveSubProyecto={2}&CveCliente={3}&CveVendedor={4}&Gpo={5}&CveGpo={6}&CvePS={7}&CveClasificacion={8}&CveMarca={9}", e.Row.DBCampo("FechaI"), e.Row.DBCampo("FechaF"), e.Row.DBCampo("CveSubProyecto"), e.Row.DBCampo("CveCliente"), e.Row.DBCampo("CveVendedor"), - e.Row.DBCampo("Grupo"), e.Row.DBCampo("GPO"), e.Row.DBCampo("CvePS"), e.Row.DBCampo("CveClasificacion")) - e.Row.Cells(0).Text = "" & e.Row.Cells(0).Text & "" + e.Row.DBCampo("Grupo"), e.Row.DBCampo("GPO"), e.Row.DBCampo("CvePS"), e.Row.DBCampo("CveClasificacion"), e.Row.DBCampo("CveMarca")) + e.Row.Cells(0).Text = String.Format("{2}", Css, Liga, e.Row.Cells(0).Text) Else e.Row.Cells(9).BackColor = Drawing.Color.LightGray End If @@ -261,6 +266,7 @@ Partial Class Ventas_RepVentasUtilidadPadre If DdlClasificacion.SelectedValue <> "-1" Then StrFiltro.AppendFormat(" Clasificación: {0}", DdlClasificacion.SelectedItem.Text) If DdlClientesWS.SelectedValue <> "-1" Then StrFiltro.AppendFormat(" Cliente: {0}", DdlClientesWS.SelectedText) If DdlVendedor.GetSelectedText <> "" Then StrFiltro.AppendFormat(" Vendedor: {0}", DdlVendedor.GetSelectedText) + If DdlMarcas.SelectedValue <> "-1" Then StrFiltro.AppendFormat(" Marcas: {0}", DdlMarcas.SelectedItem.Text) Dim params As List(Of ReportParameter) = New List(Of ReportParameter)() Dim Imagen As System.IO.FileInfo = New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa)