This commit is contained in:
AbrahamCastilloV
2024-02-19 11:10:51 -07:00
13 changed files with 290 additions and 323 deletions

View File

@@ -40,6 +40,14 @@ Partial Class Boletos
ViewState("Contrato") = value
End Set
End Property
Private Property DtDestinos As DataTable
Get
Return CType(ViewState("DtDestinos"), DataTable)
End Get
Set(value As DataTable)
ViewState("DtDestinos") = value
End Set
End Property
Private Property DtPasajeros As DataTable
Get
Return CType(ViewState("DtPasajeros"), DataTable)
@@ -73,7 +81,7 @@ Partial Class Boletos
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
TxtRuta.Text = Contrato.Rows(0)("SubProyecto").ToString
TxtFecha.Text = Contrato.Rows(0)("FechaInicial").ToString.ToDate.ToShortDateString
DtPasajeros = New DataTable
DtPasajeros.Columns.Add("Numero", GetType(Integer))
@@ -122,22 +130,35 @@ Partial Class Boletos
End Sub
Protected Sub InicializaCombos()
Dim CveRuta As Integer = Contrato.Rows(0)("CveRuta").ToString.ToEntero
Dim CveSubProyecto As Integer = Contrato.Rows(0)("CveSubProyecto").ToString.ToEntero
'Lista Destinos''carga específicos
Dim ObjDestinos As New ClsTransportes()
If ObjDestinos.GetDestinos(CveRuta:=CveRuta) Then
If ObjDestinos.DtResultados.Rows.Count > 0 Then
DdlPartida.DataSource = ObjDestinos.DtResultados
If ObjDestinos.GetDestinosTarifas(CveSubProyecto, -1, -1) Then
If ObjDestinos.DtResultados.Rows.Count > 0 Then
DtDestinos = ObjDestinos.DtResultados
DdlPartida.DataSource = DtDestinos.FiltraParametros("", DistinctColumns:={"CveDestinoOrigen", "Partida"})
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"))
'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
@@ -145,12 +166,12 @@ Partial Class Boletos
If DdlDestino.SelectedValue <> "-1" And DdlPartida.SelectedValue <> "-1" Then
Dim ImporteR As Decimal = 0
Dim ObjDestinos As New ClsTransportes()
Dim CveSubProyecto As Integer = Contrato.Rows(0)("CveSubProyecto").ToString.ToEntero
Try
If ObjDestinos.GetDestinosTarifas(DdlPartida.SelectedValue.ToEntero, DdlDestino.SelectedValue.ToEntero) Then
ImporteR = ObjDestinos.DtResultados.FiltroPrimeroValor("Importe").ToDecimal.RoundSQL
End If
If ImporteR > 0 Then
If ObjDestinos.GetDestinosTarifas(CveSubProyecto, DdlPartida.SelectedValue.ToEntero, DdlDestino.SelectedValue.ToEntero) Then
ImporteR = ObjDestinos.DtResultados.FiltroPrimeroValor("Importe").ToDecimal.RoundSQL
End If
If ImporteR > 0 Then
ViewState("Importe") = ImporteR
LbCostos.Text = $"El precio de su boleto es ${ImporteR.FormatoNumero}"
LbCostos.Visible = True
@@ -161,12 +182,9 @@ Partial Class Boletos
LbCostos.Visible = False
Alert("No se encontro una tarifa para estos destinos", TipoMensaje.MsgAdvertencia)
End If
Catch ex As Exception
Alert("No se encontro una tarifa para estos destinos", TipoMensaje.MsgAdvertencia)
ObjDestinos.RollBack()
Finally
ObjDestinos.Dispose()
End Try
ObjDestinos.Dispose()
End If
End Sub
@@ -276,8 +294,10 @@ Partial Class Boletos
End Sub
Protected Sub DdlPartida_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlPartida.SelectedIndexChanged
CotizarTarifa()
Protected Sub DdlPartida_SelectedIndexChanged(sender As Object, e As EventArgs)
DdlDestino.DataSource = DtDestinos.FiltraParametros($"CveDestinoOrigen = {DdlPartida.SelectedValue}")
DdlDestino.DataBind()
DdlDestino.Items.Insert(0, New ListItem("Seleccione Destino", "-1"))
End Sub
Protected Sub DdlDestino_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlDestino.SelectedIndexChanged
@@ -393,8 +413,10 @@ 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
'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