Merge branch 'master' of http://192.168.10.111:8383/SIG
This commit is contained in:
@@ -34,6 +34,7 @@ Public Class ClsViajes
|
|||||||
Public Property CveEmpresa As Integer
|
Public Property CveEmpresa As Integer
|
||||||
Public Property CvePartida As Integer
|
Public Property CvePartida As Integer
|
||||||
Public Property CveDestino As Integer
|
Public Property CveDestino As Integer
|
||||||
|
Public Property CveMasivo As Integer
|
||||||
Public Property Fecha As DateTime
|
Public Property Fecha As DateTime
|
||||||
#End Region
|
#End Region
|
||||||
|
|
||||||
@@ -135,7 +136,7 @@ Public Class ClsViajes
|
|||||||
#End Region
|
#End Region
|
||||||
|
|
||||||
#Region "Métodos"
|
#Region "Métodos"
|
||||||
Public Function AddViajes(CveRuta As Integer, CveAF As Integer, CvePersonal As Integer, CveEmpresa As Integer, Fecha As DateTime, CvePartida As Integer, CveDestino As Integer) As Integer
|
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
|
Dim Retorno As Integer = -1
|
||||||
|
|
||||||
DataAdapter("PA_Trans_ViajesAdd")
|
DataAdapter("PA_Trans_ViajesAdd")
|
||||||
@@ -149,6 +150,8 @@ Public Class ClsViajes
|
|||||||
.Add("@Fecha", SqlDbType.DateTime).Value = Fecha
|
.Add("@Fecha", SqlDbType.DateTime).Value = Fecha
|
||||||
.Add("@CvePartida", SqlDbType.Int).Value = CvePartida
|
.Add("@CvePartida", SqlDbType.Int).Value = CvePartida
|
||||||
.Add("@CveDestino", SqlDbType.Int).Value = CveDestino
|
.Add("@CveDestino", SqlDbType.Int).Value = CveDestino
|
||||||
|
.Add("@IsMasivo", SqlDbType.Bit).Value = IsMasivo
|
||||||
|
.Add("@CveMasivo", SqlDbType.Int).Value = CveMasivo
|
||||||
End With
|
End With
|
||||||
|
|
||||||
Try
|
Try
|
||||||
@@ -164,6 +167,7 @@ Public Class ClsViajes
|
|||||||
|
|
||||||
Public Function GetViajes(Optional CveViaje As Integer = 0) As Boolean
|
Public Function GetViajes(Optional CveViaje As Integer = 0) As Boolean
|
||||||
Dim Retorno As Boolean = False
|
Dim Retorno As Boolean = False
|
||||||
|
|
||||||
DataAdapter("PA_Trans_ViajesGet")
|
DataAdapter("PA_Trans_ViajesGet")
|
||||||
If CveViaje > 0 Then
|
If CveViaje > 0 Then
|
||||||
With SqlAdapter.SelectCommand.Parameters
|
With SqlAdapter.SelectCommand.Parameters
|
||||||
@@ -179,6 +183,7 @@ Public Class ClsViajes
|
|||||||
CveEmpresa = Data.Rows(0)("CveEmpresa").ToString.ToEntero
|
CveEmpresa = Data.Rows(0)("CveEmpresa").ToString.ToEntero
|
||||||
CvePartida = Data.Rows(0)("CvePartida").ToString.ToEntero
|
CvePartida = Data.Rows(0)("CvePartida").ToString.ToEntero
|
||||||
CveDestino = Data.Rows(0)("CveDestino").ToString.ToEntero
|
CveDestino = Data.Rows(0)("CveDestino").ToString.ToEntero
|
||||||
|
CveMasivo = Data.Rows(0)("CveMasivo").ToString.ToEntero
|
||||||
Fecha = Data.Rows(0)("Fecha").ToString.ToDate
|
Fecha = Data.Rows(0)("Fecha").ToString.ToDate
|
||||||
End If
|
End If
|
||||||
Retorno = True
|
Retorno = True
|
||||||
@@ -189,12 +194,14 @@ Public Class ClsViajes
|
|||||||
Return Retorno
|
Return Retorno
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Public Function RemoveViaje(CveViaje As Integer) As Boolean
|
Public Function RemoveViaje(CveViaje As Integer, Optional CveMasivo As Integer = 0) As Boolean
|
||||||
Dim Retorno As Boolean = False
|
Dim Retorno As Boolean = False
|
||||||
|
|
||||||
|
|
||||||
DataAdapter("PA_Trans_ViajesRemove")
|
DataAdapter("PA_Trans_ViajesRemove")
|
||||||
With SqlAdapter.SelectCommand.Parameters
|
With SqlAdapter.SelectCommand.Parameters
|
||||||
.Add("@CveViaje", SqlDbType.Int).Value = CveViaje
|
.Add("@CveViaje", SqlDbType.Int).Value = CveViaje
|
||||||
|
.Add("@CveMasivo", SqlDbType.Int).Value = CveMasivo
|
||||||
End With
|
End With
|
||||||
|
|
||||||
Try
|
Try
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
<ContentTemplate>
|
<ContentTemplate>
|
||||||
<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-list'></i>Contratos</asp:HyperLink>
|
Target="_blank"><i class='fa fa-file'></i>Contratos</asp:HyperLink>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<asp:HyperLink ID="LBListadoViajes" runat="server" NavigateUrl="ListadoViajes.aspx"
|
<asp:HyperLink ID="LBListadoViajes" runat="server" NavigateUrl="ListadoViajes.aspx"
|
||||||
|
|||||||
@@ -14,6 +14,9 @@
|
|||||||
.fecha {
|
.fecha {
|
||||||
padding: 3px;
|
padding: 3px;
|
||||||
}
|
}
|
||||||
|
.masivo{
|
||||||
|
color:green;
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
</asp:Content>
|
</asp:Content>
|
||||||
@@ -42,7 +45,7 @@
|
|||||||
|
|
||||||
<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">
|
data-sort="true" DataKeyNames="CveViaje, CveRuta, Fecha, CveAF, CvePersonal, CveEmpresa, CvePartida, CveDestino, CveMasivo">
|
||||||
<Columns>
|
<Columns>
|
||||||
|
|
||||||
<asp:TemplateField HeaderText="Ruta">
|
<asp:TemplateField HeaderText="Ruta">
|
||||||
@@ -81,13 +84,19 @@
|
|||||||
</ItemTemplate>
|
</ItemTemplate>
|
||||||
</asp:TemplateField>
|
</asp:TemplateField>
|
||||||
|
|
||||||
|
<asp:TemplateField ItemStyle-HorizontalAlign="Center" HeaderText="Masivo">
|
||||||
|
<ItemTemplate>
|
||||||
|
<asp:Label ID="LtlMasivo" runat="server" Text='<%# Eval("CveMasivo") %>'>></asp:Label>
|
||||||
|
</ItemTemplate>
|
||||||
|
</asp:TemplateField>
|
||||||
|
|
||||||
<asp:TemplateField ItemStyle-HorizontalAlign="Center" HeaderText="Acciones">
|
<asp:TemplateField ItemStyle-HorizontalAlign="Center" HeaderText="Acciones">
|
||||||
<ItemTemplate>
|
<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>" />
|
CssClass="btn btn-circle btn-sm green" OnClick="UpdateViaje" Text="<i class='fa fa-pencil'></i>" />
|
||||||
<asp:LinkButton ID="BtnEliminar" runat="server" AlternateText="Eliminar"
|
<asp:LinkButton ID="BtnEliminar" runat="server" AlternateText="Eliminar"
|
||||||
CssClass="btn btn-circle btn-sm red" OnClick="RemoveViaje" Text="<i class='fa fa-trash'></i>"
|
CssClass="btn btn-circle btn-sm red" OnClick="RemoveViaje" Text="<i class='fa fa-trash'></i>"
|
||||||
data-toggle="confirmation" data-popout="true" data-original-title="Confirmar"
|
data-toggle="confirmation" data-popout="true" data-original-title='<%# If(Eval("CveMasivo").ToString <> "", "Eliminación masiva", "Confirmar") %>'
|
||||||
data-btn-ok-label="si" />
|
data-btn-ok-label="si" />
|
||||||
|
|
||||||
</ItemTemplate>
|
</ItemTemplate>
|
||||||
@@ -207,7 +216,7 @@
|
|||||||
<div class="input-group input-sm input-small date date-picker">
|
<div class="input-group input-sm input-small date date-picker">
|
||||||
<asp:TextBox ID="TxtFechaViaje" runat="server" CssClass="form-control" CausesValidation="True"
|
<asp:TextBox ID="TxtFechaViaje" runat="server" CssClass="form-control" CausesValidation="True"
|
||||||
type="date"
|
type="date"
|
||||||
MaxLength="10"> <i class="fa fa-calendar"></i>
|
MaxLength="10">
|
||||||
</asp:TextBox>
|
</asp:TextBox>
|
||||||
|
|
||||||
<asp:RequiredFieldValidator ID="RFVTxtFechaViaje" runat="server" ControlToValidate="TxtFechaViaje"
|
<asp:RequiredFieldValidator ID="RFVTxtFechaViaje" runat="server" ControlToValidate="TxtFechaViaje"
|
||||||
|
|||||||
@@ -7,12 +7,23 @@ Partial Class ListadoViajes
|
|||||||
Inherits ClsPaginas
|
Inherits ClsPaginas
|
||||||
|
|
||||||
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
||||||
|
|
||||||
If Not IsPostBack Then
|
If Not IsPostBack Then
|
||||||
CargaDatos()
|
CargaDatos()
|
||||||
End If
|
End If
|
||||||
|
|
||||||
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()
|
Private Sub CargaDatos()
|
||||||
|
|
||||||
Dim ObjViajes As New ClsViajes
|
Dim ObjViajes As New ClsViajes
|
||||||
|
|
||||||
ObjViajes.IniciaTransacSQL()
|
ObjViajes.IniciaTransacSQL()
|
||||||
@@ -86,8 +97,8 @@ Partial Class ListadoViajes
|
|||||||
|
|
||||||
Dim ObjViajes As New ClsViajes
|
Dim ObjViajes As New ClsViajes
|
||||||
|
|
||||||
|
|
||||||
ObjViajes.IniciaTransacSQL()
|
ObjViajes.IniciaTransacSQL()
|
||||||
Page.Response.Write("<script>console.log('El resultado de tu variable" + IsMasivo.Checked.ToString + "')</script>")
|
|
||||||
|
|
||||||
If IsMasivo.Checked = True Then
|
If IsMasivo.Checked = True Then
|
||||||
If TxtFechaInicial.Text = "" Or TxtFrecuencia.Text = "" Then
|
If TxtFechaInicial.Text = "" Or TxtFrecuencia.Text = "" Then
|
||||||
@@ -95,6 +106,8 @@ Partial Class ListadoViajes
|
|||||||
Exit Sub
|
Exit Sub
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
Dim CveMasivo = DateTimeOffset.Now.ToUnixTimeSeconds().ToEntero
|
||||||
|
|
||||||
Dim fechaInicial As DateTime = DateTime.Parse(TxtFechaInicial.Text)
|
Dim fechaInicial As DateTime = DateTime.Parse(TxtFechaInicial.Text)
|
||||||
Dim frecuencia As Integer = Integer.Parse(TxtFrecuencia.Text)
|
Dim frecuencia As Integer = Integer.Parse(TxtFrecuencia.Text)
|
||||||
Dim fechasGeneradas As New List(Of DateTime)()
|
Dim fechasGeneradas As New List(Of DateTime)()
|
||||||
@@ -106,7 +119,7 @@ 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)
|
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)
|
||||||
|
|
||||||
If CveContratoHijo > 0 Then
|
If CveContratoHijo > 0 Then
|
||||||
ObjViajes.Commit()
|
ObjViajes.Commit()
|
||||||
@@ -187,18 +200,35 @@ Partial Class ListadoViajes
|
|||||||
|
|
||||||
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 ObjViajes As New ClsViajes
|
Dim ObjViajes As New ClsViajes
|
||||||
|
|
||||||
ObjViajes.IniciaTransacSQL()
|
ObjViajes.IniciaTransacSQL()
|
||||||
Try
|
If IsMasivo <> "" Then
|
||||||
ObjViajes.RemoveViaje(GvRow.DataKey("CveViaje").ToEntero)
|
Try
|
||||||
ObjViajes.Commit()
|
ObjViajes.RemoveViaje(-1, CveMasivo:=IsMasivo.ToEntero)
|
||||||
Response.Redirect(Request.RawUrl)
|
ObjViajes.Commit()
|
||||||
Catch ex As Exception
|
Response.Redirect(Request.RawUrl)
|
||||||
Alert($"Ocurrió un error {ex}", TipoMensaje.MsgError)
|
Catch ex As Exception
|
||||||
Finally
|
Alert($"Ocurrió un error {ex}", TipoMensaje.MsgError)
|
||||||
ObjViajes.Dispose()
|
Finally
|
||||||
End Try
|
ObjViajes.Dispose()
|
||||||
|
End Try
|
||||||
|
|
||||||
|
Else
|
||||||
|
Try
|
||||||
|
ObjViajes.RemoveViaje(GvRow.DataKey("CveViaje").ToEntero)
|
||||||
|
ObjViajes.Commit()
|
||||||
|
Response.Redirect(Request.RawUrl)
|
||||||
|
Catch ex As Exception
|
||||||
|
Alert($"Ocurrió un error {ex}", TipoMensaje.MsgError)
|
||||||
|
Finally
|
||||||
|
ObjViajes.Dispose()
|
||||||
|
End Try
|
||||||
|
End If
|
||||||
|
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Protected Sub ToggleMasivo(sender As Object, e As EventArgs)
|
Protected Sub ToggleMasivo(sender As Object, e As EventArgs)
|
||||||
|
|||||||
Reference in New Issue
Block a user