From 27a173ac1b2a46558a740c59b527b03bde791ff7 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Thu, 8 May 2025 18:01:27 -0700 Subject: [PATCH] --FIX ventas --- Ventas/RepVentas.aspx.vb | 3 -- Ventas/RepVentasDetalle.aspx.vb | 4 --- Ventas/Ventas.aspx.vb | 51 +++++++++++++++++++++++++++++++++ 3 files changed, 51 insertions(+), 7 deletions(-) diff --git a/Ventas/RepVentas.aspx.vb b/Ventas/RepVentas.aspx.vb index f2495b84c..be58e771b 100644 --- a/Ventas/RepVentas.aspx.vb +++ b/Ventas/RepVentas.aspx.vb @@ -301,9 +301,6 @@ Partial Class Ventas_RepVentas Dim Vendedores As String = If(DdlVendedor.GetSelectedValuesM = "", "-1", DdlVendedor.GetSelectedValuesM) Dim CveCliente As Integer = If(DdlClientes.SelectedValue = "", -1, DdlClientes.SelectedValue.ToEntero) - If TipoComprobante.Contiene("Rem") And Not Estatus.Contiene("11") Then - Estatus = Estatus & ",11" - End If If RblTipoCambio.SelectedValue.ToEntero = 3 And TxtEspecifico.Text <> "" Then TCEspecifico = TxtEspecifico.Text.ToDecimal diff --git a/Ventas/RepVentasDetalle.aspx.vb b/Ventas/RepVentasDetalle.aspx.vb index 5229dd38f..ea1b0561f 100644 --- a/Ventas/RepVentasDetalle.aspx.vb +++ b/Ventas/RepVentasDetalle.aspx.vb @@ -459,10 +459,6 @@ Partial Class RepVentasDetalle FechaIEjec = If(IsDate(TxtFechaIEjec.Text.Trim()), TxtFechaIEjec.Text.Trim.ToDate, MinFecha) FechaFEjec = If(IsDate(TxtFechaFEjec.Text.Trim()), TxtFechaFEjec.Text.Trim.ToDate, MaxFecha) - If TipoComprobante.Contiene("Rem") And Not Estatus.Contiene("11") Then - Estatus = Estatus & ",11" - End If - Dim ModalidadContable As Boolean = CBool(If(Request("ModalidadContable") IsNot Nothing, Request("ModalidadContable").ToEntero(), 0)) ChkLecturaAdmin.Checked = Not ModalidadContable diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 4e80b42c6..87393a619 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -10670,6 +10670,10 @@ Partial Class Ventas End If End If + If Not ValidaPSSoloCotizacion() Then + Exit Sub + End If + 'CREA UNA COPIA DE SEGURIDAD PARA LOS DATOS DEL TMPDT If TmpDTError Is Nothing OrElse TmpDTError.Rows.Count = 0 Then TmpDTError = TmpDT.Copy() @@ -19914,6 +19918,36 @@ Partial Class Ventas Protected Sub LbAgregar_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles LbAgregar.Click AgregarPS() End Sub + + Private Function ValidaPSSoloCotizacion() As Boolean + Dim Returno As Boolean = True + If UsuarioActual.Empresa.Funcionalidad(720) <> "" AndAlso DdlTipoComprobante.SelectedValue <> "Cot" Then + Dim ProductosSoloCotizacion As List(Of String) = UsuarioActual.Empresa.Funcionalidad(720).Split(","c).ToList() + + If ProductosSoloCotizacion IsNot Nothing AndAlso ProductosSoloCotizacion.Count > 0 Then + + For Each GvRow As GridViewRow In GvPS.Rows + If GvRow.RowType = DataControlRowType.DataRow Then + Dim CvePS As String = GvRow.DataKey("CvePS") + If ProductosSoloCotizacion.Any(Function(CvePSCot) CvePSCot.Trim() = CvePS) Then + Dim PSCot As String = "" + Dim DrPSCot As DataRow = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CvePS:=CvePS.ToEntero()).Rows(0) + If DrPSCot IsNot Nothing Then + PSCot = DrPSCot("PSCodigo").ToString + End If + + Alert($"El producto y/o servicio '{PSCot}' está disponible únicamente para cotizaciones.", TipoMensaje.MsgAdvertencia) + Returno = False + Exit For + End If + End If + Next + End If + End If + + Return Returno + End Function + Private Function ValidaAgregarPS(Cantidad As Decimal, CvePS As Integer, CveUM As Integer, PU As Double, CveTipoPS As Integer, CveClasificacion As Integer, CveSubProyecto As Integer, ObjDescuento As Modelos.VentaDescuentos, Optional CantidadModal As Decimal = 0D, Optional PSValidarModal As String = "", Optional CantidadOriginal As Decimal = 0D, Optional EsEdicion As Boolean = False) As Boolean 'NO TOCAR - IPP 'VALIDA PARAMETROS @@ -19922,6 +19956,23 @@ Partial Class Ventas Return False End If + 'VALIDA PS DE COTIZACION + If UsuarioActual.Empresa.Funcionalidad(720) <> "" Then + Dim ProductosSoloCotizacion As List(Of String) = UsuarioActual.Empresa.Funcionalidad(720).Split(","c).ToList() + If ProductosSoloCotizacion IsNot Nothing AndAlso ProductosSoloCotizacion.Count > 0 Then + If DdlTipoComprobante.SelectedValue <> "Cot" AndAlso ProductosSoloCotizacion.Any(Function(CvePSCot) CvePSCot.Trim() = CvePS.ToString()) Then + Dim PSCot As String = "" + Dim DrPSCot As DataRow = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CvePS:=CvePS).Rows(0) + If DrPSCot IsNot Nothing Then + PSCot = DrPSCot("PSCodigo").ToString + End If + + Alert($"El producto y/o servicio '{PSCot}' está disponible únicamente para cotizaciones.", TipoMensaje.MsgAdvertencia) + Return False + End If + End If + End If + If PSValidarModal.Trim.Length > 0 Then HdnPS.Value = PSValidarModal End If