From 6140f1b73abf1c17866fa2fbea2e423319c45247 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Sat, 18 Jan 2025 15:17:22 -0700 Subject: [PATCH] --FIX cargas de precios --- Ventas/Ventas.aspx.vb | 66 +++++++++++++++++++++++++++++++------------ 1 file changed, 48 insertions(+), 18 deletions(-) diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 61e7f21b3..e39c4fe68 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -18733,7 +18733,22 @@ Partial Class Ventas End Sub Protected Sub DdlPSEdit_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) - If UsuarioActual.Empresa.Funcionalidad(109) = "1" OrElse UsuarioActual.Empresa.Funcionalidad(558) = "1" Then + + Dim ActualizarPrecios As Boolean = False + + If UsuarioActual.Empresa.Funcionalidad(109) = "1" Then + ActualizarPrecios = true + End If + + If UsuarioActual.Empresa.Funcionalidad(558) = "1" Then + ActualizarPrecios = True + End If + + If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then + ActualizarPrecios = True + End If + + If ActualizarPrecios Then Dim EditarPrecio As Boolean = True If DdlTipoComprobante.SelectedValue = "Ant" AndAlso UsuarioActual.CveEmpresa = 189 Then @@ -18747,25 +18762,40 @@ Partial Class Ventas If (GvRow.RowState = DataControlRowState.Edit OrElse GvRow.RowState = 5) Then Dim CvePSParametro = ddlPSEdit.SelectedValue.ToEntero() - Dim DdlPrecioListaEdit = GvRow.FCDropDownList("DdlPrecioListaEdit") + Dim CveClasificacion As Integer = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CvePS:=CvePSParametro).FiltroPrimeroValor("CveClasificacion").ToEntero() - If UsuarioActual.CveEmpresa = 189 Then - If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem", "Cot", "Ped") AndAlso GvRow.FCHtmlGenericControl("DivPrecioLista").Visible Then - Using ObjVta As New ClsVentas - If ObjVta.GetPreciosListaSPPermitidos(DdlSubProyectoDatos.SelectedValue.ToEntero(), CvePSParametro, UsuarioActual.CveEmpresa) Then - Dim Dt As DataTable = Nothing - If UsuarioActual.TienePermisoProceso(384) Then - Dt = ObjVta.DtResultados.Copy() - Else - Dt = ObjVta.DtResultados.FiltraParametros("Restringuida = 'False'") + If CveClasificacion > 0 Then + Dim DdlCla As DropDownList = GvRow.FCDropDownList("DdlClasificacion") + DdlCla.SelectedValueExist(CveClasificacion) + End If + + Dim CvePrecioListaSugerido As Integer = -1 + + If UsuarioActual.Empresa.Funcionalidad(360) = "1" OrElse UsuarioActual.Empresa.Funcionalidad(109) = "1" Then + Dim DdlPrecioListaEdit = GvRow.FCDropDownList("DdlPrecioListaEdit") + + If UsuarioActual.CveEmpresa = 189 Then + If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem", "Cot", "Ped") AndAlso GvRow.FCHtmlGenericControl("DivPrecioLista").Visible Then + Using ObjVta As New ClsVentas + If ObjVta.GetPreciosListaSPPermitidos(DdlSubProyectoDatos.SelectedValue.ToEntero(), CvePSParametro, UsuarioActual.CveEmpresa) Then + Dim Dt As DataTable = Nothing + If UsuarioActual.TienePermisoProceso(384) Then + Dt = ObjVta.DtResultados.Copy() + Else + Dt = ObjVta.DtResultados.FiltraParametros("Restringuida = 'False'") + End If + + GvRow.FCDropDownList("DdlPrecioListaEdit").DataSource = Dt + GvRow.FCDropDownList("DdlPrecioListaEdit").DataBind() + GvRow.FCDropDownList("DdlPrecioListaEdit").SelectedValueExist(GvRow.DataKey("CvePrecioLista")) End If - - GvRow.FCDropDownList("DdlPrecioListaEdit").DataSource = Dt - GvRow.FCDropDownList("DdlPrecioListaEdit").DataBind() - GvRow.FCDropDownList("DdlPrecioListaEdit").SelectedValueExist(GvRow.DataKey("CvePrecioLista")) - End If - End Using + End Using + End If End If + + CvePrecioListaSugerido = DdlPrecioListaEdit.SelectedValue.ToEntero() + Else + CvePrecioListaSugerido = GvRow.DataKey("CvePrecioLista").ToEntero() End If Dim DrPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePSParametro).FiltroPrimero("") @@ -18774,7 +18804,7 @@ Partial Class Ventas Dim PrecioSugerido As Decimal = 0 Dim tPrecioSugerido As Decimal = 0 tPrecioSugerido = DrPS("Precio").ToString().ToDecimal - Dim ObjPrecioSugerido As Modelos.MPrecioSugerido = CalculaPrecioSugerido(CvePSParametro, DrPS("CveClasificacion").ToString().ToEntero(), CvePrecioListaSugerido:=DdlPrecioListaEdit.SelectedValue.ToEntero()) + Dim ObjPrecioSugerido As Modelos.MPrecioSugerido = CalculaPrecioSugerido(CvePSParametro, DrPS("CveClasificacion").ToString().ToEntero(), CvePrecioListaSugerido:=CvePrecioListaSugerido) PrecioSugerido = ObjPrecioSugerido.PrecioSugerido