-- cambio en promociones

This commit is contained in:
rrene
2020-04-06 10:29:29 -07:00
parent e93a4b9347
commit cf3006ca42

View File

@@ -14315,6 +14315,8 @@ Partial Class Ventas
Dim TipoPromo As Integer = 0
Dim TotalPromocion As Decimal = 0
Dim PromocionPorcentaje As Decimal = 0
Dim PUModificado As Decimal = 0
Dim SeAjustoPU As Boolean = False
Dim PUPromocion As Decimal = 0
Dim CantMinima As Integer = 0
Dim CveMarcaPS As Integer = 0
@@ -14322,6 +14324,7 @@ Partial Class Ventas
Dim CveRinTamañoPS As Integer = 0
Dim CvePromocionDetalle As Integer = 0
Dim IncluyeImpuestos As Boolean = False
Dim TipoAplicacion As Integer = 1 ' 1 - descuento, 2 en PU
Dim ObjDescuento As New Descuentos
Dim DrPS As DataRow = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("")
@@ -14356,6 +14359,7 @@ Partial Class Ventas
PromocionPorcentaje = dr("Promocion").ToString.ToDecimal
PUPromocion = dr("PUPromocion").ToString.ToDecimal
CvePromocionDetalle = dr("CvePromocionDetalle").ToString.ToEntero
TipoAplicacion = dr("TipoAplicacion").ToString.ToEntero
If CantMinima > 0 Then
Cant = Math.Floor(TxtCantidad.Text.ToDecimal / CantMinima).ToEntero
@@ -14363,11 +14367,17 @@ Partial Class Ventas
End If
TotalPromocion = Math.Round(PUPromocion * Cant / (1 + If(IncluyeImpuestos, PorcentajeIVA, 1)), 6)
TotalPromocion = Math.Round(PUPromocion * Cant / (1 + If(IncluyeImpuestos, PorcentajeIVA, 0)), 6)
If TipoPromo = 1 Then 'Promocion por Importe $
Descuento = Descuento + TotalPromocion
If TipoAplicacion = 2 Then
Descuento = 0
SeAjustoPU = True
PUModificado = PUPromocion
Else
Descuento = Descuento + PU - TotalPromocion
End If
ElseIf TipoPromo = 2 Then 'Promocion por %
Descuento = Descuento + ((PU * PromocionPorcentaje / 100) * Cantidad)
ElseIf TipoPromo = 3 Then 'Promocion por Cantidad
@@ -14426,6 +14436,10 @@ Partial Class Ventas
ObjDescuento.ImporteDescuento = Descuento
ObjDescuento.CvePromocionDetalle = CvePromocionDetalle
If SeAjustoPU Then
ObjDescuento.PU = PUModificado
ObjDescuento.EsPUModificado = True
End If
Return ObjDescuento
End Function
@@ -14449,6 +14463,9 @@ Partial Class Ventas
Dim Cantidad As Decimal = TxtCantidad.Text.ToDecimal
Dim PU As Decimal = If(CvePSAmortizacion > 0, TxtPrecio.Text.Trim.ToDecimal * -1, TxtPrecio.Text.Trim.ToDecimal)
Dim ObjDescuento As Descuentos = CalcularDescuentos(CvePS, Cantidad, PU)
If ObjDescuento.EsPUModificado Then
PU = ObjDescuento.PU
End If
AgregarProductoServicio(Cantidad, DdlUnidadMedida.SelectedValue.ToEntero, DdlUnidadMedida.SelectedItem.Text, DdlClasificacion.SelectedValue.ToEntero, DdlClasificacion.SelectedItem.Text,
CvePS, "", TxtObsPS.Text.Trim, PU, ObjDescuento.ImporteDescuento,
@@ -25264,5 +25281,7 @@ Partial Class Ventas
Partial Class Descuentos
Public ImporteDescuento As Decimal = 0
Public CvePromocionDetalle As Integer = -1
Public PU As Decimal = 0
Public EsPUModificado As Boolean = False
End Class
End Class