-- Se pasó fecha inicial abajo, se cambió CveRuta por Ruta descriptiva, se cambio "activo" por sí en la columna de viajes masivos, se quitó generar viajes masivos cuando es update, se implementó buscadores en Listado de viajes y contratos y se usó función cargarDatos() en vez de refrescar la página
This commit is contained in:
@@ -3,7 +3,7 @@ Imports System.Data
|
|||||||
Imports System.Data.SqlClient
|
Imports System.Data.SqlClient
|
||||||
Imports Extensiones
|
Imports Extensiones
|
||||||
|
|
||||||
Public Class ClsViajes
|
Public Class ClsTransportes
|
||||||
Implements IDisposable
|
Implements IDisposable
|
||||||
|
|
||||||
#Region "Campos"
|
#Region "Campos"
|
||||||
@@ -194,7 +194,7 @@ Public Class ClsViajes
|
|||||||
Return Retorno
|
Return Retorno
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Public Function RemoveViaje(CveViaje As Integer, Optional CveMasivo As Integer = 0) As Boolean
|
Public Function RemoveViaje(Optional CveViaje As Integer = -1, Optional CveMasivo As Integer = -1) As Boolean
|
||||||
Dim Retorno As Boolean = False
|
Dim Retorno As Boolean = False
|
||||||
|
|
||||||
|
|
||||||
@@ -34,6 +34,9 @@
|
|||||||
<asp:Content ID="Content1" ContentPlaceHolderID="HB" runat="Server">
|
<asp:Content ID="Content1" ContentPlaceHolderID="HB" runat="Server">
|
||||||
<asp:UpdatePanel runat="server">
|
<asp:UpdatePanel runat="server">
|
||||||
<ContentTemplate>
|
<ContentTemplate>
|
||||||
|
<li>
|
||||||
|
<asp:LinkButton ID="LBAgregarContrato" runat="server"><i class='fa fa-plus'></i>Agregar Contrato</asp:LinkButton>
|
||||||
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<asp:HyperLink ID="LBListadoContratos" runat="server" NavigateUrl="ListadoContratos.aspx"
|
<asp:HyperLink ID="LBListadoContratos" runat="server" NavigateUrl="ListadoContratos.aspx"
|
||||||
Target="_blank"><i class='fa fa-file'></i>Contratos</asp:HyperLink>
|
Target="_blank"><i class='fa fa-file'></i>Contratos</asp:HyperLink>
|
||||||
@@ -42,22 +45,25 @@
|
|||||||
<asp:HyperLink ID="LBListadoViajes" runat="server" NavigateUrl="ListadoViajes.aspx"
|
<asp:HyperLink ID="LBListadoViajes" runat="server" NavigateUrl="ListadoViajes.aspx"
|
||||||
Target="_blank"><i class='fa fa-road'></i>Viajes</asp:HyperLink>
|
Target="_blank"><i class='fa fa-road'></i>Viajes</asp:HyperLink>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
</ContentTemplate>
|
</ContentTemplate>
|
||||||
</asp:UpdatePanel>
|
</asp:UpdatePanel>
|
||||||
</asp:Content>
|
</asp:Content>
|
||||||
|
|
||||||
<asp:Content ID="Content7" ContentPlaceHolderID="C" runat="Server">
|
<asp:Content ID="Content7" ContentPlaceHolderID="C" runat="Server">
|
||||||
|
|
||||||
|
<div class="row my-1" style="margin-right: 10px; margin-top: 18px;" align="right">
|
||||||
|
<input type="text" id="TxtBusqueda" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBusqueda','{0}')", GvContratos.ClientID) %>"
|
||||||
|
style="display: inline-block; margin-right: -20px; width: 150px;" />
|
||||||
|
<a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBusqueda','{0}')", GvContratos.ClientID) %>"
|
||||||
|
style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier">
|
||||||
|
</i></a>
|
||||||
|
</div>
|
||||||
<contenttemplate>
|
<contenttemplate>
|
||||||
|
|
||||||
<div class="row" style="margin-block: 10px; margin-right: 10px;" align="right">
|
|
||||||
<asp:LinkButton OnClick="MostrarModal" runat="server" AlternateText="Agregar"
|
|
||||||
CssClass="btn btn-sm blue" align="right" Text="Agregar<i class='fa fa-plus'></i>" />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<asp:GridView ID="GvContratos" runat="server" AutoGenerateColumns="false" EmptyDataText="No se Encontró Contrato Registrado"
|
<asp:GridView ID="GvContratos" runat="server" AutoGenerateColumns="false" EmptyDataText="No se Encontró Contrato Registrado"
|
||||||
CssClass="table table-striped table-hover Widthall ScrollAD text-center" GridLines="None"
|
CssClass="table table-striped table-hover Widthall ScrollAD text-center" GridLines="None"
|
||||||
data-sort="true" DataKeyNames="CveContrato, DescripcionContrato, Ubicacion, FechaInicial, FechaFinal, CveCliente, CveTipoAF, CveContratoEstatus ">
|
data-sort="true" DataKeyNames="CveContrato, DescripcionContrato, Ubicacion, FechaInicial, FechaFinal, CveCliente, CveTipoAF ">
|
||||||
<Columns>
|
<Columns>
|
||||||
|
|
||||||
<asp:TemplateField HeaderText="No. Contrato">
|
<asp:TemplateField HeaderText="No. Contrato">
|
||||||
@@ -264,7 +270,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</contenttemplate>
|
</contenttemplate>
|
||||||
</asp:Content>
|
</asp:Content>
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
Option Explicit On
|
Option Explicit On
|
||||||
Option Strict On
|
Option Strict On
|
||||||
Imports Extensiones
|
Imports Extensiones.ModExtensiones
|
||||||
|
|
||||||
Partial Class ListadoContratos
|
Partial Class ListadoContratos
|
||||||
Inherits ClsPaginas
|
Inherits ClsPaginas
|
||||||
@@ -19,11 +19,11 @@ Partial Class ListadoContratos
|
|||||||
If ObjAF.GetActivosFijos(-1, 13, "-1", "-1", -1, -1, "-1", -1, -1, -1, -1, 1, "-1", -1, -1, -1) Then
|
If ObjAF.GetActivosFijos(-1, 13, "-1", "-1", -1, -1, "-1", -1, -1, -1, -1, 1, "-1", -1, -1, -1) Then
|
||||||
If ObjAF.DtResultados.Rows.Count > 0 Then
|
If ObjAF.DtResultados.Rows.Count > 0 Then
|
||||||
DdlTransporte.DataSource = ObjAF.DtResultados
|
DdlTransporte.DataSource = ObjAF.DtResultados
|
||||||
DdlTransporte.Items.Insert(0, New ListItem("Seleccione", "0"))
|
DdlTransporte.Items.Insert(0, New ListItem("Seleccione", ""))
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
ObjAF.Dispose()
|
|
||||||
DdlTransporte.DataBind()
|
DdlTransporte.DataBind()
|
||||||
|
ObjAF.Dispose()
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub CargaDatos()
|
Private Sub CargaDatos()
|
||||||
@@ -35,7 +35,7 @@ Partial Class ListadoContratos
|
|||||||
GvContratos.DataBind()
|
GvContratos.DataBind()
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Protected Sub MostrarModal(sender As Object, e As System.EventArgs)
|
Protected Sub MostrarModal()
|
||||||
TxtDescripcion.Text = ""
|
TxtDescripcion.Text = ""
|
||||||
TxtFechaSalida.Text = ""
|
TxtFechaSalida.Text = ""
|
||||||
TxtFechaRegreso.Text = ""
|
TxtFechaRegreso.Text = ""
|
||||||
@@ -45,7 +45,9 @@ Partial Class ListadoContratos
|
|||||||
BtnGuardar.Text = "Guardar"
|
BtnGuardar.Text = "Guardar"
|
||||||
RegistraScript(String.Format("$('#{0}').modal('show');", "ModalAgregar"))
|
RegistraScript(String.Format("$('#{0}').modal('show');", "ModalAgregar"))
|
||||||
End Sub
|
End Sub
|
||||||
|
Private Sub LBAgregarContrato_Click(sender As Object, e As EventArgs) Handles LBAgregarContrato.Click
|
||||||
|
MostrarModal()
|
||||||
|
End Sub
|
||||||
Protected Sub AddContrato(sender As Object, e As EventArgs)
|
Protected Sub AddContrato(sender As Object, e As EventArgs)
|
||||||
|
|
||||||
If DdlClientes.SelectedValue = "" Then
|
If DdlClientes.SelectedValue = "" Then
|
||||||
@@ -57,51 +59,29 @@ Partial Class ListadoContratos
|
|||||||
ObjContratos.IniciaTransacSQL()
|
ObjContratos.IniciaTransacSQL()
|
||||||
Try
|
Try
|
||||||
|
|
||||||
If BtnGuardar.Text = "Guardar" Then
|
|
||||||
|
|
||||||
Dim CveEstatusInicial As Integer = 10
|
Dim CveEstatusInicial As Integer = 10
|
||||||
Dim CveContratoHijo As Integer = -1
|
Dim CveContratoHijo As Integer = -1
|
||||||
Dim CveContratoTipo As Integer = 2
|
Dim CveContratoTipo As Integer = 2
|
||||||
|
|
||||||
If ObjContratos.GetContratosEstatus(UsuarioActual.CveEmpresa) Then
|
If ObjContratos.GetContratosEstatus(UsuarioActual.CveEmpresa) Then
|
||||||
CveEstatusInicial = ObjContratos.DtResultados.FiltroPrimeroValor("CveContratoEstatus", "TipoEstatus=1").ToEntero
|
CveEstatusInicial = ObjContratos.DtResultados.FiltroPrimeroValor("CveContratoEstatus", "TipoEstatus=1").ToEntero
|
||||||
End If
|
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, CveTipoAF:=DdlTransporte.SelectedValue.ToEntero)
|
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, CveTipoAF:=DdlTransporte.SelectedValue.ToEntero)
|
||||||
|
|
||||||
|
|
||||||
If CveContratoHijo > 0 Then
|
If CveContratoHijo > 0 Then
|
||||||
ObjContratos.Commit()
|
ObjContratos.Commit()
|
||||||
Alert("Agregado Correctamente.")
|
Alert("Agregado Correctamente.")
|
||||||
TxtDescripcion.Text = ""
|
TxtDescripcion.Text = ""
|
||||||
TxtFechaSalida.Text = ""
|
TxtFechaSalida.Text = ""
|
||||||
TxtFechaRegreso.Text = ""
|
TxtFechaRegreso.Text = ""
|
||||||
TxtObservaciones.Text = ""
|
TxtObservaciones.Text = ""
|
||||||
TxtUbicacion.Text = ""
|
TxtUbicacion.Text = ""
|
||||||
DdlClientes.SelectedValue = ""
|
DdlClientes.SelectedValue = ""
|
||||||
DdlTransporte.SelectedValue = ""
|
DdlTransporte.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)
|
|
||||||
|
|
||||||
If Editar = True Then
|
|
||||||
ContratoEditado.Commit()
|
|
||||||
Alert("El contrato se modificó correctamente.")
|
|
||||||
End If
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
@@ -116,9 +96,9 @@ Partial Class ListadoContratos
|
|||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Protected Sub UpdateContrato(sender As Object, e As EventArgs)
|
Protected Sub UpdateContrato(sender As Object, e As EventArgs)
|
||||||
|
|
||||||
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
||||||
|
|
||||||
Page.Response.Write("<script>console.log('El resultado de tu variable" + GvRow.DataKey("CveTipoAF") + "')</script>")
|
|
||||||
Dim fechaInicial As DateTime
|
Dim fechaInicial As DateTime
|
||||||
Dim fechaFinal As DateTime
|
Dim fechaFinal As DateTime
|
||||||
|
|
||||||
@@ -126,7 +106,7 @@ Partial Class ListadoContratos
|
|||||||
TxtDescripcion.Text = GvRow.DataKey("DescripcionContrato")
|
TxtDescripcion.Text = GvRow.DataKey("DescripcionContrato")
|
||||||
TxtObservaciones.Text = GvRow.DataKey("DescripcionContrato")
|
TxtObservaciones.Text = GvRow.DataKey("DescripcionContrato")
|
||||||
TxtUbicacion.Text = GvRow.DataKey("Ubicacion")
|
TxtUbicacion.Text = GvRow.DataKey("Ubicacion")
|
||||||
'DdlTransporte.SelectedValue = GvRow.DataKey("CveActivoFijo")
|
DdlTransporte.SelectedValue = GvRow.DataKey("CveTipoAF")
|
||||||
If DateTime.TryParse(GvRow.DataKey("FechaInicial").ToString, fechaInicial) And DateTime.TryParse(GvRow.DataKey("FechaFinal").ToString, fechaFinal) Then
|
If DateTime.TryParse(GvRow.DataKey("FechaInicial").ToString, fechaInicial) And DateTime.TryParse(GvRow.DataKey("FechaFinal").ToString, fechaFinal) Then
|
||||||
TxtFechaSalida.Text = fechaInicial.ToString("yyyy-MM-dd HH:mm:ss").Replace(" ", "T")
|
TxtFechaSalida.Text = fechaInicial.ToString("yyyy-MM-dd HH:mm:ss").Replace(" ", "T")
|
||||||
TxtFechaRegreso.Text = fechaFinal.ToString("yyyy-MM-dd HH:mm:ss").Replace(" ", "T")
|
TxtFechaRegreso.Text = fechaFinal.ToString("yyyy-MM-dd HH:mm:ss").Replace(" ", "T")
|
||||||
|
|||||||
@@ -14,17 +14,21 @@
|
|||||||
.fecha {
|
.fecha {
|
||||||
padding: 3px;
|
padding: 3px;
|
||||||
}
|
}
|
||||||
.masivo{
|
|
||||||
color:green;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
.masivo {
|
||||||
|
color: green;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
</asp:Content>
|
</asp:Content>
|
||||||
|
|
||||||
<asp:Content ID="Content1" ContentPlaceHolderID="HB" runat="Server">
|
<asp:Content ID="Content1" ContentPlaceHolderID="HB" runat="Server">
|
||||||
<contenttemplate>
|
<contenttemplate>
|
||||||
<li>
|
<li>
|
||||||
<asp:HyperLink ID="LBListadoContratos" runat="server" NavigateUrl="ListadoContratos.aspx"
|
<asp:LinkButton ID="LBAgregarViaje" runat="server"
|
||||||
|
><i class='fa fa-plus'></i>Agregar viaje</asp:LinkButton>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<asp:HyperLink ID="LBListadoContratos" runat="server" NavigateUrl="ListadoContratos.aspx"
|
||||||
Target="_blank"><i class='fa fa-file'></i>Contratos</asp:HyperLink>
|
Target="_blank"><i class='fa fa-file'></i>Contratos</asp:HyperLink>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
@@ -37,20 +41,22 @@
|
|||||||
|
|
||||||
<asp:Content ID="Content7" ContentPlaceHolderID="C" runat="Server">
|
<asp:Content ID="Content7" ContentPlaceHolderID="C" runat="Server">
|
||||||
|
|
||||||
|
<div class="row my-1" style="margin-right: 10px; margin-top: 18px;" align="right">
|
||||||
<div class="row" style="margin-block: 10px; margin-right: 10px;" align="right">
|
<input type="text" id="TxtBusqueda" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBusqueda','{0}')", GvViajes.ClientID) %>"
|
||||||
<asp:LinkButton OnClick="MostrarModal" runat="server" AlternateText="Agregar"
|
style="display: inline-block; margin-right: -20px; width: 150px;" />
|
||||||
CssClass="btn btn-sm blue" align="right" Text="Agregar<i class='fa fa-plus'></i>" />
|
<a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBusqueda','{0}')", GvViajes.ClientID) %>"
|
||||||
|
style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier">
|
||||||
|
</i></a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<asp:GridView ID="GvViajes" runat="server" AutoGenerateColumns="false" EmptyDataText="No se encontró ningún viaje registrado"
|
<asp:GridView ID="GvViajes" runat="server" AutoGenerateColumns="false" EmptyDataText="No se encontró ningún viaje registrado"
|
||||||
CssClass="table table-striped table-hover Widthall ScrollAD text-center" GridLines="None"
|
CssClass="table table-striped table-hover Widthall ScrollAD text-center" GridLines="None"
|
||||||
data-sort="true" DataKeyNames="CveViaje, CveRuta, Fecha, CveAF, CvePersonal, CveEmpresa, CvePartida, CveDestino, CveMasivo">
|
data-sort="true" DataKeyNames="CveViaje, CveRuta, Fecha, CveAF, CvePersonal, CveEmpresa, CvePartida, CveDestino, CveMasivo, Ruta">
|
||||||
<Columns>
|
<Columns>
|
||||||
|
|
||||||
<asp:TemplateField HeaderText="Ruta">
|
<asp:TemplateField HeaderText="Ruta">
|
||||||
<ItemTemplate>
|
<ItemTemplate>
|
||||||
<asp:Literal ID="LtlRuta" runat="server" Text='<%# Eval("CveRuta") %>'></asp:Literal>
|
<asp:Literal ID="LtlRuta" runat="server" Text='<%# Eval("Ruta") %>'></asp:Literal>
|
||||||
</ItemTemplate>
|
</ItemTemplate>
|
||||||
</asp:TemplateField>
|
</asp:TemplateField>
|
||||||
|
|
||||||
@@ -139,7 +145,7 @@
|
|||||||
|
|
||||||
<div class="row margin-bottom-5" id="TrRutas" runat="server">
|
<div class="row margin-bottom-5" id="TrRutas" runat="server">
|
||||||
<label class="col-md-4 bold">
|
<label class="col-md-4 bold">
|
||||||
<asp:Label runat="server" Text="Seleccione Ruta:"></asp:Label></label><div
|
<asp:Label runat="server" Text="Ruta:"></asp:Label></label><div
|
||||||
class="col-md-8">
|
class="col-md-8">
|
||||||
|
|
||||||
<asp:DropDownList ID="DdlRutas" AppendDataBoundItems="true" DataTextField="Ruta"
|
<asp:DropDownList ID="DdlRutas" AppendDataBoundItems="true" DataTextField="Ruta"
|
||||||
@@ -229,22 +235,31 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row my-1 truncate">
|
||||||
<asp:CheckBox CssClass="col-md-4" ID="IsMasivo" runat="server" Text="Generar Viajes Masivo"
|
<asp:CheckBox CssClass="col-md-4" ID="IsMasivo" runat="server" Text="Generar Viajes Masivo"
|
||||||
|
Visible="true"
|
||||||
OnCheckedChanged="ToggleMasivo" AutoPostBack="true" />
|
OnCheckedChanged="ToggleMasivo" AutoPostBack="true" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row my-1 truncate">
|
||||||
<asp:Panel ID="DivFechaMasivo" runat="server" Visible="false" CssClass="col-md-8">
|
<asp:Panel ID="DivFechaMasivo" runat="server" Visible="false" CssClass="col-md-8">
|
||||||
<div class="row col-md-8">
|
<div class="row my-1 truncate date date-picker">
|
||||||
<label class="col-md-4 bold">Fecha Inicial:</label>
|
<label class="col-md-4 bold">Fecha Inicial:</label>
|
||||||
<asp:TextBox CssClass="col-md-8" ID="TxtFechaInicial" runat="server" type="date"></asp:TextBox>
|
<asp:TextBox CssClass="col-md-8" ID="TxtFechaInicial" runat="server" type="date"
|
||||||
|
Width="150px"></asp:TextBox>
|
||||||
</div>
|
</div>
|
||||||
<div class="row col-md-8 ">
|
<div class="row my-1 truncate">
|
||||||
<label class="col-md-4 bold">Lapso</label>
|
<label class="col-md-4 bold">Lapso</label>
|
||||||
<asp:TextBox CssClass="col-md-8" ID="TxtFrecuencia" runat="server" type="number"></asp:TextBox>
|
<asp:TextBox CssClass="col-md-8" ID="TxtFrecuencia" runat="server" type="number"
|
||||||
|
Width="150px"></asp:TextBox>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</asp:Panel>
|
</asp:Panel>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
|
|||||||
@@ -10,31 +10,11 @@ Partial Class ListadoViajes
|
|||||||
|
|
||||||
If Not IsPostBack Then
|
If Not IsPostBack Then
|
||||||
CargaDatos()
|
CargaDatos()
|
||||||
|
InicializaCombos()
|
||||||
End If
|
End If
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
|
Private Sub InicializaCombos()
|
||||||
Private Sub GvViajes_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvViajes.RowDataBound
|
|
||||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
|
||||||
If e.Row.DBCampo("CveMasivo") <> "" Then
|
|
||||||
e.Row.FCLabel("LtlMasivo").Text = "Sí"
|
|
||||||
e.Row.FCLabel("LtlMasivo").ForeColor = Drawing.Color.Green
|
|
||||||
End If
|
|
||||||
End If
|
|
||||||
End Sub
|
|
||||||
Private Sub CargaDatos()
|
|
||||||
|
|
||||||
Dim ObjViajes As New ClsViajes
|
|
||||||
|
|
||||||
ObjViajes.IniciaTransacSQL()
|
|
||||||
|
|
||||||
If ObjViajes.GetViajes() Then
|
|
||||||
GvViajes.DataSource = ObjViajes.DtResultados
|
|
||||||
ObjViajes.Dispose()
|
|
||||||
GvViajes.DataBind()
|
|
||||||
Else
|
|
||||||
Me.GvViajes.DataSource = Nothing
|
|
||||||
End If
|
|
||||||
'Lista Activos Fijos'
|
'Lista Activos Fijos'
|
||||||
Dim ObjAF As New ClsAF()
|
Dim ObjAF As New ClsAF()
|
||||||
If ObjAF.GetActivosFijos(-1, 13, "-1", "-1", -1, -1, "-1", -1, -1, -1, -1, 1, "-1", -1, -1, -1) Then
|
If ObjAF.GetActivosFijos(-1, 13, "-1", "-1", -1, -1, "-1", -1, -1, -1, -1, 1, "-1", -1, -1, -1) Then
|
||||||
@@ -81,8 +61,31 @@ Partial Class ListadoViajes
|
|||||||
DdlChofer.Items.Insert(0, New ListItem("Seleccione Chofer", ""))
|
DdlChofer.Items.Insert(0, New ListItem("Seleccione Chofer", ""))
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
|
Private Sub GvViajes_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvViajes.RowDataBound
|
||||||
|
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||||
|
If e.Row.DBCampo("CveMasivo") <> "" Then
|
||||||
|
e.Row.FCLabel("LtlMasivo").Text = "Sí"
|
||||||
|
e.Row.FCLabel("LtlMasivo").ForeColor = Drawing.Color.Green
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
End Sub
|
||||||
|
Private Sub CargaDatos()
|
||||||
|
Dim ObjTransportes As New ClsTransportes
|
||||||
|
|
||||||
Protected Sub MostrarModal(sender As Object, e As System.EventArgs)
|
If ObjTransportes.GetViajes() Then
|
||||||
|
GvViajes.DataSource = ObjTransportes.DtResultados
|
||||||
|
ObjTransportes.Dispose()
|
||||||
|
GvViajes.DataBind()
|
||||||
|
End If
|
||||||
|
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Sub LBAgregarViaje_Click(sender As Object, e As EventArgs) Handles LBAgregarViaje.Click
|
||||||
|
MostrarModal()
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Public Sub MostrarModal()
|
||||||
|
IsMasivo.Visible = True
|
||||||
DdlRutas.Text = ""
|
DdlRutas.Text = ""
|
||||||
DdlTransporte.Text = ""
|
DdlTransporte.Text = ""
|
||||||
DdlChofer.Text = ""
|
DdlChofer.Text = ""
|
||||||
@@ -95,10 +98,10 @@ Partial Class ListadoViajes
|
|||||||
|
|
||||||
Protected Sub AddViaje(sender As Object, e As EventArgs)
|
Protected Sub AddViaje(sender As Object, e As EventArgs)
|
||||||
|
|
||||||
Dim ObjViajes As New ClsViajes
|
Dim ObjTransportes As New ClsTransportes
|
||||||
|
|
||||||
|
|
||||||
ObjViajes.IniciaTransacSQL()
|
ObjTransportes.IniciaTransacSQL()
|
||||||
|
|
||||||
If IsMasivo.Checked = True Then
|
If IsMasivo.Checked = True Then
|
||||||
If TxtFechaInicial.Text = "" Or TxtFrecuencia.Text = "" Then
|
If TxtFechaInicial.Text = "" Or TxtFrecuencia.Text = "" Then
|
||||||
@@ -119,10 +122,10 @@ Partial Class ListadoViajes
|
|||||||
For Each fecha As DateTime In fechasGeneradas
|
For Each fecha As DateTime In fechasGeneradas
|
||||||
Try
|
Try
|
||||||
Dim CveContratoHijo As Integer = -1
|
Dim CveContratoHijo As Integer = -1
|
||||||
CveContratoHijo = ObjViajes.AddViajes(DdlRutas.Text.ToEntero, DdlTransporte.Text.ToEntero, DdlChofer.Text.ToEntero, UsuarioActual.CveEmpresa, fecha, DdlPartida.Text.ToEntero, DdlDestino.Text.ToEntero, IsMasivo:=True, CveMasivo:=CveMasivo)
|
CveContratoHijo = ObjTransportes.AddViajes(DdlRutas.Text.ToEntero, DdlTransporte.Text.ToEntero, DdlChofer.Text.ToEntero, UsuarioActual.CveEmpresa, fecha, DdlPartida.Text.ToEntero, DdlDestino.Text.ToEntero, IsMasivo:=True, CveMasivo:=CveMasivo)
|
||||||
|
|
||||||
If CveContratoHijo > 0 Then
|
If CveContratoHijo > 0 Then
|
||||||
ObjViajes.Commit()
|
ObjTransportes.Commit()
|
||||||
End If
|
End If
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
Alert($"Ocurrió un error {ex}", TipoMensaje.MsgError)
|
Alert($"Ocurrió un error {ex}", TipoMensaje.MsgError)
|
||||||
@@ -135,18 +138,18 @@ Partial Class ListadoViajes
|
|||||||
TxtFechaViaje.Text = ""
|
TxtFechaViaje.Text = ""
|
||||||
DdlPartida.Text = ""
|
DdlPartida.Text = ""
|
||||||
DdlDestino.SelectedValue = ""
|
DdlDestino.SelectedValue = ""
|
||||||
ObjViajes.Dispose()
|
ObjTransportes.Dispose()
|
||||||
Response.Redirect("ListadoViajes.aspx")
|
CargaDatos()
|
||||||
Alert("El viaje masivo se registró correctamente.", TipoMensaje.MsgInformacion)
|
Alert("El viaje masivo se registró correctamente.", TipoMensaje.MsgInformacion)
|
||||||
|
|
||||||
Else
|
Else
|
||||||
Try
|
Try
|
||||||
If BtnGuardar.Text = "Guardar" Then
|
If BtnGuardar.Text = "Guardar" Then
|
||||||
Dim CveContratoHijo As Integer = -1
|
Dim CveContratoHijo As Integer = -1
|
||||||
CveContratoHijo = ObjViajes.AddViajes(DdlRutas.Text.ToEntero, DdlTransporte.Text.ToEntero, DdlChofer.Text.ToEntero, UsuarioActual.CveEmpresa, TxtFechaViaje.Text.ToDate, DdlPartida.Text.ToEntero, DdlDestino.Text.ToEntero)
|
CveContratoHijo = ObjTransportes.AddViajes(DdlRutas.Text.ToEntero, DdlTransporte.Text.ToEntero, DdlChofer.Text.ToEntero, UsuarioActual.CveEmpresa, TxtFechaViaje.Text.ToDate, DdlPartida.Text.ToEntero, DdlDestino.Text.ToEntero)
|
||||||
|
|
||||||
If CveContratoHijo > 0 Then
|
If CveContratoHijo > 0 Then
|
||||||
ObjViajes.Commit()
|
ObjTransportes.Commit()
|
||||||
Alert("El Viaje se registró Correctamente.", TipoMensaje.MsgInformacion)
|
Alert("El Viaje se registró Correctamente.", TipoMensaje.MsgInformacion)
|
||||||
DdlRutas.Text = ""
|
DdlRutas.Text = ""
|
||||||
DdlTransporte.Text = ""
|
DdlTransporte.Text = ""
|
||||||
@@ -160,25 +163,25 @@ Partial Class ListadoViajes
|
|||||||
Else
|
Else
|
||||||
Dim id As Integer = Convert.ToInt32(Request.QueryString("CveViaje"))
|
Dim id As Integer = Convert.ToInt32(Request.QueryString("CveViaje"))
|
||||||
|
|
||||||
If ObjViajes.UpdateViajes(id, DdlRutas.Text.ToEntero, DdlTransporte.Text.ToEntero, DdlChofer.Text.ToEntero, UsuarioActual.CveEmpresa, TxtFechaViaje.Text.ToDate, DdlPartida.Text.ToEntero, DdlDestino.Text.ToEntero) = True Then
|
If ObjTransportes.UpdateViajes(id, DdlRutas.Text.ToEntero, DdlTransporte.Text.ToEntero, DdlChofer.Text.ToEntero, UsuarioActual.CveEmpresa, TxtFechaViaje.Text.ToDate, DdlPartida.Text.ToEntero, DdlDestino.Text.ToEntero) = True Then
|
||||||
Alert("El viaje se modificó correctamente.", TipoMensaje.MsgInformacion)
|
Alert("El viaje se modificó correctamente.", TipoMensaje.MsgInformacion)
|
||||||
ObjViajes.Commit()
|
ObjTransportes.Commit()
|
||||||
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
End If
|
End If
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
ObjViajes.RollBack()
|
ObjTransportes.RollBack()
|
||||||
Finally
|
Finally
|
||||||
ObjViajes.Dispose()
|
CargaDatos()
|
||||||
Response.Redirect("ListadoViajes.aspx")
|
ObjTransportes.Dispose()
|
||||||
End Try
|
End Try
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Protected Sub UpdateViaje(sender As Object, e As EventArgs)
|
Protected Sub UpdateViaje(sender As Object, e As EventArgs)
|
||||||
|
IsMasivo.Visible = False
|
||||||
|
DivFechaMasivo.Visible = False
|
||||||
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
||||||
|
|
||||||
DdlTransporte.SelectedValue = GvRow.DataKey("CveAF")
|
DdlTransporte.SelectedValue = GvRow.DataKey("CveAF")
|
||||||
@@ -192,42 +195,38 @@ Partial Class ListadoViajes
|
|||||||
TxtFechaViaje.Text = fecha.ToString("yyyy-MM-dd").Replace(" ", "T")
|
TxtFechaViaje.Text = fecha.ToString("yyyy-MM-dd").Replace(" ", "T")
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
|
||||||
BtnGuardar.Text = "Editar"
|
BtnGuardar.Text = "Editar"
|
||||||
|
|
||||||
RegistraScript(String.Format("$('#{0}').modal('show');", "ModalAgregar"))
|
RegistraScript(String.Format("$('#{0}').modal('show');", "ModalAgregar"))
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Protected Sub RemoveViaje(sender As Object, e As EventArgs)
|
Protected Sub RemoveViaje(sender As Object, e As EventArgs)
|
||||||
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
||||||
Dim IsMasivo = GvRow.DataKey("CveMasivo")
|
Dim CveMasivo = GvRow.DataKey("CveMasivo")
|
||||||
|
|
||||||
Dim ObjViajes As New ClsViajes
|
Dim ObjTransportes As New ClsTransportes
|
||||||
|
|
||||||
ObjViajes.IniciaTransacSQL()
|
ObjTransportes.IniciaTransacSQL()
|
||||||
If IsMasivo <> "" Then
|
If CveMasivo = "" Then
|
||||||
Try
|
Try
|
||||||
ObjViajes.RemoveViaje(-1, CveMasivo:=IsMasivo.ToEntero)
|
ObjTransportes.RemoveViaje(CveViaje:=GvRow.DataKey("CveViaje").ToEntero)
|
||||||
ObjViajes.Commit()
|
ObjTransportes.Commit()
|
||||||
Response.Redirect(Request.RawUrl)
|
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
Alert($"Ocurrió un error {ex}", TipoMensaje.MsgError)
|
Alert($"Ocurrió un error {ex}", TipoMensaje.MsgError)
|
||||||
Finally
|
|
||||||
ObjViajes.Dispose()
|
|
||||||
End Try
|
End Try
|
||||||
|
|
||||||
Else
|
Else
|
||||||
Try
|
Try
|
||||||
ObjViajes.RemoveViaje(GvRow.DataKey("CveViaje").ToEntero)
|
ObjTransportes.RemoveViaje(CveMasivo:=CveMasivo.ToEntero)
|
||||||
ObjViajes.Commit()
|
ObjTransportes.Commit()
|
||||||
Response.Redirect(Request.RawUrl)
|
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
Alert($"Ocurrió un error {ex}", TipoMensaje.MsgError)
|
Alert($"Ocurrió un error {ex}", TipoMensaje.MsgError)
|
||||||
Finally
|
|
||||||
ObjViajes.Dispose()
|
|
||||||
End Try
|
End Try
|
||||||
End If
|
End If
|
||||||
|
Alert("Viaje eliminado correctamente")
|
||||||
|
CargaDatos()
|
||||||
|
ObjTransportes.Dispose()
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user