--SMS - 2024.01.24

--En la opción de venta directa: no importa el cliente/hospital que se seleccione, la lista de precios predeterminada debe de ser la de venta directa
--Al cancelar una cirugía se debe de ver reflejado en almacén y en ordenes de servicio
This commit is contained in:
2024-01-26 16:24:36 -07:00
parent c2b5a707a1
commit 9ce9702618
5 changed files with 64 additions and 14 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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) {

View File

@@ -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)