Se trabajo en los listados de Viajes y Contratos de V&A con su CRUD y PA. Se eliminó Crear Viajes y ContratoTransporte, ya que lo termina absorbiendo los listados

This commit is contained in:
AbrahamCastilloV
2023-12-13 09:16:58 -07:00
parent 47caaa3997
commit f4eba5924f
8 changed files with 641 additions and 648 deletions

View File

@@ -1,165 +0,0 @@
<%@ Page Language="VB" AutoEventWireup="false" MasterPageFile="~/Site.master" CodeFile="ContratoTransporte.aspx.vb"
Inherits="ContratoTransportes" %>
<asp:Content ID="Content3" ContentPlaceHolderID="E" runat="Server">
Registro de Contratos
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Css" runat="Server">
<style>
.my-1 {
margin-block: 1rem;
}
</style>
</asp:Content>
<asp:Content ID="Content7" ContentPlaceHolderID="C" runat="Server">
<contenttemplate>
<div class="col-md-12 ">
<div class="portlet smmallpadding light bordered">
<div class="portlet-title">
<div class="caption uppercase" style="position: relative;">
<i class="fa fa-info-circle"></i>Datos del Contrato
</div>
<a href="../SAT/">../SAT/</a>
</div>
<div class="portlet-body">
<%-- cveCliente--%>
<div class="row my-1" id="TrCliente" runat="server">
<label class="col-md-4 bold">
<asp:Label ID="Label1" runat="server" Text="Cliente:"></asp:Label></label><div class="col-md-8">
<ADS:Dropdownlost CssClassDdl="select2me" ID="DdlClientes" Width="100%" data-metodo="getcliente"
runat="server" DataTextField="NombreComercial" DataValueField="CveCliente" CssStyle="width: 100%;"
UsaWebService="true"></ADS:Dropdownlost>
</div>
</div>
<div class="row my-1">
<label class="col-md-4 bold">Servicio:</label>
<div class="col-md-8">
<asp:TextBox ID="TxtDescripcion" runat="server" MaxLength="70" Width="400px"
TextMode="MultiLine"></asp:TextBox>
<asp:RequiredFieldValidator ID="RFVDescripcion" runat="server" ControlToValidate="TxtDescripcion"
Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Descripcion''</b> es necesario, por favor ingréselo."
ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCEDescripcion" runat="server" HighlightCssClass="vco"
TargetControlID="RFVDescripcion" Width="400px" BehaviorID="_content_VCEDescripcion">
</ajax:ValidatorCalloutExtender>
</div>
</div>
<div class="row">
<label class="col-md-4 bold">Lugar de Salida:</label>
<div class="col-md-8">
<asp:TextBox ID="TxtUbicacion" runat="server" MaxLength="70" Width="400px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RFVUbicacion" runat="server" ControlToValidate="TxtUbicacion"
Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Ubicación''</b> es necesario, por favor ingréselo."
ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCEUbicacion" runat="server" HighlightCssClass="vco"
TargetControlID="RFVUbicacion" Width="400px" BehaviorID="_content_VCEUbicacion">
</ajax:ValidatorCalloutExtender>
</div>
</div>
<div class="row my-1">
<label class="col-md-4 bold">Fecha Salida:</label>
<div class="col-md-8">
<div class="input-group input-sm input-small date date-picker">
<asp:TextBox ID="TxtFechaSalida" runat="server" CssClass="form-control" CausesValidation="True"
type="datetime-local"></asp:TextBox>
<asp:RequiredFieldValidator ID="RFVTxtFechaSalida" runat="server" ControlToValidate="TxtFechaSalida"
Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Fecha Salida''</b> es necesario, por favor ingréselo."
ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCETxtFechaSalida" runat="server" HighlightCssClass="vco"
TargetControlID="RFVTxtFechaSalida" Width="400px" BehaviorID="_content_VCETxtFechaSalida">
</ajax:ValidatorCalloutExtender>
</div>
</div>
</div>
<div class="row my-1">
<label class="col-md-4 bold">Fecha Regreso:</label>
<div class="col-md-8">
<div class="input-group input-sm input-small date date-picker">
<asp:TextBox ID="TxtFechaRegreso" runat="server" CssClass="form-control" CausesValidation="True"
type="datetime-local"></asp:TextBox>
<asp:RequiredFieldValidator ID="RFVTxtFechaRegreso" runat="server" ControlToValidate="TxtFechaRegreso"
Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Fecha Regreso''</b> es necesario, por favor ingréselo."
ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="ValidatorCalloutExtender1" runat="server" HighlightCssClass="vco"
TargetControlID="RFVTxtFechaRegreso" Width="400px" BehaviorID="_content_VCETxtFechaRegreso">
</ajax:ValidatorCalloutExtender>
</div>
</div>
</div>
<div class="row margin-bottom-5" id="TrAF" runat="server">
<label class="col-md-4 bold">
<asp:Label runat="server" Text="Transporte:"></asp:Label></label><div
class="col-md-8">
<asp:DropDownList ID="DdlTransporte" AppendDataBoundItems="true" DataTextField="Descripcion"
DataValueField="CveActivoFijo" Class="table-group-action-input form-control input-inline text-center"
Width="200px" runat="server">
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RFVTransporte" runat="server" ControlToValidate="DdlTransporte"
Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Transporte''</b> es necesario, por favor ingréselo."
ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCETransporte" runat="server" HighlightCssClass="vco"
TargetControlID="RFVTransporte" Width="400px" BehaviorID="_content_VCETransporte">
</ajax:ValidatorCalloutExtender>
</div>
</div>
<div class="row my-1">
<label class="col-md-4 bold">Observaciones:</label>
<div class="col-md-8">
<asp:TextBox ID="TxtObservaciones" runat="server" MaxLength="70" Width="400px"
TextMode="MultiLine"></asp:TextBox>
<asp:RequiredFieldValidator ID="RFVObservaciones" runat="server" ControlToValidate="TxtObservaciones"
Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Descripcion''</b> es necesario, por favor ingréselo."
ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCEObservaciones" runat="server" HighlightCssClass="vco"
TargetControlID="RFVObservaciones" Width="400px" BehaviorID="_content_VCEObservaciones">
</ajax:ValidatorCalloutExtender>
</div>
</div>
<div class="row my-1">
<label class="col-md-4 bold">Costo dólares:</label>
<div class="col-md-8">
<asp:TextBox ID="TxtDolares" runat="server" type="number"></asp:TextBox>
</div>
</div>
<div class="row my-1">
<label class="col-md-4 bold">Costo pesos:</label>
<div class="col-md-8">
<asp:TextBox ID="TxtPesos" runat="server" type="number"></asp:TextBox>
</div>
</div>
<div class="row my-1">
<label class="col-md-4 bold">Anticipo:</label>
<div class="col-md-8">
<asp:TextBox ID="TxtAnticipo" runat="server" type="number"></asp:TextBox>
</div>
</div>
</div>
</div>
<contenttemplate>
<asp:Button ID="BtnGuardar" runat="server" Text="Guardar" ValidationGroup="GrpGuardar"
CssClass="btn btn-success" OnClick="AddContrato" />
</contenttemplate>
</div>
</contenttemplate>
</asp:Content>

View File

@@ -1,126 +0,0 @@
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)
'Lista Activos Fijos'
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.DtResultados.Rows.Count > 0 Then
DdlTransporte.DataSource = ObjAF.DtResultados
DdlTransporte.DataBind()
DdlTransporte.Items.Insert(0, New ListItem("Seleccione Transporte", ""))
End If
End If
ObjAF.Dispose()
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("<script>console.log('El resultado de tu variable" + TxtFechaSalida.Text + "')</script>")
If DdlClientes.SelectedValue = "" Then
Alert("Debe seleccionar al cliente", TipoMensaje.MsgAdvertencia)
Exit Sub
Else
Try
If BtnGuardar.Text = "Guardar" Then
Page.Response.Write("<script>console.log('El resultado de tu variable" + "Guardando" + "')</script>")
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("<script>console.log('El resultado de tu variable" + Editar.ToString + "')</script>")
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

View File

@@ -1,127 +0,0 @@
<%@ Page Language="VB" AutoEventWireup="false" MasterPageFile="~/Site.master" CodeFile="CrearViaje.aspx.vb"
Inherits="CrearViaje" %>
<asp:Content ID="Content1" ContentPlaceHolderID="E" runat="Server">
Crear Viaje
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="C" runat="Server">
<ContentTemplate>
<div class="col-md-12">
<div class="row margin-bottom-5" id="TrAF" runat="server">
<label class="col-md-4 bold">
<asp:Label runat="server" Text="Transporte:"></asp:Label></label><div
class="col-md-8">
<asp:DropDownList ID="DdlTransporte" AppendDataBoundItems="true" DataTextField="Descripcion"
DataValueField="CveActivoFijo" Class="table-group-action-input form-control input-inline text-center"
Width="200px" runat="server">
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RFVTransporte" runat="server" ControlToValidate="DdlTransporte"
Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Transporte''</b> es necesario, por favor ingréselo."
ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCETransporte" runat="server" HighlightCssClass="vco"
TargetControlID="RFVTransporte" Width="400px" BehaviorID="_content_VCETransporte">
</ajax:ValidatorCalloutExtender>
</div>
</div>
<div class="row margin-bottom-5" id="TrRutas" runat="server">
<label class="col-md-4 bold">
<asp:Label runat="server" Text="Seleccione Ruta:"></asp:Label></label><div
class="col-md-8">
<asp:DropDownList ID="DdlRutas" AppendDataBoundItems="true" DataTextField="Ruta"
DataValueField="CveRuta" Class="table-group-action-input form-control input-inline text-center"
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>
<div class="row margin-bottom-5" id="TrDestino" runat="server">
<label class="col-md-4 bold">
<asp:Label runat="server" Text="Partida:"></asp:Label></label><div
class="col-md-8">
<asp:DropDownList ID="DdlDestino" AppendDataBoundItems="true" DataTextField="Destino"
DataValueField="CveDestino" Class="table-group-action-input form-control input-inline text-center"
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 bold">
<asp:Label runat="server" Text="Destino:"></asp:Label></label><div
class="col-md-8">
<asp:DropDownList ID="DdlPartida" AppendDataBoundItems="true" DataTextField="Destino"
DataValueField="CveDestino" Class="table-group-action-input form-control input-inline text-center"
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" id="TrChofer" runat="server">
<label class="col-md-4 bold">
<asp:Label runat="server" Text="Chofer:"></asp:Label></label><div
class="col-md-8">
<asp:DropDownList ID="DdlChofer" AppendDataBoundItems="true" DataValueField="CvePersonal"
DataTextField="NombreCompleto" Class="table-group-action-input form-control input-inline text-center"
Width="200px" runat="server">
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RFVChofer" runat="server" ControlToValidate="DdlChofer"
Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Chofer''</b> es necesario, por favor ingréselo."
ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCEChofer" runat="server" HighlightCssClass="vco"
TargetControlID="RFVChofer" Width="400px" BehaviorID="_content_VCEChofer">
</ajax:ValidatorCalloutExtender>
</div>
</div>
<div class="row my-1">
<label class="col-md-4 bold">Fecha Viaje:</label>
<div class="col-md-8">
<div class="input-group input-sm input-small date date-picker">
<asp:TextBox ID="TxtFechaViaje" runat="server" CssClass="form-control text-center" Width="200px"
CausesValidation="True"
type="date"></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>
<asp:Button CssClass="btn btn-success rounded-4 " Text="Guardar" ID="BtnGuardar"
runat="server" OnClick="AddViaje" ValidationGroup="GrpGuardar" />
</div>
</ContentTemplate>
</asp:Content>

View File

@@ -1,129 +0,0 @@
Imports ADSNetLibrary.Helpers
Imports ADSNetLibrary.SIGAPI.Helpers
Imports Extensiones.ModExtensiones
Partial Class CrearViaje
Inherits ClsPaginas
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
CargaDatos()
If Not String.IsNullOrEmpty(Request.QueryString("CveViaje")) Then
Dim id As Integer = Convert.ToInt32(Request.QueryString("CveViaje"))
Dim ObjViajes As New ClsViajes
If ObjViajes.GetViajes(CveViaje:=id) Then
Dim fecha As DateTime
If DateTime.TryParse(ObjViajes.Fecha.ToString, fecha) Then
TxtFechaViaje.Text = fecha.ToString("yyyy-MM-dd").Replace(" ", "T")
End If
DdlRutas.Text = ObjViajes.CveRuta.ToString
DdlTransporte.Text = ObjViajes.CveAF.ToString
DdlPartida.Text = ObjViajes.CvePartida.ToString
DdlDestino.Text = ObjViajes.CveDestino.ToString
DdlChofer.Text = ObjViajes.CvePersonal.ToString
BtnGuardar.Text = "Editar"
End If
End If
End If
End Sub
Private Sub CargaDatos()
'Lista Activos Fijos'
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.DtResultados.Rows.Count > 0 Then
DdlTransporte.DataSource = ObjAF.DtResultados
DdlTransporte.DataBind()
DdlTransporte.Items.Insert(0, New ListItem("Seleccione Transporte", ""))
End If
End If
ObjAF.Dispose()
'Lista Rutas'
Dim ObjRutas As New ClsRutas()
If ObjRutas.GetRutas(-1, -1, -1, "", True, DateTime.Now) Then
If ObjRutas.DtResultados.Rows.Count > 0 Then
DdlRutas.DataSource = ObjRutas.DtResultados
DdlRutas.DataBind()
DdlRutas.Items.Insert(0, New ListItem("Seleccione Ruta", ""))
End If
End If
ObjRutas.Dispose()
'Lista Destinos'
Dim ObjDestinos As New ClsDestinos()
If ObjDestinos.GetDestinos(-1, -1, -1, "", True, True, DateTime.Now) Then
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
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)
Dim ObjViajes As New ClsViajes
ObjViajes.IniciaTransacSQL()
Try
If BtnGuardar.Text = "Guardar" Then
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)
If CveContratoHijo > 0 Then
ObjViajes.Commit()
Alert("El Viaje se registró Correctamente.", TipoMensaje.MsgInformacion)
DdlRutas.Text = ""
DdlTransporte.Text = ""
DdlChofer.Text = ""
TxtFechaViaje.Text = ""
DdlPartida.Text = ""
DdlDestino.SelectedValue = ""
End If
Else
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
Alert("El viaje se modificó correctamente.", TipoMensaje.MsgInformacion)
ObjViajes.Commit()
End If
End If
Catch ex As Exception
ObjViajes.RollBack()
Finally
ObjViajes.Dispose()
Response.Redirect("ListadoViajes.aspx")
End Try
End Sub
End Class

View File

@@ -35,26 +35,29 @@
<asp:UpdatePanel runat="server">
<ContentTemplate>
<li>
<asp:HyperLink ID="LBAgregarContrato" runat="server" NavigateUrl="ContratoTransporte.aspx"
Target="_blank"><i class='fa fa-plus'></i> Agregar Contrato</asp:HyperLink>
</li>
<li>
<asp:HyperLink ID="LBCrearViaje" runat="server" NavigateUrl="CrearViaje.aspx"
Target="_blank"><i class='fa fa-car'></i> Crear Viaje</asp:HyperLink>
</li>
<asp:HyperLink ID="LBListadoContratos" runat="server" NavigateUrl="ListadoContratos.aspx"
Target="_blank"><i class='fa fa-list'></i>Contratos</asp:HyperLink>
</li>
<li>
<asp:HyperLink ID="LBListadoViajes" runat="server" NavigateUrl="ListadoViajes.aspx"
Target="_blank"><i class='fa fa-road'></i> Listado de Viajes</asp:HyperLink>
Target="_blank"><i class='fa fa-road'></i>Viajes</asp:HyperLink>
</li>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Content>
<asp:Content ID="Content7" ContentPlaceHolderID="C" runat="Server">
<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"
CssClass="table table-striped table-hover Widthall ScrollAD text-center" GridLines="None"
data-sort="true" OnRowCommand="GvContratos_Comandos">
data-sort="true" DataKeyNames="CveContrato, DescripcionContrato, Ubicacion, FechaInicial, FechaFinal, CveCliente, CveTipoAF">
<Columns>
<asp:TemplateField HeaderText="No. Contrato">
@@ -69,7 +72,7 @@
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Ubicación" ItemStyle-HorizontalAlign="Left">
<asp:TemplateField ItemStyle-HorizontalAlign="Center" HeaderText="Ubicación">
<ItemTemplate>
<asp:Literal ID="LtUbicacion" runat="server" Text='<%# Eval("Ubicacion") %>'></asp:Literal>
</ItemTemplate>
@@ -95,17 +98,173 @@
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Acciones">
<asp:TemplateField ItemStyle-HorizontalAlign="Center" HeaderText="Acciones">
<ItemTemplate>
<asp:Button ID="btnEditar" runat="server" Text="Editar" CommandName="Editar" class="btn btn-primary"
CommandArgument='<%# Eval("CveContrato") %>' />
<asp:Button ID="btnEliminar" runat="server" Text="Eliminar" CommandName="Eliminar"
class="btn btn-danger" CommandArgument='<%# Eval("CveContrato") %>' />
<asp:LinkButton ID="BtnEditar" runat="server" AlternateText="Editar"
CssClass="btn btn-circle btn-sm green" OnClick="UpdateContrato" Text="<i class='fa fa-pencil'></i>" />
<asp:LinkButton ID="BtnEliminar" runat="server" AlternateText="Eliminar"
CssClass="btn btn-circle btn-sm red" OnClick="RemoveContrato" Text="<i class='fa fa-trash'></i>"
data-toggle="confirmation" data-popout="true" data-original-title="Confirmar"
data-btn-ok-label="si" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<div id="ModalAgregar" class="modal ADS fade" role="dialog">
<div class="modal-dialog">
<div id="UpAddChofer" class="modal-content rowpadding" tabindex="-1"
runat="server">
<contenttemplate>
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title" id="myModalLabel" runat="server">Agregar Contrato</h4>
</div>
<div class="modal-body">
<div class="portlet-body">
<div class="row my-1" id="TrCliente" runat="server">
<label class="col-md-4 bold">
<asp:Label ID="Label1" runat="server" Text="Cliente:"></asp:Label></label><div class="col-md-8">
<ADS:Dropdownlost CssClassDdl="select2me" ID="DdlClientes" Width="100%" data-metodo="getcliente"
runat="server" DataTextField="NombreComercial" DataValueField="CveCliente" CssStyle="width: 100%;"
UsaWebService="true"></ADS:Dropdownlost>
</div>
</div>
<div class="row my-1">
<label class="col-md-4 bold">Servicio:</label>
<div class="col-md-8">
<asp:TextBox ID="TxtDescripcion" runat="server" MaxLength="70" Width="100%"
TextMode="MultiLine"></asp:TextBox>
<asp:RequiredFieldValidator ID="RFVDescripcion" runat="server" ControlToValidate="TxtDescripcion"
Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Descripcion''</b> es necesario, por favor ingréselo."
ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCEDescripcion" runat="server" HighlightCssClass="vco"
TargetControlID="RFVDescripcion" Width="100%" BehaviorID="_content_VCEDescripcion">
</ajax:ValidatorCalloutExtender>
</div>
</div>
<div class="row">
<label class="col-md-4 bold">Lugar de Salida:</label>
<div class="col-md-8">
<asp:TextBox ID="TxtUbicacion" runat="server" MaxLength="70" Width="100%"></asp:TextBox>
<asp:RequiredFieldValidator ID="RFVUbicacion" runat="server" ControlToValidate="TxtUbicacion"
Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Ubicación''</b> es necesario, por favor ingréselo."
ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCEUbicacion" runat="server" HighlightCssClass="vco"
TargetControlID="RFVUbicacion" Width="100%" BehaviorID="_content_VCEUbicacion">
</ajax:ValidatorCalloutExtender>
</div>
</div>
<div class="row my-1">
<label class="col-md-4 bold">Fecha Salida:</label>
<div class="col-md-8">
<div class="input-group input-sm input-small date date-picker">
<asp:TextBox ID="TxtFechaSalida" runat="server" CssClass="form-control" CausesValidation="True"
type="datetime-local"></asp:TextBox>
<asp:RequiredFieldValidator ID="RFVTxtFechaSalida" runat="server" ControlToValidate="TxtFechaSalida"
Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Fecha Salida''</b> es necesario, por favor ingréselo."
ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCETxtFechaSalida" runat="server" HighlightCssClass="vco"
TargetControlID="RFVTxtFechaSalida" Width="100%" BehaviorID="_content_VCETxtFechaSalida">
</ajax:ValidatorCalloutExtender>
</div>
</div>
</div>
<div class="row my-1">
<label class="col-md-4 bold">Fecha Regreso:</label>
<div class="col-md-8">
<div class="input-group input-sm input-small date date-picker">
<asp:TextBox ID="TxtFechaRegreso" runat="server" CssClass="form-control" CausesValidation="True"
type="datetime-local"></asp:TextBox>
<asp:RequiredFieldValidator ID="RFVTxtFechaRegreso" runat="server" ControlToValidate="TxtFechaRegreso"
Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Fecha Regreso''</b> es necesario, por favor ingréselo."
ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="ValidatorCalloutExtender1" runat="server" HighlightCssClass="vco"
TargetControlID="RFVTxtFechaRegreso" Width="100%" BehaviorID="_content_VCETxtFechaRegreso">
</ajax:ValidatorCalloutExtender>
</div>
</div>
</div>
<div class="row margin-bottom-5" id="TrAF" runat="server">
<label class="col-md-4 bold">
<asp:Label runat="server" Text="Tipo de Unidad:"></asp:Label></label><div
class="col-md-8">
<asp:DropDownList ID="DdlTransporte" AppendDataBoundItems="true" DataTextField="Descripcion"
DataValueField="CveActivoFijo" Class="table-group-action-input form-control input-inline text-center"
Width="200px" runat="server">
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RFVTransporte" runat="server" ControlToValidate="DdlTransporte"
Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Transporte''</b> es necesario, por favor ingréselo."
ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCETransporte" runat="server" HighlightCssClass="vco"
TargetControlID="RFVTransporte" Width="400px" BehaviorID="_content_VCETransporte">
</ajax:ValidatorCalloutExtender>
</div>
</div>
<div class="row my-1">
<label class="col-md-4 bold">Observaciones:</label>
<div class="col-md-8">
<asp:TextBox ID="TxtObservaciones" runat="server" MaxLength="70" Width="100%"
TextMode="MultiLine"></asp:TextBox>
<asp:RequiredFieldValidator ID="RFVObservaciones" runat="server" ControlToValidate="TxtObservaciones"
Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Descripcion''</b> es necesario, por favor ingréselo."
ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCEObservaciones" runat="server" HighlightCssClass="vco"
TargetControlID="RFVObservaciones" Width="100%" BehaviorID="_content_VCEObservaciones">
</ajax:ValidatorCalloutExtender>
</div>
</div>
<div class="row my-1">
<label class="col-md-4 bold">Costo dólares:</label>
<div class="col-md-8">
<asp:TextBox ID="TxtDolares" runat="server" type="number"></asp:TextBox>
</div>
</div>
<div class="row my-1">
<label class="col-md-4 bold">Costo pesos:</label>
<div class="col-md-8">
<asp:TextBox ID="TxtPesos" runat="server" type="number"></asp:TextBox>
</div>
</div>
<div class="row my-1">
<label class="col-md-4 bold">Anticipo:</label>
<div class="col-md-8">
<asp:TextBox ID="TxtAnticipo" runat="server" type="number"></asp:TextBox>
</div>
</div>
</div>
<div class="modal-footer">
<asp:Button ID="BtnGuardar" OnClick="AddContrato" runat="server" CssClass="btn btn-primary"
Text="Guardar"
ValidationGroup="GrpGuardar"></asp:Button>
<button type="button" class="btn btn-default" data-dismiss="modal">Cancelar</button>
</div>
</div>
</contenttemplate>
</div>
</div>
</div>
</contenttemplate>
</asp:Content>

View File

@@ -1,5 +1,7 @@
Option Explicit On
Option Strict On
Imports ADSNetLibrary.SIGAPI.Helpers
Imports Extensiones.ModExtensiones
Partial Class ListadoContratos
@@ -14,44 +16,148 @@ Partial Class ListadoContratos
Private Sub CargaDatos()
Dim ObjContratos As New ClsContratos
ObjContratos.IniciaTransacSQL()
If ObjContratos.GetContratos(-1, UsuarioActual.CveEmpresa, TipoContrato:=2) Then
GvContratos.DataSource = ObjContratos.DtResultados
ObjContratos.Dispose()
GvContratos.DataBind()
Else
Me.GvContratos.DataSource = Nothing
End If
DdlClientes.setEsWebService(True)
'Lista Activos Fijos'
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.DtResultados.Rows.Count > 0 Then
DdlTransporte.DataSource = ObjAF.DtResultados
DdlTransporte.DataBind()
DdlTransporte.Items.Insert(0, New ListItem("Seleccione Transporte", ""))
End If
End If
ObjAF.Dispose()
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}"
Protected Sub MostrarModal(sender As Object, e As System.EventArgs)
TxtDescripcion.Text = ""
TxtFechaSalida.Text = ""
TxtFechaRegreso.Text = ""
TxtObservaciones.Text = ""
TxtUbicacion.Text = ""
DdlTransporte.SelectedValue = ""
BtnGuardar.Text = "Guardar"
RegistraScript(String.Format("$('#{0}').modal('show');", "ModalAgregar"))
End Sub
If e.CommandName = "Editar" Then
Dim script As String = $"window.open('{url}', '_blank');"
Page.ClientScript.RegisterStartupScript(Me.GetType(), "OpenWindow", script, True)
Protected Sub AddContrato(sender As Object, e As EventArgs)
Dim ObjContratos As New ClsContratos
ObjContratos.IniciaTransacSQL()
If DdlClientes.SelectedValue = "" Then
Alert("Debe seleccionar al cliente", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
If e.CommandName = "Eliminar" Then
Dim ObjContratos As New ClsContratos
ObjContratos.IniciaTransacSQL()
Try
Try
ObjContratos.RemoveContrato(id, UsuarioActual.CveEmpresa)
ObjContratos.Commit()
Catch ex As Exception
ObjContratos.RollBack()
Finally
ObjContratos.Dispose()
Response.Redirect("ListadoContratos.aspx")
End Try
If BtnGuardar.Text = "Guardar" Then
End If
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, CveTipoAF:=DdlTransporte.SelectedValue.ToEntero)
If CveContratoHijo > 0 Then
ObjContratos.Commit()
Alert("Agregado Correctamente.")
TxtDescripcion.Text = ""
TxtFechaSalida.Text = ""
TxtFechaRegreso.Text = ""
TxtObservaciones.Text = ""
TxtUbicacion.Text = ""
DdlClientes.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
Catch ex As Exception
Alert($"Ocurrió un error {ex}", TipoMensaje.MsgError)
ObjContratos.RollBack()
Finally
ObjContratos.Dispose()
Response.Redirect("ListadoContratos.aspx")
End Try
End Sub
Protected Sub UpdateContrato(sender As Object, e As EventArgs)
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
Dim fechaInicial As DateTime
Dim fechaFinal As DateTime
DdlClientes.SelectedValue = GvRow.DataKey("CveCliente")
TxtDescripcion.Text = GvRow.DataKey("DescripcionContrato")
TxtObservaciones.Text = GvRow.DataKey("DescripcionContrato")
TxtUbicacion.Text = GvRow.DataKey("Ubicacion")
DdlTransporte.SelectedValue = GvRow.DataKey("CveTipoAF")
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")
TxtFechaRegreso.Text = fechaFinal.ToString("yyyy-MM-dd HH:mm:ss").Replace(" ", "T")
End If
BtnGuardar.Text = "Editar"
RegistraScript(String.Format("$('#{0}').modal('show');", "ModalAgregar"))
End Sub
Protected Sub RemoveContrato(sender As Object, e As EventArgs)
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
Dim ObjContratos As New ClsContratos
ObjContratos.IniciaTransacSQL()
Try
ObjContratos.RemoveContrato(GvRow.DataKey("CveContrato").ToEntero, UsuarioActual.CveEmpresa)
ObjContratos.Commit()
Response.Redirect(Request.RawUrl)
Catch ex As Exception
Alert($"Ocurrió un error {ex}", TipoMensaje.MsgError)
Finally
ObjContratos.Dispose()
End Try
End Sub
End Class

View File

@@ -2,7 +2,8 @@
Inherits="ListadoViajes" %>
<asp:Content ID="Content3" ContentPlaceHolderID="E" runat="Server">
Listado de Viajes</asp:Content>
Listado de Viajes
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Css" runat="Server">
<style>
@@ -12,58 +13,225 @@ Listado de Viajes</asp:Content>
</style>
</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="HB" runat="Server">
<ContentTemplate>
<li>
<asp:HyperLink ID="LBListadoContratos" runat="server" NavigateUrl="ListadoContratos.aspx"
Target="_blank"><i class='fa fa-list'></i>Contratos</asp:HyperLink>
</li>
<li>
<asp:HyperLink ID="LBListadoViajes" runat="server" NavigateUrl="ListadoViajes.aspx"
Target="_blank"><i class='fa fa-road'></i>Viajes</asp:HyperLink>
</li>
</ContentTemplate>
</asp:Content>
<asp:Content ID="Content7" ContentPlaceHolderID="C" runat="Server">
<contenttemplate>
<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"
data-sort="true" OnRowCommand="GvViajes_Comandos">
<Columns>
<asp:TemplateField HeaderText="Ruta">
<ItemTemplate>
<asp:Literal ID="LtlRuta" runat="server" Text='<%# Eval("Ruta") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<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:TemplateField HeaderText="Partida">
<ItemTemplate>
<asp:Literal ID="LtlPartida" runat="server" Text='<%# Eval("Partida") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<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"
data-sort="true" DataKeyNames="CveViaje, CveRuta, Fecha, CveAF, CvePersonal, CveEmpresa, CvePartida, CveDestino">
<Columns>
<asp:TemplateField HeaderText="Destino">
<ItemTemplate>
<asp:Literal ID="LtlDestino" runat="server" Text='<%# Eval("Destino") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Ruta">
<ItemTemplate>
<asp:Literal ID="LtlRuta" runat="server" Text='<%# Eval("CveRuta") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Fecha">
<ItemTemplate>
<asp:Literal ID="LtlFecha" runat="server" Text='<%# Eval("Fecha") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Partida">
<ItemTemplate>
<asp:Literal ID="LtlPartida" runat="server" Text='<%# Eval("Partida") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Destino">
<ItemTemplate>
<asp:Literal ID="LtlDestino" runat="server" Text='<%# Eval("Destino") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Chofer">
<ItemTemplate>
<asp:Literal ID="LtlChofer" runat="server" Text='<%# Eval("Chofer") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Fecha">
<ItemTemplate>
<asp:Literal ID="LtlFecha" runat="server" Text='<%# Eval("Fecha") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Unidad">
<ItemTemplate>
<asp:Literal ID="LtlFecha" runat="server" Text='<%# Eval("Fecha") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Acciones">
<ItemTemplate>
<asp:Button ID="btnEditar" runat="server" Text="Editar" CommandName="Editar" class="btn btn-primary"
CommandArgument='<%# Eval("CveViaje") %>' />
<asp:Button ID="btnEliminar" runat="server" Text="Eliminar" CommandName="Eliminar"
class="btn btn-danger" CommandArgument='<%# Eval("CveViaje") %>' />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:TemplateField HeaderText="Chofer">
<ItemTemplate>
<asp:Literal ID="LtlChofer" runat="server" Text='<%# Eval("NombreCompleto") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
</contenttemplate>
<asp:TemplateField ItemStyle-HorizontalAlign="Center" HeaderText="Acciones">
<ItemTemplate>
<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>"
data-toggle="confirmation" data-popout="true" data-original-title="Confirmar"
data-btn-ok-label="si" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<div id="ModalAgregar" class="modal ADS fade" role="dialog">
<div class="modal-dialog">
<div id="UpAddChofer" class="modal-content rowpadding" tabindex="-1"
runat="server">
<contenttemplate>
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title" id="ModalLabel" runat="server">Agregar Viaje</h4>
</div>
<div class="modal-body">
<div class="portlet-body">
<div class="row margin-bottom-5" id="TrAF" runat="server">
<label class="col-md-4 bold">
<asp:Label runat="server" Text="Transporte:"></asp:Label></label><div
class="col-md-8">
<asp:DropDownList ID="DdlTransporte" AppendDataBoundItems="true" DataTextField="Descripcion"
DataValueField="CveActivoFijo" Class="table-group-action-input form-control input-inline text-center"
Width="200px" runat="server">
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RFVTransporte" runat="server" ControlToValidate="DdlTransporte"
Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Transporte''</b> es necesario, por favor ingréselo."
ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCETransporte" runat="server" HighlightCssClass="vco"
TargetControlID="RFVTransporte" Width="400px" BehaviorID="_content_VCETransporte">
</ajax:ValidatorCalloutExtender>
</div>
</div>
<div class="row margin-bottom-5" id="TrRutas" runat="server">
<label class="col-md-4 bold">
<asp:Label runat="server" Text="Seleccione Ruta:"></asp:Label></label><div
class="col-md-8">
<asp:DropDownList ID="DdlRutas" AppendDataBoundItems="true" DataTextField="Ruta"
DataValueField="CveRuta" Class="table-group-action-input form-control input-inline text-center"
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>
<div class="row margin-bottom-5" id="TrDestino" runat="server">
<label class="col-md-4 bold">
<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="table-group-action-input form-control input-inline text-center"
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 bold">
<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="table-group-action-input form-control input-inline text-center"
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" id="TrChofer" runat="server">
<label class="col-md-4 bold">
<asp:Label runat="server" Text="Chofer:"></asp:Label></label><div
class="col-md-8">
<asp:DropDownList ID="DdlChofer" AppendDataBoundItems="true" DataValueField="CvePersonal"
DataTextField="NombreCompleto" Class="table-group-action-input form-control input-inline text-center"
Width="200px" runat="server">
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RFVChofer" runat="server" ControlToValidate="DdlChofer"
Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Chofer''</b> es necesario, por favor ingréselo."
ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCEChofer" runat="server" HighlightCssClass="vco"
TargetControlID="RFVChofer" Width="400px" BehaviorID="_content_VCEChofer">
</ajax:ValidatorCalloutExtender>
</div>
</div>
<div class="row my-1">
<label class="col-md-4 bold">Fecha Viaje:</label>
<div class="col-md-8">
<div class="input-group input-sm input-small date date-picker">
<asp:TextBox ID="TxtFechaViaje" runat="server" CssClass="form-control text-center"
Width="200px"
CausesValidation="True"
type="date"></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>
<div class="form-group form-md-line-input input-iconright" id="divEstatus" runat="server">
<asp:CheckBox ID="ChkEstatus" runat="server" CssClass="form-control bold" />
<label>Generar Viaje Masivo</label>
</div>
</div>
<div class="modal-footer">
<asp:Button ID="BtnGuardar" OnClick="AddViaje" runat="server" CssClass="btn btn-primary"
Text="Guardar"
ValidationGroup="GrpGuardar"></asp:Button>
<button type="button" class="btn btn-default" data-dismiss="modal">Cancelar</button>
</div>
</div>
</contenttemplate>
</div>
</div>
</div>
</asp:Content>

View File

@@ -1,6 +1,7 @@
Option Explicit On
Option Strict On
Imports ADSNetLibrary.SIGAPI.Helpers
Imports Extensiones.ModExtensiones
Partial Class ListadoViajes
Inherits ClsPaginas
@@ -15,42 +16,148 @@ Partial Class ListadoViajes
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'
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.DtResultados.Rows.Count > 0 Then
DdlTransporte.DataSource = ObjAF.DtResultados
DdlTransporte.DataBind()
DdlTransporte.Items.Insert(0, New ListItem("Seleccione Transporte", ""))
End If
End If
ObjAF.Dispose()
'Lista Rutas'
Dim ObjRutas As New ClsRutas()
If ObjRutas.GetRutas(-1, -1, -1, "", True, DateTime.Now) Then
If ObjRutas.DtResultados.Rows.Count > 0 Then
DdlRutas.DataSource = ObjRutas.DtResultados
DdlRutas.DataBind()
DdlRutas.Items.Insert(0, New ListItem("Seleccione Ruta", ""))
End If
End If
ObjRutas.Dispose()
'Lista Destinos'
Dim ObjDestinos As New ClsDestinos()
If ObjDestinos.GetDestinos(-1, -1, -1, "", True, True, DateTime.Now) Then
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
ObjRutas.Dispose()
'Lista Chofer'
DdlChofer.DataSource = GlobalDTRHPersonal(UsuarioActual.CveEmpresa)
DdlChofer.DataBind()
DdlChofer.Items.Insert(0, New ListItem("Seleccione Chofer", ""))
ObjViajes.Dispose()
GvViajes.DataBind()
Page.Response.Write("<script>console.log('El resultado de tu variable" + GvViajes.ToString + "')</script>")
End Sub
Protected Sub GvViajes_Comandos(sender As Object, e As GridViewCommandEventArgs)
Dim id As Integer = Convert.ToInt32(e.CommandArgument)
Dim url As String = $"CrearViaje.aspx?CveViaje={id}"
Protected Sub MostrarModal(sender As Object, e As System.EventArgs)
DdlRutas.Text = ""
DdlTransporte.Text = ""
DdlChofer.Text = ""
TxtFechaViaje.Text = ""
DdlPartida.Text = ""
DdlDestino.SelectedValue = ""
BtnGuardar.Text = "Guardar"
RegistraScript(String.Format("$('#{0}').modal('show');", "ModalAgregar"))
End Sub
If e.CommandName = "Editar" Then
Dim script As String = $"window.open('{url}', '_blank');"
Page.ClientScript.RegisterStartupScript(Me.GetType(), "OpenWindow", script, True)
Protected Sub AddViaje(sender As Object, e As EventArgs)
Dim ObjViajes As New ClsViajes
ObjViajes.IniciaTransacSQL()
Try
If BtnGuardar.Text = "Guardar" Then
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)
If CveContratoHijo > 0 Then
ObjViajes.Commit()
Alert("El Viaje se registró Correctamente.", TipoMensaje.MsgInformacion)
DdlRutas.Text = ""
DdlTransporte.Text = ""
DdlChofer.Text = ""
TxtFechaViaje.Text = ""
DdlPartida.Text = ""
DdlDestino.SelectedValue = ""
End If
Else
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
Alert("El viaje se modificó correctamente.", TipoMensaje.MsgInformacion)
ObjViajes.Commit()
End If
End If
Catch ex As Exception
ObjViajes.RollBack()
Finally
ObjViajes.Dispose()
Response.Redirect("ListadoViajes.aspx")
End Try
End Sub
Protected Sub UpdateViaje(sender As Object, e As EventArgs)
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
DdlTransporte.SelectedValue = GvRow.DataKey("CveAF")
DdlRutas.SelectedValue = GvRow.DataKey("CveRuta")
DdlDestino.SelectedValue = GvRow.DataKey("CveDestino")
DdlPartida.SelectedValue = GvRow.DataKey("CvePartida")
DdlChofer.SelectedValue = GvRow.DataKey("CvePersonal")
Dim fecha As DateTime
If DateTime.TryParse(GvRow.DataKey("Fecha").ToString, fecha) Then
TxtFechaViaje.Text = fecha.ToString("yyyy-MM-dd").Replace(" ", "T")
End If
If e.CommandName = "Eliminar" Then
Dim ObjViajes As New ClsViajes
ObjViajes.IniciaTransacSQL()
Try
ObjViajes.RemoveViaje(id)
ObjViajes.Commit()
Catch ex As Exception
ObjViajes.RollBack()
Finally
ObjViajes.Dispose()
Response.Redirect("ListadoViajes.aspx")
End Try
BtnGuardar.Text = "Editar"
End If
RegistraScript(String.Format("$('#{0}').modal('show');", "ModalAgregar"))
End Sub
Protected Sub RemoveViaje(sender As Object, e As EventArgs)
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
Dim ObjViajes As New ClsViajes
ObjViajes.IniciaTransacSQL()
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 Sub
End Class