--FIX. BDH Promociones en distruibuidores

This commit is contained in:
2024-09-13 17:30:20 -07:00
parent 4f27e12f68
commit 34c0b61235

View File

@@ -9457,7 +9457,7 @@ Partial Class Ventas
End If
'SI SE ELIMINA EL LUBRICANTE, ELIMINAR LOS FILTROS CON PROMOCION
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso Not ClienteEsDistribuidor Then
If TmpDT.Rows(e.RowIndex)("CveClasificacion").ToString().ToString().Contiene("20516") Then
Dim RowsFiltros = TmpDT.Select("CveClasificacion IN(20515) AND Descuento > 0")
For Each Row As DataRow In RowsFiltros
@@ -19830,15 +19830,17 @@ Partial Class Ventas
End Sub
Private Sub CalculaPSPromocionFiltrosLubricantes(ByRef RowEdit As DataRow)
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso Not ClienteEsDistribuidor Then
Dim CantidadMinValidaPromoFiltro As Decimal = 4
Dim CantidadMinValidaPromoLubricantes As Decimal = 5
Dim CantidadDescuento As Decimal = 0
'Dim AgregaDescuentos As Boolean = False
'DESCUENTO EN LUBRICANTES
If RowEdit IsNot Nothing AndAlso RowEdit("CveClasificacion").ToString().Contiene("20516") Then
Dim Cantidad As Decimal = RowEdit("Cantidad").ToString().ToDecimal()
'CALCULA LA CANTIDAD DE DESCUENTO, REDONDEO HACIA ABAJO
Dim CantidadDescuento As Decimal = Math.DivRem(Cantidad.ToString().ToEntero(), CantidadMinValidaPromoLubricantes.ToString().ToEntero(), 1).ToString().ToDecimal()
CantidadDescuento = Math.DivRem(Cantidad.ToString().ToEntero(), CantidadMinValidaPromoLubricantes.ToString().ToEntero(), 1).ToString().ToDecimal()
Dim Descuentos = CantidadDescuento * RowEdit("PU").ToString().ToDecimal()
@@ -19864,6 +19866,9 @@ Partial Class Ventas
Next
End If
'AGREGA LOS DESCUENTOS ADICIONALES
'AgregaDescuentos = True
End If
' DESCUENTO EN FILTROS
@@ -19875,7 +19880,7 @@ Partial Class Ventas
'SI HAY LUBRICANTES, 1 FILTRO DEBE SER GRATIS
If TotalLubricantes >= CantidadMinValidaPromoFiltro Then
'CALCULA LA CANTIDAD DE DESCUENTO, REDONDEO HACIA ABAJO
Dim CantidadDescuento As Decimal = Math.DivRem(TotalLubricantes.ToString().ToEntero(), CantidadMinValidaPromoFiltro.ToString().ToEntero(), 1).ToString().ToDecimal()
CantidadDescuento = Math.DivRem(TotalLubricantes.ToString().ToEntero(), CantidadMinValidaPromoFiltro.ToString().ToEntero(), 1).ToString().ToDecimal()
'VERIFICA QUE AUN SE PUEDA APLICAR DESCUENTO
If TotalFiltrosDescuento < CantidadDescuento Then
@@ -19901,12 +19906,36 @@ Partial Class Ventas
RowEdit("Total") = (Cantidad * PU)
RowEdit("TotalImporte") = (Cantidad * PU).RoundSQL(NumeroDecimales)
RowEdit("TotalConImpuestos") = (RowEdit("Total").ToString().ToDecimal() - RowEdit("Descuento").ToString().ToDecimal() + RowEdit("ImporteIVA").ToString().ToDecimal()).RoundSQL(2)
'AGREGA LOS DESCUENTOS ADICIONALES
'AgregaDescuentos = True
End If
End If
End If
'VERIFICA SI APLICAN OTROS DESCUENTOS
'If AgregaDescuentos Then
' Dim ObjDescuento As Modelos.VentaDescuentos = CalcularDescuentos(RowEdit("CvePS").ToString().ToEntero(), RowEdit("Cantidad").ToString().ToDecimal(), RowEdit("PU").ToString().ToDecimal())
' If ObjDescuento.ImporteDescuento > 0 AndAlso Not ObjDescuento.EsPUModificado Then
' Dim Cantidad As Decimal = RowEdit("Cantidad").ToString().ToDecimal()
' Dim PU As Decimal = RowEdit("PU").ToString().ToDecimal()
' Dim Descuentos = RowEdit("Descuento").ToString().ToDecimal() + ObjDescuento.ImporteDescuento
' If Descuentos < (Cantidad * PU) Then
' Dim TotalCalculableImpuestos As Decimal = ((Cantidad * PU) - (Descuentos))
' Dim TotalCalculableImpuestosIVA As Decimal = 0
' TotalCalculableImpuestosIVA = TotalCalculableImpuestos * (1 + RowEdit("PorcentajeIEPS").ToString().ToDecimal)
' RowEdit("Descuento") = Descuentos
' RowEdit("ImporteIVA") = (RowEdit("PorcentajeIVA").ToString().ToDecimal * TotalCalculableImpuestosIVA).RoundSQL(NumeroDecimales)
' RowEdit("TotalConImpuestos") = (RowEdit("Total").ToString().ToDecimal() - RowEdit("Descuento").ToString().ToDecimal() + RowEdit("ImporteIVA").ToString().ToDecimal()).RoundSQL(2)
' End If
' End If
'End If
End If
End Sub