- SMS -cancelar una remisión y liberar en OS
This commit is contained in:
@@ -1337,7 +1337,7 @@ Public Class ClsOS
|
||||
|
||||
Return Retorno
|
||||
End Function
|
||||
Public Function UpdateVentaOS(CveVenta As Integer, CveOS As Integer, Optional Paciente As String = "-1", Optional Episodio As String = "-1", Optional FolioAdicional As String = "") As Boolean
|
||||
Public Function UpdateVentaOS(CveVenta As Integer, CveOS As Integer, CveEmpresa As Integer, Optional Paciente As String = "-1", Optional Episodio As String = "-1", Optional FolioAdicional As String = "") As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
|
||||
DataAdapter("PA_OS_UpdateVentaOS")
|
||||
@@ -1345,6 +1345,7 @@ Public Class ClsOS
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@CveVenta", SqlDbType.Int).Value = CveVenta
|
||||
.Add("@CveOS", SqlDbType.Int).Value = CveOS
|
||||
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
|
||||
.Add("@Paciente", SqlDbType.VarChar).Value = Paciente
|
||||
.Add("@Episodio", SqlDbType.VarChar).Value = Episodio
|
||||
.Add("@FolioAdicional", SqlDbType.VarChar).Value = FolioAdicional
|
||||
@@ -1361,6 +1362,28 @@ Public Class ClsOS
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
Public Function LiberarVentaOS(CveVenta As Integer, CveEmpresa As Integer, Optional CveOS As Integer = -1) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
|
||||
DataAdapter("PA_OS_LiberarVentaOS")
|
||||
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@CveVenta", SqlDbType.Int).Value = CveVenta
|
||||
.Add("@CveOS", SqlDbType.Int).Value = CveOS
|
||||
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
|
||||
End With
|
||||
|
||||
Try
|
||||
SqlAdapter.Fill(Data)
|
||||
Retorno = True
|
||||
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al guardar la venta en la Orden de Servicio.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
|
||||
End Try
|
||||
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
Public Function GetOrdenesServicioDevolucionMaterial(CveOS As Integer, CveVenta As Integer, Opcion As Integer, CveEmpresa As Integer) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
DataAdapter("PA_OS_OrdenesServicioDevolucionMaterialGet")
|
||||
|
||||
@@ -2353,7 +2353,7 @@ Namespace Modelos
|
||||
|
||||
'Si viene de OS, Se guarda CveVenta en OS
|
||||
If CveOS > 0 Then
|
||||
If Not ObjOS.UpdateVentaOS(factura.CveVenta, CveOS) Then
|
||||
If Not ObjOS.UpdateVentaOS(factura.CveVenta, CveOS, UsuarioActual.CveEmpresa) Then
|
||||
ErrorList.Add("Ocurrió un error al guardar la venta en Ordenes de Servicio")
|
||||
End If
|
||||
End If
|
||||
@@ -5995,6 +5995,7 @@ Namespace Modelos
|
||||
Dim ObjEventos As New ClsOIEventos(ObjVentas.IniciaTransacSQL())
|
||||
Dim ObjAcum As New ClsAcumuladores(ObjVentas.IniciaTransacSQL())
|
||||
Dim ObjClientes As New ClsClientes(ObjVentas.IniciaTransacSQL())
|
||||
Dim ObjOS As New ClsOS(ObjVentas.IniciaTransacSQL())
|
||||
|
||||
Try
|
||||
If ObjFactura.TipoDocto.Contiene("Egs", "Dev") Then
|
||||
@@ -6556,6 +6557,8 @@ Namespace Modelos
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
|
||||
'CANCELA CONTRATOS
|
||||
If Not ErrorCancelar Then
|
||||
If ObjFactura.CveContrato > 0 AndAlso ObjFactura.TipoDocto.Contiene("Ing", "Ant") Then
|
||||
@@ -6613,6 +6616,16 @@ Namespace Modelos
|
||||
End If
|
||||
End If
|
||||
|
||||
'EMPRESA HOSPITALARIA - SI SE CANCELA UNA REMISIÓN DEBE DE DESVINCULARSE DE LA OS y retornarle el estatus en proceso
|
||||
If Not ErrorCancelar AndAlso UsuarioActual.Empresa.Funcionalidad(578) = "1" AndAlso ObjFactura.TipoDocto = "Rem" Then
|
||||
|
||||
If Not ObjOS.LiberarVentaOS(ObjFactura.CveVenta, UsuarioActual.CveEmpresa) Then
|
||||
ErrorCancelar = True
|
||||
MensajeError = "No se pudo actualizar el estatus de almacen del pedido"
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
'POLIZA DE CANCELACION
|
||||
'If Not ErrorCancelar Then
|
||||
' If UsuarioActual.Empresa.UsaAC Then
|
||||
@@ -7080,13 +7093,14 @@ Namespace Modelos
|
||||
Dim CveMovimientoEntradaDevRem As Integer = 0
|
||||
Dim FolioMovimientoEntradaDevRem As Integer = 0
|
||||
Dim Fecha As DateTime = ClsPaginas.NowADS()
|
||||
Dim tCveOS As Integer = DtMovDetalle.MAX("CveOS").ToEntero
|
||||
|
||||
'SALIDA DE (ENTREGA POR ADELANTADO)
|
||||
CveMovimientoSalidaDevRem = ObjInventario.AddMovimiento(CveAlmacen, 8, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveRemision, -1, -1, Observaciones:="", Guia:="", CveContrato:=CveContrato, CveAlmacenDestino:=CveAlmacenDestino, Modulo:="Mod/CancExAR1")
|
||||
CveMovimientoSalidaDevRem = ObjInventario.AddMovimiento(CveAlmacen, 8, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveRemision, -1, -1, Observaciones:="", Guia:="", CveContrato:=CveContrato, CveAlmacenDestino:=CveAlmacenDestino, Modulo:="Mod/CancExAR1", CveOS:=tCveOS)
|
||||
FolioMovimientoSalidaDevRem = ObjInventario.Folio
|
||||
|
||||
'ENTRADA A (ALMACEN GENERAL)
|
||||
CveMovimientoEntradaDevRem = ObjInventario.AddMovimiento(CveAlmacenDestino, 9, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveRemision, -1, -1, Observaciones:="", Guia:="", CveContrato:=CveContrato, CveMovimientoRelacionado:=CveMovimientoSalidaDevRem, CveAlmacenDestino:=CveAlmacenDestino, Modulo:="Mod/CancExAR2")
|
||||
CveMovimientoEntradaDevRem = ObjInventario.AddMovimiento(CveAlmacenDestino, 9, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveRemision, -1, -1, Observaciones:="", Guia:="", CveContrato:=CveContrato, CveMovimientoRelacionado:=CveMovimientoSalidaDevRem, CveAlmacenDestino:=CveAlmacenDestino, Modulo:="Mod/CancExAR2", CveOS:=tCveOS)
|
||||
FolioMovimientoEntradaDevRem = ObjInventario.Folio
|
||||
|
||||
If Not (CveMovimientoSalidaDevRem > 0 And CveMovimientoEntradaDevRem > 0) Then
|
||||
|
||||
Reference in New Issue
Block a user