1122 lines
48 KiB
VB.net
1122 lines
48 KiB
VB.net
Option Explicit On
|
|
Option Strict On
|
|
Imports System.Data
|
|
Imports System.Data.SqlClient
|
|
Imports System.IO
|
|
Imports Extensiones
|
|
Imports Microsoft.Reporting.WebForms
|
|
Imports Modelos
|
|
|
|
|
|
Partial Class RepContratoDetalle
|
|
Inherits ClsPaginas
|
|
#Region "Propiedades"
|
|
Private Property CveContrato As Integer
|
|
Get
|
|
Return CType(ViewState("CveContrato"), Integer)
|
|
End Get
|
|
Set(value As Integer)
|
|
ViewState("CveContrato") = value
|
|
End Set
|
|
End Property
|
|
Private Property ArchivoUpdate As String
|
|
Get
|
|
Return ViewState("ArchivoUpdate").ToString
|
|
End Get
|
|
Set(value As String)
|
|
ViewState("ArchivoUpdate") = value
|
|
End Set
|
|
End Property
|
|
Private Property CveContratoTipo As Integer
|
|
Get
|
|
Return CType(ViewState("CveContratoTipo"), Integer)
|
|
End Get
|
|
Set(value As Integer)
|
|
ViewState("CveContratoTipo") = value
|
|
End Set
|
|
End Property
|
|
Private Property CveContratoEstatus As Integer
|
|
Get
|
|
Return CType(ViewState("CveContratoEstatus"), Integer)
|
|
End Get
|
|
Set(value As Integer)
|
|
ViewState("CveContratoEstatus") = value
|
|
End Set
|
|
End Property
|
|
Private Property CveMasivo As Integer
|
|
Get
|
|
Return CType(ViewState("CveMasivo"), Integer)
|
|
End Get
|
|
Set(value As Integer)
|
|
ViewState("CveMasivo") = 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)
|
|
End Get
|
|
Set(value As DataTable)
|
|
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)
|
|
End Get
|
|
Set(value As String)
|
|
ViewState("SubProyecto") = value
|
|
End Set
|
|
End Property
|
|
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 TelefonoEmpresa As String
|
|
Get
|
|
Return ViewState("TelefonoEmpresa").ToString()
|
|
End Get
|
|
Set(value As String)
|
|
ViewState("TelefonoEmpresa") = value
|
|
End Set
|
|
End Property
|
|
|
|
Private Property CveVentaRemision As Integer
|
|
Get
|
|
If ViewState("CveVentaRemision") Is Nothing Then
|
|
ViewState("CveVentaRemision") = -1
|
|
End If
|
|
|
|
Return ViewState("CveVentaRemision").ToString.ToEntero
|
|
|
|
End Get
|
|
Set(value As Integer)
|
|
ViewState("CveVentaRemision") = value
|
|
End Set
|
|
End Property
|
|
|
|
Private Property CveSubProyectoOriginal As Integer
|
|
Get
|
|
If ViewState("CveSubProyectoOriginal") Is Nothing Then
|
|
ViewState("CveSubProyectoOriginal") = -1
|
|
End If
|
|
|
|
Return ViewState("CveSubProyectoOriginal").ToString.ToEntero
|
|
|
|
End Get
|
|
Set(value As Integer)
|
|
ViewState("CveSubProyectoOriginal") = value
|
|
End Set
|
|
End Property
|
|
|
|
Private Property CveMonedaOriginal As Integer
|
|
Get
|
|
If ViewState("CveMonedaOriginal") Is Nothing Then
|
|
ViewState("CveMonedaOriginal") = -1
|
|
End If
|
|
|
|
Return ViewState("CveMonedaOriginal").ToString.ToEntero
|
|
|
|
End Get
|
|
Set(value As Integer)
|
|
ViewState("CveMonedaOriginal") = value
|
|
End Set
|
|
End Property
|
|
|
|
|
|
Private Property ImporteOrigial As Decimal
|
|
Get
|
|
If ViewState("ImporteOrigial") Is Nothing Then
|
|
ViewState("ImporteOrigial") = 0D
|
|
End If
|
|
|
|
Return ViewState("ImporteOrigial").ToString.ToDecimal
|
|
|
|
End Get
|
|
Set(value As Decimal)
|
|
ViewState("ImporteOrigial") = value
|
|
End Set
|
|
End Property
|
|
|
|
|
|
Private Property DescripcionOriginal As String
|
|
Get
|
|
If ViewState("DescripcionOriginal") Is Nothing Then
|
|
ViewState("DescripcionOriginal") = ""
|
|
End If
|
|
|
|
Return ViewState("DescripcionOriginal").ToString
|
|
|
|
End Get
|
|
Set(value As String)
|
|
ViewState("DescripcionOriginal") = value
|
|
End Set
|
|
End Property
|
|
|
|
|
|
Private Property TipoAFOriginal As String
|
|
Get
|
|
If ViewState("TipoAFOriginal") Is Nothing Then
|
|
ViewState("TipoAFOriginal") = ""
|
|
End If
|
|
|
|
Return ViewState("TipoAFOriginal").ToString
|
|
|
|
End Get
|
|
Set(value As String)
|
|
ViewState("TipoAFOriginal") = value
|
|
End Set
|
|
End Property
|
|
|
|
Private Property FolioOriginal As String
|
|
Get
|
|
If ViewState("FolioOriginal") Is Nothing Then
|
|
ViewState("FolioOriginal") = ""
|
|
End If
|
|
|
|
Return ViewState("FolioOriginal").ToString
|
|
|
|
End Get
|
|
Set(value As String)
|
|
ViewState("FolioOriginal") = value
|
|
End Set
|
|
End Property
|
|
|
|
Private Property TotalPagos As Decimal
|
|
Get
|
|
If ViewState("TotalPagos") Is Nothing Then
|
|
ViewState("TotalPagos") = 0
|
|
End If
|
|
|
|
Return ViewState("TotalPagos").ToString.ToDecimal
|
|
|
|
End Get
|
|
Set(value As Decimal)
|
|
ViewState("TotalPagos") = value
|
|
End Set
|
|
End Property
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#End Region
|
|
|
|
#Region "Carga Página"
|
|
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()
|
|
CargaAuxiliarClienteCxC(DdlClientes.SelectedValue.ToEntero, CveVentaRemision)
|
|
AsientoSeleccionado = ""
|
|
CveViajePasajero = 0
|
|
Session("FileExtension") = ""
|
|
ArchivoUpdate = ""
|
|
CargaGvBitacora()
|
|
|
|
If CveContrato > 0 Then
|
|
HlEvento.Visible = True
|
|
HlEvento.NavigateUrl = "/OI/PopUpAgenda.aspx?CveTipoEvento=2&CveContrato=" & CveContrato & "&TB_iframe=true&height=370&width=600;"
|
|
ImgAddObs.Visible = True
|
|
LtlTareaNueva.Text = String.Format("<a class=""caption-subject bold font-light"" onclick=""OpenModalNewTareaUserControl(1,-1,{{CveContrato:{0}}});""> <i class=""fa fa-plus""'></i> Tarea</a>", CveContrato)
|
|
CargaEventoBitacora()
|
|
End If
|
|
|
|
If CveVentaRemision > 0 Then
|
|
DVFactura.Visible = True
|
|
End If
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
End Sub
|
|
Private Sub InicializaCombos()
|
|
'Lista Tipo AF
|
|
DdlTipoAF.DataSource = GlobalDTTipoActivoFijo(UsuarioActual.CveEmpresa).FiltraParametros("MedidaVehicularClave IN (2,3)")
|
|
DdlTipoAF.DataBind()
|
|
DdlTipoAF.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
|
|
|
'Lista de Monedas
|
|
DdlMoneda.DataSource = GlobalDTMonedas
|
|
DdlMoneda.DataBind()
|
|
|
|
|
|
CargarCentrosDeCosto(Nothing, Nothing, Nothing, LblSubProyectoModal)
|
|
|
|
DdlSubProyecto.DataSource = GlobalDTSubProyectos(UsuarioActual.CveEmpresa)
|
|
DdlSubProyecto.DataBind()
|
|
DdlSubProyecto.Items.Insert(0, New ListItem("Seleccione uno", "-1"))
|
|
|
|
|
|
End Sub
|
|
Private Sub CargaDatos()
|
|
'Información General
|
|
Dim ObjContratos As New ClsContratos
|
|
If ObjContratos.GetContratos(CveContrato, UsuarioActual.CveEmpresa) Then
|
|
Contrato = ObjContratos.DtResultados
|
|
If Contrato IsNot Nothing AndAlso Contrato.Rows.Count > 0 Then
|
|
Dim Importe As Decimal = Contrato.Rows(0)("Importe").ToString.ToDecimal
|
|
Dim Pesos As Decimal = Contrato.Rows(0)("ImporteMax").ToString.ToDecimal
|
|
Dim Anticipo As Decimal = Contrato.Rows(0)("ImporteMin").ToString.ToDecimal
|
|
CveContratoTipo = Contrato.Rows(0)("CveContratoTipo").ToString.ToEntero
|
|
SubProyecto = Contrato.Rows(0)("SubProyecto").ToString
|
|
CveMasivo = Contrato.Rows(0)("CveMasivo").ToString.ToEntero
|
|
TxtFolio.Text = Contrato.Rows(0)("NumeroContrato").ToString
|
|
|
|
DdlClientes.SelectedText = Contrato.Rows(0)("NombreComercial").ToString
|
|
DdlClientes.SelectedValue = Contrato.Rows(0)("CveCliente").ToString
|
|
DdlMoneda.SelectedValue = Contrato.Rows(0)("CveMoneda").ToString
|
|
TxtDescripcion.Text = Contrato.Rows(0)("DescripcionContrato").ToString
|
|
TxtObservaciones.Text = Contrato.Rows(0)("Observaciones").ToString
|
|
TelefonoEmpresa = Contrato.Rows(0)("Telefono").ToString
|
|
TxtUbicacion.Text = Contrato.Rows(0)("Ubicacion").ToString
|
|
TxtFechaSalida.Text = Contrato.Rows(0)("FechaInicial").ToString.ToDate.ToString("dd/MM/yyyy HH:mm:ss")
|
|
TxtFechaRegreso.Text = Contrato.Rows(0)("FechaFinal").ToString.ToDate.ToString("dd/MM/yyyy HH:mm:ss")
|
|
TxtCantidadPasajeros.Text = Contrato.Rows(0)("CantidadPasajeros").ToString
|
|
DdlTipoAF.SelectedValue = If(Contrato.Rows(0)("CveTipoAF") Is Nothing, "", Contrato.Rows(0)("CveTipoAF").ToString)
|
|
TxtImporte.Text = Math.Round(Importe, 2).ToString
|
|
TxtAnticipo.Text = Math.Round(Anticipo, 2).ToString
|
|
CveContratoEstatus = Contrato.Rows(0)("CveContratosEstatus").ToString.ToEntero
|
|
DdlSubProyecto.SelectedValueExist(Contrato.Rows(0)("CveSubProyecto").ToString)
|
|
If Contrato.Rows(0)("CveAF").ToString <> "" Then
|
|
divAF.Visible = True
|
|
LblAF.Text = Contrato.Rows(0)("CodigoNombreAF").ToString
|
|
End If
|
|
|
|
CveSubProyectoOriginal = Contrato.Rows(0)("CveSubProyecto").ToString.ToEntero
|
|
CveMonedaOriginal = Contrato.Rows(0)("CveMoneda").ToString.ToEntero
|
|
ImporteOrigial = Importe
|
|
DescripcionOriginal = Contrato.Rows(0)("DescripcionContrato").ToString
|
|
TipoAFOriginal = DdlTipoAF.SelectedItem.Text
|
|
FolioOriginal = TxtFolio.Text.Trim
|
|
|
|
CveVentaRemision = Contrato.Rows(0)("CveVentaRemision").ToString.ToEntero
|
|
HypRemision.Text = Contrato.Rows(0)("RemisionSerieFolio").ToString
|
|
HypRemision.NavigateUrl = $"/Ventas/Ventas.aspx?CveVenta={ CveVentaRemision}"
|
|
|
|
If Contrato.Rows(0)("RemisionSaldo").ToString.ToDecimal > 0 Then
|
|
LblSaldo.Text = $"Saldo { Contrato.Rows(0)("RemisionSaldo").ToString.ToDecimal.ToString("###,###,###.00")}"
|
|
Else
|
|
LblSaldo.Text = ""
|
|
End If
|
|
|
|
If Not IsDBNull(ObjContratos.Archivo) AndAlso ObjContratos.Archivo <> "" AndAlso ObjContratos.Archivo <> "-1" AndAlso ObjContratos.Archivo <> $"{ObjContratos.CveContrato}." Then
|
|
ViewState("FUrl") = Path.Combine(UsuarioActual.Empresa.Ruta, "CONTRATOS", ObjContratos.Archivo)
|
|
BtnDescargar.Visible = True
|
|
|
|
Dim File As New FileInfo(ViewState("FUrl").ToString)
|
|
BtnDescargar.NavigateUrl = $"~/Compras/PopUpVerFactura.aspx?ArchivoContrato={Encripta(File.FullName)}"
|
|
'If File.Exists Then
|
|
' RegistraScript($"window.open({Url}, ""_blank"");")
|
|
'End If
|
|
|
|
|
|
Else
|
|
BtnDescargar.Visible = False
|
|
A1.Visible = True
|
|
End If
|
|
|
|
'Boletos Vendidos
|
|
If Contrato.Rows(0)("CveContratoTipo").ToString() = "35" Then
|
|
TabBoletos.Visible = True
|
|
Dim ObjTransportes As New ClsTransportes
|
|
If ObjTransportes.GetViajesPasajeros(CveContrato) Then
|
|
GvViajesPasajeros.DataSource = ObjTransportes.DtResultados
|
|
BusquedaSeleccionada(ObjTransportes.DtResultados)
|
|
End If
|
|
ObjTransportes.Dispose()
|
|
GvViajesPasajeros.DataBind()
|
|
End If
|
|
''Bitácora
|
|
'Dim ObjEventoBitacora As New ClsOIEventos
|
|
'If ObjEventoBitacora.GetEventos(-1, -1, -1, "-1", "-1", -1, -1, -1, -1, -1, -1, "-1", -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveContrato:=CveContrato) Then
|
|
' GvEB.DataSource = ObjEventoBitacora.DtResultados
|
|
' GvEB.DataBind()
|
|
'End If
|
|
'ObjEventoBitacora.Dispose()
|
|
|
|
End If
|
|
Else
|
|
ObjContratos.Dispose()
|
|
Response.Redirect($"~/Transportes/RepContratos.aspx")
|
|
End If
|
|
ObjContratos.Dispose()
|
|
UpTabContainer.Update()
|
|
|
|
End Sub
|
|
#End Region
|
|
|
|
|
|
#Region "Bitacora"
|
|
Protected Sub GVEventoBitacora_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvEB.RowDataBound
|
|
If e.Row.RowType = DataControlRowType.DataRow Then
|
|
If e.Row.RowIndex = 0 Then
|
|
e.Row.Cells(0).Width = Unit.Pixel(200)
|
|
e.Row.Cells(1).Width = Unit.Pixel(200)
|
|
e.Row.Cells(2).Width = Unit.Pixel(100)
|
|
e.Row.Cells(3).Width = Unit.Pixel(500)
|
|
End If
|
|
|
|
If e.Row.DBCampo("Archivo").ToString <> "" Then
|
|
e.Row.FCLinkButton("LinkArchivo").Visible = True
|
|
e.Row.FCLinkButton("LinkArchivo").CommandArgument = String.Format("OI\{0}", e.Row.DBCampo("Archivo").ToString)
|
|
ScriptManager.GetCurrent(Me).RegisterPostBackControl(e.Row.FCLinkButton("LinkArchivo")) 'Registro un evento Postbacktrigger, que recargue toda la pagina para que funcione
|
|
End If
|
|
|
|
e.Row.Cells(3).HorizontalAlign = HorizontalAlign.Left
|
|
|
|
End If
|
|
End Sub
|
|
|
|
Protected Sub BtnGuardarEventoBitacora_Click(sender As Object, e As EventArgs) Handles BtnGuardarEventoBitacora.Click
|
|
Dim ObjEventoBitacora As New ClsOIEventos
|
|
|
|
Dim FileExtension As String = "-1"
|
|
Dim Filesgral As List(Of Archivo) = AnexoBit.getfiles().Archivos
|
|
Dim Filename As String = ""
|
|
For Each fileItem As Archivo In Filesgral
|
|
FileExtension = IO.Path.GetExtension(String.Format("{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, fileItem.filename)).Replace(".", "")
|
|
Filename = fileItem.filename
|
|
Next
|
|
|
|
|
|
|
|
If ObjEventoBitacora.AddEventoBitacora(TxtEventoDescripcion.Text.Trim, String.Format(".{0}", FileExtension), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveContrato:=CveContrato) Then
|
|
If Filename <> "" Then
|
|
Filename.FilesMove(String.Format("OI{0}", ObjEventoBitacora.CveEvento.ToString), String.Format("{0}OI", UsuarioActual.Empresa.Ruta), ConcatenarDirectorioBase:=False)
|
|
End If
|
|
|
|
GvEB.DataSource = ObjEventoBitacora.DtResultados
|
|
TxtEventoDescripcion.Text = ""
|
|
AnexoBit.Text = "[]"
|
|
Alert("La bitácora/observación se guardó correctamente", TipoMensaje.MsgInformacion)
|
|
RegistraScript("$('#ModalBitacora').modal('hide')", "hidemodal")
|
|
|
|
End If
|
|
ObjEventoBitacora.Dispose()
|
|
GvEB.DataBind()
|
|
|
|
UPEventoBitacora.Update()
|
|
CargaEventoBitacora()
|
|
UPAddEventoBitacora.Update()
|
|
End Sub
|
|
|
|
Private Sub CargaEventoBitacora()
|
|
|
|
If CveContrato > 0 Then
|
|
Dim ObjEventoBitacora As New ClsOIEventos()
|
|
If ObjEventoBitacora.GetAgendaBitacora(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveContrato:=CveContrato) Then
|
|
GvEB.DataSource = ObjEventoBitacora.DtResultados.FiltraParametros("CveTipoEvento = 6 OR CveTipoEvento = 2")
|
|
Else
|
|
GvEB.DataSource = Nothing
|
|
End If
|
|
ObjEventoBitacora.Dispose()
|
|
GvEB.DataBind()
|
|
UPEventoBitacora.Update()
|
|
End If
|
|
|
|
End Sub
|
|
|
|
'Protected Sub CargarArchivo(ByVal sender As Object, ByVal e As AjaxControlToolkit.AsyncFileUploadEventArgs) Handles AFU.UploadedComplete
|
|
' If AFU.HasFile Then
|
|
|
|
|
|
' Dim UploadFolder As String = String.Format("{0}\Temp\", UsuarioActual.Empresa.Ruta)
|
|
' UploadFolder.DirectoryExistsCreate()
|
|
' Dim Extension As String = System.IO.Path.GetExtension(AFU.PostedFile.FileName)
|
|
|
|
' If File.Exists(String.Format("{0}{1}{2}", UploadFolder, UsuarioActual.CveUsuario.ToString, Extension)) Then File.Delete(String.Format("{0}{1}{2}", UploadFolder, UsuarioActual.CveUsuario.ToString, Extension))
|
|
|
|
' AFU.SaveAs(UploadFolder & UsuarioActual.CveUsuario.ToString & Extension)
|
|
' Session("FileUpload") = UploadFolder & UsuarioActual.CveUsuario.ToString & Extension
|
|
' Session("FileExtension") = Extension
|
|
' Session("FileFolder") = UploadFolder
|
|
' End If
|
|
'End Sub
|
|
Protected Sub DownloadFile(ByVal sender As Object, ByVal e As EventArgs)
|
|
Dim filePath As String = String.Format("{0}{1}", UsuarioActual.Empresa.Ruta, CType(sender, LinkButton).CommandArgument)
|
|
Dim Archivo As New System.IO.FileInfo(filePath)
|
|
|
|
HttpContext.Current.Response.Clear()
|
|
HttpContext.Current.Response.ClearContent()
|
|
HttpContext.Current.Response.ContentType = "application/octet-stream"
|
|
HttpContext.Current.Response.AppendHeader("Content-disposition", "attachment; filename=" + Path.GetFileName(filePath))
|
|
HttpContext.Current.Response.AddHeader("Content-Length", Archivo.Length.ToString())
|
|
HttpContext.Current.Response.TransmitFile(filePath)
|
|
HttpContext.Current.Response.Flush()
|
|
HttpContext.Current.Response.End()
|
|
|
|
Archivo = Nothing
|
|
End Sub
|
|
#End Region
|
|
|
|
#Region "Información General"
|
|
Protected Sub BtnGuardarArchivo_Click1(sender As Object, e As EventArgs) Handles BtnGuardarArchivo.Click
|
|
|
|
Dim FileExtension As String = "-1"
|
|
Dim Filesgral As List(Of Extensiones.Archivo) = Anexo.getfiles().Archivos
|
|
Dim Filename As String = ""
|
|
Dim folderContratosPath As String = Path.Combine(UsuarioActual.Empresa.Ruta, "Contratos")
|
|
|
|
If Not Directory.Exists(folderContratosPath) Then
|
|
Directory.CreateDirectory(folderContratosPath)
|
|
End If
|
|
|
|
If Not Directory.Exists(Path.Combine(folderContratosPath, "Temp")) Then
|
|
Directory.CreateDirectory(Path.Combine(folderContratosPath, "Temp"))
|
|
End If
|
|
|
|
For Each fileItem As Archivo In Filesgral
|
|
|
|
FileExtension = IO.Path.GetExtension(String.Format("{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, fileItem.filename)).Replace(".", "")
|
|
Session("FileExtension") = FileExtension
|
|
Dim tempArray() As String
|
|
tempArray = fileItem.filename.ToString().Split("-".ToCharArray())
|
|
|
|
|
|
ViewState("extencion") = FileExtension
|
|
ViewState("FUrl") = Path.Combine(UsuarioActual.Empresa.Ruta, "Contratos", $"{CveContrato.ToString}.{ FileExtension}")
|
|
|
|
If File.Exists(ViewState("FUrl").ToString) Then
|
|
File.Delete(ViewState("FUrl").ToString)
|
|
End If
|
|
|
|
File.Move(fileItem.FileUrl, ViewState("FUrl").ToString)
|
|
TxtArchivo.Text = tempArray(1)
|
|
|
|
Next
|
|
|
|
UPAFUL.Update()
|
|
|
|
RegistraScript("$('#ModalUpload').modal('hide')", "hidemodal1")
|
|
A1.Visible = True
|
|
If Not FileExtension = "-1" Then
|
|
BtnDescargar.Visible = True
|
|
End If
|
|
End Sub
|
|
'Private Sub BtnDescargar_Click(sender As Object, e As EventArgs) Handles BtnDescargar.Click
|
|
' Dim File As New FileInfo(ViewState("FUrl").ToString)
|
|
' Dim Url As String = $"{ObtenerUrlCompleta()}Compras/PopUpVerFactura.aspx?ArchivoContrato={Encripta(File.FullName)}"
|
|
' If File.Exists Then
|
|
' RegistraScript($"window.open({Url}, ""_blank"");")
|
|
' End If
|
|
|
|
|
|
'End Sub
|
|
|
|
Public Function ObtenerUrlCompleta() As String
|
|
|
|
Dim Solicitud As HttpRequest = HttpContext.Current.Request
|
|
Dim url As String = Solicitud.Url.Scheme & "://" & Solicitud.Url.Host
|
|
|
|
If (Solicitud.Url.Port <> 80 AndAlso Solicitud.Url.Port <> 443) Then
|
|
url &= ":" & Solicitud.Url.Port
|
|
End If
|
|
|
|
|
|
url &= Solicitud.ApplicationPath
|
|
|
|
If Not url.EndsWith("/") Then
|
|
url &= "/"
|
|
End If
|
|
|
|
Return url
|
|
|
|
End Function
|
|
'Private Sub DescargaArchivo(urlArchivo As String)
|
|
|
|
' Dim File As New FileInfo(urlArchivo)
|
|
|
|
' If File.Exists Then 'set appropriate headers
|
|
|
|
' Response.Clear()
|
|
' Response.ClearHeaders()
|
|
' Response.ClearContent()
|
|
' Response.AddHeader("Content-Disposition", "inline; filename=" & TxtFolio.Text & $"{File.Extension}")
|
|
' Response.AddHeader("Content-Length", File.Length.ToString())
|
|
' 'Response.ContentType = "text/plain"
|
|
' Response.ContentType = "application/octet-stream"
|
|
' Response.Flush()
|
|
' ' Response.TransmitFile(File.FullName)
|
|
' Response.WriteFile(File.FullName)
|
|
' Response.End()
|
|
|
|
' Else
|
|
|
|
' Alert("Ocurrio un error al descargar el archivo", TipoMensaje.MsgAdvertencia, "window.close()")
|
|
|
|
' End If
|
|
|
|
'End Sub
|
|
|
|
Protected Sub UpdateContrato(sender As Object, e As EventArgs)
|
|
Dim ArchivoUpdate As String = "-1"
|
|
Dim ErrorProceso As Boolean = False
|
|
If Session("FileExtension").ToString <> "" Then
|
|
|
|
'ArchivoUpdate = $"{CveContrato.ToString}.{ Session("FileExtension")}"
|
|
ArchivoUpdate = $".{Session("FileExtension").ToString}"
|
|
Else
|
|
|
|
End If
|
|
|
|
Dim ObjContratos As New ClsContratos
|
|
ObjContratos.IniciaTransacSQL()
|
|
|
|
|
|
If Not ObjContratos.UpdateContratos(CveContrato, TxtFolio.Text, TxtDescripcion.Text, "", UsuarioActual.CveProveedor, DdlClientes.SelectedValue.ToEntero, -1, TxtFechaSalida.Text.ToDate, TxtFechaRegreso.Text.ToDate, TxtUbicacion.Text, "",
|
|
DdlSubProyecto.SelectedValue.ToEntero, -1, -1, -1, -1, ArchivoUpdate, "", -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, False, TxtAnticipo.Text.ToDecimal, -1, TxtImporte.Text.ToDecimal,
|
|
DdlMoneda.SelectedValue.ToEntero, 0, CveContratoTipo:=CveContratoTipo, CveTipoAF:=DdlTipoAF.SelectedValue.ToEntero, CveContratosEstatus:=CveContratoEstatus, Observaciones:=TxtObservaciones.Text) Then
|
|
ErrorProceso = True
|
|
End If
|
|
|
|
If Not ErrorProceso Then
|
|
If CveVentaRemision > 0 AndAlso (CveSubProyectoOriginal <> DdlSubProyecto.SelectedValue.ToEntero OrElse
|
|
CveMonedaOriginal <> DdlMoneda.SelectedValue.ToEntero OrElse
|
|
ImporteOrigial <> TxtImporte.Text.ToDecimal OrElse
|
|
DescripcionOriginal <> TxtDescripcion.Text OrElse
|
|
TipoAFOriginal <> DdlTipoAF.SelectedItem.Text OrElse
|
|
FolioOriginal <> TxtFolio.Text.Trim) Then
|
|
|
|
Dim ObsRemisionPartida As String = $"{DdlTipoAF.SelectedItem.Text}-{ TxtDescripcion.Text}-{TxtFolio.Text}"
|
|
If Not UpdateRemision(ObjContratos.IniciaTransacSQL(), DdlSubProyecto.SelectedValue.ToEntero, DdlMoneda.SelectedValue.ToEntero, TxtImporte.Text.ToDecimal, ObsRemisionPartida) Then
|
|
ErrorProceso = True
|
|
End If
|
|
End If
|
|
End If
|
|
|
|
If Not ErrorProceso Then
|
|
|
|
ObjContratos.Commit()
|
|
AgregarABitacora($"Actualización del contrato {CveContrato}")
|
|
Alert("Contrato actualizado correctamente")
|
|
Else
|
|
Alert("Ocurrió un ocurrió un error al actualizar su boleto", TipoMensaje.MsgError)
|
|
ObjContratos.RollBack()
|
|
End If
|
|
|
|
ObjContratos.Dispose()
|
|
|
|
If Not ErrorProceso Then
|
|
'CargaDatos()
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Private Function UpdateRemision(ByRef transaccionSql As SqlTransaction, CveSubProyectoNew As Integer, CveMonedaNew As Integer, TotalNew As Decimal, DescripcionNew As String) As Boolean
|
|
|
|
Dim Respuesta As Boolean = False
|
|
Dim TmpDT As DataTable = New DataTable
|
|
Dim OcurrioError As Boolean = False
|
|
Dim ObjVentas As New ClsVentas(transaccionSql)
|
|
Dim FechaVenta As Date = MinFecha
|
|
Dim PorcentajeIVA As Decimal = 0D
|
|
Dim IVANew As Decimal = 0D
|
|
Dim SubTotalNew As Decimal = TotalNew
|
|
Dim CvePrePoliza As Integer = -1
|
|
|
|
If ObjVentas.GetVenta(CveVentaRemision, UsuarioActual.CveEmpresa) Then
|
|
FechaVenta = ObjVentas.DtResultados(0)("Fecha").ToString.ToDate
|
|
CvePrePoliza = ObjVentas.DtResultados(0)("CvePrePoliza").ToString.ToEntero
|
|
End If
|
|
|
|
If ObjVentas.GetVentaDetalle(CveVentaRemision) Then
|
|
TmpDT = ObjVentas.DtResultados
|
|
PorcentajeIVA = ObjVentas.DtResultados.MAX("PorcentajeIVA").ToDecimal
|
|
|
|
If PorcentajeIVA > 0 Then
|
|
|
|
IVANew = (TotalNew * (PorcentajeIVA * 100)) / (100 + (PorcentajeIVA * 100))
|
|
SubTotalNew = TotalNew - IVANew
|
|
|
|
End If
|
|
|
|
End If
|
|
|
|
If TmpDT Is Nothing OrElse TmpDT.Rows.Count = 0 Or FechaVenta = MinFecha Then
|
|
Alert("Error al obtener los datos de la remisión.", TipoMensaje.MsgAdvertencia)
|
|
Return False
|
|
End If
|
|
|
|
Dim ObjConta As New ClsContabilidad(ObjVentas.IniciaTransacSQL())
|
|
Dim Moneda As Integer = DdlMoneda.SelectedValue.ToEntero()
|
|
Dim TC As Decimal = If(CveMonedaNew = 2, GlobalTipoCambio(FechaVenta).ToDecimal, 1)
|
|
|
|
Try
|
|
If Not ObjVentas.UpdateVentas(SubTotalNew, 0, IVANew, 0, TotalNew, CveMonedaNew, TC, FechaVenta, DescripcionNew,
|
|
UsuarioActual.CveEmpresa, CveVentaRemision,
|
|
Vigencia:=FechaVenta, CondicionesPago:=-1,
|
|
PedidoContrato:="-1", AtencionA:="-1", CveMetodoPago33:=-1,
|
|
CveFormaPago33:=-1, TipoDocto:="Rem", CveCliente:=-1, CveClienteSucursal:=-1,
|
|
OrdenCompra:="-1", RetIVA:=0, RetISR:=0, Kilometraje:=0D, CveUsoCFDi:=-1,
|
|
CveVendedor:=-1, ServicioDomicilio:=False, CveMedico:=-1, CveProcedimiento:=-1,
|
|
FechaParaSurtir:=MinFecha, Paciente:="-1", Episodio:="-1", CveCondicionEntrega:=-1, FolioRemision:="-1") Then
|
|
OcurrioError = True
|
|
End If
|
|
|
|
'Cargo de nueva cuenta el detalle de Ventas (Conceptos)
|
|
If Not OcurrioError Then
|
|
Dim index As Integer = 0
|
|
For Each Row As DataRow In TmpDT.Rows
|
|
Dim CveVentaDetalle As Integer = Row("CveVentaDetalle").ToString().ToEntero()
|
|
If CveVentaDetalle > 0 Then
|
|
If Not ObjVentas.UpdateVentaDetalleRemision(Row("CveVentaDetalle").ToString().ToEntero(), Row("CvePS").ToString().ToEntero(), Row("Cantidad").ToString().ToDecimal, SubTotalNew, Row("ImporteIEPS").ToString().ToDecimal(), Row("PorcentajeIEPS").ToString().ToDecimal(), IVANew, PorcentajeIVA, 0, DescripcionNew, UsuarioActual.CveUsuario) Then
|
|
OcurrioError = True
|
|
End If
|
|
End If
|
|
Exit For ' solo debe de tener un detalle por eso se sale
|
|
index = index + 1
|
|
Next
|
|
End If
|
|
|
|
If Not OcurrioError Then
|
|
Dim DTPrePoliza As New DataTable
|
|
|
|
If ObjConta.GetPrePolizasDetalle(CvePrePoliza, UsuarioActual.CveEmpresa) Then
|
|
DTPrePoliza = ObjConta.DtResultados
|
|
If DTPrePoliza.Rows.Count = 0 Then
|
|
OcurrioError = True
|
|
Alert("No se encontraron datos de prepoliza", TipoMensaje.MsgAdvertencia)
|
|
End If
|
|
Else
|
|
OcurrioError = True
|
|
End If
|
|
|
|
For Each dRow As DataRow In DTPrePoliza.Rows
|
|
|
|
If Not ObjConta.UpdatePrePolizasDetalle(dRow("CvePrePolizaDetalle").ToString.ToEntero, dRow("Concepto").ToString, dRow("CveSubProyecto").ToString.ToEntero, -1, Boolean.Parse(dRow("TipoMovto").ToString), ImporteMN:=(TotalNew * TC), Importe:=TotalNew, TipoCambio:=TC) Then
|
|
OcurrioError = True
|
|
Exit For
|
|
End If
|
|
Next
|
|
End If
|
|
|
|
If ObjConta.ValidacionesPrePoliza(-1, UsuarioActual, Opcion:=2, CveVenta:=CveVentaRemision) Then
|
|
If ObjConta.ValorPolizaDescuadre > 0 Then
|
|
If ObjConta.ValorPolizaDescuadre = 2 Then
|
|
OcurrioError = True
|
|
Alert(ObjConta.MensajePolizaDescuadre, TipoMensaje.MsgError)
|
|
End If
|
|
End If
|
|
End If
|
|
Catch ex As Exception
|
|
OcurrioError = True
|
|
OnError("Ocurrió un error al actualizar la remisión", ex)
|
|
End Try
|
|
|
|
If OcurrioError Then
|
|
'Alert("Ocurrió un error al guardar los cambios. Por favor intente de nuevo.", TipoMensaje.MsgError)
|
|
Return False
|
|
Else
|
|
' Alert("Los cambios se guardaron correctamente.", TipoMensaje.MsgInformacion, JSBtnAceptar:="BtnRefrescarPagina();")
|
|
Return True
|
|
End If
|
|
End Function
|
|
|
|
Protected Sub EliminarContrato(sender As Object, e As EventArgs)
|
|
Dim ObjContratos As New ClsContratos
|
|
If (CveContratoTipo = 35) Then
|
|
If CveMasivo <> 0 Then
|
|
If ObjContratos.RemoveContrato(CveContrato, UsuarioActual.CveEmpresa, CveMasivo:=CveMasivo) Then
|
|
Alert("Viajes masivos eliminados correctamente")
|
|
AgregarABitacora($"Eliminación del contrato {CveContrato}")
|
|
|
|
ObjContratos.Dispose()
|
|
Response.Redirect("RepViajes.aspx")
|
|
End If
|
|
Else
|
|
If ObjContratos.RemoveContrato(CveContrato, UsuarioActual.CveEmpresa) Then
|
|
Alert("Viaje eliminado correctamente")
|
|
AgregarABitacora($"Eliminación de contratos masivos con clave {CveMasivo}")
|
|
|
|
ObjContratos.Dispose()
|
|
Response.Redirect("RepViajes.aspx")
|
|
End If
|
|
End If
|
|
Else
|
|
If ObjContratos.RemoveContrato(CveContrato, UsuarioActual.CveEmpresa) Then
|
|
Alert("Contrato eliminado correctamente")
|
|
ObjContratos.Dispose()
|
|
Response.Redirect("RepContratos.aspx")
|
|
End If
|
|
End If
|
|
|
|
End Sub
|
|
Protected Sub ImprimirContrato(sender As Object, e As EventArgs)
|
|
Dim dtResult As New DataTable()
|
|
|
|
Dim params As New List(Of ReportParameter) From {
|
|
New ReportParameter("Folio", TxtFolio.Text),
|
|
New ReportParameter("Cliente", DdlClientes.SelectedText),
|
|
New ReportParameter("Servicio", TxtDescripcion.Text),
|
|
New ReportParameter("Observaciones", TxtObservaciones.Text),
|
|
New ReportParameter("Ubicacion", TxtUbicacion.Text),
|
|
New ReportParameter("FechaSalida", TxtFechaSalida.Text.ToDate.ToString("dd/MM/yyyy HH:mm tt")),
|
|
New ReportParameter("FechaRegreso", TxtFechaRegreso.Text.ToDate.ToString("dd/MM/yyyy HH:mm tt")),
|
|
New ReportParameter("CantidadPasajeros", TxtCantidadPasajeros.Text),
|
|
New ReportParameter("TipoAF", DdlTipoAF.SelectedItem.ToString()),
|
|
New ReportParameter("Pesos", TxtImporte.Text.ToDecimal.ToString("###,###,###.00")),
|
|
New ReportParameter("Moneda", DdlMoneda.SelectedItem.ToString),
|
|
New ReportParameter("Anticipo", TxtAnticipo.Text.ToDecimal.ToString("###,###,###.00")),
|
|
New ReportParameter("Total", (TxtImporte.Text.ToDecimal - (TxtAnticipo.Text.ToDecimal)).ToString("###,###,###.00")),
|
|
New ReportParameter("DiaSalida", TxtFechaSalida.Text.ToDate.ToString("HH:mm tt")),
|
|
New ReportParameter("TelefonoEmpresa", TelefonoEmpresa),
|
|
New ReportParameter("FechaImpresion", Date.Now.ToString("dd/MM/yyyy HH:mm:ss")),
|
|
New ReportParameter("Usuario", UsuarioActual.Nombre)
|
|
}
|
|
'New ReportParameter("Folio", TxtFolio.Text),
|
|
' New ReportParameter("Cliente", DdlClientes.SelectedText),
|
|
' New ReportParameter("Servicio", TxtDescripcion.Text),
|
|
' New ReportParameter("Observaciones", TxtObservaciones.Text),
|
|
' New ReportParameter("Ubicacion", TxtUbicacion.Text),
|
|
' New ReportParameter("FechaSalida", TxtFechaSalida.Text.ToDate.ToString("dd/MM/yyyy")),
|
|
' New ReportParameter("FechaRegreso", TxtFechaRegreso.Text.ToDate.ToString("dd/MM/yyyy")),
|
|
' New ReportParameter("CantidadPasajeros", TxtCantidadPasajeros.Text),
|
|
' New ReportParameter("TipoAF", DdlTipoAF.SelectedItem.ToString()),
|
|
' New ReportParameter("Pesos", Math.Round(TxtImporte.Text.ToDecimal, 2).ToString),
|
|
' New ReportParameter("Moneda", DdlMoneda.SelectedItem.ToString),
|
|
' New ReportParameter("Anticipo", Math.Round((TxtAnticipo.Text.ToDecimal * TxtImporte.Text.ToDecimal), 2).ToString),
|
|
' New ReportParameter("Total", Math.Round((TxtImporte.Text.ToDecimal - (TxtAnticipo.Text.ToDecimal * TxtImporte.Text.ToDecimal)), 2).ToString),
|
|
' New ReportParameter("DiaSalida", $"{TxtFechaSalida.Text.ToDate.Hour}:{TxtFechaSalida.Text.ToDate.Minute} "),
|
|
' New ReportParameter("TelefonoEmpresa", TelefonoEmpresa),
|
|
' New ReportParameter("FechaImpresion", Date.Now.ToString("dd/MM/yyyy HH:mm:ss")),
|
|
' New ReportParameter("Usuario", UsuarioActual.Nombre)
|
|
|
|
ImprimirPDFStimul($"{UsuarioActual.Empresa.Ruta}Formatos\Contrato.mrt", dtResult, params, NombreArchivo:=TxtFolio.Text)
|
|
End Sub
|
|
Protected Sub AgregarABitacora(Descripcion As String)
|
|
Dim ObjEventoBitacora As New ClsOIEventos
|
|
|
|
Dim FileExtension As String = "-1"
|
|
|
|
If ObjEventoBitacora.AddEventoBitacora(Descripcion, FileExtension, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveContrato:=CveContrato) Then
|
|
'Alert("Evento agregado a bitácora correctamente", TipoMensaje.MsgInformacion)
|
|
|
|
End If
|
|
ObjEventoBitacora.Dispose()
|
|
|
|
End Sub
|
|
#End Region
|
|
|
|
#Region "Boletos"
|
|
Protected Sub OnLinkButtonClick(sender As Object, e As EventArgs)
|
|
'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)
|
|
|
|
UpTabContainer.Update()
|
|
RegistraScript(String.Format("$('#{0}').modal('show');", "ModalEditar"))
|
|
End Sub
|
|
Protected Sub UpdateBoleto(sender As Object, e As EventArgs)
|
|
|
|
|
|
If PnEditarViaje.Visible = True Then
|
|
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
|
|
End If
|
|
|
|
Dim ObjTransportes As New ClsTransportes
|
|
|
|
Try
|
|
ObjTransportes.IniciaTransacSQL()
|
|
|
|
If ObjTransportes.UpdateViajesPasajeros(CveViajePasajero, DdlRuta.SelectedValue.ToEntero, UsuarioActual.CveVendedor, LbImporte.Text.ToDecimal, TxtAsiento.Text.ToEntero, TxtNombre.Text, TxtVisa.Text, TxtCelular.Text, TxtObservacion.Text, CBool(TxtEstatus.Text), UsuarioActual.CveUsuario, CBool(RblSexo.SelectedValue)) 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")
|
|
AgregarABitacora($"Cambio de asiento del pasajero {CveViajePasajero} del asiento al {TxtAsiento.Text} del contrato {CveContrato}")
|
|
|
|
ObjTransportes.Dispose()
|
|
|
|
End Try
|
|
|
|
CargaDatos()
|
|
RegistraScript(String.Format("$('#{0}').modal('hide');", "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
|
|
ObjTransportes.Dispose()
|
|
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
|
|
UpTabContainer.Update()
|
|
|
|
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)
|
|
Dim Fecha As Date = GvRow.DataKey("FechaIng").ToDate
|
|
Dim Importe As Decimal = GvRow.DataKey("Importe").ToDecimal
|
|
|
|
Dim params As New List(Of ReportParameter) From {
|
|
New ReportParameter("Ruta", SubProyecto),
|
|
New ReportParameter("Origen", GvRow.DataKey("Partida")),
|
|
New ReportParameter("Destino", GvRow.DataKey("Destino")),
|
|
New ReportParameter("FechaSalida", Fecha.ToShortDateString()),
|
|
New ReportParameter("HoraSalida", Fecha.ToString("HH:mm")),
|
|
New ReportParameter("Nombre", GvRow.DataKey("Nombre")),
|
|
New ReportParameter("Visa", GvRow.DataKey("Visa")),
|
|
New ReportParameter("Celular", GvRow.DataKey("Celular")),
|
|
New ReportParameter("Importe", Math.Round(Importe, 2).ToString),
|
|
New ReportParameter("TipoBoleto", "Tipo Boleto"),
|
|
New ReportParameter("Agencia", "Agencia"),
|
|
New ReportParameter("TelefonoAgencia", "TelefonoAgencia"),
|
|
New ReportParameter("Asiento", GvRow.DataKey("Asiento"))
|
|
}
|
|
|
|
ImprimirPDFStimul($"{UsuarioActual.Empresa.Ruta}Formatos\Boleto.mrt", dtResult, params, NombreArchivo:="Boleto")
|
|
End Sub
|
|
Protected Sub GvViajesPasajeros_RowDataBound(sender As Object, e As GridViewRowEventArgs)
|
|
If e.Row.RowType = DataControlRowType.DataRow Then
|
|
ScriptManager.GetCurrent(Me).RegisterPostBackControl(e.Row.FCLinkButton("BtnImprimir"))
|
|
End If
|
|
End Sub
|
|
Protected Sub EditarBoleto(sender As Object, e As EventArgs)
|
|
PnEditarUsuario.Visible = True
|
|
PnEditarViaje.Visible = False
|
|
PnAsientos.Visible = False
|
|
|
|
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
|
|
|
CveViajePasajero = GvRow.DataKey("CveViajePasajero").ToEntero
|
|
DdlRuta.SelectedValue = GvRow.DataKey("CveViaje")
|
|
LbPartida.Text = GvRow.DataKey("Partida").ToString()
|
|
LbDestino.Text = GvRow.DataKey("Destino").ToString()
|
|
LbImporte.Text = Convert.ToDecimal(GvRow.DataKey("Importe")).ToString("C")
|
|
TxtNombre.Text = GvRow.DataKey("Nombre").ToString()
|
|
TxtVisa.Text = GvRow.DataKey("Visa").ToString()
|
|
TxtCelular.Text = GvRow.DataKey("Celular").ToString()
|
|
RblSexo.SelectedValue = If(CBool(GvRow.DataKey("Sexo").ToString), "1", "0")
|
|
TxtObservacion.Text = GvRow.DataKey("Observacion").ToString()
|
|
LbEstatus.Text = If(CBool(GvRow.DataKey("Estatus").ToString), "Activo", "Cancelado")
|
|
TxtEstatus.Text = GvRow.DataKey("Estatus").ToString
|
|
LbEstatus.CssClass = If(CBool(GvRow.DataKey("Estatus").ToString), "text-success bold", "text-danger bold")
|
|
TxtAsiento.Text = GvRow.DataKey("Asiento").ToString()
|
|
|
|
UpTabContainer.Update()
|
|
UpModal.Update()
|
|
RegistraScript(String.Format("$('#{0}').modal('show');", "ModalEditar"))
|
|
|
|
End Sub
|
|
Protected Sub CambiarBoleto(sender As Object, e As EventArgs)
|
|
PnEditarViaje.Visible = True
|
|
PnEditarUsuario.Visible = False
|
|
PnAsientos.Visible = True
|
|
|
|
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")
|
|
TxtNombre.Text = GvRow.DataKey("Nombre").ToString()
|
|
TxtVisa.Text = GvRow.DataKey("Visa").ToString()
|
|
TxtCelular.Text = GvRow.DataKey("Celular").ToString()
|
|
RblSexo.SelectedValue = If(CBool(GvRow.DataKey("Sexo").ToString), "1", "0")
|
|
TxtObservacion.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("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()
|
|
UpTabContainer.Update()
|
|
RegistraScript(String.Format("$('#{0}').modal('show');", "ModalEditar"))
|
|
End Sub
|
|
Protected Sub BtnCancelar_Click(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 = Convert.ToDecimal(GvRow.DataKey("Importe")).ToString("C")
|
|
TxtNombre.Text = GvRow.DataKey("Nombre").ToString()
|
|
TxtVisa.Text = GvRow.DataKey("Visa").ToString()
|
|
TxtCelular.Text = GvRow.DataKey("Celular").ToString()
|
|
RblSexo.SelectedValue = If(CBool(GvRow.DataKey("Sexo").ToString), "1", "0")
|
|
TxtObservacion.Text = GvRow.DataKey("Observacion").ToString()
|
|
TxtEstatus.Text = GvRow.DataKey("Estatus").ToString()
|
|
LbCreado.Text = GvRow.DataKey("FechaIng").ToString()
|
|
TxtAsiento.Text = GvRow.DataKey("Asiento").ToString()
|
|
Dim Estatus As Boolean = Not CBool(TxtEstatus.Text)
|
|
Dim ObjTransportes As New ClsTransportes
|
|
Try
|
|
ObjTransportes.IniciaTransacSQL()
|
|
|
|
If ObjTransportes.UpdateViajesPasajeros(CveViajePasajero, CveContrato, UsuarioActual.CveVendedor, LbImporte.Text.ToDecimal, TxtAsiento.Text.ToEntero, TxtNombre.Text, TxtVisa.Text, TxtCelular.Text, TxtObservacion.Text, Estatus, UsuarioActual.CveUsuario, CBool(RblSexo.SelectedValue)) Then
|
|
Alert("Se 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()
|
|
Dim toggleEstatus As String
|
|
If CBool(RblSexo.SelectedValue) Then
|
|
toggleEstatus = "Cancelación"
|
|
Else
|
|
toggleEstatus = "Reactivación"
|
|
|
|
End If
|
|
AgregarABitacora($"{toggleEstatus} del asiento {TxtAsiento.Text} del viaje {CveContrato} con clave de pasajero {CveViajePasajero}")
|
|
|
|
CargaDatos()
|
|
End Try
|
|
UpPasajeros.Update()
|
|
End Sub
|
|
#End Region
|
|
|
|
#Region "Bitacora historial"
|
|
Private Sub CargaGvBitacora()
|
|
' COMENTADO POR IPP PARA SUBIR 5 ABRIL 2017
|
|
If CveContrato > 0 Then
|
|
Dim ObjGral As New ClsGenerales()
|
|
If ObjGral.GetHistorialBitacora(-1, -1, -1, -1, -1, -1, -1, UsuarioActual.CveEmpresa, CveContrato:=CveContrato) Then
|
|
GvBitacora.DataSource = ObjGral.DtResultados
|
|
End If
|
|
ObjGral.Dispose()
|
|
End If
|
|
GvBitacora.DataBind()
|
|
End Sub
|
|
#End Region
|
|
|
|
#Region "PAGOS"
|
|
Private Sub CargaAuxiliarClienteCxC(CveCliente As Integer, CveRemision As Integer)
|
|
|
|
If CveRemision > 0 Then
|
|
Dim ObjMovtos As New ClsMovimientos()
|
|
|
|
If ObjMovtos.GetCxCClienteAuxiliar(CveCliente, CveRemision) Then
|
|
|
|
Dim dtTemp As New DataTable
|
|
dtTemp = ObjMovtos.DtResultados.FiltraParametros(" Conceptocontable = 'Pago del Cliente' ")
|
|
TotalPagos = dtTemp.SUM("Abono")
|
|
GVAuxiliar.DataSource = dtTemp
|
|
|
|
Else
|
|
GVAuxiliar.DataSource = Nothing
|
|
End If
|
|
|
|
ObjMovtos.Dispose()
|
|
GVAuxiliar.DataBind()
|
|
UpPagos.Update()
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Protected Sub GVAuxiliar_RowDataBound(sender As Object, e As GridViewRowEventArgs)
|
|
|
|
If e.Row.RowType = DataControlRowType.DataRow Then
|
|
If e.Row.DataKey("TipoReferencia").ToEntero = 1 Then
|
|
e.Row.FCHyperLink("HplReferencia").NavigateUrl = $"/Bancos/IE.aspx?CveIE={e.Row.DataKey("CveReferencia").ToEntero}"
|
|
End If
|
|
End If
|
|
If e.Row.RowType = DataControlRowType.Footer Then
|
|
e.Row.Cells(1).HorizontalAlign = HorizontalAlign.Right
|
|
e.Row.Cells(2).HorizontalAlign = HorizontalAlign.Right
|
|
e.Row.Cells(1).Text = "Total"
|
|
e.Row.FCLabel("Lbltotal").Text = TotalPagos.ToString("###,###,###.00")
|
|
End If
|
|
|
|
End Sub
|
|
|
|
#End Region
|
|
|
|
|
|
|
|
|
|
End Class
|
|
|
|
|