--merge RepBoletos
This commit is contained in:
@@ -85,13 +85,12 @@
|
||||
</asp:Content>
|
||||
|
||||
<asp:Content ID="Content2" ContentPlaceHolderID="C" runat="Server">
|
||||
|
||||
<asp:UpdatePanel runat="server" UpdateMode="Conditional" ID="UpPanel">
|
||||
<ContentTemplate>
|
||||
<div class="row">
|
||||
<%-- Boleto --%>
|
||||
<div class="col-md-9">
|
||||
<%-- Datos del Cliente --%>
|
||||
<%-- Datos del Pasajero --%>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="portlet light xspadding bordered">
|
||||
@@ -149,7 +148,7 @@
|
||||
|
||||
<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:TextBox ID="TxtCelular" runat="server" Width="100%" CssClass="form-control" type="number" MaxLength="10"></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>
|
||||
@@ -168,7 +167,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<%-- Datos del Viaje y Destinos --%>
|
||||
<%-- Datos del Viaje --%>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="portlet light xspadding bordered ">
|
||||
@@ -237,14 +236,14 @@
|
||||
</div>
|
||||
</div>
|
||||
<%-- Botón para Agregar Pasajero(Oculto) --%>
|
||||
<div class="form-group form-md-line-input input-iconright">
|
||||
<asp:Label runat="server" ID="LbAviso" CssClass="col-md-9 alert alert-warning text-center mx-1"
|
||||
Visible="False"><p><span class="bold uppercase">information: </span>Los boletos están siendo apartados hasta finalizar su compra</p></asp:Label>
|
||||
<asp:Button ID="BtnAgregarPasajero" runat="server" CssClass="col-md-2 btn btn-success"
|
||||
Visible="false"
|
||||
Text="Agregar Pasajeros" OnClick="AgregarPasajero" ValidationGroup="GrpGuardar" />
|
||||
|
||||
|
||||
<div class="form-group form-md-line-input input-iconright my-1">
|
||||
<div style="display:flex; justify-content:space-between">
|
||||
<asp:Label runat="server" ID="LbAviso" CssClass="col-md-9 alert alert-warning text-center mx-1"
|
||||
Visible="False"><p><span class="bold uppercase">information: </span>Los boletos están siendo apartados hasta finalizar su compra</p></asp:Label>
|
||||
<asp:Button ID="BtnAgregarPasajero" runat="server" CssClass="col-md-2 btn btn-success"
|
||||
Visible="false"
|
||||
Text="Agregar Pasajeros" OnClick="AgregarPasajero" ValidationGroup="GrpGuardar" />
|
||||
</div>
|
||||
</div>
|
||||
<%-- Listado de Boletos --%>
|
||||
<div class="row">
|
||||
|
||||
@@ -31,14 +31,6 @@ Partial Class Boletos
|
||||
ViewState("CveViaje") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property CveSubProyecto As Integer
|
||||
Get
|
||||
Return ViewState("CveSubProyecto").ToString().ToEntero
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
ViewState("CveSubProyecto") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private Property Contrato As DataTable
|
||||
Get
|
||||
@@ -67,21 +59,19 @@ Partial Class Boletos
|
||||
|
||||
|
||||
#End Region
|
||||
|
||||
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||
If Not IsPostBack Then
|
||||
If Request.QueryString("CveViaje") Is Nothing And UsuarioActual.CveVendedor <> Nothing And UsuarioActual.CveVendedor <> -1 Then
|
||||
Response.Redirect("/Transportes/RepViajes.aspx")
|
||||
End If
|
||||
AsientoSeleccionado = ""
|
||||
CveViaje = IfNull(Request("CveViaje"), "0").ToString.ToEntero
|
||||
CveViaje = Request.QueryString("CveViaje").ToEntero
|
||||
If CveViaje > 0 Then
|
||||
CargaDatos()
|
||||
End If
|
||||
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub CargaDatos()
|
||||
Dim ObjContratos As New ClsContratos
|
||||
Dim ObjViaje As New ClsTransportes
|
||||
@@ -92,7 +82,6 @@ Partial Class Boletos
|
||||
If ObjContratos.DtResultados IsNot Nothing AndAlso ObjContratos.DtResultados.Rows.Count > 0 Then
|
||||
TxtRuta.Text = Contrato.Rows(0)("SubProyecto").ToString
|
||||
TxtFecha.Text = Contrato.Rows(0)("FechaInicial").ToString.ToDate.ToShortDateString
|
||||
CveSubProyecto = Contrato.Rows(0)("CveSubProyecto").ToString.ToEntero
|
||||
DtPasajeros = New DataTable
|
||||
DtPasajeros.Columns.Add("CveViajePasajero", GetType(Integer))
|
||||
DtPasajeros.Columns.Add("Numero", GetType(Integer))
|
||||
@@ -135,11 +124,14 @@ Partial Class Boletos
|
||||
|
||||
Response.Redirect($"~/Transportes/RepContratos.aspx")
|
||||
End If
|
||||
|
||||
|
||||
'Boletos Vendidos
|
||||
|
||||
End Sub
|
||||
|
||||
Protected Sub InicializaCombos()
|
||||
Dim CveSubProyecto As Integer = Contrato.Rows(0)("CveSubProyecto").ToString.ToEntero
|
||||
|
||||
'Lista Destinos''carga específicos
|
||||
Dim ObjDestinos As New ClsTransportes()
|
||||
|
||||
@@ -149,12 +141,26 @@ Partial Class Boletos
|
||||
DdlPartida.DataSource = DtDestinos.FiltraParametros("", DistinctColumns:={"CveDestinoOrigen", "Partida"})
|
||||
DdlPartida.DataBind()
|
||||
DdlPartida.Items.Insert(0, New ListItem("Seleccione Partida", "-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
|
||||
|
||||
Protected Sub CotizarTarifa()
|
||||
If DdlDestino.SelectedValue <> "-1" And DdlPartida.SelectedValue <> "-1" Then
|
||||
Dim ImporteR As Decimal = 0
|
||||
@@ -169,6 +175,7 @@ Partial Class Boletos
|
||||
LbCostos.Text = $"El precio de su boleto es ${ImporteR.FormatoNumero}"
|
||||
LbCostos.Visible = True
|
||||
BtnAgregarPasajero.Visible = True
|
||||
LbAviso.Visible = True
|
||||
Else
|
||||
ViewState("Importe") = 0
|
||||
BtnAgregarPasajero.Visible = False
|
||||
@@ -180,7 +187,6 @@ Partial Class Boletos
|
||||
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Protected Sub OnLinkButtonClick(sender As Object, e As EventArgs)
|
||||
'quitamos la selección anterior, en caso de existir.
|
||||
If AsientoSeleccionado <> "" Then
|
||||
@@ -196,119 +202,132 @@ Partial Class Boletos
|
||||
|
||||
UpPanel.Update()
|
||||
End Sub
|
||||
|
||||
Protected Sub FinalizarVenta(sender As Object, e As EventArgs)
|
||||
|
||||
Dim SbAlert As New StringBuilder()
|
||||
Dim Retorno As New Modelos.Factura.MMensajeFactura()
|
||||
|
||||
Dim ObjTransporte As New ClsTransportes()
|
||||
ObjTransporte.IniciaTransacSQL()
|
||||
|
||||
Dim TieneError As Boolean = False
|
||||
|
||||
For Each dr As DataRow In DtPasajeros.Rows
|
||||
Dim Nombre, Visa, Celular, Obs, Asiento As String
|
||||
Dim Sexo As Boolean
|
||||
Dim Importe As Decimal = 0
|
||||
Dim CveDestinoOrigen, CveDestinoFinal As Integer
|
||||
Try
|
||||
For Each dr As DataRow In DtPasajeros.Rows
|
||||
Dim Nombre, Visa, Celular, Obs, Asiento As String
|
||||
Dim Sexo As Boolean
|
||||
Dim Importe As Decimal = 0
|
||||
Dim CveDestinoOrigen, CveDestinoFinal As Integer
|
||||
|
||||
CveDestinoOrigen = dr("CveDestinoOrigen").ToString.ToEntero
|
||||
CveDestinoFinal = dr("CveDestinoFinal").ToString.ToEntero
|
||||
Importe = dr("Importe").ToString.ToDecimal
|
||||
Asiento = dr("Asiento").ToString
|
||||
Nombre = dr("Nombre").ToString
|
||||
Visa = dr("Visa").ToString
|
||||
Celular = dr("Celular").ToString
|
||||
Sexo = dr("CveSexo").ToString.ToBool
|
||||
Obs = dr("Observaciones").ToString
|
||||
CveDestinoOrigen = dr("CveDestinoOrigen").ToString.ToEntero
|
||||
CveDestinoFinal = dr("CveDestinoFinal").ToString.ToEntero
|
||||
Importe = dr("Importe").ToString.ToDecimal
|
||||
Asiento = dr("Asiento").ToString
|
||||
Nombre = dr("Nombre").ToString
|
||||
Visa = dr("Visa").ToString
|
||||
Celular = dr("Celular").ToString
|
||||
Sexo = dr("CveSexo").ToString.ToBool
|
||||
Obs = dr("Observaciones").ToString
|
||||
|
||||
Dim CveViajePasajero As Integer = ObjTransporte.AddViajesPasajeros(CveViaje, CveDestinoOrigen, CveDestinoFinal, Importe, Asiento.ToEntero, Nombre, Visa, Celular, Sexo, Obs, UsuarioActual.CveUsuario, UsuarioActual.CveVendedor)
|
||||
If CveViajePasajero < 1 Then
|
||||
TieneError = True
|
||||
SbAlert.Append("Ocurrió un error al generar el viaje")
|
||||
Exit For
|
||||
End If
|
||||
Dim CveViajePasajero = ObjTransporte.AddViajesPasajeros(CveViaje, CveDestinoOrigen, CveDestinoFinal, Importe, Asiento.ToEntero, Nombre, Visa, Celular, Sexo, Obs, UsuarioActual.CveUsuario, UsuarioActual.CveVendedor)
|
||||
|
||||
dr("CveViajePasajero") = CveViajePasajero
|
||||
Next
|
||||
If CveViajePasajero < 1 Then
|
||||
TieneError = True
|
||||
SbAlert.Append("Ocurrió un error al generar el viaje")
|
||||
Exit For
|
||||
End If
|
||||
|
||||
If Not TieneError Then Retorno = CrearRemision(ObjTransporte)
|
||||
dr("CveViajePasajero") = CveViajePasajero
|
||||
Next
|
||||
|
||||
If Retorno IsNot Nothing Then
|
||||
TieneError = Retorno.TieneError
|
||||
|
||||
If Not TieneError Then
|
||||
Retorno = CrearRemision(ObjTransporte)
|
||||
End If
|
||||
|
||||
If Not Retorno.TieneError Then
|
||||
If Retorno.CveVenta <= 0 Then
|
||||
Retorno.TieneError = True
|
||||
If Retorno IsNot Nothing Then
|
||||
TieneError = Retorno.TieneError
|
||||
|
||||
If Not TieneError Then
|
||||
|
||||
If Not Retorno.TieneError Then
|
||||
If Retorno.CveVenta <= 0 Then
|
||||
Retorno.TieneError = True
|
||||
End If
|
||||
Else
|
||||
TieneError = True
|
||||
SbAlert.Append("Ocurrió un error al generar la factura")
|
||||
End If
|
||||
|
||||
If Retorno.Mensajes IsNot Nothing AndAlso Retorno.Mensajes.Count > 0 Then
|
||||
For Each Mensaje As String In Retorno.Mensajes
|
||||
SbAlert.AppendFormat("{0} <br/>", Mensaje)
|
||||
Next
|
||||
Else
|
||||
TieneError = True
|
||||
End If
|
||||
Else
|
||||
TieneError = True
|
||||
SbAlert.Append("Ocurrió un error al generar la factura")
|
||||
End If
|
||||
|
||||
If Retorno.Mensajes IsNot Nothing AndAlso Retorno.Mensajes.Count > 0 Then
|
||||
For Each Mensaje As String In Retorno.Mensajes
|
||||
SbAlert.AppendFormat("{0} <br/>", Mensaje)
|
||||
Next
|
||||
Else
|
||||
TieneError = True
|
||||
If Retorno.Mensajes IsNot Nothing AndAlso Retorno.Mensajes.Count > 0 Then
|
||||
For Each Mensaje As String In Retorno.Mensajes
|
||||
SbAlert.AppendFormat("{0} <br/>", Mensaje)
|
||||
Next
|
||||
End If
|
||||
End If
|
||||
Else
|
||||
If Retorno.Mensajes IsNot Nothing AndAlso Retorno.Mensajes.Count > 0 Then
|
||||
For Each Mensaje As String In Retorno.Mensajes
|
||||
SbAlert.AppendFormat("{0} <br/>", Mensaje)
|
||||
Next
|
||||
End If
|
||||
TieneError = True
|
||||
SbAlert.Append("Ocurrió un error al generar la factura")
|
||||
End If
|
||||
Else
|
||||
|
||||
If SbAlert.Length = 0 Then
|
||||
SbAlert.Append("Ocurrió un error al generar la factura")
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
TieneError = True
|
||||
SbAlert.Append("Ocurrió un error al generar la factura")
|
||||
End If
|
||||
SbAlert.Append("Ocurrió un error al generar la factura." + ex.ToString())
|
||||
GuardaLog(ex.ToString())
|
||||
Finally
|
||||
If TieneError Then
|
||||
ObjTransporte.RollBack()
|
||||
ObjTransporte.Dispose()
|
||||
Else
|
||||
ObjTransporte.Commit()
|
||||
ObjTransporte.Dispose()
|
||||
|
||||
If SbAlert.Length = 0 Then
|
||||
SbAlert.Append("Ocurrió un error al generar la factura")
|
||||
End If
|
||||
SbAlert.Append("El boleto se genero correctamente.")
|
||||
|
||||
If TieneError Then
|
||||
ObjTransporte.RollBack()
|
||||
ObjTransporte.Dispose()
|
||||
Else
|
||||
ObjTransporte.Commit()
|
||||
ObjTransporte.Dispose()
|
||||
DtPasajeros.Clear()
|
||||
GvB.DataSource = DtPasajeros
|
||||
GvB.DataBind()
|
||||
|
||||
SbAlert.Append("El boleto se genero correctamente.")
|
||||
DdlPartida.SelectedIndex = -1
|
||||
'DdlPartida.SelectedValueExist("-1")
|
||||
|
||||
DtPasajeros.Clear()
|
||||
GvB.DataSource = DtPasajeros
|
||||
GvB.DataBind()
|
||||
DdlDestino.SelectedIndex = -1
|
||||
'DdlDestino.SelectedValueExist("-1")
|
||||
|
||||
DdlPartida.SelectedIndex = -1
|
||||
'DdlPartida.SelectedValueExist("-1")
|
||||
AsientoSeleccionado = ""
|
||||
CargaDatos()
|
||||
End If
|
||||
|
||||
DdlDestino.SelectedIndex = -1
|
||||
'DdlDestino.SelectedValueExist("-1")
|
||||
|
||||
AsientoSeleccionado = ""
|
||||
CargaDatos()
|
||||
End If
|
||||
|
||||
Alert(SbAlert.ToString(), If(TieneError, TipoMensaje.MsgError, TipoMensaje.MsgInformacion), ShowCloseButton:=False)
|
||||
Alert(SbAlert.ToString(), If(TieneError, TipoMensaje.MsgError, TipoMensaje.MsgInformacion), ShowCloseButton:=False)
|
||||
End Try
|
||||
|
||||
LbAviso.Visible = False
|
||||
BtnAgregarPasajero.Visible = False
|
||||
BtnGuardar.Visible = False
|
||||
LbCostos.Visible = False
|
||||
UpPanel.Update()
|
||||
|
||||
End Sub
|
||||
|
||||
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
|
||||
CotizarTarifa()
|
||||
End Sub
|
||||
|
||||
Private Sub GeneraPasajeros(Cantidad As Integer)
|
||||
DtPasajeros.Clear()
|
||||
For i As Integer = 1 To Cantidad
|
||||
@@ -320,7 +339,6 @@ Partial Class Boletos
|
||||
GvB.DataSource = DtPasajeros
|
||||
GvB.DataBind()
|
||||
End Sub
|
||||
|
||||
Protected Sub AgregarPasajero(sender As Object, e As EventArgs)
|
||||
|
||||
If AsientoSeleccionado = "" Then
|
||||
@@ -369,18 +387,14 @@ Partial Class Boletos
|
||||
BtnGuardar.Visible = True
|
||||
UpPanel.Update()
|
||||
End Sub
|
||||
|
||||
Private Function CrearRemision(ByRef objTrans As ClsTransportes) As Modelos.Factura.MMensajeFactura
|
||||
|
||||
Dim Retorno As New Modelos.Factura.MMensajeFactura
|
||||
Dim CveCliente As Integer = 1172306 ' 1154164
|
||||
Dim CveMoneda As Integer = 2
|
||||
Dim CvePSBoleto As Integer = 986337 '912720
|
||||
|
||||
If CveSubProyecto <= 0 Then
|
||||
Retorno.Mensajes.Add("No se pudo cargar el subproyecto")
|
||||
Return Retorno
|
||||
End If
|
||||
Dim CveCliente As Integer = 1154164
|
||||
Dim CveMoneda As Integer = 2
|
||||
Dim CveSubProyecto As Integer = -1
|
||||
|
||||
Dim CvePSBoleto As Integer = 912720
|
||||
|
||||
If EsProduccion Then
|
||||
CvePSBoleto = 986337
|
||||
@@ -395,8 +409,14 @@ Partial Class Boletos
|
||||
Dim ObjFactura = Modelos.Factura.CrearVentaNueva(UsuarioActual, -1, CveCliente, CveMoneda, "Rem")
|
||||
|
||||
If ObjFactura IsNot Nothing Then
|
||||
ObjFactura.CveMoneda = CveMoneda
|
||||
ObjFactura.TipoCambio = GlobalTipoCambio(DateTime.Now).ToDecimal
|
||||
'TOMA EL SUBPROYECTO DEL CLIENTE
|
||||
CveSubProyecto = ObjFactura.Cliente.CveSubProyecto
|
||||
|
||||
If CveSubProyecto <= 0 Then
|
||||
Retorno.Mensajes.Add("No se pudo cargar el subproyecto")
|
||||
Return Retorno
|
||||
End If
|
||||
|
||||
ObjFactura.CveSubProyecto = CveSubProyecto
|
||||
ObjFactura.CveSubProyectoCobranza = CveSubProyecto
|
||||
ObjFactura.CveSubProyectoEjecucion = CveSubProyecto
|
||||
@@ -404,7 +424,7 @@ Partial Class Boletos
|
||||
ObjFactura.SetSubProyectoMatriz()
|
||||
|
||||
For Each Dr As DataRow In DtPasajeros.Rows
|
||||
Dim Obs = "Asiento #" & Dr("Asiento").ToString
|
||||
Dim Obs = Dr("Observaciones").ToString
|
||||
Dim Importe = Dr("Importe").ToString.ToDecimal()
|
||||
|
||||
If Importe <= 0 Then
|
||||
@@ -413,7 +433,9 @@ Partial Class Boletos
|
||||
End If
|
||||
|
||||
Dim PorcentajeIVA As Decimal = 0
|
||||
Dim DrPS As DataRow = ClsPaginas.GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CvePS:=CvePSBoleto).FiltroPrimero("") ' Estado = -1
|
||||
|
||||
Dim DrPS As DataRow = ClsPaginas.GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePSBoleto).FiltroPrimero("") ' Estado = -1
|
||||
|
||||
If DrPS Is Nothing Then
|
||||
Retorno.Mensajes.Add("No se pudo agregar el producto")
|
||||
Return Retorno
|
||||
@@ -436,6 +458,7 @@ Partial Class Boletos
|
||||
Next
|
||||
|
||||
ObjFactura.CalculaTotales()
|
||||
|
||||
Try
|
||||
Retorno = ObjFactura.EmitirFactura(False, Transac:=objTrans.IniciaTransacSQL())
|
||||
Catch ex As Exception
|
||||
@@ -452,5 +475,8 @@ 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
|
||||
End Class
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -7,9 +7,9 @@ Imports Extensiones
|
||||
Imports Extensiones.ModExtensiones
|
||||
Imports Microsoft.Reporting.WebForms
|
||||
|
||||
|
||||
Partial Class RepContratoDetalle
|
||||
Inherits ClsPaginas
|
||||
#Region "Propiedades"
|
||||
Private Property CveContrato As Integer
|
||||
Get
|
||||
Return CType(ViewState("CveContrato"), Integer)
|
||||
@@ -18,6 +18,14 @@ Partial Class RepContratoDetalle
|
||||
ViewState("CveContrato") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property CveViajePasajero As Integer
|
||||
Get
|
||||
Return CType(ViewState("CveViajePasajero"), Integer)
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
ViewState("CveViajePasajero") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property Contrato As DataTable
|
||||
Get
|
||||
Return CType(ViewState("Contrato"), DataTable)
|
||||
@@ -26,6 +34,14 @@ Partial Class RepContratoDetalle
|
||||
ViewState("Contrato") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property ViajeActual As DataTable
|
||||
Get
|
||||
Return CType(ViewState("ViajeActual"), DataTable)
|
||||
End Get
|
||||
Set(value As DataTable)
|
||||
ViewState("ViajeActual") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property SubProyecto As String
|
||||
Get
|
||||
Return CType(ViewState("SubProyecto"), String)
|
||||
@@ -42,15 +58,19 @@ Partial Class RepContratoDetalle
|
||||
ViewState("AsientoSeleccionado") = value
|
||||
End Set
|
||||
End Property
|
||||
#End Region
|
||||
|
||||
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
||||
If Request("CveContrato") Is Nothing Then
|
||||
Response.Redirect($"~/Transportes/RepContratos.aspx")
|
||||
End If
|
||||
CveContrato = Request("CveContrato").ToEntero
|
||||
|
||||
If Not IsPostBack Then
|
||||
InicializaCombos()
|
||||
CargaDatos()
|
||||
AsientoSeleccionado = ""
|
||||
CveViajePasajero = 0
|
||||
|
||||
End If
|
||||
End Sub
|
||||
Private Sub InicializaCombos()
|
||||
@@ -85,6 +105,8 @@ Partial Class RepContratoDetalle
|
||||
Dim ObjTransportes As New ClsTransportes
|
||||
If ObjTransportes.GetViajesPasajeros(CveContrato) Then
|
||||
GvViajesPasajeros.DataSource = ObjTransportes.DtResultados
|
||||
BusquedaSeleccionada(ObjTransportes.DtResultados)
|
||||
|
||||
End If
|
||||
ObjTransportes.Dispose()
|
||||
GvViajesPasajeros.DataBind()
|
||||
@@ -96,119 +118,153 @@ Partial Class RepContratoDetalle
|
||||
End If
|
||||
ObjContratos.Dispose()
|
||||
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 Integer = GvRow.DataKey("CveViajePasajero").ToEntero()
|
||||
Dim Estatus As String = GvRow.DataKey("Estatus")
|
||||
Dim cambiarEstatus As Boolean = Not Estatus.ToBool
|
||||
|
||||
Dim TieneError As Boolean = False
|
||||
Try
|
||||
Dim DtRem As DataTable = Nothing
|
||||
Dim ObjTran As New ClsTransportes
|
||||
If ObjTran.GetRemisionBoleto(CveViajePasajero.ToEntero, UsuarioActual.CveEmpresa) Then
|
||||
DtRem = ObjTran.DtResultados.Copy()
|
||||
End If
|
||||
ObjTran.Dispose()
|
||||
|
||||
If DtRem IsNot Nothing Then
|
||||
If DtRem.Rows.Count > 0 Then
|
||||
Dim CveVenta As Integer = DtRem.Rows(0)("CveVenta").ToString().ToEntero()
|
||||
Dim BoletosVigentes As Integer = DtRem.Rows(0)("BoletosVigentes").ToString().ToEntero()
|
||||
|
||||
If CveVenta > 0 Then
|
||||
Dim ObjRem As New Modelos.Factura(UsuarioActual, CveVenta, UsuarioActual.CveEmpresa, VerificaAlmacen:=False)
|
||||
|
||||
If ObjRem.DtDetalle.Rows.Count > 0 Then
|
||||
'SI SOLO TIENE UNA PARTIDA CANCELAR LA REMISION
|
||||
If ObjRem.DtDetalle.Rows.Count = 1 OrElse BoletosVigentes <= 1 Then
|
||||
Dim RespCancelacion = ObjRem.CancelarFactura(False, ValidarSAT:=False, CancelarBoletos:=True, ListaRemisionesCancelar:=New List(Of Integer))
|
||||
If RespCancelacion IsNot Nothing Then
|
||||
TieneError = RespCancelacion.HuboError
|
||||
Else
|
||||
TieneError = True
|
||||
End If
|
||||
Else
|
||||
TieneError = Not ObjRem.CancelarBoleto(CveViajePasajero)
|
||||
End If
|
||||
Else
|
||||
TieneError = True
|
||||
End If
|
||||
End If
|
||||
Else
|
||||
'SI NO TIENE VENTA, SOLO CANCELAR EL BOLETO
|
||||
Dim ObjTran2 As New ClsTransportes
|
||||
If Not ObjTran2.UpdateViajesPasajeros(CveViajePasajero, Activar:=cambiarEstatus, Estatus:=cambiarEstatus) Then
|
||||
TieneError = True
|
||||
End If
|
||||
ObjTran2.Dispose()
|
||||
End If
|
||||
|
||||
End If
|
||||
Catch ex As Exception
|
||||
TieneError = True
|
||||
GuardaLog(ex.ToString())
|
||||
Finally
|
||||
If TieneError Then
|
||||
Alert($"Ocurrió un error al cancelar el boleto.", TipoMensaje.MsgError)
|
||||
Else
|
||||
Alert($"El boleto ha sido cancelado correctamente.")
|
||||
End If
|
||||
|
||||
CargaDatos()
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Protected Sub EditarBoleto(sender As Object, e As EventArgs)
|
||||
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
||||
CveViajePasajero = GvRow.DataKey("CveViajePasajero").ToEntero
|
||||
LbPartida.Text = GvRow.DataKey("Partida").ToString()
|
||||
LbDestino.Text = GvRow.DataKey("Destino").ToString()
|
||||
LbImporte.Text = GvRow.DataKey("Importe").ToString()
|
||||
LbImporte.Text = Convert.ToDecimal(GvRow.DataKey("Importe")).ToString("C")
|
||||
LbNombre.Text = GvRow.DataKey("Nombre").ToString()
|
||||
LbVisa.Text = GvRow.DataKey("Visa").ToString()
|
||||
LbCelular.Text = GvRow.DataKey("Celular").ToString()
|
||||
LbSexo.Text = GvRow.DataKey("Sexo").ToString()
|
||||
LbObservacion.Text = GvRow.DataKey("Observacion").ToString()
|
||||
LbEstatus.Text = GvRow.DataKey("Estatus").ToString()
|
||||
LbCreado.Text = GvRow.DataKey("FechaIng").ToString()
|
||||
LbAsiento.Text = GvRow.DataKey("Asiento").ToString()
|
||||
TxtAsiento.Text = GvRow.DataKey("Asiento").ToString()
|
||||
Dim Estatus As Boolean = Not LbEstatus.Text.ToBool
|
||||
Dim ObjTransportes As New ClsTransportes
|
||||
Try
|
||||
ObjTransportes.IniciaTransacSQL()
|
||||
|
||||
If ObjTransportes.UpdateViajesPasajeros(CveViajePasajero, CveContrato, UsuarioActual.CveVendedor, LbImporte.Text.ToDecimal, TxtAsiento.Text.ToEntero, LbNombre.Text, LbVisa.Text, LbCelular.Text, LbObservacion.Text, Estatus, UsuarioActual.CveUsuario, LbSexo.Text.ToBool) Then
|
||||
Alert($"El boleto ha modificado el estatus de su boleto correctamente.")
|
||||
|
||||
ObjTransportes.Commit()
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
ObjTransportes.RollBack()
|
||||
Alert($"No se pudo cambiar el estatus del boleto", TipoMensaje.MsgError)
|
||||
Finally
|
||||
ObjTransportes.Dispose()
|
||||
CargaDatos()
|
||||
End Try
|
||||
End Sub
|
||||
Protected Sub CambiarBoleto(sender As Object, e As EventArgs)
|
||||
DdlRuta.ClearSelection()
|
||||
PnEditarViaje.Visible = True
|
||||
PnEditarUsuario.Visible = False
|
||||
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
||||
|
||||
CveViajePasajero = GvRow.DataKey("CveViajePasajero").ToEntero
|
||||
LbPartida.Text = GvRow.DataKey("Partida").ToString()
|
||||
LbDestino.Text = GvRow.DataKey("Destino").ToString()
|
||||
LbImporte.Text = Convert.ToDecimal(GvRow.DataKey("Importe")).ToString("C")
|
||||
LbNombre.Text = GvRow.DataKey("Nombre").ToString()
|
||||
LbVisa.Text = GvRow.DataKey("Visa").ToString()
|
||||
LbCelular.Text = GvRow.DataKey("Celular").ToString()
|
||||
LbSexo.Text = GvRow.DataKey("Sexo").ToString()
|
||||
LbObservacion.Text = GvRow.DataKey("Observacion").ToString()
|
||||
LbEstatus.Text = GvRow.DataKey("Estatus").ToString()
|
||||
LbCreado.Text = GvRow.DataKey("FechaIng").ToString()
|
||||
TxtAsiento.Text = GvRow.DataKey("Asiento").ToString()
|
||||
|
||||
'Seleccionamos la ruta que tiene el usuario actual
|
||||
DdlRuta.ClearSelection()
|
||||
Dim ObjContratos As New ClsContratos
|
||||
If ObjContratos.GetContratosReporte(UsuarioActual.CveEmpresa, MinFecha, MaxFecha, -1, CveEstatus:=-1, CveTipoContrato:=35) Then
|
||||
For Each row As DataRow In ObjContratos.DtResultados.Rows
|
||||
Dim fecha As DateTime = row("FechaInicial").ToString.ToDateTime
|
||||
' Asigna los valores de la columna deseada al ListItem
|
||||
Dim listItem As New ListItem(row("CveContrato").ToString(), row("CveContrato").ToString())
|
||||
|
||||
Dim listItem As New ListItem(row("SubProyecto").ToString() + " - " + fecha.ToShortDateString + " - " + fecha.ToShortTimeString, row("CveContrato").ToString())
|
||||
' Agrega el ListItem al DropDownList
|
||||
DdlRuta.Items.Add(listItem)
|
||||
Next
|
||||
End If
|
||||
DdlRuta.SelectedValue = GvRow.DataKey("CveViaje")
|
||||
ObjContratos.Dispose()
|
||||
RegistraScript(String.Format("$('#{0}').modal('show');", "ModalEditar"))
|
||||
End Sub
|
||||
|
||||
Protected Sub UpdateBoleto(sender As Object, e As EventArgs)
|
||||
For Each boleto As DataRow In ViajeActual.Rows
|
||||
If (boleto.Item("Asiento").ToString = TxtAsiento.Text) Then
|
||||
Alert($"El asiento {boleto.Item("Asiento")} ya ha está ocupado", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
Next
|
||||
|
||||
Dim ObjTransportes As New ClsTransportes
|
||||
|
||||
Try
|
||||
ObjTransportes.IniciaTransacSQL()
|
||||
|
||||
If ObjTransportes.UpdateViajesPasajeros(CveViajePasajero, DdlRuta.SelectedValue.ToEntero, UsuarioActual.CveVendedor, LbImporte.Text.ToDecimal, TxtAsiento.Text.ToEntero, LbNombre.Text, LbVisa.Text, LbCelular.Text, LbObservacion.Text, LbEstatus.Text.ToBool, UsuarioActual.CveUsuario, LbSexo.Text.ToBool) Then
|
||||
ObjTransportes.Commit()
|
||||
End If
|
||||
Catch ex As ArgumentException
|
||||
Alert($"Ocurrió un ocurrió un error al actualizar su boleto", TipoMensaje.MsgError)
|
||||
ObjTransportes.RollBack()
|
||||
Finally
|
||||
Alert("Su asiento fue actualizado correctamente")
|
||||
ObjTransportes.Dispose()
|
||||
CargaDatos()
|
||||
End Try
|
||||
End Sub
|
||||
Protected Sub EditarBoleto(sender As Object, e As EventArgs)
|
||||
|
||||
End Sub
|
||||
|
||||
Protected Sub OnLinkButtonClick(sender As Object, e As EventArgs)
|
||||
'quitamos la selección anterior, en caso de existir.
|
||||
'Limpiamos la selección anterior
|
||||
If AsientoSeleccionado <> "" Then
|
||||
Dim cph As ContentPlaceHolder = CType(Me.Master.FindControl("C"), ContentPlaceHolder)
|
||||
Dim lnk As LinkButton = CType(cph.FindControl(AsientoSeleccionado), LinkButton)
|
||||
lnk.CssClass = "disponible"
|
||||
End If
|
||||
|
||||
'Seleccionamos un asiento
|
||||
Dim linkButton As LinkButton = DirectCast(sender, LinkButton)
|
||||
Dim buttonID As String = linkButton.ID
|
||||
linkButton.CssClass += " activo"
|
||||
AsientoSeleccionado = buttonID
|
||||
TxtAsiento.Text = buttonID.Substring(1)
|
||||
|
||||
UpBoletos.Update()
|
||||
RegistraScript(String.Format("$('#{0}').modal('show');", "ModalEditar"))
|
||||
End Sub
|
||||
Protected Sub OnChangeRuta(sender As Object, e As EventArgs)
|
||||
Dim ObjTransportes As New ClsTransportes
|
||||
|
||||
If ObjTransportes.GetViajesPasajeros(DdlRuta.SelectedValue.ToEntero) Then
|
||||
BusquedaSeleccionada(ObjTransportes.DtResultados)
|
||||
End If
|
||||
|
||||
RegistraScript(String.Format("$('#{0}').modal('show');", "ModalEditar"))
|
||||
End Sub
|
||||
Protected Sub BusquedaSeleccionada(dt As DataTable)
|
||||
'Limpiamos autobus
|
||||
Dim cph As ContentPlaceHolder = CType(Me.Master.FindControl("C"), ContentPlaceHolder)
|
||||
|
||||
For i As Integer = 1 To 50
|
||||
Dim lnk As LinkButton = CType(cph.FindControl($"A{i}"), LinkButton)
|
||||
If lnk IsNot Nothing Then
|
||||
lnk.Enabled = True
|
||||
lnk.CssClass = "disponible"
|
||||
End If
|
||||
Next
|
||||
'Si la dt DataTable tiene algo llenamos los asientos
|
||||
If dt IsNot Nothing AndAlso dt.Rows.Count > 0 Then
|
||||
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
|
||||
ViajeActual = dt
|
||||
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)
|
||||
@@ -236,8 +292,6 @@ Partial Class RepContratoDetalle
|
||||
'Empresas/188/Formatos/Boleto.mrt
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
End Class
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user