diff --git a/App_Code/ClsInventarios.vb b/App_Code/ClsInventarios.vb index f34c3b52e..70e923f48 100644 --- a/App_Code/ClsInventarios.vb +++ b/App_Code/ClsInventarios.vb @@ -6283,12 +6283,13 @@ Public Class ClsInventarios Return Retorno End Function - Public Function GetUltimoCosto(CveEmpresa As Integer) As Boolean + Public Function GetUltimoCosto(CveEmpresa As Integer, Optional CvePS As Integer = -1) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Inv_UltimoCostoGet") With SqlAdapter.SelectCommand.Parameters .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CvePS", SqlDbType.Int).Value = CvePS End With Try diff --git a/Ventas/Promociones.aspx.vb b/Ventas/Promociones.aspx.vb index 0d90fe29d..549ac61ee 100644 --- a/Ventas/Promociones.aspx.vb +++ b/Ventas/Promociones.aspx.vb @@ -513,6 +513,15 @@ Partial Class Ventas_Promociones End If End If + ' validación de %minimo considerado 02580104V + If UsuarioActual.Empresa.Funcionalidad(382) = "1" Then + Dim tuc As Decimal = LblUltimoCosto.Text.ToDecimal + Dim tpu As Decimal = TxtPromocionConcepto.Text.ToDecimal + If (tpu - tuc) / tuc < UsuarioActual.Empresa.Funcionalidad(129).ToDecimal / 100 Then + Alert("El producto está debajo de la utilidad permitida, la promoción requerirá autorización.", TipoMensaje.MsgAdvertencia.ToastAdventencia) + End If + End If + If TxtCantMinima.Text.ToEntero <= 0 Then Alert("La cantidad minima debe ser de 1", TipoMensaje.MsgAdvertencia) Exit Sub @@ -1416,13 +1425,13 @@ Partial Class Ventas_Promociones Dim DTPSUltimoCosto = New DataTable Dim ObjInv As New ClsInventarios - If ObjInv.GetUltimoCosto(UsuarioActual.CveEmpresa) Then + If ObjInv.GetUltimoCosto(UsuarioActual.CveEmpresa, CvePS:=DdlPS.SelectedValue.ToEntero) Then DTPSUltimoCosto = ObjInv.DtResultados End If ObjInv.Dispose() - LblUltimoCosto.Text = DTPSUltimoCosto.FiltroPrimeroValor("UltimoCosto", $"CvePS = {DdlPS.SelectedValue}").FormatoNumero - LblCostoPromedio.Text = DTPSUltimoCosto.FiltroPrimeroValor("CostoPromedio", $"CvePS = {DdlPS.SelectedValue}").FormatoNumero + LblUltimoCosto.Text = DTPSUltimoCosto.FiltroPrimeroValor("UltimoCosto", "").FormatoNumero(4) + LblCostoPromedio.Text = DTPSUltimoCosto.FiltroPrimeroValor("CostoPromedio", "").FormatoNumero(4) UpAgregar.Update() End Sub