--creación de listado de boletos

This commit is contained in:
AbrahamCastilloV
2023-12-21 19:11:03 -07:00
parent 567a2c9263
commit e38bd1adbd
3 changed files with 107 additions and 32 deletions

View File

@@ -271,7 +271,7 @@ Public Class ClsTransportes
#End Region #End Region
#Region "Boletos" #Region "Boletos"
Public Function AddViajePasajero(CveViaje As Integer, CveDestinoOrigen As Integer, CveDestinoFinal As Integer, Importe As Decimal, Asiento As Integer, Nombre As String, Visa As String, Celular As String, Sexo As Boolean, Observacion As String, CveUsuario As Integer) As Integer Public Function AddViajePasajeros(CveViaje As Integer, CveDestinoOrigen As Integer, CveDestinoFinal As Integer, Importe As Decimal, Asiento As Integer, Nombre As String, Visa As String, Celular As String, Sexo As Boolean, Observacion As String, CveUsuario As Integer) As Integer
Dim Retorno As Integer = -1 Dim Retorno As Integer = -1
DataAdapter("PA_Trans_ViajesPasajerosAdd") DataAdapter("PA_Trans_ViajesPasajerosAdd")
@@ -297,6 +297,30 @@ Public Class ClsTransportes
OnError("Ocurrió un error al guardar el nuevo boleto.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) OnError("Ocurrió un error al guardar el nuevo boleto.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
End Try End Try
Return Retorno
End Function
Public Function GetViajesPasajeros(CveViaje As Integer, Optional CveViajePasajero As Integer = 0) As Boolean
Dim Retorno As Boolean = False
DataAdapter("[PA_Trans_ViajesPasajerosGet]")
If CveViajePasajero <> 0 Then
With SqlAdapter.SelectCommand.Parameters
.Add("@CveViaje", SqlDbType.Int).Value = CveViaje
.Add("@CveViajePasajero", SqlDbType.Int).Value = CveViajePasajero
End With
Else
With SqlAdapter.SelectCommand.Parameters
.Add("@CveViaje", SqlDbType.Int).Value = CveViaje
End With
End If
Try
SqlAdapter.Fill(Data)
Retorno = True
Catch ex As Exception
OnError("Ocurrió un error al obtener el catálogo de viajes.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
End Try
Return Retorno Return Retorno
End Function End Function
#End Region #End Region

View File

@@ -15,21 +15,21 @@
display: inline-block; display: inline-block;
width: 45px; width: 45px;
height: 45px; height: 45px;
border: 2px solid #26C281; border: 2px solid #45b6af;
border-radius: 10px !important; border-radius: 10px !important;
margin: .1px; margin: .1px;
cursor: pointer; cursor: pointer;
color: #26C281; color: #45b6af;
text-align: center; text-align: center;
} }
.disponible:hover { .disponible:hover {
background-color: #26C281; background-color: #45b6af;
color: #fff; color: #fff;
} }
.disponible.activo { .disponible.activo {
background-color: #26C281; background-color: #45b6af;
color: #fff; color: #fff;
} }
@@ -60,12 +60,6 @@
cursor: pointer; cursor: pointer;
color: black; color: black;
} }
.tarifa {
font-weight: bold;
font-size: 1.6rem;
color: #26C281
}
</style> </style>
</asp:Content> </asp:Content>
@@ -84,7 +78,7 @@
<asp:Content ID="Content2" ContentPlaceHolderID="C" runat="Server"> <asp:Content ID="Content2" ContentPlaceHolderID="C" runat="Server">
<div class="col-md-6"> <div class="col-md-8">
<div class="portlet light xspadding bordered margin-bottom-10"> <div class="portlet light xspadding bordered margin-bottom-10">
<div class="caption font-green"> <div class="caption font-green">
<i class=" fa fa-user font-green"></i> <i class=" fa fa-user font-green"></i>
@@ -208,10 +202,14 @@
</div> </div>
</div> </div>
<asp:Label runat="server" ID="TxtCosto" CssClass="tarifa"></asp:Label> <asp:Label runat="server" ID="TxtCosto" CssClass="text-success bold text-center"></asp:Label>
<asp:Button ID="BtnGuardar" Visible="False" OnClick="AddBoleto" runat="server" CssClass="btn btn-success" <br />
Text="Comprar Boleto" <div class="text-center">
ValidationGroup="GrpGuardar"></asp:Button> <asp:Button ID="BtnGuardar" Visible="False" OnClick="AddBoleto" runat="server" CssClass="btn btn-success margin-top-15"
Text="Comprar Boleto"
ValidationGroup="GrpGuardar"></asp:Button>
</div>
</ContentTemplate> </ContentTemplate>
</asp:UpdatePanel> </asp:UpdatePanel>
@@ -219,6 +217,60 @@
</div> </div>
<div class="portlet light xspadding bordered margin-bottom-10">
<asp:GridView ID="GvBoletos" runat="server" AutoGenerateColumns="False" EmptyDataText="No se encontró ningún viaje registrado"
CssClass="table table-striped table-hover Widthall ScrollAD text-center" GridLines="None"
data-sort="true">
<Columns>
<asp:TemplateField HeaderText="Nombre">
<ItemTemplate>
<asp:Literal ID="LtlNombre" runat="server" Text='<%# Eval("Nombre") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Visa">
<ItemTemplate>
<asp:Literal ID="LtlVisa" runat="server" Text='<%# Eval("Visa") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Celular">
<ItemTemplate>
<asp:Literal ID="LtlCelular" runat="server" Text='<%# Eval("Celular") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Sexo">
<ItemTemplate>
<asp:Literal ID="LtlSexo" runat="server" Text='<%# If(Eval("Sexo").ToString = "True", "Masculino", "Femenino") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Estatus">
<ItemTemplate>
<asp:Label ID="LtlEstatus" runat="server" Text='<%# If(Eval("Estatus").ToString = "True", "Activo", "Cancelado") %>'
CssClass='<%# If(Eval("Estatus").ToString = "True", "text-success", "text-danger") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField ItemStyle-HorizontalAlign="Center" HeaderText="Acciones">
<ItemTemplate>
<asp:LinkButton ID="BtnEditar" runat="server" AlternateText="Editar"
CssClass="btn btn-circle btn-sm green" Text="<i class='fa fa-pencil'></i>" />
<asp:LinkButton ID="BtnEliminar" runat="server" AlternateText="Eliminar"
CssClass="btn btn-circle btn-sm red" Text="<i class='fa fa-cancel'></i>"
data-toggle="confirmation" data-popout="true" data-original-title="Confirmar"
data-btn-ok-label="si" />
<asp:LinkButton ID="BtnViaje" runat="server" AlternateText="Viaje"
CssClass="btn btn-circle btn-sm blue" Text="<i class='fa fa-print'></i>" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</div>
</div> </div>
@@ -481,18 +533,6 @@
</asp:Content> </asp:Content>
<asp:Content ID="Content7" ContentPlaceHolderID="JS" runat="Server"> <asp:Content ID="Content7" ContentPlaceHolderID="JS" runat="Server">
<%-- <script type="text/javascript">
function changeStyle(id) {
// Obtén el elemento por ID
var linkButton = document.getElementById(id);
// Cambia los estilos como desees
linkButton.c
linkButton.style.color = 'red';
linkButton.style.fontWeight = 'bold';
// Agrega más estilos según tus necesidades
}
</script>--%>
</asp:Content> </asp:Content>

View File

@@ -2,6 +2,7 @@
Partial Class Boletos Partial Class Boletos
Inherits ClsPaginas Inherits ClsPaginas
#Region "Propiedades"
Private Property AsientoSeleccionado As String Private Property AsientoSeleccionado As String
Get Get
Return ViewState("AsientoSeleccionado").ToString() Return ViewState("AsientoSeleccionado").ToString()
@@ -35,7 +36,7 @@ Partial Class Boletos
ViewState("CveRuta") = value ViewState("CveRuta") = value
End Set End Set
End Property End Property
#End Region
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
If Not IsPostBack Then If Not IsPostBack Then
@@ -56,12 +57,19 @@ Partial Class Boletos
Private Sub CargaDatos() Private Sub CargaDatos()
'Datos Viaje 'Datos Viaje
Dim ObjViaje As New ClsTransportes Dim ObjViaje As New ClsTransportes
Dim retorno As Boolean = ObjViaje.GetViajes(CveViaje.ToEntero, UsuarioActual.CveEmpresa) Dim retornoViaje As Boolean = ObjViaje.GetViajes(CveViaje.ToEntero, UsuarioActual.CveEmpresa)
ViewState("CveRuta") = ObjViaje.CveRuta ViewState("CveRuta") = ObjViaje.CveRuta
If retorno Then If retornoViaje Then
TxtRuta.Text = ObjViaje.Ruta TxtRuta.Text = ObjViaje.Ruta
TxtFecha.Text = ObjViaje.Fecha.ToString TxtFecha.Text = ObjViaje.Fecha.ToString
End If End If
'Boletos Vendidos
Dim retornoBoletos As Boolean = ObjViaje.GetViajesPasajeros(CveViaje)
If retornoBoletos Then
GvBoletos.DataSource = ObjViaje.DtResultados
ObjViaje.Dispose()
GvBoletos.DataBind()
End If
End Sub End Sub
@@ -106,12 +114,14 @@ Partial Class Boletos
End If End If
End Sub End Sub
Protected Sub OnLinkButtonClick(sender As Object, e As EventArgs) Protected Sub OnLinkButtonClick(sender As Object, e As EventArgs)
Dim linkButton As LinkButton = DirectCast(sender, LinkButton) Dim linkButton As LinkButton = DirectCast(sender, LinkButton)
Dim buttonID As String = linkButton.ID Dim buttonID As String = linkButton.ID
linkButton.CssClass += " activo" linkButton.CssClass += " activo"
ViewState("AsientoSeleccionado") = buttonID ViewState("AsientoSeleccionado") = buttonID
End Sub End Sub
Protected Sub AddBoleto(sender As Object, e As EventArgs) Protected Sub AddBoleto(sender As Object, e As EventArgs)
If AsientoSeleccionado = "" Then If AsientoSeleccionado = "" Then
@@ -124,7 +134,7 @@ Partial Class Boletos
Try Try
AsientoSeleccionado = AsientoSeleccionado.Replace("A", "") AsientoSeleccionado = AsientoSeleccionado.Replace("A", "")
Dim retorno As Integer = ObjTransporte.AddViajePasajero(CveViaje, DdlPartida.SelectedValue.ToEntero, DdlDestino.SelectedValue.ToEntero, Importe, AsientoSeleccionado.ToEntero, TxtNombre.Text, TxtVisa.Text, TxtCelular.Text, CBool(RblSexo.SelectedValue), TxtObservaciones.Text, UsuarioActual.CveUsuario) Dim retorno As Integer = ObjTransporte.AddViajePasajeros(CveViaje, DdlPartida.SelectedValue.ToEntero, DdlDestino.SelectedValue.ToEntero, Importe, AsientoSeleccionado.ToEntero, TxtNombre.Text, TxtVisa.Text, TxtCelular.Text, CBool(RblSexo.SelectedValue), TxtObservaciones.Text, UsuarioActual.CveUsuario)
If retorno > 1 Then If retorno > 1 Then
ObjTransporte.Commit() ObjTransporte.Commit()
@@ -137,4 +147,5 @@ Partial Class Boletos
End Try End Try
End Sub End Sub
End Class End Class