-- multiples pasajeros en una venta
This commit is contained in:
@@ -49,6 +49,18 @@
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.seleccionado {
|
||||
display: inline-block;
|
||||
width: 45px;
|
||||
height: 45px;
|
||||
background-color: #ff6a00;
|
||||
border-radius: 10px !important;
|
||||
margin: 5px;
|
||||
cursor: pointer;
|
||||
color: white;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.btnChofer {
|
||||
width: 45px;
|
||||
height: 45px;
|
||||
@@ -73,70 +85,7 @@
|
||||
<ContentTemplate>
|
||||
<%-- Datos de cliente y su viaje --%>
|
||||
<div class="col-md-8">
|
||||
<div class="portlet light xspadding bordered">
|
||||
<div class="portlet-title">
|
||||
<div class="caption font-green">
|
||||
<i class="fa fa-users font-green"></i>
|
||||
<span class="caption-subject bold uppercase">Datos del Cliente </span>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<div class="btn-group">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="portlet-body form">
|
||||
|
||||
|
||||
<div class="form-group form-md-line-input input-iconright ">
|
||||
<asp:TextBox ID="TxtNombre" CssClass="form-control" runat="server" MaxLength="200"
|
||||
ClientIDMode="Static"></asp:TextBox>
|
||||
<asp:RequiredFieldValidator ID="RFVTxtNombre" runat="server" ControlToValidate="TxtNombre"
|
||||
CssClass="help-block errorimput" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Nombre''</b> es necesario, por favor ingréselo."
|
||||
ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
|
||||
<label for="<%= TxtNombre.ClientID.ToString()%>">Nombre:</label>
|
||||
<i></i>
|
||||
</div>
|
||||
|
||||
<div class="row ">
|
||||
<div class="col-md-12">
|
||||
<div class="form-group form-md-line-input input-iconright">
|
||||
<asp:TextBox ID="TxtVisa" runat="server" Width="100%" CssClass="form-control"></asp:TextBox>
|
||||
<label for="<%= TxtVisa.ClientID.ToString()%>">Visa:</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group form-md-line-input input-iconright">
|
||||
<asp:DropDownList ID="RblSexo" CssClass="form-control" runat="server">
|
||||
<asp:ListItem Text="Masculino" Value="1" Selected="True" />
|
||||
<asp:ListItem Text="Femenino" Value="0" />
|
||||
</asp:DropDownList>
|
||||
<label for="<%= RblSexo.ClientID.ToString()%>">Sexo:</label>
|
||||
<i></i>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group form-md-line-input input-iconright">
|
||||
<asp:TextBox ID="TxtCelular" runat="server" Width="100%" CssClass="form-control"></asp:TextBox>
|
||||
<asp:RequiredFieldValidator ID="RequiredFieldValidator12" runat="server" CssClass="help-block errorimput"
|
||||
ControlToValidate="TxtCelular" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Celular''</b> es necesario, por favor ingréselo."
|
||||
ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
|
||||
<label for="<%= TxtCelular.ClientID.ToString()%>">Celular:</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group form-md-line-input input-iconright ">
|
||||
<asp:TextBox ID="TxtObservaciones" CssClass="form-control" runat="server" MaxLength="200"
|
||||
ClientIDMode="Static"></asp:TextBox>
|
||||
<label for="<%= TxtObservaciones.ClientID.ToString()%>">Observaciones:</label>
|
||||
<i></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="portlet light xspadding bordered ">
|
||||
<div class="portlet-title">
|
||||
<div class="caption font-yellow">
|
||||
@@ -200,13 +149,98 @@
|
||||
<asp:Label runat="server" ID="TxtCosto" CssClass="text-success bold mx-1"></asp:Label>
|
||||
<br />
|
||||
<div class="text-center">
|
||||
<asp:Button ID="BtnGuardar" Visible="False" OnClick="AddBoleto" runat="server" CssClass="btn btn-success "
|
||||
Text="Comprar Boleto"
|
||||
ValidationGroup="GrpGuardar"></asp:Button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="portlet light xspadding bordered">
|
||||
<div class="portlet-title">
|
||||
<div class="caption font-green">
|
||||
<i class="fa fa-users font-green"></i>
|
||||
<span class="caption-subject bold uppercase">Datos del Pasajero <asp:Label ID="LblNum" runat="server" Text='<%# Eval("Numero") %>'></asp:Label> </span>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<div class="btn-group">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="portlet-body form">
|
||||
<div class="form-group form-md-line-input input-iconright ">
|
||||
<asp:TextBox ID="TxtNombre" CssClass="form-control" runat="server" MaxLength="200"
|
||||
ClientIDMode="Static"></asp:TextBox>
|
||||
<asp:RequiredFieldValidator ID="RFVTxtNombre" runat="server" ControlToValidate="TxtNombre"
|
||||
CssClass="help-block errorimput" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Nombre''</b> es necesario, por favor ingréselo."
|
||||
ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
|
||||
<label >Nombre:</label>
|
||||
<i></i>
|
||||
</div>
|
||||
|
||||
<div class="row ">
|
||||
<div class="col-md-12">
|
||||
<div class="form-group form-md-line-input input-iconright">
|
||||
<asp:TextBox ID="TxtVisa" runat="server" Width="100%" CssClass="form-control"></asp:TextBox>
|
||||
<label >Visa:</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group form-md-line-input input-iconright">
|
||||
<asp:DropDownList ID="RblSexo" CssClass="form-control" runat="server">
|
||||
<asp:ListItem Text="Masculino" Value="1" Selected="True" />
|
||||
<asp:ListItem Text="Femenino" Value="0" />
|
||||
</asp:DropDownList>
|
||||
<label >Sexo:</label>
|
||||
<i></i>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group form-md-line-input input-iconright">
|
||||
<asp:TextBox ID="TxtCelular" runat="server" Width="100%" CssClass="form-control"></asp:TextBox>
|
||||
<asp:RequiredFieldValidator ID="RequiredFieldValidator12" runat="server" CssClass="help-block errorimput"
|
||||
ControlToValidate="TxtCelular" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Celular''</b> es necesario, por favor ingréselo."
|
||||
ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
|
||||
<label> Celular:</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group form-md-line-input input-iconright ">
|
||||
<asp:TextBox ID="TxtObservaciones" CssClass="form-control" runat="server" MaxLength="200"
|
||||
ClientIDMode="Static"></asp:TextBox>
|
||||
<label >Observaciones:</label>
|
||||
<i></i>
|
||||
</div>
|
||||
<div class="form-group form-md-line-input input-iconright ">
|
||||
<asp:Button ID="BtnAgregar" runat="server" Text="Agregar Pasajero" CssClass="btn btn-success " OnClick="BtnAgregar_Click" />
|
||||
<i></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
|
||||
<asp:GridView ID="GvB" runat="server" Width="100%" AutoGenerateColumns="false" CssClass="table table-advance table-hover" GridLines="None" DataKeyNames="Nombre,Visa,Asiento">
|
||||
<Columns>
|
||||
<asp:BoundField DataField="Nombre" HeaderText="Nombre" />
|
||||
<asp:BoundField DataField="Visa" HeaderText="Visa" />
|
||||
<asp:BoundField DataField="Asiento" HeaderText="Asiento" />
|
||||
<asp:BoundField DataField="Importe" HeaderText="Importe" DataFormatString="${0:N2}" />
|
||||
</Columns>
|
||||
</asp:GridView>
|
||||
|
||||
</div>
|
||||
<div class="row">
|
||||
<asp:Button ID="BtnGuardar" Visible="False" OnClick="FinalizarVenta" runat="server" CssClass="btn btn-success "
|
||||
Text="Finalizar Compra"
|
||||
ValidationGroup="GrpGuardar"></asp:Button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<%-- Asientos --%>
|
||||
<div class="col-md-4">
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
Option Explicit On
|
||||
Option Strict On
|
||||
Imports System.Data
|
||||
Imports ADSNetLibrary.Helpers
|
||||
Imports ADSNetLibrary.SIGAPI.Helpers
|
||||
Imports Extensiones
|
||||
Imports Extensiones.ModExtensiones
|
||||
Imports Microsoft.Ajax.Utilities
|
||||
|
||||
Partial Class Boletos
|
||||
Inherits ClsPaginas
|
||||
@@ -42,6 +41,14 @@ Partial Class Boletos
|
||||
ViewState("Contrato") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property DtPasajeros As DataTable
|
||||
Get
|
||||
Return CType(ViewState("DtPasajeros"), DataTable)
|
||||
End Get
|
||||
Set(value As DataTable)
|
||||
ViewState("DtPasajeros") = value
|
||||
End Set
|
||||
End Property
|
||||
#End Region
|
||||
|
||||
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||
@@ -53,7 +60,7 @@ Partial Class Boletos
|
||||
CveViaje = Request.QueryString("CveViaje").ToEntero
|
||||
If CveViaje > 0 Then
|
||||
CargaDatos()
|
||||
InicializaCombos()
|
||||
|
||||
End If
|
||||
|
||||
End If
|
||||
@@ -61,14 +68,44 @@ Partial Class Boletos
|
||||
|
||||
Private Sub CargaDatos()
|
||||
Dim ObjContratos As New ClsContratos
|
||||
Dim ObjViaje As New ClsTransportes
|
||||
If ObjContratos.GetContratos(CveViaje, UsuarioActual.CveEmpresa) Then
|
||||
Contrato = ObjContratos.DtResultados
|
||||
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("Importe", GetType(Decimal))
|
||||
|
||||
InicializaCombos()
|
||||
|
||||
'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 If
|
||||
|
||||
|
||||
Else
|
||||
ObjContratos.Dispose()
|
||||
Response.Redirect($"~/Transportes/RepContratos.aspx")
|
||||
End If
|
||||
|
||||
TxtRuta.Text = Contrato.Rows(0)("Ruta").ToString
|
||||
TxtFecha.Text = Contrato.Rows(0)("FechaInicial").ToString
|
||||
ObjContratos.Dispose()
|
||||
ObjViaje.Dispose()
|
||||
|
||||
|
||||
End Sub
|
||||
@@ -80,7 +117,6 @@ Partial Class Boletos
|
||||
Dim ObjDestinos As New ClsTransportes()
|
||||
If Not ObjDestinos.GetDestinos(CveRuta:=CveRuta) Then
|
||||
Else
|
||||
|
||||
If ObjDestinos.DtResultados.Rows.Count > 0 Then
|
||||
|
||||
DdlPartida.DataSource = ObjDestinos.DtResultados
|
||||
@@ -136,7 +172,7 @@ Partial Class Boletos
|
||||
linkButton.CssClass += " activo"
|
||||
AsientoSeleccionado = buttonID
|
||||
End Sub
|
||||
Protected Sub AddBoleto(sender As Object, e As EventArgs)
|
||||
Protected Sub FinalizarVenta(sender As Object, e As EventArgs)
|
||||
If AsientoSeleccionado = "" Then
|
||||
Alert("Se requiere seleccionar su asiento", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
@@ -147,17 +183,29 @@ Partial Class Boletos
|
||||
|
||||
Try
|
||||
AsientoSeleccionado = AsientoSeleccionado.Replace("A", "")
|
||||
If ObjTransporte.AddViajesPasajeros(CveViaje, DdlPartida.SelectedValue.ToEntero, DdlDestino.SelectedValue.ToEntero, Importe, AsientoSeleccionado.ToEntero, TxtNombre.Text, TxtVisa.Text, TxtCelular.Text, CBool(RblSexo.SelectedValue), TxtObservaciones.Text, UsuarioActual.CveUsuario, UsuarioActual.CveVendedor) > 1 Then
|
||||
Alert("Boleto generado correctamente")
|
||||
ObjTransporte.Commit()
|
||||
DdlPartida.SelectedValue = ""
|
||||
DdlDestino.SelectedValue = ""
|
||||
TxtNombre.Text = ""
|
||||
TxtVisa.Text = ""
|
||||
TxtCelular.Text = ""
|
||||
TxtObservaciones.Text = ""
|
||||
AsientoSeleccionado = ""
|
||||
End If
|
||||
|
||||
For Each dr As DataRow In DtPasajeros.Rows 'gvr As GridViewRow In GvB.Rows
|
||||
Dim Nombre, Visa, Celular, Obs, Asiento As String
|
||||
Dim Sexo As Boolean = False
|
||||
Dim Importe As Decimal = 0
|
||||
|
||||
Nombre = dr("Nombre").ToString
|
||||
Visa = dr("Visa").ToString
|
||||
Celular = dr("Celular").ToString
|
||||
Obs = dr("Observaciones").ToString
|
||||
Asiento = dr("Asiento").ToString
|
||||
Importe = dr("Importe").ToString.ToDecimal
|
||||
'.Text, TxtVisa.Text, TxtCelular.Text, CBool(RblSexo.SelectedValue), TxtObservaciones.Text
|
||||
If ObjTransporte.AddViajesPasajeros(CveViaje, DdlPartida.SelectedValue.ToEntero, DdlDestino.SelectedValue.ToEntero, Importe, Asiento.ToEntero, Nombre, Visa, Celular, Sexo, Obs, UsuarioActual.CveUsuario, UsuarioActual.CveVendedor) > 1 Then
|
||||
Alert("Boleto generado correctamente")
|
||||
ObjTransporte.Commit()
|
||||
DdlPartida.SelectedValue = ""
|
||||
DdlDestino.SelectedValue = ""
|
||||
AsientoSeleccionado = ""
|
||||
End If
|
||||
Next
|
||||
|
||||
|
||||
Catch ex As Exception
|
||||
ObjTransporte.RollBack()
|
||||
Alert($"No se pudo generar el boleto {ex}", TipoMensaje.MsgError)
|
||||
@@ -176,4 +224,50 @@ Partial Class Boletos
|
||||
Protected Sub DdlDestino_SelectedIndexChanged(sender As Object, e As EventArgs)
|
||||
CotizarTarifa(sender, e)
|
||||
End Sub
|
||||
|
||||
Protected Sub BtnNumPasajeros_Click(sender As Object, e As EventArgs)
|
||||
' GeneraPasajeros(TxtNumPasajeros.Text.ToEntero)
|
||||
End Sub
|
||||
|
||||
Private Sub GeneraPasajeros(Cantidad As Integer)
|
||||
DtPasajeros.Clear()
|
||||
For i As Integer = 1 To Cantidad
|
||||
Dim Dr1 As DataRow = DtPasajeros.NewRow
|
||||
Dr1("Numero") = i
|
||||
'asiento
|
||||
DtPasajeros.Rows.Add(Dr1)
|
||||
Next
|
||||
GvB.DataSource = DtPasajeros
|
||||
GvB.DataBind()
|
||||
End Sub
|
||||
|
||||
Protected Sub BtnAgregar_Click(sender As Object, e As EventArgs)
|
||||
|
||||
If AsientoSeleccionado = "" Then
|
||||
Alert("No se ha seleccionado el asiento.")
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Dim Dr1 As DataRow = DtPasajeros.NewRow
|
||||
Dr1("Asiento") = AsientoSeleccionado.Replace("A", "")
|
||||
Dr1("Nombre") = TxtNombre.Text.Trim
|
||||
Dr1("Visa") = TxtVisa.Text.Trim
|
||||
'asiento
|
||||
DtPasajeros.Rows.Add(Dr1)
|
||||
AsientoSeleccionado = ""
|
||||
|
||||
GvB.DataSource = DtPasajeros
|
||||
GvB.DataBind()
|
||||
|
||||
'identifico los asientos seleccionados para la venta
|
||||
Dim cph As ContentPlaceHolder = CType(Me.Master.FindControl("C"), ContentPlaceHolder)
|
||||
For Each dr As DataRow In DtPasajeros.Rows
|
||||
Dim lnk As LinkButton = CType(cph.FindControl($"A{dr("Asiento")}"), LinkButton)
|
||||
If lnk IsNot Nothing Then
|
||||
lnk.Enabled = False
|
||||
lnk.CssClass = "seleccionado"
|
||||
lnk.ToolTip = dr("Nombre").ToString
|
||||
End If
|
||||
Next
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
Reference in New Issue
Block a user