--
This commit is contained in:
@@ -1,378 +1,381 @@
|
||||
Option Explicit On
|
||||
Option Strict On
|
||||
Imports System.Data
|
||||
Imports Extensiones
|
||||
Imports Extensiones.ModExtensiones
|
||||
Imports Microsoft.Ajax.Utilities
|
||||
|
||||
Partial Class Boletos
|
||||
Option Explicit On
|
||||
Option Strict On
|
||||
Imports System.Data
|
||||
Imports Extensiones
|
||||
Imports Extensiones.ModExtensiones
|
||||
|
||||
Partial Class Boletos
|
||||
Inherits ClsPaginas
|
||||
#Region "Propiedades"
|
||||
Private Property AsientoSeleccionado As String
|
||||
Get
|
||||
Return ViewState("AsientoSeleccionado").ToString()
|
||||
End Get
|
||||
Set(value As String)
|
||||
ViewState("AsientoSeleccionado") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property Importe As Decimal
|
||||
Get
|
||||
Return If(IsNothing(ViewState("Importe")), 0, ViewState("Importe")).ToString().ToDecimal()
|
||||
End Get
|
||||
Set(value As Decimal)
|
||||
ViewState("Importe") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property CveViaje As Integer
|
||||
Get
|
||||
Return ViewState("CveViaje").ToString().ToEntero
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
ViewState("CveViaje") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private Property Contrato As DataTable
|
||||
Get
|
||||
Return CType(ViewState("Contrato"), DataTable)
|
||||
End Get
|
||||
Set(value As DataTable)
|
||||
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
|
||||
#Region "Propiedades"
|
||||
Private Property AsientoSeleccionado As String
|
||||
Get
|
||||
Return ViewState("AsientoSeleccionado").ToString()
|
||||
End Get
|
||||
Set(value As String)
|
||||
ViewState("AsientoSeleccionado") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property Importe As Decimal
|
||||
Get
|
||||
Return If(IsNothing(ViewState("Importe")), 0, ViewState("Importe")).ToString().ToDecimal()
|
||||
End Get
|
||||
Set(value As Decimal)
|
||||
ViewState("Importe") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property CveViaje As Integer
|
||||
Get
|
||||
Return ViewState("CveViaje").ToString().ToEntero
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
ViewState("CveViaje") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private Property Contrato As DataTable
|
||||
Get
|
||||
Return CType(ViewState("Contrato"), DataTable)
|
||||
End Get
|
||||
Set(value As DataTable)
|
||||
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
|
||||
#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 Then
|
||||
Response.Redirect("/Transportes/RepViajes.aspx")
|
||||
End If
|
||||
AsientoSeleccionado = ""
|
||||
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
|
||||
|
||||
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("Celular", GetType(String))
|
||||
DtPasajeros.Columns.Add("Importe", GetType(Decimal))
|
||||
DtPasajeros.Columns.Add("Observaciones", GetType(String))
|
||||
|
||||
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()
|
||||
ObjViaje.Dispose()
|
||||
|
||||
Response.Redirect($"~/Transportes/RepContratos.aspx")
|
||||
End If
|
||||
|
||||
ObjContratos.Dispose()
|
||||
ObjViaje.Dispose()
|
||||
|
||||
'Boletos Vendidos
|
||||
|
||||
End Sub
|
||||
|
||||
Protected Sub InicializaCombos()
|
||||
Dim CveRuta As Integer = Contrato.Rows(0)("CveRuta").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
|
||||
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 <> "" And DdlPartida.SelectedValue <> "" Then
|
||||
Dim ImporteR As Decimal = 0
|
||||
Dim ObjDestinos As New ClsTransportes()
|
||||
If ObjDestinos.GetDestinosTarifas(DdlPartida.SelectedValue.ToEntero, DdlDestino.SelectedValue.ToEntero) Then
|
||||
ImporteR = ObjDestinos.DtResultados.FiltroPrimeroValor("Importe").ToDecimal.RoundSQL
|
||||
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||
If Not IsPostBack Then
|
||||
If Request.QueryString("CveViaje") Is Nothing Then
|
||||
Response.Redirect("/Transportes/RepViajes.aspx")
|
||||
End If
|
||||
ObjDestinos.Dispose()
|
||||
|
||||
If ImporteR > 0 Then
|
||||
ViewState("Importe") = ImporteR
|
||||
TxtCosto.Text = $"El precio de su boleto es ${ImporteR.FormatoNumero}"
|
||||
BtnGuardar.Visible = True
|
||||
Else
|
||||
Alert("No se encontro una tarifa para esta ruta", TipoMensaje.MsgAdvertencia)
|
||||
|
||||
TxtCosto.Text = ""
|
||||
BtnGuardar.Visible = False
|
||||
ViewState("Importe") = 0
|
||||
End If
|
||||
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
|
||||
Dim cph As ContentPlaceHolder = CType(Me.Master.FindControl("C"), ContentPlaceHolder)
|
||||
Dim lnk As LinkButton = CType(cph.FindControl(AsientoSeleccionado), LinkButton)
|
||||
lnk.CssClass = "disponible"
|
||||
End If
|
||||
|
||||
Dim linkButton As LinkButton = DirectCast(sender, LinkButton)
|
||||
Dim buttonID As String = linkButton.ID
|
||||
linkButton.CssClass += " activo"
|
||||
AsientoSeleccionado = buttonID
|
||||
|
||||
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
|
||||
|
||||
Try
|
||||
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 Not ObjTransporte.AddViajesPasajeros(CveViaje, DdlPartida.SelectedValue.ToEntero, DdlDestino.SelectedValue.ToEntero, Importe, Asiento.ToEntero, Nombre, Visa, Celular, Sexo, Obs, UsuarioActual.CveUsuario, UsuarioActual.CveVendedor) > 1 Then
|
||||
TieneError = True
|
||||
SbAlert.Append("Ocurrió un error al generar el viaje")
|
||||
End If
|
||||
Next
|
||||
|
||||
If Not TieneError Then
|
||||
Retorno = CrearRemision(ObjTransporte)
|
||||
End If
|
||||
|
||||
If Retorno IsNot Nothing Then
|
||||
TieneError = Retorno.TieneError
|
||||
|
||||
If Not TieneError Then
|
||||
If Retorno.CveVenta > 0 AndAlso Not Retorno.TieneError Then
|
||||
SbAlert.AppendFormat("{0}", Retorno.Mensajes(Retorno.Mensajes.Count - 1))
|
||||
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
|
||||
End If
|
||||
Else
|
||||
TieneError = True
|
||||
SbAlert.Append("Ocurrió un error al generar la factura")
|
||||
End If
|
||||
|
||||
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." + ex.ToString())
|
||||
GuardaLog(ex.ToString())
|
||||
Finally
|
||||
If TieneError Then
|
||||
ObjTransporte.RollBack()
|
||||
ObjTransporte.Dispose()
|
||||
Else
|
||||
SbAlert.Append("El boleto se genero correctamente")
|
||||
ObjTransporte.Commit()
|
||||
ObjTransporte.Dispose()
|
||||
|
||||
DdlPartida.SelectedValueExist("-1")
|
||||
DdlDestino.SelectedValueExist("-1")
|
||||
AsientoSeleccionado = ""
|
||||
AsientoSeleccionado = ""
|
||||
CveViaje = Request.QueryString("CveViaje").ToEntero
|
||||
If CveViaje > 0 Then
|
||||
CargaDatos()
|
||||
End If
|
||||
|
||||
Alert(SbAlert.ToString(), If(TieneError, TipoMensaje.MsgError, TipoMensaje.MsgInformacion), ShowCloseButton:=False)
|
||||
|
||||
UpPanel.Update()
|
||||
End Try
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
Protected Sub DdlPartida_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlPartida.SelectedIndexChanged
|
||||
CotizarTarifa()
|
||||
UpPanel.Update()
|
||||
End Sub
|
||||
|
||||
Protected Sub DdlDestino_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlDestino.SelectedIndexChanged
|
||||
CotizarTarifa()
|
||||
UpPanel.Update()
|
||||
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
|
||||
|
||||
If Me.Importe <= 0 Then
|
||||
Alert("No hay un importe asignado.")
|
||||
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
|
||||
Dr1("Importe") = Me.Importe
|
||||
'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
|
||||
|
||||
UpPanel.Update()
|
||||
End Sub
|
||||
|
||||
Private Function CrearRemision(ByRef objTrans As ClsTransportes) As Modelos.Factura.MMensajeFactura
|
||||
Dim Retorno As Modelos.Factura.MMensajeFactura = Nothing
|
||||
|
||||
Dim CveCliente As Integer = 1154164
|
||||
Dim CveMoneda As Integer = 2
|
||||
Dim CveSubProyecto As Integer = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveSubProyecto").ToEntero()
|
||||
|
||||
If CveCliente <= 0 Then
|
||||
Retorno.Mensajes.Add("No se pudo cargar el cliente")
|
||||
Return Retorno
|
||||
End If
|
||||
End Sub
|
||||
|
||||
If CveSubProyecto <= 0 Then
|
||||
Retorno.Mensajes.Add("No se pudo cargar el subproyecto")
|
||||
Return Retorno
|
||||
End If
|
||||
Private Sub CargaDatos()
|
||||
Dim ObjContratos As New ClsContratos
|
||||
Dim ObjViaje As New ClsTransportes
|
||||
|
||||
Dim ObjFactura = Modelos.Factura.CrearVentaNueva(UsuarioActual, CveSubProyecto, CveCliente, CveMoneda, "Rem")
|
||||
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("Celular", GetType(String))
|
||||
DtPasajeros.Columns.Add("Importe", GetType(Decimal))
|
||||
DtPasajeros.Columns.Add("Observaciones", GetType(String))
|
||||
|
||||
Dim CvePSBoleto As Integer = 912720
|
||||
InicializaCombos()
|
||||
|
||||
For Each Dr As DataRow In DtPasajeros.Rows
|
||||
Dim Obs = Dr("Nombre").ToString
|
||||
Dim Importe = Dr("Importe").ToString.ToDecimal()
|
||||
If Importe <= 0 Then
|
||||
Retorno.Mensajes.Add("El importe debe ser mayor a 0")
|
||||
Return Retorno
|
||||
'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
|
||||
|
||||
ObjFactura.AgregarPS(CvePSBoleto, 1, Importe, 0, Obs, CveSubProyecto:=CveSubProyecto, PorcentajeIVA:=0)
|
||||
Next
|
||||
Else
|
||||
ObjContratos.Dispose()
|
||||
ObjViaje.Dispose()
|
||||
|
||||
ObjFactura.CalculaTotales()
|
||||
|
||||
Try
|
||||
Retorno = ObjFactura.EmitirFactura(False, Transac:=objTrans.IniciaTransacSQL())
|
||||
Catch ex As Exception
|
||||
Retorno = Nothing
|
||||
GuardaLog(ex.ToString())
|
||||
End Try
|
||||
|
||||
If ObjFactura IsNot Nothing Then
|
||||
ObjFactura.Dispose()
|
||||
Response.Redirect($"~/Transportes/RepContratos.aspx")
|
||||
End If
|
||||
|
||||
Return Retorno
|
||||
End Function
|
||||
End Class
|
||||
ObjContratos.Dispose()
|
||||
ObjViaje.Dispose()
|
||||
|
||||
'Boletos Vendidos
|
||||
|
||||
End Sub
|
||||
|
||||
Protected Sub InicializaCombos()
|
||||
Dim CveRuta As Integer = Contrato.Rows(0)("CveRuta").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
|
||||
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
|
||||
Dim ObjDestinos As New ClsTransportes()
|
||||
|
||||
Try
|
||||
If ObjDestinos.GetDestinosTarifas(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
|
||||
BtnAgregarPasajero.Visible = True
|
||||
Else
|
||||
ViewState("Importe") = 0
|
||||
BtnAgregarPasajero.Visible = False
|
||||
LbCostos.Visible = False
|
||||
Alert("No se encontro una tarifa para esta ruta", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
Catch ex As Exception
|
||||
Alert("No se encontro una tarifa para esta ruta", TipoMensaje.MsgAdvertencia)
|
||||
ObjDestinos.RollBack()
|
||||
Finally
|
||||
ObjDestinos.Dispose()
|
||||
End Try
|
||||
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
|
||||
Dim cph As ContentPlaceHolder = CType(Me.Master.FindControl("C"), ContentPlaceHolder)
|
||||
Dim lnk As LinkButton = CType(cph.FindControl(AsientoSeleccionado), LinkButton)
|
||||
lnk.CssClass = "disponible"
|
||||
End If
|
||||
|
||||
Dim linkButton As LinkButton = DirectCast(sender, LinkButton)
|
||||
Dim buttonID As String = linkButton.ID
|
||||
linkButton.CssClass += " activo"
|
||||
AsientoSeleccionado = buttonID
|
||||
|
||||
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
|
||||
|
||||
' Try
|
||||
' 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 Not ObjTransporte.AddViajesPasajeros(CveViaje, DdlPartida.SelectedValue.ToEntero, DdlDestino.SelectedValue.ToEntero, Importe, Asiento.ToEntero, Nombre, Visa, Celular, Sexo, Obs, UsuarioActual.CveUsuario, UsuarioActual.CveVendedor) > 1 Then
|
||||
' TieneError = True
|
||||
' SbAlert.Append("Ocurrió un error al generar el viaje")
|
||||
' End If
|
||||
' Next
|
||||
|
||||
' If Not TieneError Then
|
||||
' Retorno = CrearRemision(ObjTransporte)
|
||||
' End If
|
||||
|
||||
' If Retorno IsNot Nothing Then
|
||||
' TieneError = Retorno.TieneError
|
||||
|
||||
' If Not TieneError Then
|
||||
' If Retorno.CveVenta > 0 AndAlso Not Retorno.TieneError Then
|
||||
' SbAlert.AppendFormat("{0}", Retorno.Mensajes(Retorno.Mensajes.Count - 1))
|
||||
' 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
|
||||
' End If
|
||||
' Else
|
||||
' TieneError = True
|
||||
' SbAlert.Append("Ocurrió un error al generar la factura")
|
||||
' End If
|
||||
|
||||
' 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." + ex.ToString())
|
||||
' GuardaLog(ex.ToString())
|
||||
' Finally
|
||||
' If TieneError Then
|
||||
' ObjTransporte.RollBack()
|
||||
' ObjTransporte.Dispose()
|
||||
' Else
|
||||
' SbAlert.Append("El boleto se genero correctamente")
|
||||
' ObjTransporte.Commit()
|
||||
' ObjTransporte.Dispose()
|
||||
|
||||
' DdlPartida.SelectedValueExist("-1")
|
||||
' DdlDestino.SelectedValueExist("-1")
|
||||
' AsientoSeleccionado = ""
|
||||
' CargaDatos()
|
||||
' End If
|
||||
|
||||
' Alert(SbAlert.ToString(), If(TieneError, TipoMensaje.MsgError, TipoMensaje.MsgInformacion), ShowCloseButton:=False)
|
||||
|
||||
' UpPanel.Update()
|
||||
' End Try
|
||||
|
||||
'End Sub
|
||||
|
||||
|
||||
Protected Sub DdlPartida_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlPartida.SelectedIndexChanged
|
||||
CotizarTarifa()
|
||||
End Sub
|
||||
|
||||
Protected Sub DdlDestino_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlDestino.SelectedIndexChanged
|
||||
CotizarTarifa()
|
||||
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 AgregarPasajero(sender As Object, e As EventArgs)
|
||||
|
||||
If AsientoSeleccionado = "" Then
|
||||
Alert("No se ha seleccionado el asiento.")
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
If Me.Importe <= 0 Then
|
||||
Alert("No hay un importe asignado.")
|
||||
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
|
||||
Dr1("Importe") = Me.Importe
|
||||
'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
|
||||
|
||||
UpPanel.Update()
|
||||
End Sub
|
||||
|
||||
'Private Function CrearRemision(ByRef objTrans As ClsTransportes) As Modelos.Factura.MMensajeFactura
|
||||
' Dim Retorno As Modelos.Factura.MMensajeFactura = Nothing
|
||||
|
||||
' Dim CveCliente As Integer = 1154164
|
||||
' Dim CveMoneda As Integer = 2
|
||||
' Dim CveSubProyecto As Integer = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveSubProyecto").ToEntero()
|
||||
|
||||
' If CveCliente <= 0 Then
|
||||
' Retorno.Mensajes.Add("No se pudo cargar el cliente")
|
||||
' Return Retorno
|
||||
' End If
|
||||
|
||||
' If CveSubProyecto <= 0 Then
|
||||
' Retorno.Mensajes.Add("No se pudo cargar el subproyecto")
|
||||
' Return Retorno
|
||||
' End If
|
||||
|
||||
' Dim ObjFactura = Modelos.Factura.CrearVentaNueva(UsuarioActual, CveSubProyecto, CveCliente, CveMoneda, "Rem")
|
||||
|
||||
' Dim CvePSBoleto As Integer = 912720
|
||||
|
||||
' For Each Dr As DataRow In DtPasajeros.Rows
|
||||
' Dim Obs = Dr("Nombre").ToString
|
||||
' Dim Importe = Dr("Importe").ToString.ToDecimal()
|
||||
' If Importe <= 0 Then
|
||||
' Retorno.Mensajes.Add("El importe debe ser mayor a 0")
|
||||
' Return Retorno
|
||||
' End If
|
||||
|
||||
' ObjFactura.AgregarPS(CvePSBoleto, 1, Importe, 0, Obs, CveSubProyecto:=CveSubProyecto, PorcentajeIVA:=0)
|
||||
' Next
|
||||
|
||||
' ObjFactura.CalculaTotales()
|
||||
|
||||
' Try
|
||||
' Retorno = ObjFactura.EmitirFactura(False, Transac:=objTrans.IniciaTransacSQL())
|
||||
' Catch ex As Exception
|
||||
' Retorno = Nothing
|
||||
' GuardaLog(ex.ToString())
|
||||
' End Try
|
||||
|
||||
' If ObjFactura IsNot Nothing Then
|
||||
' ObjFactura.Dispose()
|
||||
' End If
|
||||
|
||||
' Return Retorno
|
||||
'End Function
|
||||
End Class
|
||||
|
||||
Reference in New Issue
Block a user