diff --git a/App_Code/ClsDestinos.vb b/App_Code/ClsDestinos.vb new file mode 100644 index 000000000..b08400c79 --- /dev/null +++ b/App_Code/ClsDestinos.vb @@ -0,0 +1,156 @@ +Imports System.Data +Imports System.Data.SqlClient +Imports Extensiones + +Public Class ClsDestinos + Implements IDisposable + +#Region "Campos" + 'SQL + Private SqlConexion As SqlConnection + Private SqlAdapter As SqlDataAdapter + Private SqlCommand As SqlCommand + Private SqlTransacc As SqlTransaction + Private Data As DataTable + Private DSet As New DataSet + + Private disposedValue As Boolean = False ' Para detectar llamadas redundantes + 'REGISTRAR CONEXIÓN + Private CveConexion As Integer = 0 + Public ReadOnly Property DtResultados() As DataTable + Get + DtResultados = Data + End Get + End Property + +#End Region + +#Region "Propiedades" + Public Property CveDestino As Integer + Public Property CveUsuario As Integer + Public Property CveEmpresa As Integer + Public Property Destino As String + Public Property Estatus As Boolean + Public Property EsNacional As Boolean + Public Property FechaIng As DateTime +#End Region + +#Region "Funciones básicas" + Sub New(Optional TransaccionCompartida As SqlTransaction = Nothing) + + If TransaccionCompartida Is Nothing Then + SqlConexion = New SqlConnection + SqlConexion.ConnectionString = ConfigurationManager.ConnectionStrings("Conexion").ConnectionString + Try + SqlConexion.Open() + Catch ex As Exception + OnError("Ocurrió un error al intentar conectarse a la base de datos.", ex) + End Try + Else + SqlConexion = TransaccionCompartida.Connection + SqlTransacc = TransaccionCompartida + End If + + SqlAdapter = New SqlDataAdapter("", SqlConexion) + ConexionAdd() + End Sub + Private Sub DataAdapter(StrSQL As String, Optional TipoComando As CommandType = CommandType.StoredProcedure) + With SqlAdapter.SelectCommand + .Parameters.Clear() + .CommandText = StrSQL + .CommandType = TipoComando + End With + If Not SqlTransacc Is Nothing Then SqlAdapter.SelectCommand.Transaction = SqlTransacc + Data = New DataTable + End Sub +#Region "Conexiones" + + Private Sub ConexionAdd() + If ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then + Try + DataAdapter("PA_Sis_RegistrarConexion") + With SqlAdapter.SelectCommand.Parameters + .Add("@Clase", SqlDbType.VarChar).Value = Me.GetType().Name + .Add("@Modulo", SqlDbType.VarChar).Value = String.Format("{0}?{1}", HttpContext.Current.Request.Url.AbsolutePath.ToString, HttpContext.Current.Request.QueryString.ToString) + .Add("@IDConexion", SqlDbType.Int).Direction = ParameterDirection.Output + End With + SqlAdapter.Fill(Data) + CveConexion = SqlAdapter.SelectCommand.Parameters("@IDConexion").Value.ToString.ToEntero + Catch ex As Exception + OnError("Ocurrió un error registrar la conexión.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + End If + End Sub + + Private Sub ConexionClose() + If CveConexion > 0 AndAlso ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then + + DataAdapter(String.Format("UPDATE Sis_Conexiones SET FechaCierre = GETDATE() WHERE CveConexion = {0}", CveConexion), CommandType.Text) + + Try + SqlAdapter.Fill(Data) + + Catch ex As Exception + OnError("Ocurrió un error registrar la conexión.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + CveConexion = 0 + End If + + End Sub +#End Region + Public Function IniciaTransacSQL() As SqlTransaction + If SqlTransacc Is Nothing Then SqlTransacc = SqlConexion.BeginTransaction() + Return SqlTransacc + End Function + Public Sub RollBack() + SqlTransacc.Rollback() + End Sub + Public Sub Commit() + SqlTransacc.Commit() + End Sub + Protected Overridable Sub Dispose(ByVal disposing As Boolean) + If Not disposedValue Then + If disposing Then + If Not Data Is Nothing Then Data.Dispose() : Data = Nothing + If Not DSet Is Nothing Then DSet.Dispose() : DSet = Nothing + If Not SqlAdapter Is Nothing Then SqlAdapter.Dispose() : SqlAdapter = Nothing + If Not SqlCommand Is Nothing Then SqlCommand.Dispose() : SqlCommand = Nothing + If Not SqlTransacc Is Nothing Then SqlTransacc.Dispose() : SqlTransacc = Nothing + If SqlConexion.State <> ConnectionState.Closed Then SqlConexion.Close() + If Not SqlConexion Is Nothing Then SqlConexion.Dispose() : SqlConexion = Nothing + + End If + End If + disposedValue = True + End Sub + Public Sub Dispose() Implements IDisposable.Dispose + ConexionClose() + Dispose(True) + GC.SuppressFinalize(Me) + End Sub +#End Region + Public Function GetDestinos(CveDestino As Integer, CveUsuario As Integer, CveEmpresa As Integer, Destino As String, Estatus As Boolean, EsNacional As Boolean, FechaIng As DateTime) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Trans_DestinosGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveDestino", SqlDbType.Int).Value = CveDestino + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@Destino", SqlDbType.VarChar).Value = Destino + .Add("@Estatus", SqlDbType.Bit).Value = Estatus + .Add("@EsNacional", SqlDbType.Bit).Value = EsNacional + .Add("@FechaIng", SqlDbType.DateTime).Value = FechaIng + + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener los destino.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + +End Class diff --git a/App_Code/ClsRutas.vb b/App_Code/ClsRutas.vb new file mode 100644 index 000000000..82f301ee0 --- /dev/null +++ b/App_Code/ClsRutas.vb @@ -0,0 +1,154 @@ +Imports System.Data +Imports System.Data.SqlClient +Imports Extensiones + +Public Class ClsRutas + Implements IDisposable + +#Region "Campos" + 'SQL + Private SqlConexion As SqlConnection + Private SqlAdapter As SqlDataAdapter + Private SqlCommand As SqlCommand + Private SqlTransacc As SqlTransaction + Private Data As DataTable + Private DSet As New DataSet + + Private disposedValue As Boolean = False ' Para detectar llamadas redundantes + 'REGISTRAR CONEXIÓN + Private CveConexion As Integer = 0 + Public ReadOnly Property DtResultados() As DataTable + Get + DtResultados = Data + End Get + End Property + +#End Region + +#Region "Propiedades" + Public Property CveRuta As Integer + Public Property CveUsuario As Integer + Public Property CveEmpresa As Integer + Public Property Ruta As String + Public Property Estatus As Boolean + Public Property FechaIng As DateTime +#End Region + +#Region "Funciones básicas" + Sub New(Optional TransaccionCompartida As SqlTransaction = Nothing) + + If TransaccionCompartida Is Nothing Then + SqlConexion = New SqlConnection + SqlConexion.ConnectionString = ConfigurationManager.ConnectionStrings("Conexion").ConnectionString + Try + SqlConexion.Open() + Catch ex As Exception + OnError("Ocurrió un error al intentar conectarse a la base de datos.", ex) + End Try + Else + SqlConexion = TransaccionCompartida.Connection + SqlTransacc = TransaccionCompartida + End If + + SqlAdapter = New SqlDataAdapter("", SqlConexion) + ConexionAdd() + End Sub + Private Sub DataAdapter(StrSQL As String, Optional TipoComando As CommandType = CommandType.StoredProcedure) + With SqlAdapter.SelectCommand + .Parameters.Clear() + .CommandText = StrSQL + .CommandType = TipoComando + End With + If Not SqlTransacc Is Nothing Then SqlAdapter.SelectCommand.Transaction = SqlTransacc + Data = New DataTable + End Sub +#Region "Conexiones" + + Private Sub ConexionAdd() + If ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then + Try + DataAdapter("PA_Sis_RegistrarConexion") + With SqlAdapter.SelectCommand.Parameters + .Add("@Clase", SqlDbType.VarChar).Value = Me.GetType().Name + .Add("@Modulo", SqlDbType.VarChar).Value = String.Format("{0}?{1}", HttpContext.Current.Request.Url.AbsolutePath.ToString, HttpContext.Current.Request.QueryString.ToString) + .Add("@IDConexion", SqlDbType.Int).Direction = ParameterDirection.Output + End With + SqlAdapter.Fill(Data) + CveConexion = SqlAdapter.SelectCommand.Parameters("@IDConexion").Value.ToString.ToEntero + Catch ex As Exception + OnError("Ocurrió un error registrar la conexión.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + End If + End Sub + + Private Sub ConexionClose() + If CveConexion > 0 AndAlso ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then + + DataAdapter(String.Format("UPDATE Sis_Conexiones SET FechaCierre = GETDATE() WHERE CveConexion = {0}", CveConexion), CommandType.Text) + + Try + SqlAdapter.Fill(Data) + + Catch ex As Exception + OnError("Ocurrió un error registrar la conexión.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + CveConexion = 0 + End If + + End Sub +#End Region + Public Function IniciaTransacSQL() As SqlTransaction + If SqlTransacc Is Nothing Then SqlTransacc = SqlConexion.BeginTransaction() + Return SqlTransacc + End Function + Public Sub RollBack() + SqlTransacc.Rollback() + End Sub + Public Sub Commit() + SqlTransacc.Commit() + End Sub + Protected Overridable Sub Dispose(ByVal disposing As Boolean) + If Not disposedValue Then + If disposing Then + If Not Data Is Nothing Then Data.Dispose() : Data = Nothing + If Not DSet Is Nothing Then DSet.Dispose() : DSet = Nothing + If Not SqlAdapter Is Nothing Then SqlAdapter.Dispose() : SqlAdapter = Nothing + If Not SqlCommand Is Nothing Then SqlCommand.Dispose() : SqlCommand = Nothing + If Not SqlTransacc Is Nothing Then SqlTransacc.Dispose() : SqlTransacc = Nothing + If SqlConexion.State <> ConnectionState.Closed Then SqlConexion.Close() + If Not SqlConexion Is Nothing Then SqlConexion.Dispose() : SqlConexion = Nothing + + End If + End If + disposedValue = True + End Sub + Public Sub Dispose() Implements IDisposable.Dispose + ConexionClose() + Dispose(True) + GC.SuppressFinalize(Me) + End Sub +#End Region + Public Function GetRutas(CveRuta As Integer, CveUsuario As Integer, CveEmpresa As Integer, Ruta As String, Estatus As Boolean, FechaIng As DateTime) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Trans_RutasGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveRuta", SqlDbType.Int).Value = CveRuta + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@Ruta", SqlDbType.VarChar).Value = Ruta + .Add("@Estatus", SqlDbType.Bit).Value = Estatus + .Add("@FechaIng", SqlDbType.DateTime).Value = FechaIng + + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener las rutas.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + +End Class diff --git a/App_Code/ClsViajes.vb b/App_Code/ClsViajes.vb new file mode 100644 index 000000000..cc207147e --- /dev/null +++ b/App_Code/ClsViajes.vb @@ -0,0 +1,159 @@ + +Imports System.Data +Imports System.Data.SqlClient +Imports Extensiones + +Public Class ClsViajes + Implements IDisposable + +#Region "Campos" + 'SQL + Private SqlConexion As SqlConnection + Private SqlAdapter As SqlDataAdapter + Private SqlCommand As SqlCommand + Private SqlTransacc As SqlTransaction + Private Data As DataTable + Private DSet As New DataSet + + Private disposedValue As Boolean = False ' Para detectar llamadas redundantes + 'REGISTRAR CONEXIÓN + Private CveConexion As Integer = 0 + Public ReadOnly Property DtResultados() As DataTable + Get + DtResultados = Data + End Get + End Property + +#End Region + +#Region "Propiedades" + Public Property CveViaje As Integer + Public Property CveRuta As String + Public Property CveAF As Integer + Public Property CvePersonal As String + Public Property CveEmpresa As Integer + Public Property Fecha As String +#End Region + +#Region "Funciones básicas" + Sub New(Optional TransaccionCompartida As SqlTransaction = Nothing) + + If TransaccionCompartida Is Nothing Then + SqlConexion = New SqlConnection + SqlConexion.ConnectionString = ConfigurationManager.ConnectionStrings("Conexion").ConnectionString + Try + SqlConexion.Open() + Catch ex As Exception + OnError("Ocurrió un error al intentar conectarse a la base de datos.", ex) + End Try + Else + SqlConexion = TransaccionCompartida.Connection + SqlTransacc = TransaccionCompartida + End If + + SqlAdapter = New SqlDataAdapter("", SqlConexion) + ConexionAdd() + End Sub + Private Sub DataAdapter(StrSQL As String, Optional TipoComando As CommandType = CommandType.StoredProcedure) + With SqlAdapter.SelectCommand + .Parameters.Clear() + .CommandText = StrSQL + .CommandType = TipoComando + End With + If Not SqlTransacc Is Nothing Then SqlAdapter.SelectCommand.Transaction = SqlTransacc + Data = New DataTable + End Sub +#Region "Conexiones" + + Private Sub ConexionAdd() + If ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then + Try + DataAdapter("PA_Sis_RegistrarConexion") + With SqlAdapter.SelectCommand.Parameters + .Add("@Clase", SqlDbType.VarChar).Value = Me.GetType().Name + .Add("@Modulo", SqlDbType.VarChar).Value = String.Format("{0}?{1}", HttpContext.Current.Request.Url.AbsolutePath.ToString, HttpContext.Current.Request.QueryString.ToString) + .Add("@IDConexion", SqlDbType.Int).Direction = ParameterDirection.Output + End With + SqlAdapter.Fill(Data) + CveConexion = SqlAdapter.SelectCommand.Parameters("@IDConexion").Value.ToString.ToEntero + Catch ex As Exception + OnError("Ocurrió un error registrar la conexión.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + End If + End Sub + + Private Sub ConexionClose() + If CveConexion > 0 AndAlso ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then + + DataAdapter(String.Format("UPDATE Sis_Conexiones SET FechaCierre = GETDATE() WHERE CveConexion = {0}", CveConexion), CommandType.Text) + + Try + SqlAdapter.Fill(Data) + + Catch ex As Exception + OnError("Ocurrió un error registrar la conexión.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + CveConexion = 0 + End If + + End Sub +#End Region + Public Function IniciaTransacSQL() As SqlTransaction + If SqlTransacc Is Nothing Then SqlTransacc = SqlConexion.BeginTransaction() + Return SqlTransacc + End Function + Public Sub RollBack() + SqlTransacc.Rollback() + End Sub + Public Sub Commit() + SqlTransacc.Commit() + End Sub + Protected Overridable Sub Dispose(ByVal disposing As Boolean) + If Not disposedValue Then + If disposing Then + If Not Data Is Nothing Then Data.Dispose() : Data = Nothing + If Not DSet Is Nothing Then DSet.Dispose() : DSet = Nothing + If Not SqlAdapter Is Nothing Then SqlAdapter.Dispose() : SqlAdapter = Nothing + If Not SqlCommand Is Nothing Then SqlCommand.Dispose() : SqlCommand = Nothing + If Not SqlTransacc Is Nothing Then SqlTransacc.Dispose() : SqlTransacc = Nothing + If SqlConexion.State <> ConnectionState.Closed Then SqlConexion.Close() + If Not SqlConexion Is Nothing Then SqlConexion.Dispose() : SqlConexion = Nothing + + End If + End If + disposedValue = True + End Sub + Public Sub Dispose() Implements IDisposable.Dispose + ConexionClose() + Dispose(True) + GC.SuppressFinalize(Me) + End Sub +#End Region + + Public Function AddViajes(CveRuta As Integer, CveAF As Integer, CvePersonal As Integer, CveEmpresa As Integer, Fecha As DateTime) As Integer + Dim Retorno As Integer = -1 + + DataAdapter("PA_Trans_ViajesAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveViaje", SqlDbType.Int).Direction = ParameterDirection.Output + .Add("@CveRuta", SqlDbType.Int).Value = CveRuta + .Add("@CveAF", SqlDbType.Int).Value = CveAF + .Add("@CvePersonal", SqlDbType.Int).Value = CvePersonal + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@Fecha", SqlDbType.DateTime).Value = Fecha + + End With + + Try + SqlAdapter.Fill(Data) + Retorno = SqlAdapter.SelectCommand.Parameters("@CveViaje").Value.ToString.ToEntero + + Catch ex As Exception + OnError("Ocurrió un error al guardar el nuevo viaje.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function +End Class diff --git a/Transportes/ContratoTransporte.aspx b/Transportes/ContratoTransporte.aspx new file mode 100644 index 000000000..ba6064227 --- /dev/null +++ b/Transportes/ContratoTransporte.aspx @@ -0,0 +1,159 @@ +<%@ Page Language="VB" AutoEventWireup="false" MasterPageFile="~/Site.master" CodeFile="ContratoTransporte.aspx.vb" + Inherits="ContratoTransportes" %> + + + Registro de Contratos + + + + + + + + +
+
+
+
+ Datos del Contrato +
+ ../SAT/ +
+ +
+ <%-- cveCliente--%> +
+
+ +
+
+ +
+ +
+ + + + +
+
+ +
+ +
+ + + + +
+
+ +
+ +
+
+ + + + + +
+
+
+ +
+ +
+
+ + + + + +
+
+
+ +
+
+ + +
+
+ +
+ +
+ + + + +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+
+ + + + +
+ + +
+
+ + diff --git a/Transportes/ContratoTransporte.aspx.vb b/Transportes/ContratoTransporte.aspx.vb new file mode 100644 index 000000000..2243b0433 --- /dev/null +++ b/Transportes/ContratoTransporte.aspx.vb @@ -0,0 +1,116 @@ +Option Explicit On +Option Strict On +Imports ADSNetLibrary.SIGAPI.Helpers +Imports Extensiones +Imports Extensiones.ModExtensiones + +Partial Class ContratoTransportes + Inherits ClsPaginas + + Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load + + If Not IsPostBack Then + DdlClientes.setEsWebService(True) + + If Not String.IsNullOrEmpty(Request.QueryString("CveContrato")) Then + + Dim id As Integer = Convert.ToInt32(Request.QueryString("CveContrato")) + Dim ObjContratos As New ClsContratos + ObjContratos.GetContratos(id, UsuarioActual.CveEmpresa) + + Dim fechaSalida As DateTime + Dim fechaRegreso As DateTime + + If DateTime.TryParse(ObjContratos.FechaInicial.ToString, fechaSalida) And DateTime.TryParse(ObjContratos.FechaFinal.ToString, fechaRegreso) Then + TxtFechaSalida.Text = fechaSalida.ToString("yyyy-MM-dd HH:mm:ss").Replace(" ", "T") + TxtFechaRegreso.Text = fechaRegreso.ToString("yyyy-MM-dd HH:mm:ss").Replace(" ", "T") + End If + + TxtDescripcion.Text = ObjContratos.DescripcionContrato + TxtObservaciones.Text = ObjContratos.DescripcionContrato + TxtUbicacion.Text = ObjContratos.Ubicacion + + + DdlClientes.DataValueField = ObjContratos.CveCliente.ToString + BtnGuardar.Text = "Editar" + End If + + End If + End Sub + + + Protected Sub AddContrato(sender As Object, e As EventArgs) + Dim ObjContratos As New ClsContratos + + + ObjContratos.IniciaTransacSQL() + Page.Response.Write("") + If DdlClientes.SelectedValue = "" Then + Alert("Debe seleccionar al cliente", TipoMensaje.MsgAdvertencia) + Exit Sub + Else + Try + + If BtnGuardar.Text = "Guardar" Then + + Page.Response.Write("") + + Dim CveEstatusInicial As Integer = 10 + Dim CveContratoHijo As Integer = -1 + Dim CveContratoTipo As Integer = 2 + If ObjContratos.GetContratosEstatus(UsuarioActual.CveEmpresa) Then + CveEstatusInicial = ObjContratos.DtResultados.FiltroPrimeroValor("CveContratoEstatus", "TipoEstatus=1").ToEntero + End If + CveContratoHijo = ObjContratos.AddContratos("", TxtDescripcion.Text, "", UsuarioActual.CveProveedor, DdlClientes.SelectedValue.ToEntero, -1, TxtFechaSalida.Text.ToDate, TxtFechaRegreso.Text.ToDate, TxtUbicacion.Text, "", 10, -1, -1, -1, -1, "", "", -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, False, -1, -1, -1, -1, 0, CveContratoTipo:=2, CveContratosEstatus:=1) + + + If CveContratoHijo > 0 Then + ObjContratos.Commit() + Alert("El Contrato se registró Correctamente.", TipoMensaje.MsgInformacion) + TxtDescripcion.Text = "" + TxtFechaSalida.Text = "" + TxtFechaRegreso.Text = "" + TxtObservaciones.Text = "" + TxtUbicacion.Text = "" + DdlClientes.SelectedValue = "" + + End If + Else + Dim id As Integer = Convert.ToInt32(Request.QueryString("CveContrato")) + + Dim ContratoEditado As New ClsContratos + ContratoEditado.GetContratos(id, UsuarioActual.CveEmpresa) + + Dim CveEstatusInicial As Integer = 10 + Dim Editar As Boolean = False + Dim CveContratoTipo As Integer = 2 + + If ContratoEditado.GetContratosEstatus(UsuarioActual.CveEmpresa) Then + CveEstatusInicial = ContratoEditado.DtResultados.FiltroPrimeroValor("CveContratoEstatus", "TipoEstatus=1").ToEntero + End If + + Editar = ContratoEditado.UpdateContratos(ContratoEditado.CveContrato, id.ToString, TxtDescripcion.Text, ContratoEditado.NumeroLicitacion, ContratoEditado.CveProveedor, ContratoEditado.CveCliente, -1, TxtFechaSalida.Text.ToDate, TxtFechaRegreso.Text.ToDate, TxtUbicacion.Text, "", ContratoEditado.CveSubProyecto, ContratoEditado.PorIVA, ContratoEditado.PorAnticipo, ContratoEditado.PorAmortizacionAnticipo, ContratoEditado.PorGarantia, "", "", ContratoEditado.CveContratoPadre, ContratoEditado.CveUsuario, ContratoEditado.CveEmpresa, False, -1, -1, -1, ContratoEditado.CveMoneda, ContratoEditado.ModalidadDetalle, CveContratoTipo:=ContratoEditado.CveContratoTipo, CveContratosEstatus:=ContratoEditado.CveContratosEstatus) + + Page.Response.Write("") + + If Editar = True Then + ContratoEditado.Commit() + Alert("El Contrato se modificó Correctamente.", TipoMensaje.MsgInformacion) + End If + End If + + Catch ex As Exception + ObjContratos.RollBack() + Finally + ObjContratos.Dispose() + Response.Redirect("ListadoContratos.aspx") + + End Try + End If + + End Sub + + + + +End Class diff --git a/Transportes/CrearViaje.aspx b/Transportes/CrearViaje.aspx index 6dd2878c9..fe19847f4 100644 --- a/Transportes/CrearViaje.aspx +++ b/Transportes/CrearViaje.aspx @@ -36,7 +36,7 @@ class="col-md-8"> +
-
+
-
+
- ", "")) + DdlTransporte.Items.Insert(0, New ListItem("Seleccione Transporte", "")) End If End If ObjAF.Dispose() 'Lista Rutas' - Dim ObjRutas As New ClsRH() - If ObjRutas.GetRutas(7) Then + Dim ObjRutas As New ClsRutas() + If ObjRutas.GetRutas(-1, -1, -1, "", True, DateTime.Now) Then Page.Response.Write("") If ObjRutas.DtResultados.Rows.Count > 0 Then DdlRutas.DataSource = ObjRutas.DtResultados DdlRutas.DataBind() - DdlRutas.Items.Insert(0, New ListItem("<--Seleccione Ruta-->", "")) - - DdlPartida.DataSource = ObjRutas.DtResultados - DdlPartida.DataBind() - DdlPartida.Items.Insert(0, New ListItem("<--Seleccione Partida-->", "")) - - DdlDestino.DataSource = ObjRutas.DtResultados - DdlDestino.DataBind() - DdlDestino.Items.Insert(0, New ListItem("<--Seleccione Destino-->", "")) - + DdlRutas.Items.Insert(0, New ListItem("Seleccione Ruta", "")) End If End If ObjRutas.Dispose() - 'Lista Chofer' - 'GlobalDTRHPersonal()' - 'CvePersonal - Text Nombre COmpleto' - Dim ObjAcar As New ClsAcarreos() - If ObjAcar.GetChofer(-1, UsuarioActual.CveEmpresa, 1, -1) Then - DdlChofer.DataSource = ObjAcar.DtResultados - DdlChofer.DataBind() - DdlChofer.Items.Insert(0, New ListItem("<--Seleccione Chofer-->", "")) + 'Lista Destinos' + Dim ObjDestinos As New ClsDestinos() + If ObjDestinos.GetDestinos(-1, -1, -1, "", True, True, DateTime.Now) Then + Page.Response.Write("") + + If ObjDestinos.DtResultados.Rows.Count > 0 Then + + DdlPartida.DataSource = ObjDestinos.DtResultados + DdlPartida.DataBind() + DdlPartida.Items.Insert(0, New ListItem("Seleccione Partida", "")) + + DdlDestino.DataSource = ObjDestinos.DtResultados + DdlDestino.DataBind() + DdlDestino.Items.Insert(0, New ListItem("Seleccione Destino", "")) + End If End If - ObjAcar.Dispose() + ObjRutas.Dispose() + 'Lista Chofer' + DdlChofer.DataSource = GlobalDTRHPersonal(UsuarioActual.CveEmpresa) + DdlChofer.DataBind() + DdlChofer.Items.Insert(0, New ListItem("Seleccione Chofer", "")) + End Sub Protected Sub AddViaje(sender As Object, e As EventArgs) - 'Dónde están los PA para agregar viajes?' - 'Dónde están los PA para consultar Destinos y rutas viajes?' - 'Por qué siempre cambia el aside de Transportes V&A?' - Page.Response.Write("") + Dim ObjViajes As New ClsViajes() + If ObjViajes.AddViajes(DdlRutas.Text.ToEntero, DdlTransporte.Text.ToEntero, DdlChofer.Text.ToEntero, UsuarioActual.CveEmpresa.ToEntero, TxtFechaViaje.Text.ToDate) = -1 Then + Alert("El Contrato se agregó correctamente.", TipoMensaje.MsgAdvertencia) + End If End Sub End Class \ No newline at end of file diff --git a/Transportes/ListadoContratos.aspx b/Transportes/ListadoContratos.aspx new file mode 100644 index 000000000..ce2b31699 --- /dev/null +++ b/Transportes/ListadoContratos.aspx @@ -0,0 +1,108 @@ +<%@ Page Language="VB" AutoEventWireup="false" MasterPageFile="~/Site.master" CodeFile="ListadoContratos.aspx.vb" + Inherits="ListadoContratos" %> + + + Listado de Contratos + + + + + + + + + +
  • + Agregar Contrato +
  • +
  • + Crear Viaje +
  • +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + Fecha
    + Salida +
    + + + +
    + + + + Fecha
    + Regreso +
    + + + +
    + + + + + + + +
    +
    + +
    +
    + + diff --git a/Transportes/ListadoContratos.aspx.vb b/Transportes/ListadoContratos.aspx.vb new file mode 100644 index 000000000..8a0cd53c3 --- /dev/null +++ b/Transportes/ListadoContratos.aspx.vb @@ -0,0 +1,57 @@ +Option Explicit On +Option Strict On + +Partial Class ListadoContratos + + Inherits ClsPaginas + + Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load + If Not IsPostBack Then + CargaDatos() + End If + End Sub + + Private Sub CargaDatos() + Dim ObjContratos As New ClsContratos + + If ObjContratos.GetContratos(-1, UsuarioActual.CveEmpresa, TipoContrato:=2) Then + GvContratos.DataSource = ObjContratos.DtResultados + Else + Me.GvContratos.DataSource = Nothing + End If + + ObjContratos.Dispose() + GvContratos.DataBind() + End Sub + + Protected Sub GvContratos_Comandos(sender As Object, e As GridViewCommandEventArgs) + Dim id As Integer = Convert.ToInt32(e.CommandArgument) + Dim url As String = $"ContratoTransporte.aspx?CveContrato={id}" + + If e.CommandName = "Editar" Then + Dim script As String = $"window.open('{url}', '_blank');" + Page.ClientScript.RegisterStartupScript(Me.GetType(), "OpenWindow", script, True) + End If + + If e.CommandName = "Eliminar" Then + Dim ObjContratos As New ClsContratos + ObjContratos.IniciaTransacSQL() + + Try + ObjContratos.RemoveContrato(id, UsuarioActual.CveEmpresa) + ObjContratos.Commit() + Catch ex As Exception + ObjContratos.RollBack() + Finally + ObjContratos.Dispose() + Response.Redirect("ListadoContratos.aspx") + End Try + + End If + + + + End Sub + + +End Class