--Se eliminó la parte para agregar viajes y se cambió todo a contratos.
This commit is contained in:
@@ -134,113 +134,6 @@ Public Class ClsTransportes
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
#Region "Viajes"
|
||||
Public Function AddViajes(CveRuta As Integer, CveAF As Integer, CvePersonal As Integer, CveEmpresa As Integer, Fecha As DateTime, CvePartida As Integer, CveDestino As Integer, Optional IsMasivo As Boolean = False, Optional CveMasivo As Integer = -1) 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
|
||||
.Add("@CvePartida", SqlDbType.Int).Value = CvePartida
|
||||
.Add("@CveDestino", SqlDbType.Int).Value = CveDestino
|
||||
.Add("@IsMasivo", SqlDbType.Bit).Value = IsMasivo
|
||||
.Add("@CveMasivo", SqlDbType.Int).Value = CveMasivo
|
||||
End With
|
||||
|
||||
Try
|
||||
SqlAdapter.Fill(Data)
|
||||
Retorno = CInt(SqlAdapter.SelectCommand.Parameters("@CveViaje").Value.ToString)
|
||||
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al guardar el nuevo viaje.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
|
||||
End Try
|
||||
|
||||
Return Retorno
|
||||
End Function
|
||||
Public Function GetViajes(CveViaje As Integer, CveEmpresa As Integer) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
|
||||
DataAdapter("PA_Trans_ViajesGet")
|
||||
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@CveViaje", SqlDbType.Int).Value = CveViaje
|
||||
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
|
||||
End With
|
||||
Try
|
||||
SqlAdapter.Fill(Data)
|
||||
If CveViaje > 0 AndAlso Data IsNot Nothing AndAlso Data.Rows.Count > 0 Then
|
||||
CveRuta = Data.Rows(0)("CveRuta").ToString.ToEntero
|
||||
CveAF = Data.Rows(0)("CveAF").ToString.ToEntero
|
||||
CvePersonal = Data.Rows(0)("CvePersonal").ToString.ToEntero
|
||||
CveEmpresa = Data.Rows(0)("CveEmpresa").ToString.ToEntero
|
||||
CvePartida = Data.Rows(0)("CvePartida").ToString.ToEntero
|
||||
CveDestino = Data.Rows(0)("CveDestino").ToString.ToEntero
|
||||
CveMasivo = Data.Rows(0)("CveMasivo").ToString.ToEntero
|
||||
Fecha = Data.Rows(0)("Fecha").ToString.ToDate
|
||||
Ruta = Data.Rows(0)("Ruta").ToString
|
||||
Me.CveViaje = Data.Rows(0)("CveViaje").ToString.ToEntero
|
||||
End If
|
||||
Retorno = True
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al obtener el catálogo de viajes.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
||||
End Try
|
||||
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
Public Function RemoveViaje(Optional CveViaje As Integer = -1, Optional CveMasivo As Integer = -1) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
|
||||
|
||||
DataAdapter("PA_Trans_ViajesRemove")
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@CveViaje", SqlDbType.Int).Value = CveViaje
|
||||
.Add("@CveMasivo", SqlDbType.Int).Value = CveMasivo
|
||||
End With
|
||||
|
||||
Try
|
||||
SqlAdapter.Fill(Data)
|
||||
Retorno = True
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al eliminar el contrato.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
||||
End Try
|
||||
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
Public Function UpdateViajes(CveViaje As Integer, CveRuta As Integer, CveAF As Integer, CvePersonal As Integer, CveEmpresa As Integer, Fecha As DateTime, CvePartida As Integer, CveDestino As Integer) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
|
||||
DataAdapter("PA_Trans_ViajesUpdate")
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@CveViaje", SqlDbType.Int).Value = CveViaje
|
||||
.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.Date).Value = Fecha
|
||||
.Add("@CvePartida", SqlDbType.Int).Value = CvePartida
|
||||
.Add("@CveDestino", SqlDbType.Int).Value = CveDestino
|
||||
|
||||
End With
|
||||
|
||||
Try
|
||||
SqlAdapter.Fill(Data)
|
||||
Retorno = True
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al actualizar el Contrato.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
||||
End Try
|
||||
|
||||
Return Retorno
|
||||
End Function
|
||||
#End Region
|
||||
|
||||
#Region "Boletos"
|
||||
Public Function AddViajesPasajeros(CveViaje As Integer, CveDestinoOrigen As Integer, CveDestinoFinal As Integer, Importe As Decimal, Asiento As Integer, Nombre As String, Visa As String, Celular As String, Sexo As Boolean, Observacion As String, CveUsuario As Integer, CveVendedor As Integer) As Integer
|
||||
Dim Retorno As Integer = -1
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
}
|
||||
|
||||
.masivo_block {
|
||||
margin: 1rem;
|
||||
border: grey 1px solid;
|
||||
padding: 1rem;
|
||||
border: #E1E5EC 1px solid;
|
||||
}
|
||||
</style>
|
||||
</asp:Content>
|
||||
@@ -36,16 +36,16 @@
|
||||
<asp:UpdatePanel ID="UpDatos" runat="server" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
<div class="row my-1" style="margin-right: 10px; margin-top: 10px;" align="right">
|
||||
<input type="text" id="TxtBusqueda" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBusqueda','{0}')", GvViajes.ClientID) %>"
|
||||
<input type="text" id="TxtBusqueda" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBusqueda','{0}')", GvContratos.ClientID) %>"
|
||||
style="display: inline-block; margin-right: -10px; width: 150px;" />
|
||||
<a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBusqueda','{0}')", GvViajes.ClientID) %>"
|
||||
<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>
|
||||
<%-- Listado de Viajes --%>
|
||||
<asp:GridView ID="GvViajes" runat="server" AutoGenerateColumns="false" EmptyDataText="No se encontró ningún viaje registrado"
|
||||
<asp:GridView ID="GvContratos" runat="server" AutoGenerateColumns="false" EmptyDataText="No se encontró ningún viaje registrado"
|
||||
CssClass="table table-striped table-hover Widthall ScrollAD mysmallbtn" GridLines="None"
|
||||
data-sort="true" DataKeyNames="CveViaje, CveRuta, Fecha, CveAF, CvePersonal, CveEmpresa, CvePartida, CveDestino, CveMasivo, Ruta">
|
||||
data-sort="true" DataKeyNames="">
|
||||
<Columns>
|
||||
|
||||
<asp:TemplateField HeaderText="Ruta">
|
||||
@@ -68,31 +68,20 @@
|
||||
|
||||
<asp:TemplateField HeaderText="Fecha">
|
||||
<ItemTemplate>
|
||||
<asp:Literal ID="LtlFecha" runat="server" Text='<%# Eval("Fecha", "{0:d}") %>'></asp:Literal>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
|
||||
<asp:TemplateField HeaderText="Unidad">
|
||||
<ItemTemplate>
|
||||
<asp:Literal ID="LltAF" runat="server" Text='<%# Eval("Unidad") %>'></asp:Literal>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
|
||||
<asp:TemplateField HeaderText="Chofer">
|
||||
<ItemTemplate>
|
||||
<asp:Literal ID="LtlChofer" runat="server" Text='<%# Eval("NombreCompleto") %>'></asp:Literal>
|
||||
<asp:Literal ID="LtlFecha" runat="server" Text='<%# Eval("FechaInicial", "{0:d}") %>'></asp:Literal>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
|
||||
<asp:TemplateField ItemStyle-HorizontalAlign="Center" HeaderText="Masivo">
|
||||
<ItemTemplate>
|
||||
<asp:Label ID="LtlMasivo" runat="server" Text='<%# Eval("CveMasivo") %>'>></asp:Label>
|
||||
<asp:Label ID="LtlMasivo" runat="server" Text='<%# If(Eval("CveMasivo").ToString = "", "", "Sí") %>'
|
||||
CssClass='<%# If(Eval("Estatus").ToString = "", "", "text-success bold") %>'></asp:Label>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
|
||||
<asp:TemplateField ItemStyle-HorizontalAlign="Center" HeaderText="Acciones">
|
||||
<ItemTemplate>
|
||||
<asp:LinkButton ID="BtnEditar" runat="server" AlternateText="Editar"
|
||||
<asp:LinkButton ID="BtnEditar" runat="server" AlternateText="Editar"
|
||||
CssClass="btn btn-circle btn-sm green" OnClick="UpdateViaje" Text="<i class='fa fa-pencil'></i>" />
|
||||
<asp:LinkButton ID="BtnEliminar" runat="server" AlternateText="Eliminar"
|
||||
CssClass="btn btn-circle btn-sm red" OnClick="RemoveViaje" Text="<i class='fa fa-trash'></i>"
|
||||
@@ -124,102 +113,96 @@
|
||||
</div>
|
||||
|
||||
<div class="modal-body">
|
||||
<div class="row margin-bottom-5" id="TrRutas" runat="server">
|
||||
<label class="col-md-4">
|
||||
<asp:Label runat="server" Text="Ruta:"></asp:Label></label><div
|
||||
class="col-md-8">
|
||||
|
||||
<asp:DropDownList ID="DdlRutas" AppendDataBoundItems="true" DataTextField="Ruta"
|
||||
DataValueField="CveRuta" Class="form-control input-sm select2me"
|
||||
Width="200px" runat="server">
|
||||
</asp:DropDownList>
|
||||
<asp:RequiredFieldValidator ID="RFVRutas" runat="server" ControlToValidate="DdlRutas"
|
||||
Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Rutas''</b> es necesario, por favor ingréselo."
|
||||
ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
|
||||
<ajax:ValidatorCalloutExtender ID="VCERutas" runat="server" HighlightCssClass="vco"
|
||||
TargetControlID="RFVRutas" Width="400px" BehaviorID="_content_VCERutas">
|
||||
</ajax:ValidatorCalloutExtender>
|
||||
</div>
|
||||
<div class="row my-1">
|
||||
<label class="col-md-4 bold text-primary">Folio</label>
|
||||
<asp:Label class="col-md-8" runat="server" ID="LbFolio" Text="Folio"></asp:Label>
|
||||
</div>
|
||||
|
||||
<div class="row margin-bottom-5" id="TrDestino" runat="server">
|
||||
<label class="col-md-4">
|
||||
<asp:Label runat="server" Text="Destino:"></asp:Label></label><div
|
||||
class="col-md-8">
|
||||
|
||||
<asp:DropDownList ID="DdlDestino" AppendDataBoundItems="true" DataTextField="Destino"
|
||||
DataValueField="CveDestino" Class="form-control input-sm select2me"
|
||||
Width="200px" runat="server">
|
||||
</asp:DropDownList>
|
||||
<asp:RequiredFieldValidator ID="RFVDestino" runat="server" ControlToValidate="DdlDestino"
|
||||
Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Destino''</b> es necesario, por favor ingréselo."
|
||||
ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
|
||||
<ajax:ValidatorCalloutExtender ID="VCEDestino" runat="server" HighlightCssClass="vco"
|
||||
TargetControlID="RFVDestino" Width="400px" BehaviorID="_content_VCEDestino">
|
||||
</ajax:ValidatorCalloutExtender>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row margin-bottom-5" id="TrPartida" runat="server">
|
||||
<label class="col-md-4">
|
||||
<asp:Label runat="server" Text="Partida:"></asp:Label></label><div
|
||||
class="col-md-8">
|
||||
|
||||
<asp:DropDownList ID="DdlPartida" AppendDataBoundItems="true" DataTextField="Destino"
|
||||
DataValueField="CveDestino" Class="form-control input-sm select2me"
|
||||
Width="200px" runat="server">
|
||||
</asp:DropDownList>
|
||||
<asp:RequiredFieldValidator ID="RFVPartida" runat="server" ControlToValidate="DdlPartida"
|
||||
Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Partida''</b> es necesario, por favor ingréselo."
|
||||
ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
|
||||
<ajax:ValidatorCalloutExtender ID="VCEPartida" runat="server" HighlightCssClass="vco"
|
||||
TargetControlID="RFVPartida" Width="400px" BehaviorID="_content_VCEPartida">
|
||||
</ajax:ValidatorCalloutExtender>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row margin-bottom-5">
|
||||
<label class="col-md-4">
|
||||
<asp:Label runat="server" Text="Fecha Viaje:"></asp:Label></label>
|
||||
<div class="row">
|
||||
<label class="col-md-4">Ruta</label>
|
||||
<div class="col-md-8">
|
||||
<div class="">
|
||||
<asp:TextBox ID="TxtFechaViaje" runat="server" Class="form-control input-sm select2me"
|
||||
Width="200px" CausesValidation="True"
|
||||
type="date"
|
||||
MaxLength="10">
|
||||
</asp:TextBox>
|
||||
|
||||
<asp:RequiredFieldValidator ID="RFVTxtFechaViaje" runat="server" ControlToValidate="TxtFechaViaje"
|
||||
Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Fecha Viaje''</b> es necesario, por favor ingréselo."
|
||||
ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
|
||||
<ajax:ValidatorCalloutExtender ID="VCETxtFechaViaje" runat="server" HighlightCssClass="vco"
|
||||
TargetControlID="RFVTxtFechaViaje" Width="400px" BehaviorID="_content_VCETxtFechaViaje">
|
||||
</ajax:ValidatorCalloutExtender>
|
||||
</div>
|
||||
<asp:DropDownList ID="DdlRutas" AppendDataBoundItems="true" DataTextField="Ruta"
|
||||
DataValueField="CveRuta" Class="form-control input-sm select2me"
|
||||
Width="100%" runat="server">
|
||||
</asp:DropDownList>
|
||||
<asp:RequiredFieldValidator ID="RFVRutas" runat="server" ControlToValidate="DdlRutas"
|
||||
Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Rutas''</b> es necesario, por favor ingréselo."
|
||||
ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
|
||||
<ajax:ValidatorCalloutExtender ID="VCERutas" runat="server" HighlightCssClass="vco"
|
||||
TargetControlID="RFVRutas" Width="400px" BehaviorID="_content_VCERutas">
|
||||
</ajax:ValidatorCalloutExtender>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row my-1 truncate">
|
||||
<div class="row my-1">
|
||||
<label class="col-md-4">Destino</label>
|
||||
<div class="col-md-8">
|
||||
<asp:DropDownList ID="DdlDestino" AppendDataBoundItems="true" DataTextField="Destino"
|
||||
DataValueField="CveDestino" Class="form-control input-sm select2me"
|
||||
Width="100%" runat="server">
|
||||
</asp:DropDownList>
|
||||
<asp:RequiredFieldValidator ID="RFVDestino" runat="server" ControlToValidate="DdlDestino"
|
||||
Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Destino''</b> es necesario, por favor ingréselo."
|
||||
ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
|
||||
<ajax:ValidatorCalloutExtender ID="VCEDestino" runat="server" HighlightCssClass="vco"
|
||||
TargetControlID="RFVDestino" Width="400px" BehaviorID="_content_VCEDestino">
|
||||
</ajax:ValidatorCalloutExtender>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<label class="col-md-4">Partida</label>
|
||||
<div class="col-md-8">
|
||||
<asp:DropDownList ID="DdlPartida" AppendDataBoundItems="true" DataTextField="Destino"
|
||||
DataValueField="CveDestino" Class="form-control input-sm select2me"
|
||||
Width="100%" runat="server">
|
||||
</asp:DropDownList>
|
||||
<asp:RequiredFieldValidator ID="RFVPartida" runat="server" ControlToValidate="DdlPartida"
|
||||
Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Partida''</b> es necesario, por favor ingréselo."
|
||||
ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
|
||||
<ajax:ValidatorCalloutExtender ID="VCEPartida" runat="server" HighlightCssClass="vco"
|
||||
TargetControlID="RFVPartida" Width="400px" BehaviorID="_content_VCEPartida">
|
||||
</ajax:ValidatorCalloutExtender>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row my-1">
|
||||
<label class="col-md-4">Fecha Viaje</label>
|
||||
<div class="col-md-8">
|
||||
<asp:TextBox ID="TxtFechaViaje" runat="server" Class="form-control input-sm select2me"
|
||||
Width="100%" CausesValidation="True"
|
||||
type="date"
|
||||
MaxLength="10">
|
||||
</asp:TextBox>
|
||||
<asp:RequiredFieldValidator ID="RFVTxtFechaViaje" runat="server" ControlToValidate="TxtFechaViaje"
|
||||
Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Fecha Viaje''</b> es necesario, por favor ingréselo."
|
||||
ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
|
||||
<ajax:ValidatorCalloutExtender ID="VCETxtFechaViaje" runat="server" HighlightCssClass="vco"
|
||||
TargetControlID="RFVTxtFechaViaje" Width="400px" BehaviorID="_content_VCETxtFechaViaje">
|
||||
</ajax:ValidatorCalloutExtender>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row my-1">
|
||||
<asp:CheckBox CssClass="col-md-4" ID="IsMasivo" runat="server" Text="Generar Viajes Masivo"
|
||||
Visible="true"
|
||||
OnCheckedChanged="ToggleMasivo" AutoPostBack="true" />
|
||||
<asp:Panel ID="DivFechaMasivo" runat="server" Visible="false" CssClass="col-md-7 masivo_block">
|
||||
<div class="row my-1 truncate date date-picker">
|
||||
<label class="col-md-4 bold">Fecha Inicial:</label>
|
||||
<asp:TextBox CssClass="col-md-8" ID="TxtFechaInicial" runat="server" type="date"
|
||||
Width="150px"></asp:TextBox>
|
||||
</div>
|
||||
|
||||
<div class="row my-1 truncate">
|
||||
<label class="col-md-4 bold">Lapso(días)</label>
|
||||
<asp:TextBox CssClass="col-md-8" ID="TxtFrecuencia" runat="server" type="number"
|
||||
Width="150px"></asp:TextBox>
|
||||
</div>
|
||||
</asp:Panel>
|
||||
</div>
|
||||
|
||||
<asp:Panel ID="DivFechaMasivo" runat="server" Visible="false" CssClass="col-md-8 masivo_block">
|
||||
<div class="row my-1 truncate date date-picker">
|
||||
<label class="col-md-4 bold">Fecha Inicial:</label>
|
||||
<asp:TextBox CssClass="col-md-8" ID="TxtFechaInicial" runat="server" type="date"
|
||||
Width="150px"></asp:TextBox>
|
||||
</div>
|
||||
|
||||
<div class="row my-1 truncate">
|
||||
<label class="col-md-4 bold">Lapso(días)</label>
|
||||
<asp:TextBox CssClass="col-md-8" ID="TxtFrecuencia" runat="server" type="number"
|
||||
Width="150px"></asp:TextBox>
|
||||
</div>
|
||||
</asp:Panel>
|
||||
</div>
|
||||
<br />
|
||||
|
||||
<div class="modal-footer">
|
||||
<asp:Button ID="BtnGuardar" OnClick="AddViaje" runat="server" CssClass="btn btn-primary"
|
||||
ValidationGroup="GrpGuardar"
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
Option Explicit On
|
||||
Option Strict On
|
||||
Imports System.Data
|
||||
Imports Extensiones.ModExtensiones
|
||||
|
||||
Partial Class ListadoViajes
|
||||
Inherits ClsPaginas
|
||||
|
||||
#Region "Propiedades"
|
||||
Private Property CveViaje As String
|
||||
Private Property CveContrato As String
|
||||
Get
|
||||
Return ViewState("CveViaje").ToString()
|
||||
Return ViewState("CveContrato").ToString()
|
||||
End Get
|
||||
Set(value As String)
|
||||
ViewState("CveViaje") = value
|
||||
ViewState("CveContrato") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property Ruta As String
|
||||
@@ -43,7 +44,6 @@ Partial Class ListadoViajes
|
||||
End If
|
||||
End If
|
||||
'Lista Destinos'
|
||||
|
||||
If ObjRutas.GetDestinos() Then
|
||||
|
||||
If ObjRutas.DtResultados.Rows.Count > 0 Then
|
||||
@@ -59,24 +59,25 @@ Partial Class ListadoViajes
|
||||
ObjRutas.Dispose()
|
||||
|
||||
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
|
||||
Private Sub CargaDatos()
|
||||
'Carga Viajes
|
||||
Dim ObjContratos As New ClsContratos
|
||||
|
||||
If ObjContratos.GetContratos(-1, UsuarioActual.CveEmpresa, TipoContrato:=35) Then
|
||||
GvContratos.DataSource = ObjContratos.DtResultados
|
||||
GvContratos.DataBind()
|
||||
End If
|
||||
|
||||
'Generar Folio
|
||||
Dim CveSubProyecto As Integer = GlobalDTSubProyectos(-1, -1, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveSubProyecto", "TipoSucursal = 1").ToEntero
|
||||
Dim ObjFolio As New ClsGralFolios
|
||||
If ObjFolio.GetFolios("Con", UsuarioActual.CveEmpresa, CveSubProyecto:=CveSubProyecto) Then
|
||||
If ObjFolio.DtResultados.Rows.Count > 0 Then
|
||||
Dim drr As DataRow = ObjFolio.DtResultados.FiltroPrimero("")
|
||||
LbFolio.Text = $"{drr("Serie").ToString}-{drr("FActual").ToString}"
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
Private Sub CargaDatos()
|
||||
Dim ObjTransportes As New ClsTransportes
|
||||
|
||||
If ObjTransportes.GetViajes(-1, UsuarioActual.CveEmpresa) 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()
|
||||
@@ -95,10 +96,7 @@ Partial Class ListadoViajes
|
||||
End Sub
|
||||
|
||||
Protected Sub AddViaje(sender As Object, e As EventArgs)
|
||||
Dim ObjTransportes As New ClsTransportes
|
||||
|
||||
ObjTransportes.IniciaTransacSQL()
|
||||
|
||||
'Generador de Viajes Masivos
|
||||
If IsMasivo.Checked = True Then
|
||||
If TxtFechaInicial.Text = "" Or TxtFrecuencia.Text = "" Then
|
||||
Alert("Es necesario agregar la fecha inicial y la frecuencia", TipoMensaje.MsgAdvertencia)
|
||||
@@ -106,65 +104,88 @@ Partial Class ListadoViajes
|
||||
End If
|
||||
|
||||
Dim CveMasivo As Integer = DateTimeOffset.Now.ToUnixTimeSeconds().ToEntero
|
||||
|
||||
Dim fechaInicial As DateTime = DateTime.Parse(TxtFechaInicial.Text)
|
||||
Dim frecuencia As Integer = Integer.Parse(TxtFrecuencia.Text)
|
||||
Dim fechaInicial As DateTime = TxtFechaInicial.Text.ToDate
|
||||
Dim fechasGeneradas As New List(Of DateTime)()
|
||||
|
||||
While fechaInicial.Year = DateTime.Now.Year
|
||||
fechasGeneradas.Add(fechaInicial)
|
||||
fechaInicial = fechaInicial.AddDays(frecuencia)
|
||||
fechaInicial = fechaInicial.AddDays(TxtFrecuencia.Text.ToEntero)
|
||||
End While
|
||||
|
||||
For Each fecha As DateTime In fechasGeneradas
|
||||
Try
|
||||
Dim CveContratoHijo As Integer = -1
|
||||
CveContratoHijo = ObjTransportes.AddViajes(DdlRutas.Text.ToEntero, -1, -1, UsuarioActual.CveEmpresa, fecha, DdlPartida.Text.ToEntero, DdlDestino.Text.ToEntero, IsMasivo:=True, CveMasivo:=CveMasivo)
|
||||
|
||||
If CveContratoHijo > 0 Then
|
||||
ObjTransportes.Commit()
|
||||
End If
|
||||
Catch ex As Exception
|
||||
Alert($"Ocurrió un error {ex}", TipoMensaje.MsgError)
|
||||
End Try
|
||||
Next
|
||||
|
||||
DdlRutas.Text = ""
|
||||
|
||||
TxtFechaViaje.Text = ""
|
||||
DdlPartida.Text = ""
|
||||
DdlDestino.SelectedValue = ""
|
||||
ObjTransportes.Dispose()
|
||||
CargaDatos()
|
||||
Alert("El viaje masivo se registró correctamente.", TipoMensaje.MsgInformacion)
|
||||
Else
|
||||
Try
|
||||
If BtnGuardar.Text = "Guardar" Then
|
||||
Dim CveContratoHijo As Integer = -1
|
||||
CveContratoHijo = ObjTransportes.AddViajes(DdlRutas.Text.ToEntero, -1, -1, UsuarioActual.CveEmpresa, TxtFechaViaje.Text.ToDate, DdlPartida.Text.ToEntero, DdlDestino.Text.ToEntero)
|
||||
For Each fecha As DateTime In fechasGeneradas
|
||||
Dim ObjFolio As New ClsGralFolios
|
||||
Dim ObjContratos As New ClsContratos
|
||||
|
||||
If CveContratoHijo > 0 Then
|
||||
ObjTransportes.Commit()
|
||||
Alert("El Viaje se registró Correctamente.", TipoMensaje.MsgInformacion)
|
||||
DdlRutas.Text = ""
|
||||
TxtFechaViaje.Text = ""
|
||||
DdlPartida.Text = ""
|
||||
DdlDestino.SelectedValue = ""
|
||||
'Generamos folio
|
||||
Dim CveSubProyecto As Integer = GlobalDTSubProyectos(-1, -1, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveSubProyecto", "TipoSucursal = 1").ToEntero
|
||||
If ObjFolio.GetFolios("Con", UsuarioActual.CveEmpresa, CveSubProyecto:=CveSubProyecto) Then
|
||||
If ObjFolio.DtResultados.Rows.Count > 0 Then
|
||||
Dim drr As DataRow = ObjFolio.DtResultados.FiltroPrimero("")
|
||||
LbFolio.Text = $"{drr("Serie").ToString}-{drr("FActual").ToString}"
|
||||
End If
|
||||
End If
|
||||
'Agregamos contrato
|
||||
ObjContratos.IniciaTransacSQL()
|
||||
If ObjContratos.AddContratos(LbFolio.Text, "", "", UsuarioActual.CveProveedor, -1, -1, fecha, fecha, "", "", 10, -1, -1, -1, -1, "", "", -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, False, -1, -1, -1, -1, 0, CveContratoTipo:=35, CveContratosEstatus:=50, CveRuta:=DdlRutas.Text.ToEntero, CvePartida:=DdlPartida.SelectedValue.ToEntero, CveDestino:=DdlDestino.SelectedValue.ToEntero, CveMasivo:=CveMasivo) > 0 Then
|
||||
ObjContratos.Commit()
|
||||
End If
|
||||
'Actualizamos Folio
|
||||
If ObjFolio.UpdateFolioActual(CveSubProyecto, "Con", True, UsuarioActual.CveEmpresa) Then
|
||||
ObjFolio.Dispose()
|
||||
End If
|
||||
Next
|
||||
Alert("Viajes Masivos generados correctamente.")
|
||||
Catch ex As Exception
|
||||
Dim ObjContratos As New ClsContratos
|
||||
ObjContratos.RollBack()
|
||||
Alert("Ocurrió un error al generar viajes masivo", TipoMensaje.MsgError)
|
||||
Finally
|
||||
DdlRutas.Text = ""
|
||||
TxtFechaViaje.Text = ""
|
||||
DdlPartida.Text = ""
|
||||
DdlDestino.SelectedValue = ""
|
||||
|
||||
Dim ObjContratos As New ClsContratos
|
||||
ObjContratos.Dispose()
|
||||
CargaDatos()
|
||||
End Try
|
||||
Else
|
||||
Dim ObjContratos As New ClsContratos
|
||||
ObjContratos.IniciaTransacSQL()
|
||||
|
||||
Try
|
||||
'Agregamos Viaje
|
||||
If BtnGuardar.Text = "Agregar" Then
|
||||
If ObjContratos.AddContratos(LbFolio.Text, "", "", UsuarioActual.CveProveedor, -1, -1, TxtFechaViaje.Text.ToDate, TxtFechaViaje.Text.ToDate, "", "", 10, -1, -1, -1, -1, "", "", -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, False, -1, -1, -1, -1, 0, CveContratoTipo:=35, CveContratosEstatus:=50, CveRuta:=DdlRutas.Text.ToEntero, CvePartida:=DdlPartida.SelectedValue.ToEntero, CveDestino:=DdlDestino.SelectedValue.ToEntero) > 0 Then
|
||||
ObjContratos.Commit()
|
||||
Alert("Viaje agregado correctamente.")
|
||||
End If
|
||||
Else
|
||||
|
||||
If ObjTransportes.UpdateViajes(CveViaje.ToEntero, DdlRutas.Text.ToEntero, -1, -1, UsuarioActual.CveEmpresa, TxtFechaViaje.Text.ToDate, DdlPartida.Text.ToEntero, DdlDestino.Text.ToEntero) = True Then
|
||||
Alert("El viaje se modificó correctamente.", TipoMensaje.MsgInformacion)
|
||||
ObjTransportes.Commit()
|
||||
CargaDatos()
|
||||
'Actualizamos Viaje
|
||||
If ObjContratos.UpdateContratos(CveContrato.ToEntero, LbFolio.Text, "", "", UsuarioActual.CveProveedor, -1, -1, TxtFechaInicial.Text.ToDate, TxtFechaInicial.Text.ToDate, "", "", 10, -1, -1, -1, -1, "", "", -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, False, -1, -1, -1, -1, 0, CveContratoTipo:=35, CveContratosEstatus:=50, CveRuta:=DdlRutas.Text.ToEntero, CvePartida:=DdlPartida.SelectedValue.ToEntero, CveDestino:=DdlDestino.SelectedValue.ToEntero) = True Then
|
||||
ObjContratos.Commit()
|
||||
Alert("El viaje se actualizó correctamente.")
|
||||
End If
|
||||
End If
|
||||
Catch ex As Exception
|
||||
ObjTransportes.RollBack()
|
||||
Alert("Ocurrió un error al generar viaje", TipoMensaje.MsgError)
|
||||
ObjContratos.RollBack()
|
||||
Finally
|
||||
DdlRutas.Text = ""
|
||||
TxtFechaViaje.Text = ""
|
||||
DdlPartida.Text = ""
|
||||
DdlDestino.SelectedValue = ""
|
||||
Dim CveSubProyecto As Integer = GlobalDTSubProyectos(-1, -1, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveSubProyecto", "TipoSucursal = 1").ToEntero
|
||||
Dim ObjFolios As New ClsGralFolios
|
||||
If ObjFolios.UpdateFolioActual(CveSubProyecto, "Con", True, UsuarioActual.CveEmpresa) Then
|
||||
ObjFolios.Dispose()
|
||||
End If
|
||||
CargaDatos()
|
||||
ObjTransportes.Dispose()
|
||||
ObjContratos.Dispose()
|
||||
End Try
|
||||
End If
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
Protected Sub UpdateViaje(sender As Object, e As EventArgs)
|
||||
@@ -175,7 +196,7 @@ Partial Class ListadoViajes
|
||||
DdlRutas.SelectedValue = GvRow.DataKey("CveRuta")
|
||||
DdlDestino.SelectedValue = GvRow.DataKey("CveDestino")
|
||||
DdlPartida.SelectedValue = GvRow.DataKey("CvePartida")
|
||||
ViewState("CveViaje") = GvRow.DataKey("CveViaje")
|
||||
ViewState("CveContrato") = GvRow.DataKey("CveContrato")
|
||||
ViewState("Ruta") = GvRow.DataKey("Ruta")
|
||||
Dim fecha As DateTime
|
||||
|
||||
@@ -192,31 +213,31 @@ Partial Class ListadoViajes
|
||||
End Sub
|
||||
|
||||
Protected Sub RemoveViaje(sender As Object, e As EventArgs)
|
||||
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
||||
Dim CveMasivo As String = GvRow.DataKey("CveMasivo")
|
||||
'Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
||||
'Dim CveMasivo As String = GvRow.DataKey("CveMasivo")
|
||||
|
||||
Dim ObjTransportes As New ClsTransportes
|
||||
'Dim ObjTransportes As New ClsTransportes
|
||||
|
||||
ObjTransportes.IniciaTransacSQL()
|
||||
If CveMasivo = "" Then
|
||||
Try
|
||||
ObjTransportes.RemoveViaje(CveViaje:=GvRow.DataKey("CveViaje").ToEntero)
|
||||
ObjTransportes.Commit()
|
||||
Catch ex As Exception
|
||||
Alert($"Ocurrió un error {ex}", TipoMensaje.MsgError)
|
||||
End Try
|
||||
Else
|
||||
Try
|
||||
ObjTransportes.RemoveViaje(CveMasivo:=CveMasivo.ToEntero)
|
||||
ObjTransportes.Commit()
|
||||
Catch ex As Exception
|
||||
Alert($"Ocurrió un error {ex}", TipoMensaje.MsgError)
|
||||
'ObjTransportes.IniciaTransacSQL()
|
||||
'If CveMasivo = "" Then
|
||||
' Try
|
||||
' ObjTransportes.RemoveViaje(CveViaje:=GvRow.DataKey("CveViaje").ToEntero)
|
||||
' ObjTransportes.Commit()
|
||||
' Catch ex As Exception
|
||||
' Alert($"Ocurrió un error {ex}", TipoMensaje.MsgError)
|
||||
' End Try
|
||||
'Else
|
||||
' Try
|
||||
' ObjTransportes.RemoveViaje(CveMasivo:=CveMasivo.ToEntero)
|
||||
' ObjTransportes.Commit()
|
||||
' Catch ex As Exception
|
||||
' Alert($"Ocurrió un error {ex}", TipoMensaje.MsgError)
|
||||
|
||||
End Try
|
||||
End If
|
||||
Alert("Viaje eliminado correctamente")
|
||||
CargaDatos()
|
||||
ObjTransportes.Dispose()
|
||||
' End Try
|
||||
'End If
|
||||
'Alert("Viaje eliminado correctamente")
|
||||
'CargaDatos()
|
||||
'ObjTransportes.Dispose()
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
Reference in New Issue
Block a user