diff --git a/Ventas/PV.aspx.vb b/Ventas/PV.aspx.vb
index 92388a1df..a8ceaff5e 100644
--- a/Ventas/PV.aspx.vb
+++ b/Ventas/PV.aspx.vb
@@ -5161,9 +5161,24 @@ Partial Class PV
Contador += 1
Next
TxtPUFactura.Text = PUFactura.FormatoNumero(2)
+
End If
- If Not DdlPSAjuste.SelectedValue.ToEntero > 0 AndAlso DdlFacturas.SelectedValue.ToEntero > 0 Then
+ If DdlPSAjuste.SelectedValue.ToEntero > 0 AndAlso Not DdlFacturas.SelectedValue.ToEntero > 0 Then
+ Dim Index As Integer = DdlPSAjuste.SelectedIndex
+ Dim CvePSParametro As Integer = DdlPSAjuste.SelectedValue.ToEntero
+ Dim PrecioSugerido As Decimal = 0
+ Dim drPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePSParametro).FiltroPrimero("")
+
+ If drPS IsNot Nothing Then
+ PrecioSugerido = drPS("Precio").ToString.ToDecimal
+ End If
+
+ TxtPUFactura.Text = PrecioSugerido.FormatoNumero(2)
+
+ End If
+
+ If Not DdlPSAjuste.SelectedValue.ToEntero > 0 AndAlso DdlFacturas.SelectedValue.ToEntero > 0 Then
TxtPUFactura.Text = ""
End If
@@ -5188,16 +5203,16 @@ Partial Class PV
If ObjAcum.GarantiasMesesGet(-1, UsuarioActual.CveEmpresa, CveMarca, DdlTipoUso.SelectedValue.ToEntero, TxtMesesUso.Text.ToEntero) Then
If ObjAcum.DtResultados.Rows.Count > 0 Then
TxtPorcentajeAjuste.Text = (ObjAcum.DtResultados.Rows(0)("Valor").ToString.ToDouble / 100).ToString
- TxtImporteAjuste.Text = (TxtPorcentajeAjuste.Text.ToDouble * TxtPrecio.Text.ToDouble).FormatoNumero
+ TxtImporteAjuste.Text = (TxtPorcentajeAjuste.Text.ToDouble * TxtPUFactura.Text.ToDouble).FormatoNumero
- Dim CargoActual As Decimal = 0
- Dim CargoAnterior As Decimal = 0
+ Dim CargoVendido As Decimal = 0
+ Dim CargoGarantia As Decimal = 0
Dim CveTamaño As Integer = 0
If DdlPSAjuste.SelectedValue.ToEntero > 0 Then
Dim Dr As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, DdlPSAjuste.SelectedValue.ToEntero).Rows(0)
If Dr IsNot Nothing Then
- CargoAnterior = Dr("Cargo").ToString.ToDecimal
+ CargoGarantia = Dr("Cargo").ToString.ToDecimal
End If
End If
@@ -5208,24 +5223,22 @@ Partial Class PV
End If
End If
-
-
If GlobalDTAcumTamaños.FiltraParametros($"CveEmpresa = {UsuarioActual.CveEmpresa} AND CveTamaño = {CveTamaño}").Rows(0) IsNot Nothing AndAlso GlobalDTAcumTamaños.FiltraParametros($"CveEmpresa = {UsuarioActual.CveEmpresa} AND CveTamaño = {CveTamaño}").Rows.Count > 0 Then
Dim DrCargo As DataRow = GlobalDTAcumTamaños.FiltraParametros($"CveEmpresa = {UsuarioActual.CveEmpresa} AND CveTamaño = {CveTamaño}").Rows(0)
If DrCargo IsNot Nothing Then
- CargoActual = DrCargo("Cargo").ToString.ToDecimal
+ CargoVendido = DrCargo("Cargo").ToString.ToDecimal
End If
End If
'el ajuste no puede ser mayor al precio de lo vendido de nuevo
- If (TxtPrecio.Text.ToDouble - ((TxtPrecio.Text.ToDouble - TxtImporteAjuste.Text.ToDouble) - (CargoActual - CargoAnterior))) < 0 Then
- TxtDescuentoAjuste.Text = TxtPrecio.Text
+ If (TxtPrecio.Text.ToDouble - ((TxtPUFactura.Text.ToDouble - TxtImporteAjuste.Text.ToDouble) - (CargoVendido - CargoGarantia))) < 0 Then
+
TxtImporteAjuste.Text = "0.00"
- CargoAnterior = CargoActual
+ CargoGarantia = CargoVendido
End If
+ TxtImporteAjuste.ToolTip = $"La diferencia de ajuste fue: {(TxtPrecio.Text.ToDouble - TxtImporteAjuste.Text.ToDouble).FormatoNumero()}. La diferencia de tamaños fue: {(CargoVendido - CargoGarantia).FormatoNumero}."
+ TxtImporteAjuste.Text = ((TxtImporteAjuste.Text.ToDouble) - (CargoVendido - CargoGarantia)).FormatoNumero
- TxtDescuentoAjuste.Text = ((TxtPrecio.Text.ToDouble - TxtImporteAjuste.Text.ToDouble) - (CargoActual - CargoAnterior)).FormatoNumero
- TxtDescuentoAjuste.ToolTip = $"La diferencia de ajuste fue: {(TxtPrecio.Text.ToDouble - TxtImporteAjuste.Text.ToDouble).FormatoNumero()}. La diferencia de tamaños fue: {(CargoActual - CargoAnterior).FormatoNumero}."
End If
End If
ObjAcum.Dispose()
@@ -5233,31 +5246,6 @@ Partial Class PV
UpAjuste.Update()
End Sub
- 'Private Function AsignaPUFijo(CvePS As Integer) As Double
- ' Select Case CvePS
- ' Case 360449
- ' Return 500
- ' Case 360450
- ' Return 1000
- ' Case 360451
- ' Return 2000
- ' Case 360452
- ' Return 3000
- ' Case 360453
- ' Return 4000
- ' Case 360455
- ' Return 5000
- ' Case 365353
- ' Return 6000
- ' Case 360454
- ' Return 1500 'lth. acumulador
- ' Case 370810
- ' Return 2500 'lth. 1872
- ' Case Else
- ' Return 5000
- ' End Select
- 'End Function
-
Private Sub GuardaAjuste()
TxtPrecio.Text = TxtPrecio.Text
UpAjuste.Update()
@@ -5340,7 +5328,8 @@ Partial Class PV
End If
End If
- Dr("Descuento") = Math.Round((TxtPrecio.Text.ToDouble - TxtImporteAjuste.Text.ToDouble) - (CargoActual - CargoAnterior), NumeroDecimales)
+ Dr("Descuento") = Math.Round(TxtImporteAjuste.Text.ToDouble, NumeroDecimales)
+ 'Dr("Descuento") = Math.Round((TxtPrecio.Text.ToDouble - TxtImporteAjuste.Text.ToDouble) + (CargoActual - CargoAnterior), NumeroDecimales)
If Dr("Descuento").ToString.ToDouble > TxtPrecio.Text.ToDouble Then Dr("Descuento") = TxtPrecio.Text.ToDouble
Dim TotalCalculableImpuestos As Decimal = (Dr("Cantidad").ToString.ToDecimal * (Dr("PU").ToString.ToDecimal)) - Dr("Descuento").ToString.ToDecimal
diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb
index cf8524973..78cb3dd19 100644
--- a/Ventas/Ventas.aspx.vb
+++ b/Ventas/Ventas.aspx.vb
@@ -4425,6 +4425,9 @@ Partial Class Ventas
Private Sub CargaFormaPago(CveMetodoPago As Integer)
'FACTURACION 3.3
+ 'permiso para desbloquear la relación entre Método de pago y forma de pago
+ If UsuarioActual.TienePermisoProceso(282) Then CveMetodoPago = -1
+
Dim dtt As DataTable = Nothing
If CveMetodoPago > 0 Then
dtt = GlobalDTVtaFormaPago.FiltraParametros(If(CveMetodoPago = 1, " CveFormaPago <> 20 ", "CveFormaPago = 20"))