--Se volvió a poner todo lo que eliminé. Se hizo el select para los destinos específicos por ruta, se agregaron boletos

This commit is contained in:
AbrahamCastilloV
2023-12-21 17:44:32 -07:00
parent f02ad6a2a3
commit 567a2c9263
7 changed files with 180 additions and 152 deletions

View File

@@ -42,8 +42,13 @@
margin: 5px;
cursor: pointer;
color: white;
text-align: center;
}
.nodisponible:hover {
color: #fff;
}
.chofer {
align-items: center;
text-align: center;
@@ -163,26 +168,6 @@
<asp:UpdatePanel runat="server" UpdateMode="Conditional" ID="upPanel">
<ContentTemplate>
<div class="row margin-bottom-5" id="TrDestino" runat="server">
<label class="col-md-4 bold">
<asp:Label runat="server" Text="Destino:"></asp:Label></label><div
class="col-md-8">
<asp:DropDownList ID="DdlDestino" AppendDataBoundItems="true" DataTextField="Destino"
AutoPostBack="true"
DataValueField="CveDestino" Class="table-group-action-input form-control input-inline text-center"
OnTextChanged="CotizarTarifa"
Width="200px" runat="server">
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RFVDestino" runat="server" ControlToValidate="DdlDestino"
Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Destino''</b> es necesario, por favor ingréselo."
ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCEDestino" runat="server" HighlightCssClass="vco"
TargetControlID="RFVDestino" Width="400px" BehaviorID="_content_VCEDestino">
</ajax:ValidatorCalloutExtender>
</div>
</div>
<div class="row margin-bottom-5" id="TrPartida" runat="server">
<label class="col-md-4 bold">
<asp:Label runat="server" Text="Partida:"></asp:Label></label><div
@@ -203,10 +188,30 @@
</div>
</div>
<asp:Label runat="server" ID="TxtCosto" CssClass="tarifa"></asp:Label>
<asp:Button ID="BtnGuardar" Visible="False" OnClick="AddBoleto" runat="server" CssClass="btn btn-success"
Text="Comprar Boleto"
ValidationGroup="GrpGuardar"></asp:Button>
<div class="row margin-bottom-5" id="TrDestino" runat="server">
<label class="col-md-4 bold">
<asp:Label runat="server" Text="Destino:"></asp:Label></label><div
class="col-md-8">
<asp:DropDownList ID="DdlDestino" AppendDataBoundItems="true" DataTextField="Destino"
AutoPostBack="true"
DataValueField="CveDestino" Class="table-group-action-input form-control input-inline text-center"
OnTextChanged="CotizarTarifa"
Width="200px" runat="server">
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RFVDestino" runat="server" ControlToValidate="DdlDestino"
Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Destino''</b> es necesario, por favor ingréselo."
ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCEDestino" runat="server" HighlightCssClass="vco"
TargetControlID="RFVDestino" Width="400px" BehaviorID="_content_VCEDestino">
</ajax:ValidatorCalloutExtender>
</div>
</div>
<asp:Label runat="server" ID="TxtCosto" CssClass="tarifa"></asp:Label>
<asp:Button ID="BtnGuardar" Visible="False" OnClick="AddBoleto" runat="server" CssClass="btn btn-success"
Text="Comprar Boleto"
ValidationGroup="GrpGuardar"></asp:Button>
</ContentTemplate>
</asp:UpdatePanel>
@@ -217,7 +222,7 @@
</div>
<div class="col-md-2">
<div class="col-md-3">
<div class="portlet light xspadding bordered margin-bottom-10">
<contenttemplate>
@@ -241,7 +246,7 @@
</td>
<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
<td>
<asp:LinkButton OnClick="OnLinkButtonClick" CssClass="nodisponible" ID="A3" runat="server"
<asp:LinkButton OnClick="OnLinkButtonClick" CssClass="disponible" ID="A3" runat="server"
Text="<i class='fa fa-user my-1'><br/>3</i>" />
</td>
<td>

View File

@@ -2,12 +2,12 @@
Partial Class Boletos
Inherits ClsPaginas
Private Property asientoSeleccionado As String
Private Property AsientoSeleccionado As String
Get
Return ViewState("asientoSeleccionado").ToString()
Return ViewState("AsientoSeleccionado").ToString()
End Get
Set(value As String)
ViewState("asientoSeleccionado") = value
ViewState("AsientoSeleccionado") = value
End Set
End Property
Private Property Importe As Decimal
@@ -21,12 +21,20 @@ Partial Class Boletos
Private Property CveViaje As Integer
Get
Return ViewState("CveViaje").ToString().toentero
Return ViewState("CveViaje").ToString().ToEntero
End Get
Set(value As Integer)
ViewState("CveViaje") = value
End Set
End Property
Private Property CveRuta As Integer
Get
Return ViewState("CveRuta").ToString().ToEntero
End Get
Set(value As Integer)
ViewState("CveRuta") = value
End Set
End Property
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
@@ -34,11 +42,13 @@ Partial Class Boletos
If Request.QueryString("CveViaje") Is Nothing Then
Response.Redirect("/Transportes/ListadoViajes.aspx")
End If
AsientoSeleccionado = ""
CveRuta = 0
CveViaje = Request.QueryString("CveViaje").ToEntero
DirectCast(Master.FindControl("TSM"), ScriptManager).EnablePageMethods = True
InicializaCombos()
CargaDatos()
InicializaCombos()
End If
End Sub
@@ -47,8 +57,9 @@ Partial Class Boletos
'Datos Viaje
Dim ObjViaje As New ClsTransportes
Dim retorno As Boolean = ObjViaje.GetViajes(CveViaje.ToEntero, UsuarioActual.CveEmpresa)
ViewState("CveRuta") = ObjViaje.CveRuta
If retorno Then
'TxtRuta.Text = ObjViaje.Ruta.ToString
TxtRuta.Text = ObjViaje.Ruta
TxtFecha.Text = ObjViaje.Fecha.ToString
End If
@@ -57,7 +68,7 @@ Partial Class Boletos
Protected Sub InicializaCombos()
'Lista Destinos''carga específicos
Dim ObjDestinos As New ClsDestinos()
If ObjDestinos.GetDestinos(-1, -1, -1, "", True, True, DateTime.Now) Then
If ObjDestinos.GetDestinos(CveRuta:=CveRuta) Then
If ObjDestinos.DtResultados.Rows.Count > 0 Then
@@ -76,18 +87,20 @@ Partial Class Boletos
If DdlDestino.SelectedValue <> "" And DdlPartida.SelectedValue <> "" Then
Dim ObjDestinos As New ClsTransportes()
If ObjDestinos.GetDestinosTarifas(DdlPartida.SelectedValue.ToEntero, DdlDestino.SelectedValue.ToEntero) Then
Dim tImporte As Decimal = ObjDestinos.DtResultados.FiltroPrimeroValor("Importe").ToDecimal
If tImporte > 0 Then
TxtCosto.Text = $"El precio de su boleto es ${tImporte}"
Dim retorno As Boolean = ObjDestinos.GetDestinosTarifas(DdlPartida.SelectedValue.ToEntero, DdlDestino.SelectedValue.ToEntero)
Dim ImporteR As Decimal = ObjDestinos.DtResultados.FiltroPrimeroValor("Importe").ToDecimal
If retorno Then
If ImporteR > 0 Then
Dim redondeado As String = CStr(Math.Round(ImporteR, 2))
ViewState("Importe") = redondeado
TxtCosto.Text = $"El precio de su boleto es ${Importe}"
BtnGuardar.Visible = True
upPanel.Visible = True
Importe = tImporte
Else
TxtCosto.Text = ""
BtnGuardar.Visible = False
upPanel.Visible = False
Importe = 0
ViewState("Importe") = 0
End If
End If
End If
@@ -97,25 +110,21 @@ Partial Class Boletos
Dim linkButton As LinkButton = DirectCast(sender, LinkButton)
Dim buttonID As String = linkButton.ID
linkButton.CssClass += " activo"
asientoSeleccionado = buttonID
ViewState("AsientoSeleccionado") = buttonID
End Sub
Protected Sub AddBoleto(sender As Object, e As EventArgs)
If asientoSeleccionado = "" Then
Alert("Se requiere seleccionar su asiento")
If AsientoSeleccionado = "" Then
Alert("Se requiere seleccionar su asiento", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
'Page.Response.Write("<script>console.log('El resultado de tu variable" + CveViaje.GetType.ToString + "')</script>")
'Page.Response.Write("<script>console.log('El resultado de tu variable" + CveViaje.ToEntero.ToString + "')</script>")
Dim ObjTransporte As New ClsTransportes()
ObjTransporte.IniciaTransacSQL()
Try
asientoSeleccionado = asientoSeleccionado.Replace("A", "")
Dim retorno As Integer = ObjTransporte.AddViajePasajero(CveViaje, DdlPartida.SelectedValue.ToEntero, DdlDestino.SelectedValue.ToEntero, 0.0, asientoSeleccionado.ToEntero,
TxtNombre.Text, TxtVisa.Text, TxtCelular.Text, CBool(RblSexo.SelectedValue), TxtObservaciones.Text, UsuarioActual.CveUsuario)
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)
If retorno > 1 Then
ObjTransporte.Commit()

View File

@@ -24,11 +24,10 @@
<asp:Content ID="Content1" ContentPlaceHolderID="HB" runat="Server">
<contenttemplate>
<li>
<asp:LinkButton ID="LBAgregarViaje" runat="server"
><i class='fa fa-plus'></i>Agregar viaje</asp:LinkButton>
<asp:LinkButton ID="LBAgregarViaje" runat="server"><i class='fa fa-plus'></i>Agregar viaje</asp:LinkButton>
</li>
<li>
<asp:HyperLink ID="LBListadoContratos" runat="server" NavigateUrl="ListadoContratos.aspx"
<asp:HyperLink ID="LBListadoContratos" runat="server" NavigateUrl="ListadoContratos.aspx"
Target="_blank"><i class='fa fa-file'></i>Contratos</asp:HyperLink>
</li>
<li>
@@ -104,6 +103,9 @@
CssClass="btn btn-circle btn-sm red" OnClick="RemoveViaje" Text="<i class='fa fa-trash'></i>"
data-toggle="confirmation" data-popout="true" data-original-title='<%# If(Eval("CveMasivo").ToString <> "", "Eliminación masiva", "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-arrow-right'></i>" OnClick="GoViaje"
/>
</ItemTemplate>
</asp:TemplateField>

View File

@@ -41,10 +41,9 @@ Partial Class ListadoViajes
'Lista Destinos'
Dim ObjDestinos As New ClsDestinos()
If ObjDestinos.GetDestinos(-1, -1, -1, "", True, True, DateTime.Now) Then
If ObjDestinos.GetDestinos() Then
If ObjDestinos.DtResultados.Rows.Count > 0 Then
DdlPartida.DataSource = ObjDestinos.DtResultados
DdlPartida.DataBind()
DdlPartida.Items.Insert(0, New ListItem("Seleccione Partida", ""))
@@ -72,7 +71,7 @@ Partial Class ListadoViajes
Private Sub CargaDatos()
Dim ObjTransportes As New ClsTransportes
If ObjTransportes.GetViajes() Then
If ObjTransportes.GetViajes(-1, UsuarioActual.CveEmpresa) Then
GvViajes.DataSource = ObjTransportes.DtResultados
ObjTransportes.Dispose()
GvViajes.DataBind()
@@ -97,10 +96,8 @@ Partial Class ListadoViajes
End Sub
Protected Sub AddViaje(sender As Object, e As EventArgs)
Dim ObjTransportes As New ClsTransportes
ObjTransportes.IniciaTransacSQL()
If IsMasivo.Checked = True Then
@@ -109,7 +106,7 @@ Partial Class ListadoViajes
Exit Sub
End If
Dim CveMasivo = DateTimeOffset.Now.ToUnixTimeSeconds().ToEntero
Dim CveMasivo As Integer = DateTimeOffset.Now.ToUnixTimeSeconds().ToEntero
Dim fechaInicial As DateTime = DateTime.Parse(TxtFechaInicial.Text)
Dim frecuencia As Integer = Integer.Parse(TxtFrecuencia.Text)
@@ -141,7 +138,6 @@ Partial Class ListadoViajes
ObjTransportes.Dispose()
CargaDatos()
Alert("El viaje masivo se registró correctamente.", TipoMensaje.MsgInformacion)
Else
Try
If BtnGuardar.Text = "Guardar" Then
@@ -157,18 +153,14 @@ Partial Class ListadoViajes
TxtFechaViaje.Text = ""
DdlPartida.Text = ""
DdlDestino.SelectedValue = ""
End If
Else
Dim id As Integer = Convert.ToInt32(Request.QueryString("CveViaje"))
If ObjTransportes.UpdateViajes(id, DdlRutas.Text.ToEntero, DdlTransporte.Text.ToEntero, DdlChofer.Text.ToEntero, UsuarioActual.CveEmpresa, TxtFechaViaje.Text.ToDate, DdlPartida.Text.ToEntero, DdlDestino.Text.ToEntero) = True Then
Alert("El viaje se modificó correctamente.", TipoMensaje.MsgInformacion)
ObjTransportes.Commit()
End If
End If
Catch ex As Exception
ObjTransportes.RollBack()
@@ -203,7 +195,7 @@ Partial Class ListadoViajes
Protected Sub RemoveViaje(sender As Object, e As EventArgs)
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
Dim CveMasivo = GvRow.DataKey("CveMasivo")
Dim CveMasivo As String = GvRow.DataKey("CveMasivo")
Dim ObjTransportes As New ClsTransportes
@@ -233,6 +225,12 @@ Partial Class ListadoViajes
Protected Sub ToggleMasivo(sender As Object, e As EventArgs)
DivFechaMasivo.Visible = IsMasivo.Checked
RegistraScript(String.Format("$('#{0}').modal('show');", "ModalAgregar"))
End Sub
Protected Sub GoViaje(sender As Object, e As EventArgs)
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
Dim CveViaje As String = GvRow.DataKey("CveViaje")
Response.Redirect(String.Format("~/Transportes/Boletos.aspx?CveViaje={0}", CveViaje))
End Sub
End Class