--cancelacion de remision con boleto. --solo si es una partida
This commit is contained in:
@@ -204,9 +204,28 @@ Public Class ClsTransportes
|
||||
|
||||
Return Retorno
|
||||
|
||||
End Function
|
||||
#End Region
|
||||
End Function
|
||||
Public Function GetRemisionBoleto(CveViajePasajero As Integer, CveEmpresa As Integer) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
DataAdapter("PA_Trans_ViajesPasajerosVentaGet")
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@CveViajePasajero", SqlDbType.Int).Value = CveViajePasajero
|
||||
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
|
||||
End With
|
||||
|
||||
Try
|
||||
SqlAdapter.Fill(Data)
|
||||
Retorno = True
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al obtener la remisión del boleto.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
||||
End Try
|
||||
|
||||
Return Retorno
|
||||
|
||||
End Function
|
||||
|
||||
#End Region
|
||||
|
||||
#Region "Destinos"
|
||||
Public Function GetDestinos(Optional CveRuta As Integer = 0) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
|
||||
@@ -880,6 +880,25 @@ Public Class ClsVentas
|
||||
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
Public Function UpdateBoletosVenta(CveVenta As Integer, CveEmpresa As Integer) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
DataAdapter("PA_Vta_VentasBoletosUpdate")
|
||||
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@CveVenta", SqlDbType.Int).Value = CveVenta
|
||||
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
|
||||
End With
|
||||
|
||||
Try
|
||||
SqlAdapter.Fill(Data)
|
||||
Retorno = True
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al cancelar los boletos de la venta.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
|
||||
End Try
|
||||
|
||||
Return Retorno
|
||||
End Function
|
||||
Public Function UpdateEstatusFactura(Estatus As Integer, FolioFiscal As String, SelloSAT As String, FechaCancelacion As DateTime, CveVenta As Integer,
|
||||
Optional IdPolizaCancelacion As Integer = -1, Optional CvePAC As Integer = -1, Optional CveEstatusRefacturacion As Integer = 0,
|
||||
Optional CveUsuarioCambiaEstatus As Integer = -1, Optional FechaCambioEstatus As String = "-1", Optional RFCReceptor As String = "-1",
|
||||
@@ -1428,7 +1447,7 @@ Public Class ClsVentas
|
||||
Optional CveContratoDetalle As Integer = -1, Optional PorcentajeIVA As Decimal = 0, Optional IEPS As Decimal = -1, Optional PorcentajeIEPS As Double = 0, Optional CvePromocionDetalle As Integer = -1,
|
||||
Optional CveMovimientoDetallePedido As Integer = -1, Optional ImporteRetIVA As Decimal = 0, Optional PorcentajeRetIVA As Double = 0,
|
||||
Optional ImporteRetISR As Decimal = 0, Optional PorcentajeRetISR As Decimal = 0, Optional CuentaPredial As String = "", Optional CvePrecioLista As Integer = -1, Optional CveActivoFijo As Integer = -1,
|
||||
Optional NumTurnos As Decimal = 0D, Optional EstatusAlmacen As Integer = 0, Optional CantidadConversion As Decimal = 0) As Boolean
|
||||
Optional NumTurnos As Decimal = 0D, Optional EstatusAlmacen As Integer = 0, Optional CantidadConversion As Decimal = 0, Optional CveViajePasajero As Integer = -1) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
DataAdapter("PA_VentasDetalleAdd")
|
||||
|
||||
@@ -1463,6 +1482,7 @@ Public Class ClsVentas
|
||||
.Add("@NumTurnos", SqlDbType.Decimal).Value = NumTurnos
|
||||
.Add("@EstatusAlmacen", SqlDbType.Int).Value = EstatusAlmacen
|
||||
.Add("@CantidadConversion", SqlDbType.Decimal).Value = CantidadConversion
|
||||
.Add("@CveViajePasajero", SqlDbType.Int).Value = CveViajePasajero
|
||||
End With
|
||||
|
||||
Try
|
||||
|
||||
@@ -1445,6 +1445,9 @@ Namespace Modelos
|
||||
TmpDT.Columns.Add("NumTurnos", GetType(Decimal))
|
||||
TmpDT.Columns("NumTurnos").DefaultValue = 0
|
||||
|
||||
TmpDT.Columns.Add("CveViajePasajero", GetType(Integer))
|
||||
TmpDT.Columns("CveViajePasajero").DefaultValue = -1
|
||||
|
||||
Return TmpDT
|
||||
End Function
|
||||
|
||||
@@ -1452,7 +1455,8 @@ Namespace Modelos
|
||||
Optional CveUM As Integer = -1, Optional CveProyecto As Integer = -1, Optional Proyecto As String = "",
|
||||
Optional CveSubProyecto As Integer = -1,
|
||||
Optional SubProyecto As String = "", Optional PorcentajeIVA As Decimal = -1,
|
||||
Optional CuentaPredial As String = "", Optional CveVentaDetallePadre As Integer = -1, Optional CveVentaDetalleRemision As Integer = -1) As Boolean
|
||||
Optional CuentaPredial As String = "", Optional CveVentaDetallePadre As Integer = -1,
|
||||
Optional CveVentaDetalleRemision As Integer = -1, Optional CveViajePasajero As Integer = -1) As Boolean
|
||||
|
||||
If Not CvePS > 0 Then
|
||||
Alert("Ocurrió un error al cargar la información del producto a agregar. Por favor verifique y vuelva a intentar.", TipoMensaje.MsgError)
|
||||
@@ -1649,6 +1653,7 @@ Namespace Modelos
|
||||
Row("AFValorInicial") = 0
|
||||
|
||||
Row("NumTurnos") = 0
|
||||
Row("CveViajePasajero") = CveViajePasajero
|
||||
|
||||
Me.DtDetalle.Rows.Add(Row)
|
||||
|
||||
@@ -2202,6 +2207,14 @@ Namespace Modelos
|
||||
|
||||
'Se agregan los PS
|
||||
For Each Row As DataRow In TmpDTDetalle.Rows
|
||||
|
||||
Dim CveViajePasajero As Integer = -1
|
||||
|
||||
'VERIFICA QUE EXISTA LA COLUMNA
|
||||
If TmpDTDetalle.Columns("CveViajePasajero") IsNot Nothing Then
|
||||
CveViajePasajero = Row("CveViajePasajero").ToString().ToEntero()
|
||||
End If
|
||||
|
||||
If Not ObjVentas.AddVentaDetalle(ObjVentas.CveVenta, Row("CvePS").ToString.ToEntero, Row("Cantidad").ToString.ToDecimal, Row("CveUM").ToString.ToEntero,
|
||||
Row("PU").ToString.ToDecimal(If(factura.ConvertirPesos, factura.TipoCambio, 1)), Row("ImporteIVA").ToString.ToDecimal(If(factura.ConvertirPesos, factura.TipoCambio, 1)), Math.Round((Row("Total").ToString.ToDecimal(If(factura.ConvertirPesos, factura.TipoCambio, 1)) * (1 + Row("PorcentajeIVA").ToString.ToDecimal(If(factura.ConvertirPesos, factura.TipoCambio, 1)))), 6),
|
||||
Row("Obs").ToString, Row("Descuento").ToString.ToDecimal(If(factura.ConvertirPesos, factura.TipoCambio, 1)), Row("TipoDescuento").ToString.ToEntero, Row("CveSubProyecto").ToString.ToEntero, Row("CvePresupuestoIngreso").ToString.ToEntero,
|
||||
@@ -2210,7 +2223,7 @@ Namespace Modelos
|
||||
IEPS:=Row("ImporteIEPS").ToString.ToDecimal, CveMovimientoDetallePedido:=Row("CveMovimientoDetallePedido").ToString.ToEntero,
|
||||
ImporteRetIVA:=Row("ImporteRetIVA").ToString.ToDecimal, ImporteRetISR:=Row("ImporteRetISR").ToString.ToDecimal,
|
||||
PorcentajeIEPS:=Row("PorcentajeIEPS").ToString.ToDecimal, PorcentajeRetIVA:=Row("PorcentajeRetIVA").ToString.ToDouble, PorcentajeRetISR:=Row("PorcentajeRetISR").ToString.ToDecimal, CuentaPredial:=Row("CuentaPredial").ToString,
|
||||
PorcentajeIVA:=Row("PorcentajeIVA").ToString.ToDecimal) Then
|
||||
PorcentajeIVA:=Row("PorcentajeIVA").ToString.ToDecimal, CveViajePasajero:=CveViajePasajero) Then
|
||||
ErrorList.Add("Ocurrió un error al agregar un Producto o Servicio a la factura.<br />Revise su factura y cualquier detalle comuníquese a Soporte Técnico")
|
||||
Exit For
|
||||
Else
|
||||
@@ -5209,6 +5222,14 @@ Namespace Modelos
|
||||
End If
|
||||
|
||||
End Function
|
||||
|
||||
Public Function CancelarBoleto(CveViajePasajero As Integer) As Boolean
|
||||
Dim TieneError As Boolean = False
|
||||
|
||||
Return Not TieneError
|
||||
End Function
|
||||
|
||||
|
||||
Private Shared Function DecodeBase64(ByVal strXMLCodificado As String) As String
|
||||
Try
|
||||
Dim decbuff As Byte() = Convert.FromBase64String(strXMLCodificado)
|
||||
@@ -5246,8 +5267,8 @@ Namespace Modelos
|
||||
''' Cancela la factura para poder realizar la refacturacion
|
||||
''' </summary>
|
||||
''' <returns></returns>
|
||||
Public Function CancelarPorRefacturacion(CveMotivoCancelacion As Integer, Motivo As String, Optional FolioSustitucion As String = "", Optional ValidarSAT As Boolean = False, Optional CveEstadoCancelacion As Integer = 0, Optional CveEstatusFacturaAsignado As Integer = -1) As MCancelacionVentaMensaje
|
||||
Return CancelarVenta(Me, Me.UsuarioActual, EsRefacturacion:=True, CveMotivoCancelacion:=CveMotivoCancelacion, MotivoCancelacion:=Motivo, FolioSustitucion:=FolioSustitucion, ValidarSAT:=ValidarSAT, CveEstadoCancelacion:=CveEstadoCancelacion, CveEstatusFacturaAsignado:=CveEstatusFacturaAsignado)
|
||||
Public Function CancelarPorRefacturacion(CveMotivoCancelacion As Integer, Motivo As String, Optional FolioSustitucion As String = "", Optional ValidarSAT As Boolean = False, Optional CveEstadoCancelacion As Integer = 0) As MCancelacionVentaMensaje
|
||||
Return CancelarVenta(Me, Me.UsuarioActual, EsRefacturacion:=True, CveMotivoCancelacion:=CveMotivoCancelacion, MotivoCancelacion:=Motivo, FolioSustitucion:=FolioSustitucion, ValidarSAT:=ValidarSAT, CveEstadoCancelacion:=CveEstadoCancelacion)
|
||||
End Function
|
||||
''' <summary>
|
||||
''' Cancela la factura y realiza las operaciones correspondientes
|
||||
@@ -5255,15 +5276,15 @@ Namespace Modelos
|
||||
''' <param name="RealizarDevolucionAlmacen"></param>
|
||||
''' <param name="ListaRemisionesCancelar"></param>
|
||||
''' <returns></returns>
|
||||
Public Function CancelarFactura(RealizarDevolucionAlmacen As Boolean, Optional ListaRemisionesCancelar As List(Of Integer) = Nothing, Optional CveMotivoCancelacion As Integer = -1, Optional Motivo As String = "", Optional ValidarSAT As Boolean = True, Optional CveEstadoCancelacion As Integer = 0) As MCancelacionVentaMensaje
|
||||
Public Function CancelarFactura(RealizarDevolucionAlmacen As Boolean, Optional ListaRemisionesCancelar As List(Of Integer) = Nothing, Optional CveMotivoCancelacion As Integer = -1, Optional Motivo As String = "", Optional ValidarSAT As Boolean = True, Optional CveEstadoCancelacion As Integer = 0, Optional CancelarBoletos As Boolean = False) As MCancelacionVentaMensaje
|
||||
'Comprobante emitido con errores sin relación
|
||||
Return CancelarVenta(Me, Me.UsuarioActual, RealizarDevolucionAlmacen:=RealizarDevolucionAlmacen, ListaRemisionesCancelar:=ListaRemisionesCancelar, CveMotivoCancelacion:=CveMotivoCancelacion, MotivoCancelacion:=Motivo, CveEstadoCancelacion:=CveEstadoCancelacion)
|
||||
Return CancelarVenta(Me, Me.UsuarioActual, RealizarDevolucionAlmacen:=RealizarDevolucionAlmacen, ListaRemisionesCancelar:=ListaRemisionesCancelar, CveMotivoCancelacion:=CveMotivoCancelacion, MotivoCancelacion:=Motivo, CveEstadoCancelacion:=CveEstadoCancelacion, CancelarBoletos:=CancelarBoletos)
|
||||
End Function
|
||||
|
||||
Private Function CancelarVenta(ObjFactura As Modelos.Factura, UsuarioActual As Usuario, Optional EsRefacturacion As Boolean = False, Optional RealizarDevolucionAlmacen As Boolean = False,
|
||||
Optional ListaRemisionesCancelar As List(Of Integer) = Nothing, Optional CveEstatusFacturaAsignado As Integer = -1, Optional FechaCancelacion As String = "-1",
|
||||
Optional AcuseCancelacion As String = "", Optional CveMotivoCancelacion As Integer = -1, Optional MotivoCancelacion As String = "",
|
||||
Optional FolioSustitucion As String = "", Optional ValidarSAT As Boolean = True, Optional CveEstadoCancelacion As Integer = 0) As MCancelacionVentaMensaje
|
||||
Optional FolioSustitucion As String = "", Optional ValidarSAT As Boolean = True, Optional CveEstadoCancelacion As Integer = 0, Optional CancelarBoletos As Boolean = False) As MCancelacionVentaMensaje
|
||||
Dim Retorno As New MCancelacionVentaMensaje()
|
||||
Dim ErrorList As New List(Of String)
|
||||
|
||||
@@ -6434,6 +6455,13 @@ Namespace Modelos
|
||||
End If
|
||||
End If
|
||||
|
||||
If CancelarBoletos Then
|
||||
If Not ObjVentas.UpdateBoletosVenta(CveVenta, UsuarioActual.CveEmpresa) Then
|
||||
ErrorCancelar = True
|
||||
MensajeError = "Ocurrió un error al cancelar los boletos."
|
||||
End If
|
||||
End If
|
||||
|
||||
If CancelarRemisiones Then
|
||||
If SeCancelaRemisionProceso Then
|
||||
|
||||
@@ -8055,7 +8083,7 @@ Namespace Modelos
|
||||
Public Property Giro As String
|
||||
Public Property CvePrecioLista As Integer
|
||||
Public Property EnviarFactura As String
|
||||
Public Property CveSucursal As Integer
|
||||
Public Property CveSubProyecto As Integer
|
||||
Public Property RetIVA As Decimal
|
||||
Public Property RetISR As Decimal
|
||||
Public Property IEPS As Decimal
|
||||
|
||||
@@ -67,6 +67,20 @@ Partial Class Boletos
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub CreaDTPasajeros()
|
||||
DtPasajeros = New DataTable
|
||||
DtPasajeros.Columns.Add("CveViajePasajero", GetType(Integer))
|
||||
DtPasajeros.Columns.Add("Numero", GetType(Integer))
|
||||
DtPasajeros.Columns.Add("Nombre", GetType(String))
|
||||
DtPasajeros.Columns.Add("Visa", GetType(String))
|
||||
DtPasajeros.Columns.Add("Asiento", GetType(String))
|
||||
DtPasajeros.Columns.Add("Celular", GetType(String))
|
||||
DtPasajeros.Columns.Add("Importe", GetType(Decimal))
|
||||
DtPasajeros.Columns.Add("Observaciones", GetType(String))
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
Private Sub CargaDatos()
|
||||
Dim ObjContratos As New ClsContratos
|
||||
Dim ObjViaje As New ClsTransportes
|
||||
@@ -76,15 +90,8 @@ Partial Class Boletos
|
||||
If ObjContratos.DtResultados IsNot Nothing AndAlso ObjContratos.DtResultados.Rows.Count > 0 Then
|
||||
TxtRuta.Text = Contrato.Rows(0)("Ruta").ToString
|
||||
TxtFecha.Text = Contrato.Rows(0)("FechaInicial").ToString.ToDate.ToShortDateString
|
||||
DtPasajeros = New DataTable
|
||||
DtPasajeros.Columns.Add("Numero", GetType(Integer))
|
||||
DtPasajeros.Columns.Add("Nombre", GetType(String))
|
||||
DtPasajeros.Columns.Add("Visa", GetType(String))
|
||||
DtPasajeros.Columns.Add("Asiento", GetType(String))
|
||||
DtPasajeros.Columns.Add("Celular", GetType(String))
|
||||
DtPasajeros.Columns.Add("Importe", GetType(Decimal))
|
||||
DtPasajeros.Columns.Add("Observaciones", GetType(String))
|
||||
|
||||
CreaDTPasajeros()
|
||||
InicializaCombos()
|
||||
|
||||
'Boletos Vendidos
|
||||
@@ -199,10 +206,14 @@ Partial Class Boletos
|
||||
Importe = dr("Importe").ToString.ToDecimal
|
||||
|
||||
'.Text, TxtVisa.Text, TxtCelular.Text, CBool(RblSexo.SelectedValue), TxtObservaciones.Text
|
||||
If Not ObjTransporte.AddViajesPasajeros(CveViaje, DdlPartida.SelectedValue.ToEntero, DdlDestino.SelectedValue.ToEntero, Importe, Asiento.ToEntero, Nombre, Visa, Celular, Sexo, Obs, UsuarioActual.CveUsuario, UsuarioActual.CveVendedor) > 1 Then
|
||||
Dim CveViajePasajero = ObjTransporte.AddViajesPasajeros(CveViaje, DdlPartida.SelectedValue.ToEntero, DdlDestino.SelectedValue.ToEntero, Importe, Asiento.ToEntero, Nombre, Visa, Celular, Sexo, Obs, UsuarioActual.CveUsuario, UsuarioActual.CveVendedor)
|
||||
If CveViajePasajero < 1 Then
|
||||
TieneError = True
|
||||
SbAlert.Append("Ocurrió un error al generar el viaje")
|
||||
Exit For
|
||||
End If
|
||||
|
||||
dr("CveViajePasajero") = CveViajePasajero
|
||||
Next
|
||||
|
||||
If Not TieneError Then
|
||||
@@ -329,11 +340,11 @@ Partial Class Boletos
|
||||
End Sub
|
||||
|
||||
Private Function CrearRemision(ByRef objTrans As ClsTransportes) As Modelos.Factura.MMensajeFactura
|
||||
Dim Retorno As Modelos.Factura.MMensajeFactura = Nothing
|
||||
Dim Retorno As New Modelos.Factura.MMensajeFactura
|
||||
|
||||
Dim CveCliente As Integer = 1154164
|
||||
Dim CveMoneda As Integer = 2
|
||||
Dim CveSubProyecto As Integer = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveSubProyecto").ToEntero()
|
||||
Dim CveSubProyecto As Integer = -1
|
||||
|
||||
If CveCliente <= 0 Then
|
||||
Retorno.Mensajes.Add("No se pudo cargar el cliente")
|
||||
@@ -345,34 +356,46 @@ Partial Class Boletos
|
||||
Return Retorno
|
||||
End If
|
||||
|
||||
Dim ObjFactura = Modelos.Factura.CrearVentaNueva(UsuarioActual, CveSubProyecto, CveCliente, CveMoneda, "Rem")
|
||||
|
||||
Dim CvePSBoleto As Integer = 912720
|
||||
|
||||
For Each Dr As DataRow In DtPasajeros.Rows
|
||||
Dim Obs = Dr("Nombre").ToString
|
||||
Dim Importe = Dr("Importe").ToString.ToDecimal()
|
||||
If Importe <= 0 Then
|
||||
Retorno.Mensajes.Add("El importe debe ser mayor a 0")
|
||||
Return Retorno
|
||||
End If
|
||||
If EsProduccion Then
|
||||
CvePSBoleto = 986337
|
||||
CveCliente = 1172306
|
||||
End If
|
||||
|
||||
ObjFactura.AgregarPS(CvePSBoleto, 1, Importe, 0, Obs, CveSubProyecto:=CveSubProyecto, PorcentajeIVA:=0)
|
||||
Next
|
||||
|
||||
ObjFactura.CalculaTotales()
|
||||
|
||||
Try
|
||||
Retorno = ObjFactura.EmitirFactura(False, Transac:=objTrans.IniciaTransacSQL())
|
||||
Catch ex As Exception
|
||||
Retorno = Nothing
|
||||
GuardaLog(ex.ToString())
|
||||
End Try
|
||||
Dim ObjFactura = Modelos.Factura.CrearVentaNueva(UsuarioActual, CveSubProyecto, CveCliente, CveMoneda, "Rem")
|
||||
|
||||
If ObjFactura IsNot Nothing Then
|
||||
ObjFactura.Dispose()
|
||||
CveSubProyecto = ObjFactura.Cliente.CveSubProyecto
|
||||
|
||||
For Each Dr As DataRow In DtPasajeros.Rows
|
||||
Dim Obs = Dr("Nombre").ToString
|
||||
Dim Importe = Dr("Importe").ToString.ToDecimal()
|
||||
If Importe <= 0 Then
|
||||
Retorno.Mensajes.Add("El importe debe ser mayor a 0")
|
||||
Return Retorno
|
||||
End If
|
||||
|
||||
ObjFactura.AgregarPS(CvePSBoleto, 1, Importe, 0, Obs, CveSubProyecto:=CveSubProyecto, PorcentajeIVA:=0, CveViajePasajero:=Dr("CveViajePasajero").ToString().ToEntero())
|
||||
Next
|
||||
|
||||
ObjFactura.CalculaTotales()
|
||||
|
||||
Try
|
||||
Retorno = ObjFactura.EmitirFactura(False, Transac:=objTrans.IniciaTransacSQL())
|
||||
Catch ex As Exception
|
||||
Retorno = Nothing
|
||||
GuardaLog(ex.ToString())
|
||||
End Try
|
||||
|
||||
If ObjFactura IsNot Nothing Then
|
||||
ObjFactura.Dispose()
|
||||
End If
|
||||
Else
|
||||
Retorno.Mensajes.Add("No se pudo generar la factura")
|
||||
End If
|
||||
|
||||
|
||||
Return Retorno
|
||||
End Function
|
||||
End Class
|
||||
|
||||
@@ -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