diff --git a/Transportes/Boletos.aspx.vb b/Transportes/Boletos.aspx.vb index c29ecdb22..9deb0ecda 100644 --- a/Transportes/Boletos.aspx.vb +++ b/Transportes/Boletos.aspx.vb @@ -70,7 +70,22 @@ Partial Class Boletos TxtRuta.Text = Contrato.Rows(0)("Ruta").ToString TxtFecha.Text = Contrato.Rows(0)("FechaInicial").ToString + Dim ObjViaje As New ClsTransportes + 'Boletos Vendidos + Dim dt As DataTable + If ObjViaje.GetViajesPasajeros(CveViaje, Estatus:=1) Then 'Poner párametro para estatus y cancelado de viajes + dt = ObjViaje.DtResultados + Dim cph As ContentPlaceHolder = CType(Me.Master.FindControl("C"), ContentPlaceHolder) + For Each dr As DataRow In dt.Rows + Dim lnk As LinkButton = CType(cph.FindControl($"A{dr("Asiento")}"), LinkButton) + If lnk IsNot Nothing Then + lnk.Enabled = False + lnk.CssClass = "nodisponible" + lnk.ToolTip = dr("Nombre").ToString + End If + Next + End If End Sub Protected Sub InicializaCombos() diff --git a/Transportes/RepContratoDetalle.aspx b/Transportes/RepContratoDetalle.aspx index 353c09528..27625321e 100644 --- a/Transportes/RepContratoDetalle.aspx +++ b/Transportes/RepContratoDetalle.aspx @@ -184,9 +184,76 @@ <%-- Boletos --%> - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Transportes/RepContratoDetalle.aspx.vb b/Transportes/RepContratoDetalle.aspx.vb index e33e2bc64..12bb773e9 100644 --- a/Transportes/RepContratoDetalle.aspx.vb +++ b/Transportes/RepContratoDetalle.aspx.vb @@ -4,6 +4,8 @@ Imports System.Data Imports ADSNetLibrary.Helpers Imports ADSNetLibrary.SIGAPI.Helpers Imports Extensiones +Imports Extensiones.ModExtensiones +Imports Microsoft.Reporting.WebForms Partial Class RepContratoDetalle @@ -42,6 +44,7 @@ Partial Class RepContratoDetalle DdlTipoAF.Items.Insert(0, New ListItem("-", "")) End Sub Private Sub CargaDatos() + 'Información General Dim ObjContratos As New ClsContratos If ObjContratos.GetContratos(CveContrato, UsuarioActual.CveEmpresa) Then Contrato = ObjContratos.DtResultados @@ -49,9 +52,6 @@ Partial Class RepContratoDetalle Response.Redirect($"~/Transportes/RepContratos.aspx") End If - If Contrato.Rows(0)("CveContratoTipo").ToString() = "35" Then - TabBoletos.Visible = True - End If LbFolio.Text = Contrato.Rows(0)("NumeroContrato").ToString DdlClientes.SelectedText = Contrato.Rows(0)("NombreComercial").ToString @@ -66,10 +66,71 @@ Partial Class RepContratoDetalle TxtDolares.Text = Contrato.Rows(0)("Importe").ToString TxtPesos.Text = Contrato.Rows(0)("ImporteMax").ToString TxtAnticipo.Text = Contrato.Rows(0)("ImporteMin").ToString + 'Boletos Vendidos + If Contrato.Rows(0)("CveContratoTipo").ToString() = "35" Then + TabBoletos.Visible = True + End If + + Dim ObjTransportes As New ClsTransportes + If ObjTransportes.GetViajesPasajeros(CveContrato) Then + GvViajesPasajeros.DataSource = ObjTransportes.DtResultados + GvViajesPasajeros.DataBind() + ObjTransportes.Dispose() + End If End Sub + 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 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) + Finally + ObjTransportes.Dispose() + CargaDatos() + End Try + End Sub + Protected Sub ImprimirBoleto(sender As Object, e As EventArgs) + Dim dtResult As New DataTable() + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + Dim Fecha As Date = GvRow.DataKey("FechaIng").ToDate + Dim Importe As Decimal = GvRow.DataKey("Importe").ToDecimal + Dim params As New List(Of ReportParameter) From { + New ReportParameter("Ruta", GvRow.DataKey("Ruta")), + New ReportParameter("Origen", GvRow.DataKey("Partida")), + New ReportParameter("Destino", GvRow.DataKey("Destino")), + New ReportParameter("FechaSalida", Fecha.ToShortDateString()), + New ReportParameter("HoraSalida", Fecha.ToString("HH:mm")), + New ReportParameter("Nombre", GvRow.DataKey("Nombre")), + New ReportParameter("Visa", GvRow.DataKey("Visa")), + New ReportParameter("Celular", GvRow.DataKey("Celular")), + New ReportParameter("Importe", Math.Round(Importe, 1).ToString), + New ReportParameter("TipoBoleto", "Tipo Boleto"), + New ReportParameter("Agencia", GvRow.DataKey("Agencia")), + New ReportParameter("TelefonoAgencia", GvRow.DataKey("TelefonoAgencia")), + New ReportParameter("Asiento", GvRow.DataKey("Asiento")) + } + + ImprimirPDFStimul($"{UsuarioActual.Empresa.Ruta}Formatos\Boleto.mrt", dtResult, params, NombreArchivo:="Boleto") + 'Empresas/Grales/Formatos/EntradaSalida.mrt + 'Empresas/188/Formatos/Boleto.mrt + + End Sub End Class