--FIX precio libre

This commit is contained in:
2024-12-09 13:54:15 -07:00
parent 07f9c6486b
commit 59e3885806

View File

@@ -9016,10 +9016,17 @@ Partial Class Ventas
End If
If UsuarioActual.CveEmpresa = 189 AndAlso Not DdlTipoComprobante.SelectedValue.Contiene("Ant") Then
If UsuarioActual.CveEmpresa = 189 Then
Dim DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=TmpDT.Rows(e.NewEditIndex)("CvePS").ToString().ToEntero()).FiltroPrimero("")
If CBool(DrPS("PrecioLibre")) Then
GvPS.Rows(e.NewEditIndex).FCTextBox("TxtPrecio").Enabled = True
Else
GvPS.Rows(e.NewEditIndex).FCTextBox("TxtPrecio").Enabled = False
End If
End If
End Sub
Protected Sub GvPS_RowCancelingEdit(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCancelEditEventArgs) Handles GvPS.RowCancelingEdit
GvPS.EditIndex = -1
@@ -9072,6 +9079,7 @@ Partial Class Ventas
Dim DatarowPS As DataRow = Nothing
DatarowPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=TmpDT.Rows(e.RowIndex)("CvePS").ToString().ToEntero()).FiltroPrimero("") ' Estado = -1
Dim PrecioLibre As Boolean = False
If UsuarioActual.Empresa.Funcionalidad(382) = "1" Then
If DdlTipoComprobante.SelectedValue = "Cot" Then
If PU < DatarowPS("PrecioMinimo").ToString().ToDecimal() Then
@@ -9080,6 +9088,8 @@ Partial Class Ventas
End If
End If
PrecioLibre = CBool(DatarowPS("PrecioLibre"))
If DdlTipoComprobante.SelectedValue = "Ant" Then
Dim PSCodigoSAT As String = DatarowPS("SATClavePS").ToString
If PSCodigoSAT <> "84111506" Then
@@ -9248,6 +9258,8 @@ Partial Class Ventas
'NO DEJA REGISTRAR MENOS AL PRECIO MINIMO
Dim MensajeCosto As New StringBuilder
Dim TienePermisoImportes As Boolean = UsuarioActual.TienePermisoProceso(201)
If Not PrecioLibre Then
If Not EsValido Then
MensajeCosto.AppendFormat("El Producto <b>{0}</b>. No se puede vender a un precio menor de su Costo <br/>", DatarowPS("PS").ToString())
If TienePermisoImportes Then
@@ -9276,6 +9288,8 @@ Partial Class Ventas
e.Cancel = True
Exit Sub
End If
End If
End If
End If
@@ -18381,18 +18395,24 @@ Partial Class Ventas
tPrecioSugerido = 0
PrecioSugerido = 0
If Not CBool(drPS("PrecioLibre")) Then
Alert("No se encontro una lista de precios permitida en la sucursal actual", TipoMensaje.MsgAdvertencia)
End If
End If
Else
ObjPrecioSugerido.CvePrecioLista = -1
ObjPrecioSugerido.PrecioSugerido = 0
tPrecioSugerido = 0
PrecioSugerido = 0
If Not CBool(drPS("PrecioLibre")) Then
Alert("No se encontraron listas de precio disponibles", TipoMensaje.MsgAdvertencia)
End If
End If
End If
End If
End If
@@ -18410,11 +18430,10 @@ Partial Class Ventas
tPrecioSugerido = 0
PrecioSugerido = 0
TxtPrecio.Enabled = True
TxtPrecio.Enabled = CBool(drPS("PrecioLibre"))
Else
TxtPrecio.Enabled = False
TxtPrecio.Enabled = CBool(drPS("PrecioLibre"))
End If
End If
If PrecioSugerido <= 0 Then PrecioSugerido = tPrecioSugerido
@@ -19439,6 +19458,8 @@ Partial Class Ventas
Return False
End If
Dim PrecioLibre As Boolean = False
If UsuarioActual.Empresa.Funcionalidad(382) = "1" Then
Dim DatarowPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("")
If DatarowPS IsNot Nothing Then
@@ -19457,6 +19478,8 @@ Partial Class Ventas
End If
End If
PrecioLibre = CBool(DatarowPS("PrecioLibre"))
End If
End If
@@ -19675,8 +19698,10 @@ Partial Class Ventas
End If
'NO DEJA REGISTRAR MENOS AL PRECIO MINIMO
If Not PrecioLibre Then
Dim MensajeCosto As New StringBuilder
Dim TienePermisoImportes As Boolean = UsuarioActual.TienePermisoProceso(201)
If Not EsValido Then
MensajeCosto.AppendFormat("El Producto <b>{0}-{1}</b>. No se puede vender a un precio menor de su Costo <br/>", HdnCodigoPS.Value, HdnPS.Value)
If TienePermisoImportes Then
@@ -19700,6 +19725,7 @@ Partial Class Ventas
Alert(MensajeCosto.ToString(), TipoMensaje.MsgAdvertencia)
Return False
End If
End If
End If
End If
@@ -19977,10 +20003,15 @@ Partial Class Ventas
End If
Else
Dim PermiteEdicion = UsuarioActual.CveEmpresa = 189 AndAlso TxtPrecio.Enabled
If Not PermiteEdicion Then
'sino es la seleccionada se recalcula de nuevo
CargaPrecioLista(DdlPS.SelectedValue.ToEntero)
Exit Sub
End If
End If
Else
If Me.CvePrecioLista > 0 Then
CvePrecioListaPS = Me.CvePrecioLista