-Se agregaron las propiedades de viajes a contratos y se alteraron los métodos Add, Get y Update de Contratos. Se agrega el folio a RepContratos. Se le agrega la funcionalidad para imprimir PDF y se aumentan el número de campos para las consultas.

This commit is contained in:
AbrahamCastilloV
2024-02-13 03:56:57 -07:00
parent bd6248a5a4
commit 389c32a7ae
7 changed files with 641 additions and 438 deletions

View File

@@ -38,7 +38,6 @@ Public Class ClsContratos
Public Property NumeroEstimacionNueva As Integer
Public Property CveEstimacionNueva As Integer
Public Property CveChofer As Integer
@@ -135,7 +134,6 @@ Public Class ClsContratos
Public Property NumeroLicitacion As String
Public Property Observaciones As String
Public Property CveDireccionEnvio As Integer
Public Property CveProveedor As Integer
Public Property RazonSocial As String
Public Property CveCliente As Integer
@@ -186,11 +184,16 @@ Public Class ClsContratos
Public Property AplicaImpuestosLocales As Boolean
Public Property CveEstimacionActual As Integer
Public Property NumeroEstimacionActual As Integer
'Viajes
Public Property CveTipoAF As Integer
Public Property CveChofer As Integer
Public Property CveChofer2 As Integer
Public Property CveAF As Integer
Public Property CantidadPasajeros As Integer
Public Property CveRuta As Integer
Public Property CvePartida As Integer
Public Property CveDestino As Integer
Public Property CveMasivo As Integer
#End Region
#Region " C O N T R A T O S "
@@ -227,8 +230,7 @@ Public Class ClsContratos
End Try
Return Retorno
End Function
End Function
Public Function GetContratos(CveContrato As Integer, CveEmpresa As Integer, Optional CveCliente As Integer = -1, Optional CveEstatus As Integer = -1,
Optional TipoEstatus As Integer = -1, Optional TipoContrato As Integer = -1, Optional EstatusFianza As Integer = -1,
Optional CveVendedor As Integer = -1) As Boolean
@@ -299,30 +301,37 @@ Public Class ClsContratos
Me.CveVendedor = Data.Rows(0)("CveVendedor").ToString.ToEntero
Me.ImporteTotal = Data.Rows(0)("ImporteTotal").ToString.ToDecimal
Me.Lugar = Data.Rows(0)("Lugar").ToString
Me.LimiteDeGasto = Data.Rows(0)("LimiteDeGasto").ToString.ToDouble
CveChofer = Data.Rows(0)("CveChofer").ToString.ToEntero
Me.LimiteDeGasto = Data.Rows(0)("LimiteDeGasto").ToString.ToDouble
Observaciones = Data.Rows(0)("Observaciones").ToString
CveDireccionEnvio = Data.Rows(0)("CveDireccionEnvio").ToString.ToEntero
AplicaImpuestosLocales = CBool(Data.Rows(0)("AplicaImpuestosLocales"))
'Viajes
Me.CveTipoAF = Data.Rows(0)("CveTipoAF").ToString.ToEntero
Me.CveChofer = Data.Rows(0)("CveChofer").ToString.ToEntero
Me.CveChofer2 = Data.Rows(0)("CveChofer2").ToString.ToEntero
Me.CveAF = Data.Rows(0)("CveAF").ToString.ToEntero
Me.CantidadPasajeros = Data.Rows(0)("CantidadPasajeros").ToString.ToEntero
Me.CveRuta = Data.Rows(0)("CveRuta").ToString.ToEntero
Me.CvePartida = Data.Rows(0)("CvePartida").ToString.ToEntero
Me.CveDestino = Data.Rows(0)("CveDestino").ToString.ToEntero
Me.CveMasivo = Data.Rows(0)("CveMasivo").ToString.ToEntero
End If
End If
Retorno = True
Catch ex As Exception
OnError("Ocurrió un error al obtener el Catálogo de Contratos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
End Try
Return Retorno
End Function
Public Function AddContratos(NumeroContrato As String, DescripcionContrato As String, NumeroLicitacion As String, CveProveedor As Integer, CveCliente As Integer, CveProspecto As Integer, FechaInicial As DateTime, FechaFinal As DateTime,
Ubicacion As String, Responsable As String, CveSubProyecto As Integer, PorIVA As Double, PorAnticipo As Double, PorAmortizacionAnticipo As Double, PorGarantia As Double, Archivo As String,
Geom As String, CveContratoPadre As Integer, CveUsuario As Integer, CveEmpresa As Integer, EsPresupuestal As Boolean, Minimo As Double, Maximo As Double, Importe As Double, CveMoneda As Integer, ModalidadDetalle As Integer,
Optional CveContratosEstatus As Integer = -1, Optional CveContratoTipo As Integer = -1, Optional TipoCambio As Double = 1, Optional CveSucursalCliente As Integer = -1, Optional CveAlmacenOrigen As Integer = -1, Optional CveAlmacenDestino As Integer = -1, Optional PorcentajeComision As Integer = -1,
Optional TipoGarantia As Integer = -1, Optional Folio As Integer = -1, Optional FechaVenc As Date = Nothing, Optional EstatusFianza As Integer = -1, Optional CvePeriodo As Integer = -1, Optional CveContratoPlantilla As Integer = -1, Optional CveCuentaEquipo As Integer = -1,
Optional CveVendedor As Integer = -1, Optional Observaciones As String = "", Optional CveDireccionEnvio As Integer = -1, Optional AplicaImpuestosLocales As Boolean = False, Optional CorreoNotificacionPedDev As String = "",
Optional FacturacionCicilica As Boolean = False, Optional FacturacionCiclicaAutomatico As Boolean = False, Optional DiaMesFacturacion As Integer = 1, Optional ObservacionesGenerales As String = "",
Optional CveTipoAF As Integer = -1, Optional CveChofer As Integer = -1, Optional CveAF As Integer = -1, Optional CantidadPasajeros As Integer = -1) As Integer
End Function
Public Function AddContratos(NumeroContrato As String, DescripcionContrato As String, NumeroLicitacion As String, CveProveedor As Integer, CveCliente As Integer, CveProspecto As Integer, FechaInicial As DateTime, FechaFinal As DateTime,
Ubicacion As String, Responsable As String, CveSubProyecto As Integer, PorIVA As Double, PorAnticipo As Double, PorAmortizacionAnticipo As Double, PorGarantia As Double, Archivo As String,
Geom As String, CveContratoPadre As Integer, CveUsuario As Integer, CveEmpresa As Integer, EsPresupuestal As Boolean, Minimo As Double, Maximo As Double, Importe As Double, CveMoneda As Integer, ModalidadDetalle As Integer,
Optional CveContratosEstatus As Integer = -1, Optional CveContratoTipo As Integer = -1, Optional TipoCambio As Double = 1, Optional CveSucursalCliente As Integer = -1, Optional CveAlmacenOrigen As Integer = -1, Optional CveAlmacenDestino As Integer = -1, Optional PorcentajeComision As Integer = -1,
Optional TipoGarantia As Integer = -1, Optional Folio As Integer = -1, Optional FechaVenc As Date = Nothing, Optional EstatusFianza As Integer = -1, Optional CvePeriodo As Integer = -1, Optional CveContratoPlantilla As Integer = -1, Optional CveCuentaEquipo As Integer = -1,
Optional CveVendedor As Integer = -1, Optional Observaciones As String = "", Optional CveDireccionEnvio As Integer = -1, Optional AplicaImpuestosLocales As Boolean = False, Optional CorreoNotificacionPedDev As String = "",
Optional FacturacionCicilica As Boolean = False, Optional FacturacionCiclicaAutomatico As Boolean = False, Optional DiaMesFacturacion As Integer = 1, Optional ObservacionesGenerales As String = "",
Optional CveTipoAF As Integer = Nothing, Optional CveChofer As Integer = Nothing, Optional CveChofer2 As Integer = Nothing, Optional CveAF As Integer = Nothing, Optional CantidadPasajeros As Integer = Nothing, Optional CveRuta As Integer = Nothing, Optional CvePartida As Integer = Nothing, Optional CveDestino As Integer = Nothing, Optional CveMasivo As Integer = Nothing) As Integer
Dim Retorno As Integer = -1
DataAdapter("PA_Con_ContratosAdd")
@@ -378,11 +387,16 @@ Public Class ClsContratos
.Add("@FacturacionCiclicaAutomatico", SqlDbType.Bit).Value = FacturacionCiclicaAutomatico
.Add("@DiaMesFacturacion", SqlDbType.TinyInt).Value = DiaMesFacturacion
.Add("@ObservacionesGenerales", SqlDbType.VarChar).Value = ObservacionesGenerales
.Add("@CveTipoAF", SqlDbType.Int).Value = CveTipoAF
.Add("@CveChofer", SqlDbType.Int).Value = CveChofer
'Viajes
.Add("@CveTipoAF", SqlDbType.Int).Value = CveTipoAF
.Add("@CveChofer", SqlDbType.Int).Value = CveChofer
.Add("@CveChofer2", SqlDbType.Int).Value = CveChofer2
.Add("@CveAF", SqlDbType.Int).Value = CveAF
.Add("@CantidadPasajeros", SqlDbType.Int).Value = CantidadPasajeros
.Add("@CveRuta", SqlDbType.Int).Value = CveRuta
.Add("@CvePartida", SqlDbType.Int).Value = CvePartida
.Add("@CveDestino", SqlDbType.Int).Value = CveDestino
.Add("@CveMasivo", SqlDbType.Int).Value = CveMasivo
End With
Try
@@ -400,14 +414,13 @@ Public Class ClsContratos
Return Retorno
End Function
Public Function UpdateContratos(CveContrato As Integer, NumeroContrato As String, DescripcionContrato As String, NumeroLicitacion As String, CveProveedor As Integer, CveCliente As Integer, CveProspecto As Integer, FechaInicial As DateTime, FechaFinal As DateTime,
Ubicacion As String, Responsable As String, CveSubProyecto As Integer, PorIVA As Double, PorAnticipo As Double, PorAmortizacionAnticipo As Double, PorGarantia As Double, Archivo As String, Geom As String,
CveContratoPadre As Integer, CveUsuario As Integer, CveEmpresa As Integer, EsPresupuestal As Boolean, Minimo As Double, Maximo As Double, Importe As Double, CveMoneda As Integer, ModalidadDetalle As Integer,
Optional CveContratosEstatus As Integer = -1, Optional CveContratoTipo As Integer = -1, Optional TipoCambio As Double = 1.0, Optional CveSucursalCliente As Integer = -1, Optional CveAlmacenOrigen As Integer = -1, Optional CveAlmacenDestino As Integer = -1, Optional PorcentajeComision As Integer = -1,
Optional TipoGarantia As Integer = -1, Optional Folio As Integer = -1, Optional FechaVenc As Date = Nothing, Optional EstatusFianza As Integer = -1, Optional CveContratoPlantilla As Integer = -1, Optional CveCuentaEquipo As Integer = -1,
Optional CveVendedor As Integer = -1, Optional Observaciones As String = "", Optional CveDireccionEnvio As Integer = -1, Optional AplicaImpuestosLocales As Boolean = False, Optional CorreoNotificacionPedDev As String = "", Optional FacturacionCicilica As Boolean = False, Optional FacturacionCiclicaAutomatico As Boolean = False,
Optional DiaMesFacturacion As Integer = 1, Optional CvePeriodo As Integer = -1, Optional ObservacionesGenerales As String = "", Optional CveTipoAF As Integer = -1, Optional CveChofer As Integer = -1, Optional EstatusContrato As Integer = -1, Optional CveAF As Integer = -1) As Boolean
Optional DiaMesFacturacion As Integer = 1, Optional CvePeriodo As Integer = -1, Optional ObservacionesGenerales As String = "", Optional CveTipoAF As Integer = Nothing, Optional CveChofer As Integer = Nothing, Optional CveChofer2 As Integer = Nothing, Optional CveAF As Integer = Nothing, Optional CantidadPasajeros As Integer = Nothing, Optional CveRuta As Integer = Nothing, Optional CvePartida As Integer = Nothing, Optional CveDestino As Integer = Nothing, Optional CveMasivo As Integer = Nothing) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Con_ContratosUpdate")
@@ -462,12 +475,17 @@ Public Class ClsContratos
.Add("@DiaMesFacturacion", SqlDbType.TinyInt).Value = DiaMesFacturacion
.Add("@CvePeriodo", SqlDbType.Int).Value = CvePeriodo
.Add("@ObservacionesGenerales", SqlDbType.VarChar).Value = ObservacionesGenerales
.Add("@CveTipoAF", SqlDbType.Int).Value = CveTipoAF
'Viajes
.Add("@CveTipoAF", SqlDbType.Int).Value = CveTipoAF
.Add("@CveChofer", SqlDbType.Int).Value = CveChofer
.Add("@EstatusContrato", SqlDbType.Int).Value = EstatusContrato
.Add("@CveChofer2", SqlDbType.Int).Value = CveChofer2
.Add("@CveAF", SqlDbType.Int).Value = CveAF
.Add("@CantidadPasajeros", SqlDbType.Int).Value = CantidadPasajeros
.Add("@CveRuta", SqlDbType.Int).Value = CveRuta
.Add("@CvePartida", SqlDbType.Int).Value = CvePartida
.Add("@CveDestino", SqlDbType.Int).Value = CveDestino
.Add("@CveMasivo", SqlDbType.Int).Value = CveMasivo
End With
Try
SqlAdapter.Fill(Data)
Retorno = True

View File

@@ -14,85 +14,131 @@
}
.consulta {
padding: 1rem 2rem;
background-color: #95A5A6;
display: flex;
justify-content: space-around;
align-items: center;
padding: 1rem 1rem;
margin-bottom: 1rem;
}
.consulta_linea {
display: flex;
justify-content: space-between;
align-items: center;
margin-block: .5rem;
gap: 1rem;
}
.consulta_campo {
display: flex;
gap: 1rem;
align-items: center;
width: 100%;
}
.consulta_campo label {
color: white;
}
.expandir {
width: 2.5rem;
font-size: 2.5rem;
font-weight: 900;
color: white;
}
</style>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="H" runat="Server">
<asp:UpdatePanel ID="UPPAcciones" runat="server" UpdateMode="Conditional" RenderMode="Inline">
<ContentTemplate>
<li>
<asp:LinkButton ID="LBAgregarContrato" runat="server"><i class='fa fa-plus'></i>Agregar Contrato</asp:LinkButton>
</li>
<li>
<asp:LinkButton ID="LBExcel" runat="server"><i class="fa fa-file-excel-o"></i>Generar Excel</asp:LinkButton>
<asp:LinkButton ID="LnkPdf" runat="server"><i class="fa fa-ad-pdf"></i> Generar PDF</asp:LinkButton>
</li>
<li>
<asp:LinkButton ID="LnkExcel" runat="server"><i class="fa fa-ad-excel"></i> Generar Excel</asp:LinkButton>
</li>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="LBExcel" />
</Triggers>
</asp:UpdatePanel>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="C" runat="Server">
<%-- Filtros --%>
<div class="consulta">
<div class="consulta_campo">
<label>Fecha Inicial:</label>
<div class="consulta_linea">
<div class="consulta_campo">
<label>Fecha Inicial:</label>
<asp:TextBox Width="150px" ID="txtFechaI" runat="server" CssClass="form-control"
type="datetime"
MaxLength="10"></asp:TextBox>
</div>
<asp:TextBox Width="150px" ID="txtFechaI" runat="server" CssClass="form-control"
type="datetime"
MaxLength="10"></asp:TextBox>
<div class="consulta_campo">
<label>Fecha Inicial:</label>
<asp:TextBox Width="150px" ID="txtFechaF" runat="server" CssClass="form-control"
type="datetime"
MaxLength="10"></asp:TextBox>
</div>
</div>
<div class="consulta_campo">
<label>Cliente</label>
<ADS:Dropdownlost ID="DdlClientesConsulta" data-metodo="getcliente"
runat="server" DataTextField="NombreComercial" DataValueField="CveCliente" CssStyle="width: 200px"
CssClassDdl="select2me"
UsaWebService="true"></ADS:Dropdownlost>
</div>
<div class="consulta_campo">
<label>Fecha Inicial:</label>
<asp:TextBox Width="150px" ID="txtFechaF" runat="server" CssClass="form-control"
type="datetime"
MaxLength="10"></asp:TextBox>
</div>
<div class="consulta_campo">
<label>Cliente</label>
<ADS:Dropdownlost ID="DdlClientesConsulta" data-metodo="getcliente"
runat="server" DataTextField="NombreComercial" DataValueField="CveCliente" CssStyle="width: 200px"
CssClassDdl="pxlect2me"
UsaWebService="true"></ADS:Dropdownlost>
</div>
<div class="consulta_campo">
<label>Estatus:</label>
<div class="col-md-8">
<asp:DropDownList ID="DdlEstatusConsulta" runat="server" Class="table-group-action-input form-control input-inline select2me"
DataTextField="ContratoEstatus" DataValueField="CveContratoEstatus"
AppendDataBoundItems="true"
Width="100%">
</asp:DropDownList>
<div class="consulta_campo">
<label>Estatus:</label>
<div class="col-md-8">
<asp:DropDownList ID="DdlEstatusConsulta" runat="server" Class="table-group-action-input form-control input-inline select2me"
DataTextField="ContratoEstatus" DataValueField="CveContratoEstatus"
AppendDataBoundItems="true" Width="200px">
</asp:DropDownList>
</div>
</div>
<div class="consulta_campo">
<asp:Button ID="BtnConsulta" runat="server" Text="Consultar" class="btn btn-primary"
OnClick="Consultar" />
<asp:LinkButton ID="BtnExpandir" runat="server" Text="↓" CssClass="expandir"
OnClick="Expandir" />
</div>
</div>
<asp:Button ID="BtnConsulta" runat="server" Text="Consultar" class="btn btn-primary"
OnClick="Consultar" />
<asp:Panel runat="server" Visible="false" ID="PnExpandirConsulta" CssClass="consulta_linea">
<div class="consulta_campo">
<label>Centro Costos:</label>
<div class="col-md-8">
<asp:DropDownList ID="DdlCentroCostos" runat="server"
DataTextField="" DataValueField=""
AppendDataBoundItems="true" Class="table-group-action-input form-control input-inline select2me"
Width="200px">
</asp:DropDownList>
</div>
</div>
<div class="consulta_campo">
<label>Tipo Unidad:</label>
<div class="col-md-8">
<asp:DropDownList ID="DdlTIpoUnidad" runat="server"
DataTextField="TipoActivoFijo"
DataValueField="CveTipoActivoFijo"
AppendDataBoundItems="true"
Class="table-group-action-input form-control input-inline select2me"
Width="200px">
</asp:DropDownList>
</div>
</div>
<div class="consulta_campo">
<label>Chofer:</label>
<div class="col-md-8">
<asp:DropDownList ID="DdlChofer" runat="server"
DataValueField="CvePersonal"
DataTextField="NombreCompleto"
AppendDataBoundItems="true"
Class="table-group-action-input form-control input-inline select2me"
Width="200px">
</asp:DropDownList>
</div>
</div>
</asp:Panel>
</div>
<%-- Listado de Contratos --%>
<asp:UpdatePanel ID="UpTitulos" runat="server" UpdateMode="Conditional">
@@ -101,9 +147,9 @@
CssClass="table table-striped table-hover Widthall ScrollAD mysmallbtn" GridLines="None"
data-sort="true" DataKeyNames="CveContrato, DescripcionContrato, Ubicacion, FechaInicial, FechaFinal, CveCliente, CveTipoAF, Importe, ImporteMin, ImporteMax,CveChofer, Observaciones, CveContratosEstatus, CveAF">
<Columns>
<asp:TemplateField HeaderText="Folio">
<asp:TemplateField HeaderText="Contrato">
<ItemTemplate>
<asp:Literal ID="LtlCveContrato" runat="server" Text='<%# Eval("CveContrato") %>'></asp:Literal>
<asp:Literal ID="LtlCveContrato" runat="server" Text='<%# Eval("NumeroContrato") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
@@ -170,7 +216,11 @@
</div>
<div class="modal-body">
<asp:Label runat="server" ID="LbFolio" Text="Folio"></asp:Label>
<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 my-1">
<label class="col-md-4">Cliente</label>
<div class="col-md-8">
@@ -243,7 +293,7 @@
</div>
</div>
<div class="row">
<div class="row my-1">
<label class="col-md-4">Cantidad de pasajeros</label>
<div class="col-md-8">
<asp:TextBox ID="TxtCantidadPasajeros" CssStyle="col-md-8 form-control" runat="server"
@@ -258,7 +308,7 @@
</div>
</div>
<div class="row my-1">
<div class="row">
<label class="col-md-4">Tipo Unidad</label>
<div class="col-md-8">
<asp:DropDownList ID="DdlTipoAF" AppendDataBoundItems="true" DataTextField="TipoActivoFijo"
@@ -274,7 +324,7 @@
</div>
</div>
<div class="row">
<div class="row my-1">
<label class="col-md-4">Costo dólares</label>
<div class="col-md-8">
<asp:TextBox ID="TxtDolares" CssStyle=" form-control" runat="server" type="number"
@@ -283,7 +333,7 @@
</div>
</div>
<div class="row my-1">
<div class="row">
<label class="col-md-4">Costo pesos</label>
<div class="col-md-8">
<asp:TextBox ID="TxtPesos" CssStyle=" form-control" runat="server" type="number"
@@ -292,7 +342,7 @@
</div>
</div>
<div class="row">
<div class="row my-1">
<label class="col-md-4">Anticipo</label>
<div class="col-md-8">
<asp:TextBox ID="TxtAnticipo" CssStyle=" form-control" Width="95%" runat="server"

View File

@@ -4,10 +4,21 @@ Imports System.Data
Imports System.Data.SqlClient
Imports Extensiones
Imports Extensiones.ModExtensiones
Imports Microsoft.Reporting.WebForms
Partial Class ListadoContratos
Inherits ClsPaginas
#Region "Propiedad"
Private Property DtAvanceDocumento As DataTable
Get
Return CType(ViewState("DtAvanceDocumento"), DataTable)
End Get
Set(value As DataTable)
ViewState("DtAvanceDocumento") = value
End Set
End Property
#End Region
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
txtFechaI.Text = DateTime.Now.AddMonths(-1).ToString("MM/dd/yyyy").Replace(" ", "T")
txtFechaF.Text = DateTime.Now.AddDays(7).ToString("MM/dd/yyyy").Replace(" ", "T")
@@ -22,16 +33,19 @@ Partial Class ListadoContratos
DdlTipoAF.DataSource = GlobalDTTipoActivoFijo(UsuarioActual.CveEmpresa)
DdlTipoAF.DataBind()
DdlTipoAF.Items.Insert(0, New ListItem("-", ""))
DdlTIpoUnidad.DataSource = GlobalDTTipoActivoFijo(UsuarioActual.CveEmpresa)
DdlTIpoUnidad.DataBind()
DdlTIpoUnidad.Items.Insert(0, New ListItem("-", ""))
'Lista Chofer'
DdlChofer.DataSource = GlobalDTRHPersonal(UsuarioActual.CveEmpresa) 'solo puesto operador.y activos
DdlChofer.DataSource = GlobalDTRHPersonal(188)
DdlChofer.DataBind()
DdlChofer.Items.Insert(0, New ListItem("-", ""))
UpModal.Update()
End Sub
Private Sub CargaDatos()
Dim ObjContratos As New ClsContratos
If ObjContratos.GetContratos(-1, UsuarioActual.CveEmpresa, TipoContrato:=2) Then
If ObjContratos.GetContratos(-1, UsuarioActual.CveEmpresa, TipoContrato:=34) Then
GvContratos.DataSource = ObjContratos.DtResultados
GvContratos.DataBind()
End If
@@ -41,15 +55,16 @@ Partial Class ListadoContratos
DdlEstatusConsulta.DataBind()
DdlEstatusConsulta.Items.Insert(0, New ListItem("-", ""))
End If
Dim CveSubProyecto As Integer = GlobalDTSubProyectos(-1, -1, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveSubProyecto", "EsMatriz = 1").ToEntero
'Generamos Folio - NumeroContrato
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("FActual").ToString
LbFolio.Text = $"{drr("Serie").ToString}-{drr("FActual").ToString}"
End If
End If
UpTitulos.Update()
End Sub
@@ -69,7 +84,7 @@ Partial Class ListadoContratos
Dim ObjContratos As New ClsContratos
ObjContratos.IniciaTransacSQL()
If 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, TxtAnticipo.Text.ToDecimal, TxtPesos.Text.ToDecimal, TxtDolares.Text.ToDecimal, -1, 0, CveContratoTipo:=2, CveContratosEstatus:=50, CveTipoAF:=DdlTipoAF.SelectedValue.ToEntero, CantidadPasajeros:=TxtCantidadPasajeros.Text.ToEntero, Observaciones:=TxtObservaciones.Text) > 0 Then
If ObjContratos.AddContratos(LbFolio.Text, 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, TxtAnticipo.Text.ToDecimal, TxtPesos.Text.ToDecimal, TxtDolares.Text.ToDecimal, -1, 0, CveContratoTipo:=34, CveContratosEstatus:=50, CveTipoAF:=DdlTipoAF.SelectedValue.ToEntero, CantidadPasajeros:=TxtCantidadPasajeros.Text.ToEntero, Observaciones:=TxtObservaciones.Text) > 0 Then
ObjContratos.Commit()
Alert("Agregado Correctamente.")
End If
@@ -91,11 +106,30 @@ Partial Class ListadoContratos
CargaDatos()
End Sub
Protected Sub LBExcel_Click(sender As Object, e As EventArgs) Handles LBExcel.Click
Protected Sub LnkExcel_Click(sender As Object, e As EventArgs) Handles LnkExcel.Click
GvContratos.ExportToExcel("ReporteCompras" & NowADS().ToShortDateString)
End Sub
Protected Sub LnkPDF_Click(sender As Object, e As EventArgs) Handles LnkPdf.Click
Dim ObjContratos As New ClsContratos
If ObjContratos.GetContratos(-1, UsuarioActual.CveEmpresa, TipoContrato:=2) Then
Dim Imagen As New IO.FileInfo($"{UsuarioActual.Empresa.Ruta}/Logo.png")
Dim logouri As String = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa)
Dim Cliente As String = If(DdlClientes.SelectedValue = "-1", "", $"&emsp;<b>Cliente:</b>&nbsp;{DdlClientes.SelectedText}")
Dim dt As DataTable = ObjContratos.DtResultados
Dim params As New List(Of ReportParameter) From {
New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa),
New ReportParameter("FechaInicio", "-1"),
New ReportParameter("FechaFin", "-1"),
New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa),
New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre),
New ReportParameter("FechaImpresion", NowADS().ToDateTime.ToShortDateString),
New ReportParameter("LogoPath", If(Imagen.Exists, $"file://{Imagen.FullName}", ""))
}
ImprimirPDF("Empresas/Grales/Formatos/RepContratos.rdlc", dt, params, NombreArchivo:="Reporte Contratos")
Else
Alert("No hay datos consultados", TipoMensaje.MsgAdvertencia)
End If
End Sub
Protected Sub Consultar(sender As Object, e As EventArgs)
Dim fechaInicial As String = txtFechaI.Text
Dim fechaFinal As String = txtFechaF.Text
@@ -104,12 +138,34 @@ Partial Class ListadoContratos
Dim estatus As String = ""
Dim nombreEstatus As String = ""
Dim innerEstatus As String = ""
Dim tipoUnidad As String = ""
Dim nombreTipoUnidad As String = ""
Dim innerTipoUnidad As String = ""
Dim chofer As String = ""
Dim nombreChofer As String = ""
Dim innerChofer As String = ""
If (DdlEstatusConsulta.SelectedValue <> "") Then
estatus = $"C.CveContratosEstatus = {DdlEstatusConsulta.SelectedValue} AND"
nombreEstatus = ", CE.ContratoEstatus As ContratoEstatus1"
innerEstatus = "INNER JOIN Con_ContratosEstatus CE with(nolock) ON CE.CveContratoEstatus = C.CveContratosEstatus
"
innerEstatus = " INNER JOIN Con_ContratosEstatus CE with(nolock) ON CE.CveContratoEstatus = C.CveContratosEstatus "
End If
If (DdlTIpoUnidad.SelectedValue <> "") Then
'tipoUnidad = $"C.CveContratosEstatus = {DdlTIpoUnidad.SelectedValue} AND"
'nombreTipoUnidad = ", CE.ContratoTipoUnidad As ContratoTipoUnidad1"
'innerTipoUnidad = " INNER JOIN Con_ContratosTipoUnidad CE with(nolock) ON CE.CveContratoTipoUnidad = C.CveContratosEstatus "
End If
If (DdlChofer.SelectedValue <> "") Then
'tipoUnidad = $"C.CveContratosEstatus = {DdlTIpoUnidad.SelectedValue} AND"
'nombreTipoUnidad = ", CE.ContratoTipoUnidad As ContratoTipoUnidad1"
'innerTipoUnidad = " INNER JOIN Con_ContratosTipoUnidad CE with(nolock) ON CE.CveContratoTipoUnidad = C.CveContratosEstatus "
End If
Dim intervalo As String = If(DdlEstatusConsulta.SelectedValue = "" And DdlClientesConsulta.SelectedValue = "", $"FechaInicial BETWEEN '{fechaInicial}' AND '{fechaFinal}'", $"FechaInicial BETWEEN '{fechaInicial}' AND '{fechaFinal}'")
@@ -126,5 +182,14 @@ Partial Class ListadoContratos
UpTitulos.Update()
End Sub
Protected Sub Expandir(sender As Object, e As EventArgs)
If PnExpandirConsulta.Visible Then
PnExpandirConsulta.Visible = False
BtnExpandir.Text = "↑"
Else
PnExpandirConsulta.Visible = True
BtnExpandir.Text = "↓"
End If
End Sub
End Class

View File

@@ -15,35 +15,41 @@
margin-block: 1rem;
}
.miGrid {
color: white;
text-align: center;
}
.consulta {
padding: 1rem 2rem;
background-color: #95A5A6;
display: flex;
justify-content: space-around;
align-items: center;
padding: 1rem 1rem;
margin-bottom: 1rem;
}
.consulta_linea {
display: flex;
justify-content: space-between;
align-items: center;
margin-block: .5rem;
gap: 1rem;
}
.consulta_campo {
display: flex;
gap: 1rem;
align-items: center;
width: 100%;
}
.consulta_campo label {
color: white;
}
.miGrid {
.expandir {
width: 2.5rem;
font-size: 2.5rem;
font-weight: 900;
color: white;
text-align: center;
}
.miGrid thead {
color: black;
text-align: center;
}
</style>
</asp:Content>
@@ -51,6 +57,14 @@
Calendario de Viajes
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="H" runat="Server">
<li>
<asp:LinkButton ID="LnkPdf" runat="server"><i class="fa fa-ad-pdf"></i> Generar PDF</asp:LinkButton>
</li>
<li>
<asp:LinkButton ID="LnkExcel" runat="server"><i class="fa fa-ad-excel"></i> Generar Excel</asp:LinkButton>
</li>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="C" runat="Server">
<asp:Panel ID="PnlGeneral" runat="server">
@@ -77,6 +91,7 @@
</div>
</div>
</div>
<div class="portlet-body" style="display: none">
</div>
</div>
@@ -102,63 +117,99 @@
<%--Contratos Tab--%>
<ajax:TabPanel ID="TabPanel1" runat="server" HeaderText="Contratos">
<ContentTemplate>
<asp:UpdatePanel ID="UPFiltros" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div class="consulta">
<div class="consulta_campo">
<label>Fecha Inicial:</label>
<asp:TextBox Width="150px" ID="txtFechaI" runat="server" CssClass="form-control" type="datetime"
MaxLength="10"></asp:TextBox>
</div>
<div class="consulta_campo">
<label>Fecha Inicial:</label>
<asp:TextBox Width="150px" ID="txtFechaF" runat="server" CssClass="form-control" type="datetime"
MaxLength="10"></asp:TextBox>
</div>
<div class="consulta_campo">
<label>Cliente</label>
<ADS:Dropdownlost ID="DdlClientesConsulta" data-metodo="getcliente"
runat="server" DataTextField="NombreComercial" DataValueField="CveCliente" CssStyle="width: 200px"
CssClassDdl="pxlect2me"
UsaWebService="true"></ADS:Dropdownlost>
</div>
<div class="consulta_campo">
<label>Estatus:</label>
<div class="col-md-8">
<asp:DropDownList ID="DdlEstatusConsulta" runat="server" Class="table-group-action-input form-control input-inline select2me"
DataValueField="CveContratoEstatus"
DataTextField="ContratoEstatus"
AppendDataBoundItems="true"
Width="100%">
</asp:DropDownList>
</div>
</div>
<asp:Button ID="BtnConsulta" runat="server" Text="Consultar" class="btn btn-primary"
OnClick="Consultar"
ValidationGroup="GrpConsulta" />
<%-- Filtros --%>
<div class="consulta">
<div class="consulta_linea">
<div class="consulta_campo">
<label>Fecha Inicial:</label>
<asp:TextBox Width="150px" ID="txtFechaI" runat="server" CssClass="form-control"
type="datetime"
MaxLength="10"></asp:TextBox>
</div>
</ContentTemplate>
</asp:UpdatePanel>
<div class="consulta_campo">
<label>Fecha Inicial:</label>
<asp:TextBox Width="150px" ID="txtFechaF" runat="server" CssClass="form-control"
type="datetime"
MaxLength="10"></asp:TextBox>
</div>
<div class="consulta_campo">
<label>Cliente</label>
<ADS:Dropdownlost ID="DdlClientesConsulta" data-metodo="getcliente"
runat="server" DataTextField="NombreComercial" DataValueField="CveCliente" CssStyle="width: 200px"
CssClassDdl="select2me"
UsaWebService="true"></ADS:Dropdownlost>
</div>
<div class="consulta_campo">
<label>Estatus:</label>
<div class="col-md-8">
<asp:DropDownList ID="DdlEstatusConsulta" runat="server" Class="table-group-action-input form-control input-inline select2me"
DataTextField="ContratoEstatus" DataValueField="CveContratoEstatus"
AppendDataBoundItems="true" Width="200px">
</asp:DropDownList>
</div>
</div>
<div class="consulta_campo">
<asp:Button ID="BtnConsulta" runat="server" Text="Consultar" class="btn btn-primary"
OnClick="Consultar" />
<asp:LinkButton ID="BtnExpandir" runat="server" Text="↓" CssClass="expandir"
OnClick="Expandir" />
</div>
</div>
<asp:Panel runat="server" Visible="false" ID="PnExpandirConsulta" CssClass="consulta_linea">
<div class="consulta_campo">
<label>Centro Costos:</label>
<div class="col-md-8">
<asp:DropDownList ID="DdlCentroCostos" runat="server"
DataTextField="" DataValueField=""
AppendDataBoundItems="true" Class="table-group-action-input form-control input-inline select2me"
Width="200px">
</asp:DropDownList>
</div>
</div>
<div class="consulta_campo">
<label>Tipo Unidad:</label>
<div class="col-md-8">
<asp:DropDownList ID="DdlTIpoUnidad" runat="server"
DataTextField="TipoActivoFijo"
DataValueField="CveTipoActivoFijo"
AppendDataBoundItems="true"
Class="table-group-action-input form-control input-inline select2me"
Width="200px">
</asp:DropDownList>
</div>
</div>
<div class="consulta_campo">
<label>Chofer:</label>
<div class="col-md-8">
<asp:DropDownList ID="DropDownList1" runat="server"
DataValueField="CvePersonal"
DataTextField="NombreCompleto"
AppendDataBoundItems="true"
Class="table-group-action-input form-control input-inline select2me"
Width="200px">
</asp:DropDownList>
</div>
</div>
</asp:Panel>
</div>
<asp:UpdatePanel ID="UpTitulos" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:GridView ID="GvContratos" runat="server" AutoGenerateColumns="false" EmptyDataText="No se Encontró Contrato Registrado"
CssClass="table table-striped table-hover Widthall ScrollAD mysmallbtn miGrid"
GridLines="None"
data-sort="true" DataKeyNames="CveContrato, DescripcionContrato, Ubicacion, FechaInicial, FechaFinal, CveCliente, CveTipoAF, Importe, ImporteMin, ImporteMax,CveChofer, Observaciones, CveAF">
data-sort="true" DataKeyNames="CveContrato, DescripcionContrato, Ubicacion, FechaInicial, FechaFinal, CveCliente,NombreComercial, CveTipoAF, Importe, ImporteMin, ImporteMax, Observaciones, CveAF, CveChofer, CveChofer2, CveContratosEstatus">
<Columns>
<asp:TemplateField HeaderText="Folio">
<asp:TemplateField HeaderText="Contrato">
<ItemTemplate>
<asp:Literal ID="LtlCveContrato" runat="server" Text='<%# Eval("CveContrato") %>'></asp:Literal>
<asp:Literal ID="LtlCveContrato" runat="server" Text='<%# Eval("NumeroContrato") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField ItemStyle-HorizontalAlign="Center" ItemStyle-Width="120px">
@@ -184,9 +235,17 @@
<asp:TemplateField HeaderText="Chofer">
<ItemTemplate>
<asp:Literal ID="LtlChofer" runat="server" Text='<%# Eval("NombreCompleto") %>'></asp:Literal>
<asp:Literal ID="LtlChofer" runat="server" Text='<%# Eval("NombreChofer") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Chofer2">
<ItemTemplate>
<asp:Literal ID="LtlChofer2" runat="server" Text='<%# Eval("NombreChofer2") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Unidad">
<ItemTemplate>
<asp:Literal ID="LtlAF" runat="server" Text='<%# Eval("CveAF") %>'></asp:Literal>
@@ -281,7 +340,7 @@
<div class="col-md-8">
<asp:TextBox ID="TxtFechaSalida" runat="server" CssClass="form-control"
type="datetime-local" ReadOnly="true" Width="100%"></asp:TextBox>
ReadOnly="true" Width="100%"></asp:TextBox>
</div>
</div>
@@ -291,7 +350,7 @@
<div class="col-md-8">
<asp:TextBox ID="TxtFechaRegreso" runat="server" CssClass="form-control"
type="datetime-local" ReadOnly="true" Width="100%"></asp:TextBox>
ReadOnly="true" Width="100%"></asp:TextBox>
</div>
</div>

View File

@@ -1,13 +1,23 @@
Option Explicit On
Option Strict On
Imports System.Data
Imports System.Data.SqlClient
Imports ADSNetLibrary.SIGAPI.Helpers
Imports Extensiones.ModExtensiones
Imports GemBox.Spreadsheet
Imports Microsoft.Reporting.WebForms
Partial Class RepContratosCalendario
Inherits ClsPaginas
#Region "PROPIEDADES"
Public Property DtAvance() As DataTable
Get
Return CType(ViewState("DtAvance"), DataTable)
End Get
Set(value As DataTable)
ViewState("DtAvance") = value
End Set
End Property
#End Region
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
@@ -24,12 +34,12 @@ Partial Class RepContratosCalendario
End Sub
Private Sub CargaDatos()
Dim ObjContratos As New ClsContratos
If ObjContratos.GetContratos(-1, UsuarioActual.CveEmpresa, TipoContrato:=2) Then
If ObjContratos.GetContratos(-1, UsuarioActual.CveEmpresa, TipoContrato:=34) Then
GvContratos.DataSource = ObjContratos.DtResultados
DtAvance = ObjContratos.DtResultados
GvContratos.DataBind()
GvContratos.HeaderStyle.ForeColor = Drawing.Color.Black
End If
If ObjContratos.GetContratosEstatus(UsuarioActual.CveEmpresa) Then
@@ -60,15 +70,15 @@ Partial Class RepContratosCalendario
'Lista de Activos fijos
DdlAF.DataSource = GlobalDTActivoFijos(UsuarioActual.CveEmpresa)
DdlAF.DataBind()
DdlAF.Items.Insert(0, New ListItem("-", ""))
DdlAF.Items.Insert(0, New ListItem("-", "0"))
'Lista Chofer'
DdlChofer.DataSource = GlobalDTRHPersonal(185)
DdlChofer.DataBind()
DdlChofer.Items.Insert(0, New ListItem("-", ""))
DdlChofer.Items.Insert(0, New ListItem("-", "0"))
DdlChofer1.DataSource = GlobalDTRHPersonal(185)
DdlChofer1.DataBind()
DdlChofer1.Items.Insert(0, New ListItem("-", ""))
DdlChofer1.Items.Insert(0, New ListItem("-", "0"))
End Sub
@@ -82,36 +92,7 @@ Partial Class RepContratosCalendario
RegistraScript("$('#ModalActualizar').modal('show');")
End Sub
Protected Sub Consultar(sender As Object, e As EventArgs)
Dim fechaInicial As String = txtFechaI.Text
Dim fechaFinal As String = txtFechaF.Text
Dim cliente As String = If(DdlClientesConsulta.SelectedValue = "", "", $"C.CveCliente = {DdlClientesConsulta.SelectedValue} AND")
Dim estatus As String = ""
Dim nombreEstatus As String = ""
Dim innerEstatus As String = ""
If (DdlEstatusConsulta.SelectedValue <> "") Then
estatus = $"C.CveContratosEstatus = {DdlEstatusConsulta.SelectedValue} AND"
nombreEstatus = ", CE.ContratoEstatus As ContratoEstatus1"
innerEstatus = "INNER JOIN Con_ContratosEstatus CE with(nolock) ON CE.CveContratoEstatus = C.CveContratosEstatus
"
End If
Dim intervalo As String = If(DdlEstatusConsulta.SelectedValue = "" And DdlClientesConsulta.SelectedValue = "", $"FechaInicial BETWEEN '{fechaInicial}' AND '{fechaFinal}'", $"FechaInicial BETWEEN '{fechaInicial}' AND '{fechaFinal}'")
Dim query As String = $"SELECT *, ISNULL(Cli.NombreComercial,'') AS NombreCompleto {nombreEstatus} FROM Con_Contratos C LEFT JOIN Clientes Cli with(nolock) ON Cli.CveCliente = C.CveCliente {innerEstatus} WHERE {cliente} {estatus} {intervalo}"
Using connection As New SqlConnection(ConfigurationManager.ConnectionStrings("Conexion").ConnectionString)
Using command As New SqlCommand(query, connection)
connection.Open()
Dim reader As SqlDataReader = command.ExecuteReader()
GvContratos.DataSource = reader
GvContratos.DataBind()
End Using
End Using
UpTitulos.Update()
End Sub
Protected Sub UpdateContrato(sender As Object, e As EventArgs)
Dim fechaS As Date = TxtFechaSalida.Text.ToDate
Dim fechaR As Date = TxtFechaRegreso.Text.ToDate
@@ -134,13 +115,102 @@ Partial Class RepContratosCalendario
TxtObservaciones.Text = GvRow.DataKey("Observaciones")
TxtDescripcion.Text = GvRow.DataKey("DescripcionContrato")
TxtUbicacion.Text = GvRow.DataKey("Ubicacion")
TxtFechaSalida.Text = GvRow.DataKey("FechaInicial").ToDateTime.ToString("MM/dd/yyyy")
TxtFechaRegreso.Text = GvRow.DataKey("FechaFinal").ToDateTime.ToString("MM/dd/yyyy")
TxtFechaSalida.Text = Convert.ToDateTime(GvRow.DataKey("FechaInicial")).ToString("dd/MM/yyyy hh:mm:ss tt")
TxtFechaRegreso.Text = Convert.ToDateTime(GvRow.DataKey("FechaFinal")).ToString("dd/MM/yyyy hh:mm:ss tt")
DdlClientes.SelectedValue = GvRow.DataKey("CveCliente")
DdlClientes.SelectedText = GvRow.DataKey("NombreComercial")
DdlAF.SelectedValue = GvRow.DataKey("CveAF")
DdlChofer.SelectedValue = GvRow.DataKey("CveChofer")
DdlChofer.SelectedValue = GvRow.DataKey("CveChofer2")
DdlEstatusContrato.SelectedValue = GvRow.DataKey("CveContratosEstatus")
UpModal.Update()
RegistraScript("$('#ModalActualizar').modal('show');")
End Sub
Protected Sub Consultar(sender As Object, e As EventArgs)
Dim fechaInicial As String = txtFechaI.Text
Dim fechaFinal As String = txtFechaF.Text
Dim cliente As String = If(DdlClientesConsulta.SelectedValue = "", "", $"C.CveCliente = {DdlClientesConsulta.SelectedValue} AND")
Dim estatus As String = ""
Dim nombreEstatus As String = ""
Dim innerEstatus As String = ""
Dim tipoUnidad As String = ""
Dim nombreTipoUnidad As String = ""
Dim innerTipoUnidad As String = ""
Dim chofer As String = ""
Dim nombreChofer As String = ""
Dim innerChofer As String = ""
If (DdlEstatusConsulta.SelectedValue <> "") Then
estatus = $"C.CveContratosEstatus = {DdlEstatusConsulta.SelectedValue} AND"
nombreEstatus = ", CE.ContratoEstatus As ContratoEstatus1"
innerEstatus = " INNER JOIN Con_ContratosEstatus CE with(nolock) ON CE.CveContratoEstatus = C.CveContratosEstatus "
End If
If (DdlTIpoUnidad.SelectedValue <> "") Then
'tipoUnidad = $"C.CveContratosEstatus = {DdlTIpoUnidad.SelectedValue} AND"
'nombreTipoUnidad = ", CE.ContratoTipoUnidad As ContratoTipoUnidad1"
'innerTipoUnidad = " INNER JOIN Con_ContratosTipoUnidad CE with(nolock) ON CE.CveContratoTipoUnidad = C.CveContratosEstatus "
End If
If (DdlChofer.SelectedValue <> "") Then
'tipoUnidad = $"C.CveContratosEstatus = {DdlTIpoUnidad.SelectedValue} AND"
'nombreTipoUnidad = ", CE.ContratoTipoUnidad As ContratoTipoUnidad1"
'innerTipoUnidad = " INNER JOIN Con_ContratosTipoUnidad CE with(nolock) ON CE.CveContratoTipoUnidad = C.CveContratosEstatus "
End If
Dim intervalo As String = If(DdlEstatusConsulta.SelectedValue = "" And DdlClientesConsulta.SelectedValue = "", $"FechaInicial BETWEEN '{fechaInicial}' AND '{fechaFinal}'", $"FechaInicial BETWEEN '{fechaInicial}' AND '{fechaFinal}'")
Dim query As String = $"SELECT *, ISNULL(Cli.NombreComercial,'') AS NombreComercial {nombreEstatus} FROM Con_Contratos C LEFT JOIN Clientes Cli with(nolock) ON Cli.CveCliente = C.CveCliente {innerEstatus} WHERE {cliente} {estatus} {intervalo}"
Using connection As New SqlConnection(ConfigurationManager.ConnectionStrings("Conexion").ConnectionString)
Using command As New SqlCommand(query, connection)
connection.Open()
Dim reader As SqlDataReader = command.ExecuteReader()
GvContratos.DataSource = reader
GvContratos.DataBind()
End Using
End Using
UpTitulos.Update()
End Sub
Protected Sub Expandir(sender As Object, e As EventArgs)
If PnExpandirConsulta.Visible Then
PnExpandirConsulta.Visible = False
BtnExpandir.Text = "↑"
Else
PnExpandirConsulta.Visible = True
BtnExpandir.Text = "↓"
End If
End Sub
Protected Sub LnkExcel_Click(sender As Object, e As EventArgs) Handles LnkExcel.Click
GvContratos.ExportToExcel("ReporteCompras" & NowADS().ToShortDateString)
End Sub
Protected Sub LnkPDF_Click(sender As Object, e As EventArgs) Handles LnkPdf.Click
Dim ObjContratos As New ClsContratos
If ObjContratos.GetContratos(-1, UsuarioActual.CveEmpresa, TipoContrato:=2) Then
Dim Imagen As New IO.FileInfo($"{UsuarioActual.Empresa.Ruta}/Logo.png")
Dim logouri As String = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa)
Dim Cliente As String = If(DdlClientes.SelectedValue = "-1", "", $"&emsp;<b>Cliente:</b>&nbsp;{DdlClientes.SelectedText}")
Dim dt As DataTable = ObjContratos.DtResultados
Dim params As New List(Of ReportParameter) From {
New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa),
New ReportParameter("FechaInicio", "-1"),
New ReportParameter("FechaFin", "-1"),
New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa),
New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre),
New ReportParameter("FechaImpresion", NowADS().ToDateTime.ToShortDateString),
New ReportParameter("LogoPath", If(Imagen.Exists, $"file://{Imagen.FullName}", ""))
}
ImprimirPDF("Empresas/Grales/Formatos/RepContratos.rdlc", dt, params, NombreArchivo:="Reporte Contratos")
Else
Alert("No hay datos consultados", TipoMensaje.MsgAdvertencia)
End If
End Sub
End Class

View File

@@ -15,6 +15,11 @@
.masivo {
color: green;
}
.masivo_block {
margin: 1rem;
border: grey 1px solid;
}
</style>
</asp:Content>
@@ -28,251 +33,207 @@
</asp:Content>
<asp:Content ID="Content7" ContentPlaceHolderID="C" runat="Server">
<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) %>"
style="display: inline-block; margin-right: -10px; width: 150px;" />
<a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBusqueda','{0}')", GvViajes.ClientID) %>"
style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier">
</i></a>
</div>
<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) %>"
style="display: inline-block; margin-right: -10px; width: 150px;" />
<a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBusqueda','{0}')", GvViajes.ClientID) %>"
style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier">
</i></a>
</div>
<%-- Listado de Viajes --%>
<asp:GridView ID="GvViajes" 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">
<Columns>
<asp:GridView ID="GvViajes" 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">
<Columns>
<asp:TemplateField HeaderText="Ruta">
<ItemTemplate>
<asp:Literal ID="LtlRuta" runat="server" Text='<%# Eval("Ruta") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Ruta">
<ItemTemplate>
<asp:Literal ID="LtlRuta" runat="server" Text='<%# Eval("Ruta") %>'></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="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="Destino">
<ItemTemplate>
<asp:Literal ID="LtlDestino" runat="server" Text='<%# Eval("Destino") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Fecha">
<ItemTemplate>
<asp:Literal ID="LtlFecha" runat="server" Text='<%# Eval("Fecha", "{0:d}") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<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="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>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Chofer">
<ItemTemplate>
<asp:Literal ID="LtlChofer" runat="server" Text='<%# Eval("NombreCompleto") %>'></asp:Literal>
</ItemTemplate>
</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="Masivo">
<ItemTemplate>
<asp:Label ID="LtlMasivo" runat="server" Text='<%# Eval("CveMasivo") %>'>></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<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='<%# If(Eval("CveMasivo").ToString <> "", "Eliminación masiva", "Confirmar") %>'
data-btn-ok-label="si" />
<asp:LinkButton ID="BtnBoletos" runat="server" AlternateText="Boletos"
CssClass="btn btn-circle btn-sm yellow" Text="<i class='fa fa-ticket'></i>"
OnClick="GoBoletos" />
<asp:LinkButton ID="BtnViaje" runat="server" AlternateText="Viaje"
CssClass="btn btn-circle btn-sm blue" Text="<i class='fa fa-arrow-right'></i>"
OnClick="GoViaje" />
<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='<%# If(Eval("CveMasivo").ToString <> "", "Eliminación masiva", "Confirmar") %>'
data-btn-ok-label="si" />
<asp:LinkButton ID="BtnBoletos" runat="server" AlternateText="Boletos"
CssClass="btn btn-circle btn-sm yellow" Text="<i class='fa fa-ticket'></i>"
OnClick="GoBoletos" />
<asp:LinkButton ID="BtnViaje" runat="server" AlternateText="Viaje"
CssClass="btn btn-circle btn-sm blue" Text="<i class='fa fa-arrow-right'></i>"
OnClick="GoViaje" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<%-- Modal --%>
<div id="ModalAgregar" class="modal ADS fade" role="dialog">
<div class="modal-dialog">
<div id="UpAddChofer" class="modal-content rowpadding" tabindex="-1"
runat="server">
<div id="ModalAgregar" class="modal ADS fade" role="dialog">
<div class="modal-dialog">
<div id="UpAddChofer" class="modal-content rowpadding" tabindex="-1"
runat="server">
<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>
<h4 class="modal-title" id="ModalLabel" runat="server">Agregar Nuevo Viaje</h4>
</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">
<div class="portlet-body">
<div class="row margin-bottom-5" id="TrAF" runat="server">
<label class="col-md-4">
<asp:Label runat="server" Text="Transporte:"></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>
<asp:DropDownList ID="DdlTransporte" AppendDataBoundItems="true" DataTextField="Descripcion"
DataValueField="CveActivoFijo" Class="form-control input-sm select2me"
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 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">
</div>
</div>
<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="TrRutas" runat="server">
<label class="col-md-4">
<asp:Label runat="server" Text="Ruta:"></asp:Label></label><div
class="col-md-8">
<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="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>
<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" id="TrDestino" runat="server">
<label class="col-md-4">
<asp:Label runat="server" Text="Destino:"></asp:Label></label><div
class="col-md-8">
<div class="row margin-bottom-5">
<label class="col-md-4">
<asp:Label runat="server" Text="Fecha Viaje:"></asp:Label></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: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" id="TrChofer" runat="server">
<label class="col-md-4">
<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="form-control input-sm select2me"
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 margin-bottom-5">
<label class="col-md-4">
<asp:Label runat="server" Text="Fecha Viaje:"></asp:Label></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: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="row my-1 truncate">
<asp:CheckBox CssClass="col-md-4" ID="IsMasivo" runat="server" Text="Generar Viajes Masivo"
Visible="true"
OnCheckedChanged="ToggleMasivo" AutoPostBack="true" />
<div class="row my-1 truncate">
<asp:CheckBox CssClass="col-md-4" ID="IsMasivo" runat="server" Text="Generar Viajes Masivo"
Visible="true"
OnCheckedChanged="ToggleMasivo" AutoPostBack="true" />
</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">
<asp:Panel ID="DivFechaMasivo" runat="server" Visible="false" CssClass="col-md-8">
<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</label>
<asp:TextBox CssClass="col-md-8" ID="TxtFrecuencia" runat="server" type="number"
Width="150px"></asp:TextBox>
</div>
</asp:Panel>
<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>
</div>
<div class="modal-footer">
<asp:Button ID="BtnGuardar" OnClick="AddViaje" runat="server" CssClass="btn btn-primary"
ValidationGroup="GrpGuardar"
Text="Guardar"></asp:Button>
<button type="button" class="btn btn-default" data-dismiss="modal">Cancelar</button>
</div>
</asp:Panel>
</div>
<br />
<div class="modal-footer">
<asp:Button ID="BtnGuardar" OnClick="AddViaje" runat="server" CssClass="btn btn-primary"
ValidationGroup="GrpGuardar"
Text="Guardar"></asp:Button>
<button type="button" class="btn btn-default" data-dismiss="modal">Cancelar</button>
</div>
</div>
</div>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Content>

View File

@@ -32,18 +32,6 @@ Partial Class ListadoViajes
End Sub
Private Sub InicializaCombos()
'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 ClsTransportes()
If ObjRutas.GetRutas(-1, -1, -1, "", True, DateTime.Now) Then
@@ -70,11 +58,6 @@ Partial Class ListadoViajes
End If
ObjRutas.Dispose()
'Lista Chofer'
DdlChofer.DataSource = GlobalDTRHPersonal(185)
DdlChofer.DataBind()
DdlChofer.Items.Insert(0, New ListItem("Seleccione Chofer", ""))
End Sub
Private Sub GvViajes_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvViajes.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
@@ -102,12 +85,12 @@ Partial Class ListadoViajes
Public Sub MostrarModal()
IsMasivo.Visible = True
DdlRutas.Text = ""
DdlTransporte.Text = ""
DdlChofer.Text = ""
TxtFechaViaje.Text = ""
DdlPartida.Text = ""
DdlDestino.SelectedValue = ""
BtnGuardar.Text = "Guardar"
BtnGuardar.Text = "Agregar"
ModalLabel.InnerHtml = "Agregar Nuevo Viaje"
RegistraScript(String.Format("$('#{0}').modal('show');", "ModalAgregar"))
End Sub
@@ -135,7 +118,7 @@ Partial Class ListadoViajes
For Each fecha As DateTime In fechasGeneradas
Try
Dim CveContratoHijo As Integer = -1
CveContratoHijo = ObjTransportes.AddViajes(DdlRutas.Text.ToEntero, DdlTransporte.Text.ToEntero, DdlChofer.Text.ToEntero, UsuarioActual.CveEmpresa, fecha, DdlPartida.Text.ToEntero, DdlDestino.Text.ToEntero, IsMasivo:=True, CveMasivo:=CveMasivo)
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()
@@ -146,8 +129,7 @@ Partial Class ListadoViajes
Next
DdlRutas.Text = ""
DdlTransporte.Text = ""
DdlChofer.Text = ""
TxtFechaViaje.Text = ""
DdlPartida.Text = ""
DdlDestino.SelectedValue = ""
@@ -158,21 +140,19 @@ Partial Class ListadoViajes
Try
If BtnGuardar.Text = "Guardar" Then
Dim CveContratoHijo As Integer = -1
CveContratoHijo = ObjTransportes.AddViajes(DdlRutas.Text.ToEntero, DdlTransporte.Text.ToEntero, DdlChofer.Text.ToEntero, UsuarioActual.CveEmpresa, TxtFechaViaje.Text.ToDate, DdlPartida.Text.ToEntero, DdlDestino.Text.ToEntero)
CveContratoHijo = ObjTransportes.AddViajes(DdlRutas.Text.ToEntero, -1, -1, UsuarioActual.CveEmpresa, TxtFechaViaje.Text.ToDate, DdlPartida.Text.ToEntero, DdlDestino.Text.ToEntero)
If CveContratoHijo > 0 Then
ObjTransportes.Commit()
Alert("El Viaje se registró Correctamente.", TipoMensaje.MsgInformacion)
DdlRutas.Text = ""
DdlTransporte.Text = ""
DdlChofer.Text = ""
TxtFechaViaje.Text = ""
DdlPartida.Text = ""
DdlDestino.SelectedValue = ""
End If
Else
If ObjTransportes.UpdateViajes(CveViaje.ToEntero, DdlRutas.Text.ToEntero, DdlTransporte.Text.ToEntero, DdlChofer.Text.ToEntero, UsuarioActual.CveEmpresa, TxtFechaViaje.Text.ToDate, DdlPartida.Text.ToEntero, DdlDestino.Text.ToEntero) = True Then
If ObjTransportes.UpdateViajes(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()
@@ -192,11 +172,9 @@ Partial Class ListadoViajes
DivFechaMasivo.Visible = False
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")
ViewState("CveViaje") = GvRow.DataKey("CveViaje")
ViewState("Ruta") = GvRow.DataKey("Ruta")
Dim fecha As DateTime
@@ -205,7 +183,9 @@ Partial Class ListadoViajes
TxtFechaViaje.Text = fecha.ToString("yyyy-MM-dd").Replace(" ", "T")
End If
BtnGuardar.Text = "Editar"
BtnGuardar.Text = "Actualizar"
ModalLabel.InnerHtml = "Actualizar Viaje"
RegistraScript(String.Format("$('#{0}').modal('show');", "ModalAgregar"))