--cancelacion de remision con boleto. --solo si es una partida
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
Option Explicit On
|
||||
Option Strict On
|
||||
|
||||
Imports System.Data
|
||||
Imports ADSNetLibrary.Helpers
|
||||
Imports ADSNetLibrary.SIGAPI.Helpers
|
||||
@@ -32,16 +33,10 @@ Partial Class ListadoBoletos
|
||||
CveViaje = Request.QueryString("CveViaje").ToEntero
|
||||
Ruta = IfNull(Request("Ruta"), "").ToString
|
||||
LblViaje.Text = Ruta
|
||||
|
||||
InicializaCombos()
|
||||
CargaDatos()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub InicializaCombos()
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub CargaDatos()
|
||||
Dim ObjTransportes As New ClsTransportes
|
||||
If ObjTransportes.GetViajesPasajeros(CveViaje) Then
|
||||
@@ -86,22 +81,58 @@ Partial Class ListadoBoletos
|
||||
Dim Estatus As String = GvRow.DataKey("Estatus")
|
||||
Dim cambiarEstatus As Boolean = Not Estatus.ToBool
|
||||
Dim ObjTransportes As New ClsTransportes
|
||||
ObjTransportes.IniciaTransacSQL()
|
||||
Try
|
||||
If ObjTransportes.UpdateViajesPasajeros(CveViajePasajero.ToEntero, Activar:=cambiarEstatus, Estatus:=cambiarEstatus) Then
|
||||
If Not cambiarEstatus Then
|
||||
Alert($"El boleto ha sido cancelado correctamente.")
|
||||
Else
|
||||
Alert($"El boleto ha sido reactivado correctamente.")
|
||||
End If
|
||||
End If
|
||||
ObjTransportes.Commit()
|
||||
Catch ex As Exception
|
||||
ObjTransportes.RollBack()
|
||||
Alert($"No se pudo cambiar el estatus del boleto {ex}", TipoMensaje.MsgError)
|
||||
|
||||
Dim TieneError As Boolean = False
|
||||
Try
|
||||
Dim DtRem As DataTable = Nothing
|
||||
If ObjTransportes.GetRemisionBoleto(CveViajePasajero.ToEntero, UsuarioActual.CveEmpresa) Then
|
||||
DtRem = ObjTransportes.DtResultados.Copy()
|
||||
End If
|
||||
|
||||
If DtRem IsNot Nothing Then
|
||||
If DtRem.Rows.Count > 0 Then
|
||||
Dim CveVenta As Integer = DtRem.Rows(0)("CveVenta").ToString().ToEntero()
|
||||
If CveVenta > 0 Then
|
||||
Dim ObjRem As New Modelos.Factura(UsuarioActual, CveVenta, UsuarioActual.CveEmpresa, VerificaAlmacen:=False)
|
||||
|
||||
If ObjRem.DtDetalle.Rows.Count > 0 Then
|
||||
'SI SOLO TIENE UNA PARTIDA CANCELAR LA REMISION
|
||||
If ObjRem.DtDetalle.Rows.Count = 1 Then
|
||||
Dim RespCancelacion = ObjRem.CancelarFactura(False, ValidarSAT:=False, CancelarBoletos:=True)
|
||||
If RespCancelacion IsNot Nothing Then
|
||||
TieneError = RespCancelacion.HuboError
|
||||
Else
|
||||
TieneError = True
|
||||
End If
|
||||
Else
|
||||
TieneError = Not ObjRem.CancelarBoleto(CveViajePasajero.ToEntero)
|
||||
End If
|
||||
Else
|
||||
TieneError = True
|
||||
End If
|
||||
|
||||
End If
|
||||
Else
|
||||
'SI NO TIENE VENTA, SOLO CANCELAR EL BOLETO
|
||||
If Not ObjTransportes.UpdateViajesPasajeros(CveViajePasajero.ToEntero, Activar:=cambiarEstatus, Estatus:=cambiarEstatus) Then
|
||||
TieneError = True
|
||||
End If
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
TieneError = True
|
||||
GuardaLog(ex.ToString())
|
||||
Finally
|
||||
If TieneError Then
|
||||
Alert($"El boleto ha sido cancelado correctamente.")
|
||||
Else
|
||||
Alert($"Ocurrió un error al cancelar el boleto.")
|
||||
End If
|
||||
ObjTransportes.Dispose()
|
||||
CargaDatos()
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
Reference in New Issue
Block a user