This commit is contained in:
2024-03-14 18:24:45 -07:00
7 changed files with 707 additions and 305 deletions

View File

@@ -7383,51 +7383,45 @@ Partial Class PV
TxtImporteAjuste.Text = (TxtPorcentajeAjuste.Text.ToDecimal * TxtPUFactura.Text.ToDecimal).FormatoNumero
ImportePagarCliente = TxtImporteAjuste.Text.ToDecimal
''ajustar un centavo
If PorcentajeAjuste = 0 Then 'PONE UN PAGO DE UN CENTAVO, PARA EL TIMBRADO
' TxtImporteAjuste.Text = (TxtImporteAjuste.Text.ToDecimal - 0.01D).FormatoNumero
TxtImporteAjuste.Text = "0.01"
End If
Dim CargoVendido As Decimal = 0
Dim CargoGarantia 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).FiltroPrimero("")
If Dr IsNot Nothing Then
CargoGarantia = Dr("Cargo").ToString.ToDecimal
End If
Dim Dr As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, DdlPSAjuste.SelectedValue.ToEntero).FiltroPrimero("")
If Dr IsNot Nothing Then
CargoGarantia = Dr("Cargo").ToString.ToDecimal
End If
End If
If DdlPS.SelectedValue.ToEntero > 0 Then
Dim Dr As DataRow = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CvePS:=DdlPS.SelectedValue.ToEntero).FiltroPrimero("")
If Dr IsNot Nothing Then
CveTamaño = Dr("CveTamaño").ToString.ToEntero
End If
If DdlPS.SelectedValue.ToEntero > 0 Then
Dim Dr As DataRow = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CvePS:=DdlPS.SelectedValue.ToEntero).FiltroPrimero("")
If Dr IsNot Nothing Then
CveTamaño = Dr("CveTamaño").ToString.ToEntero
End If
End If
Dim DrCargo As DataRow = GlobalDTAcumTamaños(UsuarioActual.CveEmpresa).FiltroPrimero($" CveTamaño = {CveTamaño}")
If DrCargo IsNot Nothing Then
Dim DrCargo As DataRow = GlobalDTAcumTamaños(UsuarioActual.CveEmpresa).FiltroPrimero($" CveTamaño = {CveTamaño}")
If DrCargo IsNot Nothing Then
CargoVendido = 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 - ((TxtPUFactura.Text.ToDouble - TxtImporteAjuste.Text.ToDouble) - (CargoVendido - CargoGarantia))) < 0 Then
'el ajuste no puede ser mayor al precio de lo vendido de nuevo
If (TxtPrecio.Text.ToDouble - ((TxtPUFactura.Text.ToDouble - TxtImporteAjuste.Text.ToDouble) - (CargoVendido - CargoGarantia))) < 0 Then
TxtImporteAjuste.Text = "0.00"
CargoGarantia = CargoVendido
ImportePagarCliente = 0
End If
ImportePagarCliente = (TxtPrecio.Text.ToDouble - ((TxtPUFactura.Text.ToDouble - TxtImporteAjuste.Text.ToDouble) - (CargoVendido - CargoGarantia))).ToDecimal
TxtImporteAjuste.Text = "0.00"
CargoGarantia = CargoVendido
ImportePagarCliente = 0
End If
ImportePagarCliente = (TxtPrecio.Text.ToDouble - ((TxtPUFactura.Text.ToDouble - TxtImporteAjuste.Text.ToDouble) - (CargoVendido - CargoGarantia))).ToDecimal
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 = ((TxtPUFactura.Text.ToDouble - TxtImporteAjuste.Text.ToDouble) - (CargoVendido - CargoGarantia)).FormatoNumero
'TxtPagarCliente.Text = ImportePagarCliente.FormatoNumero
Else
Alert("El producto no tiene ajuste en ese periodo", TipoMensaje.MsgAdvertencia)
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 = ((TxtPUFactura.Text.ToDouble - TxtImporteAjuste.Text.ToDouble) - (CargoVendido - CargoGarantia)).FormatoNumero
'TxtPagarCliente.Text = ImportePagarCliente.FormatoNumero
Else
Alert("El producto no tiene ajuste en ese periodo", TipoMensaje.MsgAdvertencia)
'cuando no está registrada, no da ajuste
TxtImporteAjuste.ToolTip = "El producto no tiene ajuste en ese periodo"
TxtImporteAjuste.Text = "0.00"
@@ -7447,6 +7441,7 @@ Partial Class PV
Alert("Especificar el producto a recibir")
End If
End If
Catch ex As Exception
OnError("Ocurrió un error al recalcular el costo", ex)
End Try
@@ -7551,7 +7546,7 @@ Partial Class PV
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
If Dr("Descuento").ToString.ToDouble >= TxtPrecio.Text.ToDouble Then Dr("Descuento") = TxtPrecio.Text.ToDouble - 0.01D
Dim TotalCalculableImpuestos As Decimal = (Dr("Cantidad").ToString.ToDecimal * (Dr("PU").ToString.ToDecimal)) - Dr("Descuento").ToString.ToDecimal
Dr("ImporteIVA") = Math.Round(Dr("PorcentajeIVA").ToString.ToDecimal * TotalCalculableImpuestos, NumeroDecimales)

View File

@@ -13519,6 +13519,13 @@ Partial Class Ventas
If CveAlmacenTraspasoDestino <= 0 And factura.TipoDocto = "Rem" Then
ErrorList.Add("Ocurrió un error al seleccionar el almacen de entrega por adelantado de la sucursal.")
End If
If UsuarioActual.Empresa.Funcionalidad(109) = "1" Then
If factura.TipoDocto = "RNC" And CveVentaDevolucion > 0 Then
CveAlmacenTraspasoOrigen = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveAlmacen", $"CveTipoAlmacen = 10 AND CveSubProyecto = {DdlSubProyectoDatos.SelectedValue}").ToString().ToEntero()
CveAlmacenTraspasoDestino = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveAlmacen", $"CveTipoAlmacen = 1 AND CveSubProyecto = {DdlSubProyectoDatos.SelectedValue}").ToString().ToEntero()
End If
End If
End If
'ASIGNA EL VALOR DEL ALMACEN AL PEDIDO
@@ -23816,7 +23823,7 @@ Partial Class Ventas
#Region " INVENTARIO POR ENTREGA"
Private Sub InventarioMov(Optional CveVentaPadre As Integer = -1)
If CveVentaPadre > 0 AndAlso DdlTipoComprobante.SelectedValue <> "Dev" Then
If CveVentaPadre > 0 AndAlso Not DdlTipoComprobante.SelectedValue.Contiene("Dev", "RNC") Then
Dim RowVentas As DataRow = Nothing
Using ObjVentas As New ClsVentas
If ObjVentas.GetVenta(CveVentaPadre, UsuarioActual.CveEmpresa, VerificaAlmacen:=False) Then
@@ -23826,7 +23833,7 @@ Partial Class Ventas
'SI TIENE UN ANTICIPO RELACIONADO O VIENE DE UNA REFACTURACION
If RowVentas IsNot Nothing Then
If RowVentas("TipoDocto").ToString().Contiene("Ing", "Ant", "Ped") AndAlso DdlTipoComprobante.SelectedValue = "Ing" Then
If RowVentas("TipoDocto").ToString().Contiene("Ing", "Ant", "Ped") AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing") Then
CargaInventario(Me.CveVenta)
End If
End If