-- mejoras
This commit is contained in:
@@ -5233,6 +5233,7 @@ Namespace Modelos
|
||||
Dim ObjVentas As New ClsVentas()
|
||||
Dim ObjTransportes As New ClsTransportes(ObjVentas.IniciaTransacSQL())
|
||||
Dim ObjConta As New ClsContabilidad(ObjVentas.IniciaTransacSQL())
|
||||
Dim ObjEventos As New ClsOIEventos(ObjVentas.IniciaTransacSQL())
|
||||
|
||||
Try
|
||||
Dim Row As DataRow = Me.DtDetalle.Select($"CveViajePasajero={CveViajePasajero}").FirstOrDefault()
|
||||
@@ -5258,6 +5259,9 @@ Namespace Modelos
|
||||
TieneError = True
|
||||
End If
|
||||
End If
|
||||
If Not ObjEventos.AddEventoBitacora("se canceló el boleto:" & Row("Obs").ToString(), "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=CveVenta) Then
|
||||
ErrorList.Add("Ocurrió un error al agregar la bitacora de cancelación de boleto.")
|
||||
End If
|
||||
|
||||
If Not TieneError Then
|
||||
TieneError = Not RegenerarPrePolizas(ObjVentas.IniciaTransacSQL())
|
||||
|
||||
@@ -31,6 +31,14 @@ Partial Class Boletos
|
||||
ViewState("CveViaje") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property CveSubProyecto As Integer
|
||||
Get
|
||||
Return ViewState("CveSubProyecto").ToString().ToEntero
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
ViewState("CveSubProyecto") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private Property Contrato As DataTable
|
||||
Get
|
||||
@@ -66,7 +74,7 @@ Partial Class Boletos
|
||||
Response.Redirect("/Transportes/RepViajes.aspx")
|
||||
End If
|
||||
AsientoSeleccionado = ""
|
||||
CveViaje = Request.QueryString("CveViaje").ToEntero
|
||||
CveViaje = IfNull(Request("CveViaje"), "0").ToString.ToEntero
|
||||
If CveViaje > 0 Then
|
||||
CargaDatos()
|
||||
End If
|
||||
@@ -84,6 +92,7 @@ Partial Class Boletos
|
||||
If ObjContratos.DtResultados IsNot Nothing AndAlso ObjContratos.DtResultados.Rows.Count > 0 Then
|
||||
TxtRuta.Text = Contrato.Rows(0)("SubProyecto").ToString
|
||||
TxtFecha.Text = Contrato.Rows(0)("FechaInicial").ToString.ToDate.ToShortDateString
|
||||
CveSubProyecto = Contrato.Rows(0)("CveSubProyecto").ToString.ToEntero
|
||||
DtPasajeros = New DataTable
|
||||
DtPasajeros.Columns.Add("CveViajePasajero", GetType(Integer))
|
||||
DtPasajeros.Columns.Add("Numero", GetType(Integer))
|
||||
@@ -126,15 +135,11 @@ Partial Class Boletos
|
||||
|
||||
Response.Redirect($"~/Transportes/RepContratos.aspx")
|
||||
End If
|
||||
|
||||
|
||||
'Boletos Vendidos
|
||||
|
||||
End Sub
|
||||
|
||||
Protected Sub InicializaCombos()
|
||||
Dim CveSubProyecto As Integer = Contrato.Rows(0)("CveSubProyecto").ToString.ToEntero
|
||||
|
||||
'Lista Destinos''carga específicos
|
||||
Dim ObjDestinos As New ClsTransportes()
|
||||
|
||||
@@ -144,25 +149,10 @@ Partial Class Boletos
|
||||
DdlPartida.DataSource = DtDestinos.FiltraParametros("", DistinctColumns:={"CveDestinoOrigen", "Partida"})
|
||||
DdlPartida.DataBind()
|
||||
DdlPartida.Items.Insert(0, New ListItem("Seleccione Partida", "-1"))
|
||||
|
||||
'DdlDestino.DataSource = DtDestinos
|
||||
'DdlDestino.DataBind()
|
||||
'DdlDestino.Items.Insert(0, New ListItem("Seleccione Destino", "-1"))
|
||||
End If
|
||||
End If
|
||||
|
||||
'If ObjDestinos.GetDestinos(CveSubProyecto:=CveSubProyecto) Then
|
||||
' If ObjDestinos.DtResultados.Rows.Count > 0 Then
|
||||
' DdlPartida.DataSource = ObjDestinos.DtResultados
|
||||
' DdlPartida.DataBind()
|
||||
' DdlPartida.Items.Insert(0, New ListItem("Seleccione Partida", "-1"))
|
||||
|
||||
' DdlDestino.DataSource = ObjDestinos.DtResultados
|
||||
' DdlDestino.DataBind()
|
||||
' DdlDestino.Items.Insert(0, New ListItem("Seleccione Destino", "-1"))
|
||||
' End If
|
||||
'End If
|
||||
ObjDestinos.Dispose()
|
||||
|
||||
End Sub
|
||||
|
||||
Protected Sub CotizarTarifa()
|
||||
@@ -211,112 +201,99 @@ Partial Class Boletos
|
||||
|
||||
Dim SbAlert As New StringBuilder()
|
||||
Dim Retorno As New Modelos.Factura.MMensajeFactura()
|
||||
|
||||
Dim ObjTransporte As New ClsTransportes()
|
||||
ObjTransporte.IniciaTransacSQL()
|
||||
|
||||
Dim TieneError As Boolean = False
|
||||
|
||||
Try
|
||||
For Each dr As DataRow In DtPasajeros.Rows
|
||||
Dim Nombre, Visa, Celular, Obs, Asiento As String
|
||||
Dim Sexo As Boolean
|
||||
Dim Importe As Decimal = 0
|
||||
Dim CveDestinoOrigen, CveDestinoFinal As Integer
|
||||
For Each dr As DataRow In DtPasajeros.Rows
|
||||
Dim Nombre, Visa, Celular, Obs, Asiento As String
|
||||
Dim Sexo As Boolean
|
||||
Dim Importe As Decimal = 0
|
||||
Dim CveDestinoOrigen, CveDestinoFinal As Integer
|
||||
|
||||
CveDestinoOrigen = dr("CveDestinoOrigen").ToString.ToEntero
|
||||
CveDestinoFinal = dr("CveDestinoFinal").ToString.ToEntero
|
||||
Importe = dr("Importe").ToString.ToDecimal
|
||||
Asiento = dr("Asiento").ToString
|
||||
Nombre = dr("Nombre").ToString
|
||||
Visa = dr("Visa").ToString
|
||||
Celular = dr("Celular").ToString
|
||||
Sexo = dr("CveSexo").ToString.ToBool
|
||||
Obs = dr("Observaciones").ToString
|
||||
CveDestinoOrigen = dr("CveDestinoOrigen").ToString.ToEntero
|
||||
CveDestinoFinal = dr("CveDestinoFinal").ToString.ToEntero
|
||||
Importe = dr("Importe").ToString.ToDecimal
|
||||
Asiento = dr("Asiento").ToString
|
||||
Nombre = dr("Nombre").ToString
|
||||
Visa = dr("Visa").ToString
|
||||
Celular = dr("Celular").ToString
|
||||
Sexo = dr("CveSexo").ToString.ToBool
|
||||
Obs = dr("Observaciones").ToString
|
||||
|
||||
Dim CveViajePasajero = ObjTransporte.AddViajesPasajeros(CveViaje, CveDestinoOrigen, CveDestinoFinal, Importe, Asiento.ToEntero, Nombre, Visa, Celular, Sexo, Obs, UsuarioActual.CveUsuario, UsuarioActual.CveVendedor)
|
||||
Dim CveViajePasajero As Integer = ObjTransporte.AddViajesPasajeros(CveViaje, CveDestinoOrigen, CveDestinoFinal, 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
|
||||
|
||||
If CveViajePasajero < 1 Then
|
||||
TieneError = True
|
||||
SbAlert.Append("Ocurrió un error al generar el viaje")
|
||||
Exit For
|
||||
End If
|
||||
dr("CveViajePasajero") = CveViajePasajero
|
||||
Next
|
||||
|
||||
dr("CveViajePasajero") = CveViajePasajero
|
||||
Next
|
||||
If Not TieneError Then Retorno = CrearRemision(ObjTransporte)
|
||||
|
||||
If Retorno IsNot Nothing Then
|
||||
TieneError = Retorno.TieneError
|
||||
|
||||
If Not TieneError Then
|
||||
Retorno = CrearRemision(ObjTransporte)
|
||||
End If
|
||||
|
||||
If Retorno IsNot Nothing Then
|
||||
TieneError = Retorno.TieneError
|
||||
|
||||
If Not TieneError Then
|
||||
|
||||
If Not Retorno.TieneError Then
|
||||
If Retorno.CveVenta <= 0 Then
|
||||
Retorno.TieneError = True
|
||||
End If
|
||||
Else
|
||||
TieneError = True
|
||||
SbAlert.Append("Ocurrió un error al generar la factura")
|
||||
End If
|
||||
|
||||
If Retorno.Mensajes IsNot Nothing AndAlso Retorno.Mensajes.Count > 0 Then
|
||||
For Each Mensaje As String In Retorno.Mensajes
|
||||
SbAlert.AppendFormat("{0} <br/>", Mensaje)
|
||||
Next
|
||||
Else
|
||||
TieneError = True
|
||||
If Not Retorno.TieneError Then
|
||||
If Retorno.CveVenta <= 0 Then
|
||||
Retorno.TieneError = True
|
||||
End If
|
||||
Else
|
||||
If Retorno.Mensajes IsNot Nothing AndAlso Retorno.Mensajes.Count > 0 Then
|
||||
For Each Mensaje As String In Retorno.Mensajes
|
||||
SbAlert.AppendFormat("{0} <br/>", Mensaje)
|
||||
Next
|
||||
End If
|
||||
TieneError = True
|
||||
SbAlert.Append("Ocurrió un error al generar la factura")
|
||||
End If
|
||||
|
||||
If Retorno.Mensajes IsNot Nothing AndAlso Retorno.Mensajes.Count > 0 Then
|
||||
For Each Mensaje As String In Retorno.Mensajes
|
||||
SbAlert.AppendFormat("{0} <br/>", Mensaje)
|
||||
Next
|
||||
Else
|
||||
TieneError = True
|
||||
End If
|
||||
Else
|
||||
TieneError = True
|
||||
SbAlert.Append("Ocurrió un error al generar la factura")
|
||||
If Retorno.Mensajes IsNot Nothing AndAlso Retorno.Mensajes.Count > 0 Then
|
||||
For Each Mensaje As String In Retorno.Mensajes
|
||||
SbAlert.AppendFormat("{0} <br/>", Mensaje)
|
||||
Next
|
||||
End If
|
||||
End If
|
||||
|
||||
If SbAlert.Length = 0 Then
|
||||
SbAlert.Append("Ocurrió un error al generar la factura")
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
Else
|
||||
TieneError = True
|
||||
SbAlert.Append("Ocurrió un error al generar la factura." + ex.ToString())
|
||||
GuardaLog(ex.ToString())
|
||||
Finally
|
||||
If TieneError Then
|
||||
ObjTransporte.RollBack()
|
||||
ObjTransporte.Dispose()
|
||||
Else
|
||||
ObjTransporte.Commit()
|
||||
ObjTransporte.Dispose()
|
||||
SbAlert.Append("Ocurrió un error al generar la factura")
|
||||
End If
|
||||
|
||||
SbAlert.Append("El boleto se genero correctamente.")
|
||||
If SbAlert.Length = 0 Then
|
||||
SbAlert.Append("Ocurrió un error al generar la factura")
|
||||
End If
|
||||
|
||||
DtPasajeros.Clear()
|
||||
GvB.DataSource = DtPasajeros
|
||||
GvB.DataBind()
|
||||
If TieneError Then
|
||||
ObjTransporte.RollBack()
|
||||
ObjTransporte.Dispose()
|
||||
Else
|
||||
ObjTransporte.Commit()
|
||||
ObjTransporte.Dispose()
|
||||
|
||||
DdlPartida.SelectedIndex = -1
|
||||
'DdlPartida.SelectedValueExist("-1")
|
||||
SbAlert.Append("El boleto se genero correctamente.")
|
||||
|
||||
DdlDestino.SelectedIndex = -1
|
||||
'DdlDestino.SelectedValueExist("-1")
|
||||
DtPasajeros.Clear()
|
||||
GvB.DataSource = DtPasajeros
|
||||
GvB.DataBind()
|
||||
|
||||
AsientoSeleccionado = ""
|
||||
CargaDatos()
|
||||
End If
|
||||
DdlPartida.SelectedIndex = -1
|
||||
'DdlPartida.SelectedValueExist("-1")
|
||||
|
||||
Alert(SbAlert.ToString(), If(TieneError, TipoMensaje.MsgError, TipoMensaje.MsgInformacion), ShowCloseButton:=False)
|
||||
End Try
|
||||
DdlDestino.SelectedIndex = -1
|
||||
'DdlDestino.SelectedValueExist("-1")
|
||||
|
||||
AsientoSeleccionado = ""
|
||||
CargaDatos()
|
||||
End If
|
||||
|
||||
Alert(SbAlert.ToString(), If(TieneError, TipoMensaje.MsgError, TipoMensaje.MsgInformacion), ShowCloseButton:=False)
|
||||
|
||||
UpPanel.Update()
|
||||
|
||||
@@ -394,13 +371,16 @@ Partial Class Boletos
|
||||
End Sub
|
||||
|
||||
Private Function CrearRemision(ByRef objTrans As ClsTransportes) As Modelos.Factura.MMensajeFactura
|
||||
|
||||
Dim Retorno As New Modelos.Factura.MMensajeFactura
|
||||
|
||||
Dim CveCliente As Integer = 1154164
|
||||
Dim CveCliente As Integer = 1172306 ' 1154164
|
||||
Dim CveMoneda As Integer = 2
|
||||
Dim CveSubProyecto As Integer = -1
|
||||
Dim CvePSBoleto As Integer = 986337 '912720
|
||||
|
||||
Dim CvePSBoleto As Integer = 912720
|
||||
If CveSubProyecto <= 0 Then
|
||||
Retorno.Mensajes.Add("No se pudo cargar el subproyecto")
|
||||
Return Retorno
|
||||
End If
|
||||
|
||||
If EsProduccion Then
|
||||
CvePSBoleto = 986337
|
||||
@@ -415,14 +395,8 @@ Partial Class Boletos
|
||||
Dim ObjFactura = Modelos.Factura.CrearVentaNueva(UsuarioActual, -1, CveCliente, CveMoneda, "Rem")
|
||||
|
||||
If ObjFactura IsNot Nothing Then
|
||||
'TOMA EL SUBPROYECTO DEL CLIENTE
|
||||
CveSubProyecto = ObjFactura.Cliente.CveSubProyecto
|
||||
|
||||
If CveSubProyecto <= 0 Then
|
||||
Retorno.Mensajes.Add("No se pudo cargar el subproyecto")
|
||||
Return Retorno
|
||||
End If
|
||||
|
||||
ObjFactura.CveMoneda = CveMoneda
|
||||
ObjFactura.TipoCambio = GlobalTipoCambio(DateTime.Now).ToDecimal
|
||||
ObjFactura.CveSubProyecto = CveSubProyecto
|
||||
ObjFactura.CveSubProyectoCobranza = CveSubProyecto
|
||||
ObjFactura.CveSubProyectoEjecucion = CveSubProyecto
|
||||
@@ -430,7 +404,7 @@ Partial Class Boletos
|
||||
ObjFactura.SetSubProyectoMatriz()
|
||||
|
||||
For Each Dr As DataRow In DtPasajeros.Rows
|
||||
Dim Obs = Dr("Observaciones").ToString
|
||||
Dim Obs = "Asiento #" & Dr("Asiento").ToString
|
||||
Dim Importe = Dr("Importe").ToString.ToDecimal()
|
||||
|
||||
If Importe <= 0 Then
|
||||
@@ -439,9 +413,7 @@ Partial Class Boletos
|
||||
End If
|
||||
|
||||
Dim PorcentajeIVA As Decimal = 0
|
||||
|
||||
Dim DrPS As DataRow = ClsPaginas.GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePSBoleto).FiltroPrimero("") ' Estado = -1
|
||||
|
||||
Dim DrPS As DataRow = ClsPaginas.GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CvePS:=CvePSBoleto).FiltroPrimero("") ' Estado = -1
|
||||
If DrPS Is Nothing Then
|
||||
Retorno.Mensajes.Add("No se pudo agregar el producto")
|
||||
Return Retorno
|
||||
@@ -464,7 +436,6 @@ Partial Class Boletos
|
||||
Next
|
||||
|
||||
ObjFactura.CalculaTotales()
|
||||
|
||||
Try
|
||||
Retorno = ObjFactura.EmitirFactura(False, Transac:=objTrans.IniciaTransacSQL())
|
||||
Catch ex As Exception
|
||||
@@ -482,10 +453,4 @@ Partial Class Boletos
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
'Protected Sub TimerActualizar_Tick(ByVal sender As Object, ByVal e As EventArgs) Handles timerActualizar.Tick
|
||||
' ScriptManager.RegisterStartupScript(Me, Me.GetType(), "ActualizarTiempo", "actualizarTiempo();", True)
|
||||
' UpTimer.Update()
|
||||
'End Sub
|
||||
|
||||
|
||||
End Class
|
||||
|
||||
@@ -264,7 +264,7 @@
|
||||
<ContentTemplate>
|
||||
<asp:GridView ID="GvViajesPasajeros" runat="server" AutoGenerateColumns="False" EmptyDataText="No se encontró ningún boleto registrado"
|
||||
CssClass="table table-striped table-hover Widthall ScrollAD mysmallbtn" GridLines="None"
|
||||
data-sort="true" DataKeyNames="CveViajePasajero, CveViaje, CveDestinoFinal, CveVendedor, Importe, Asiento, Nombre, Visa, Celular, Observacion, Estatus, CveUsuario, FechaIng, Sexo, Partida, Destino">
|
||||
data-sort="true" DataKeyNames="CveViajePasajero, CveContrato, CveDestinoFinal, CveVendedor, Importe, Asiento, Nombre, Visa, Celular, Observacion, Estatus, CveUsuario, FechaIng, Sexo, Partida, Destino">
|
||||
<Columns>
|
||||
<asp:TemplateField HeaderText="No. Asiento">
|
||||
<ItemTemplate>
|
||||
|
||||
@@ -99,25 +99,63 @@ Partial Class RepContratoDetalle
|
||||
|
||||
Protected Sub BtnCancelar_Click(sender As Object, e As EventArgs)
|
||||
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
||||
Dim CveViajePasajero As String = GvRow.DataKey("CveViajePasajero")
|
||||
Dim CveViajePasajero As Integer = GvRow.DataKey("CveViajePasajero").ToEntero()
|
||||
Dim Estatus As String = GvRow.DataKey("Estatus")
|
||||
Dim cambiarEstatus As Boolean = Not Estatus.ToBool
|
||||
Dim ObjTransportes As New ClsTransportes
|
||||
ObjTransportes.IniciaTransacSQL()
|
||||
|
||||
Dim TieneError As Boolean = False
|
||||
Try
|
||||
If ObjTransportes.UpdateViajesPasajeros(CveViajePasajero.ToEntero, Activar:=cambiarEstatus, Estatus:=cambiarEstatus) Then
|
||||
If Not cambiarEstatus Then
|
||||
Alert($"El boleto ha sido cancelado correctamente.")
|
||||
Dim DtRem As DataTable = Nothing
|
||||
Dim ObjTran As New ClsTransportes
|
||||
If ObjTran.GetRemisionBoleto(CveViajePasajero.ToEntero, UsuarioActual.CveEmpresa) Then
|
||||
DtRem = ObjTran.DtResultados.Copy()
|
||||
End If
|
||||
ObjTran.Dispose()
|
||||
|
||||
If DtRem IsNot Nothing Then
|
||||
If DtRem.Rows.Count > 0 Then
|
||||
Dim CveVenta As Integer = DtRem.Rows(0)("CveVenta").ToString().ToEntero()
|
||||
Dim BoletosVigentes As Integer = DtRem.Rows(0)("BoletosVigentes").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 OrElse BoletosVigentes <= 1 Then
|
||||
Dim RespCancelacion = ObjRem.CancelarFactura(False, ValidarSAT:=False, CancelarBoletos:=True, ListaRemisionesCancelar:=New List(Of Integer))
|
||||
If RespCancelacion IsNot Nothing Then
|
||||
TieneError = RespCancelacion.HuboError
|
||||
Else
|
||||
TieneError = True
|
||||
End If
|
||||
Else
|
||||
TieneError = Not ObjRem.CancelarBoleto(CveViajePasajero)
|
||||
End If
|
||||
Else
|
||||
TieneError = True
|
||||
End If
|
||||
End If
|
||||
Else
|
||||
Alert($"El boleto ha sido reactivado correctamente.")
|
||||
'SI NO TIENE VENTA, SOLO CANCELAR EL BOLETO
|
||||
Dim ObjTran2 As New ClsTransportes
|
||||
If Not ObjTran2.UpdateViajesPasajeros(CveViajePasajero, Activar:=cambiarEstatus, Estatus:=cambiarEstatus) Then
|
||||
TieneError = True
|
||||
End If
|
||||
ObjTran2.Dispose()
|
||||
End If
|
||||
|
||||
End If
|
||||
ObjTransportes.Commit()
|
||||
Catch ex As Exception
|
||||
ObjTransportes.RollBack()
|
||||
Alert($"No se pudo cambiar el estatus del boleto {ex}", TipoMensaje.MsgError)
|
||||
TieneError = True
|
||||
GuardaLog(ex.ToString())
|
||||
Finally
|
||||
ObjTransportes.Dispose()
|
||||
If TieneError Then
|
||||
Alert($"Ocurrió un error al cancelar el boleto.", TipoMensaje.MsgError)
|
||||
Else
|
||||
Alert($"El boleto ha sido cancelado correctamente.")
|
||||
End If
|
||||
|
||||
CargaDatos()
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Reference in New Issue
Block a user