diff --git a/App_Code/ClsInventarios.vb b/App_Code/ClsInventarios.vb index 6a592dbcc..c8ecbfe36 100644 --- a/App_Code/ClsInventarios.vb +++ b/App_Code/ClsInventarios.vb @@ -3404,13 +3404,14 @@ Public Class ClsInventarios ' Return Retorno 'End Function - Public Function ActualizarEsDevolucionVenta(CveVenta As Integer, Valor As Integer) As Boolean + Public Function ActualizarEsDevolucionVenta(CveVenta As Integer, Valor As Integer, Optional AplicaDevolucionCompleta As Boolean = False) As Boolean Dim Retorno As Boolean = False DataAdapter("Vta_UpdateDevolucionVenta") With SqlAdapter.SelectCommand.Parameters .Add("@CveVenta", SqlDbType.Int).Value = CveVenta .Add("@Valor", SqlDbType.Int).Value = Valor + .Add("@AplicaDevolucionCompleta", SqlDbType.Bit).Value = AplicaDevolucionCompleta End With Try diff --git a/App_Code/Modelos.vb b/App_Code/Modelos.vb index 32bb6cb46..263b49b72 100644 --- a/App_Code/Modelos.vb +++ b/App_Code/Modelos.vb @@ -6117,6 +6117,16 @@ Namespace Modelos End If End If + + 'EMPRESA HOSPITALARIA - SI ES PEDIDO LA DEVOLUCION SE DEBE HACER DESPUES DE CANCELAR EL PEDIDO + If Not ErrorCancelar AndAlso UsuarioActual.Empresa.Funcionalidad(578) = "1" AndAlso ObjFactura.TipoDocto = "Ped" Then + If Not RealizarDevolucionAlmacen AndAlso TieneAlmacen Then + If Not ObjInventario.ActualizarEsDevolucionVenta(ObjFactura.CveVenta, 1, AplicaDevolucionCompleta:=True) Then + ErrorCancelar = True + MensajeError = "No se pudo actualizar el estatus de almacen del pedido" + End If + End If + End If End If 'CANCELA CONTRATOS diff --git a/Inventarios/EntregaAlmacen.aspx.vb b/Inventarios/EntregaAlmacen.aspx.vb index 237f1b558..056721404 100644 --- a/Inventarios/EntregaAlmacen.aspx.vb +++ b/Inventarios/EntregaAlmacen.aspx.vb @@ -1839,8 +1839,21 @@ Partial Class Inventarios_EntregaAlmacen End If ObjVentaInv.Dispose() - If TipoEstatus = 5 Or EsDevolucionVenta.Contiene(2, 3) Then - Alert("No se puede surtir esta venta, verifique que no esté cancelada o ya registrado su movimiento en almacen", TipoMensaje.MsgAdvertencia) + Dim VerificaCancelada As Boolean = True + + If UsuarioActual.Empresa.Funcionalidad(578) = "1" AndAlso TipoDocto = "Ped" Then + VerificaCancelada = False + End If + + If VerificaCancelada Then + If TipoEstatus = 5 Then + Alert("No se puede surtir esta venta, verifique que no esté cancelada", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + End If + + If EsDevolucionVenta.Contiene(2, 3) Then + Alert("No se puede surtir esta venta, verifique que no esté registrado su movimiento en almacen", TipoMensaje.MsgAdvertencia) Exit Sub End If @@ -2739,10 +2752,12 @@ Partial Class Inventarios_EntregaAlmacen End If 'se registra - If ContabilizaMovimientoAlmacen(ObjConta, TxtFecha.Text.ToDate, HLFolio.Text, "EntregaAlmacen", CveMovimiento, CveMovimientoEntrada, ImporteAlmacen, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, False) <= 0 Then - ErrorMovInv = True - End If - + If Not ErrorMovInv Then + If ContabilizaMovimientoAlmacen(ObjConta, TxtFecha.Text.ToDate, HLFolio.Text, "EntregaAlmacen", CveMovimiento, CveMovimientoEntrada, ImporteAlmacen, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, False) <= 0 Then + ErrorMovInv = True + End If + End If + Else 'REGISTRO LA PREPOLIZA DE COSTO VS ALMACEN - SALIDA ALMACEN ErrorMovInv = Not GenerarPrePoliza(ObjInventario, ObjVentas, ObjConta, CveMovimiento, TextoError) End If diff --git a/Ventas/Ventas.aspx b/Ventas/Ventas.aspx index 94b5a8d54..f6466a32e 100644 --- a/Ventas/Ventas.aspx +++ b/Ventas/Ventas.aspx @@ -8637,16 +8637,20 @@ } //FUNCIONES PARA COMERCIO EXTERIOR - function CalculaTotalUSD(TotalUSD, ValorUnitario, TxtCantidad) { - TotalUSD.innerText = FormatoNumero(ToDouble(ValorUnitario.value) * ToDouble(TxtCantidad.value), 2); - } - function CalculaPU_USD(TxtValorUnitario, TotalUSD, TxtCantidad) { - TxtValorUnitario.value = FormatoNumero(ToDouble(TotalUSD) / ToDouble(TxtCantidad.value), 6); + if(ToDouble(TxtCantidad.value) > 0){ + TxtValorUnitario.value = ((ToDouble(TotalUSD) / ToDouble(TxtCantidad.value)).toFixed(6)).toString(); + }else{ + TxtValorUnitario.value = "0"; + } } function CalculaCantidad_USD(TxtValorUnitario, TotalUSD, TxtCantidad) { - TxtCantidad.value = FormatoNumero(ToDouble(TotalUSD) / ToDouble(TxtValorUnitario.value), 6); + if (ToDouble(TxtValorUnitario.value) > 0) { + TxtCantidad.value = ((ToDouble(TotalUSD) / ToDouble(TxtValorUnitario.value)).toFixed(6)).toString(); + }else{ + TxtCantidad.value = "0"; + } } function LimitaCantidadAplicaDev(Cantidad, TxtCantidadAplicaDevolucion) { diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 5d31eacd1..428a327d3 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -16931,6 +16931,21 @@ Partial Class Ventas CvePrecioListaPS = CvePrecioListaSugerido End If + Dim CvePrecioListaPredeterminada = -1 + Dim AplicaPredeterminado As Boolean = False + + If UsuarioActual.Empresa.Funcionalidad(578) = "1" AndAlso RBLTipoVenta.SelectedValue = "2" Then + AplicaPredeterminado = True + CvePrecioListaPredeterminada = GlobalDTPrecioListas(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CvePrecioLista", "Predeterminada = True").ToEntero() + If CvePrecioListaPredeterminada > 0 Then + CvePrecioListaPS = CvePrecioListaPredeterminada + End If + End If + + If AplicaPredeterminado AndAlso CvePrecioListaPredeterminada <= 0 Then + Alert("No hay una lista de precios predeterminada", TipoMensaje.MsgAdvertencia) + End If + If CvePrecioListaPS > 0 Then Dim ObjPS As New ClsProductosServicios If ObjPS.GetPSPreciosLista(UsuarioActual.CveEmpresa, CvePrecioListaPS, CvePS:=CvePSParametro) Then @@ -16940,6 +16955,10 @@ Partial Class Ventas ObjPS.Dispose() End If + If AplicaPredeterminado AndAlso PrecioSugerido <= 0 Then + Alert("El producto y/o servicio no tiene asignado un valor en la lista de precios predeterminada", TipoMensaje.MsgAdvertencia) + End If + If PrecioSugerido = 0 Then Dim ObjInventarios As New ClsInventarios Dim CostoPS As Decimal = ObjInventarios.GetCostoPS(CvePSParametro, TxtCantidad.Text.Trim.ToDecimal, -1, "-1", TxtFecha.Text.ToDate, DdlSubProyectoDatos.SelectedValue.ToEntero(), CveTipoAlmacen:=1) @@ -24453,8 +24472,9 @@ Partial Class Ventas ChkDevAlm.Checked = True End If + 'LOS PEDIDOS SE DEBE CANCELAR EN UN PROCESO DISTINTO If UsuarioActual.Empresa.Funcionalidad(578) = "1" AndAlso ObjFacturaCancelacion.TipoDocto = "Ped" Then - ChkDevAlm.Checked = True + ChkDevAlm.Checked = False End If resp = ObjFacturaCancelacion.CancelarFactura(ChkDevAlm.Checked, ListaRemisionesCancelar, CveMotivoCancelacion:=DdlMotivoCancelacion.SelectedValue.ToEntero(), Motivo:=TxtMotivoCancelacion.Text.Trim(), CveEstadoCancelacion:=Me.CveEstadoCancelacion)