--FIX descuentos generales
This commit is contained in:
@@ -3603,6 +3603,41 @@ Partial Class PV
|
||||
|
||||
End If
|
||||
|
||||
'VALIDA DESCUENTOS GENERALES
|
||||
If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso DdlTipoComprobante.SelectedValue.Contiene("Rem") Then
|
||||
|
||||
Dim ValidoDescuentos As Boolean = True
|
||||
Dim DtTamanios As DataTable = GlobalDTAcumTamaños(UsuarioActual.CveEmpresa).FiltraParametros($" CvePSCargo > 0")
|
||||
|
||||
For Each Row As DataRow In TmpDT.Rows
|
||||
Dim CvePS As Integer = Row("CvePS").ToString().ToEntero()
|
||||
Dim Cantidad As Decimal = Row("Cantidad").ToString().ToDecimal()
|
||||
Dim PU As Decimal = Row("PU").ToString().ToDecimal()
|
||||
Dim Descuento As Decimal = Row("Descuento").ToString().ToDecimal()
|
||||
|
||||
Dim EsGarantia As Boolean = ObjFactura.EsGarantia OrElse Row("Obs").ToString().Contains("Descuento por garantía")
|
||||
|
||||
Dim EsCargo As Boolean = DtTamanios IsNot Nothing AndAlso DtTamanios.FiltraParametros($"CvePSCargo = {CvePS}").Rows.Count = 1
|
||||
|
||||
If Not EsGarantia AndAlso Not EsCargo Then
|
||||
Dim porcentaje = ((Descuento) / (Cantidad * PU).RoundSQL(2)) * 100D
|
||||
|
||||
If porcentaje > 41 Then
|
||||
Alert($"El producto '{Row("CodigoPS")}' no puede tener un descuento mayor al 40%", TipoMensaje.MsgAdvertencia)
|
||||
ValidoDescuentos = False
|
||||
Exit For
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
Next
|
||||
|
||||
If Not ValidoDescuentos Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
If ObjFactura.CveCliente > 0 Then
|
||||
If TmpDT.Rows.Count > 0 Then
|
||||
|
||||
|
||||
Reference in New Issue
Block a user