--Se agregaron el módulo 603 RepContratosCalendario a ClsPaginas. Se agrega el case a ProcessRequest "contratos_transportes" y la función GetContratos para mostrarlos en calendario(faltan ajustes específicos). Se agrega el apartado de chofer al modal al agregar contratos(falta ver a dónde se asignará esa variable, si se crea otra o se asignada a alguna de las variables ya existentes). Se crea y alimenta RepContratosCalendarios para mostrar el calendario de contratos.

This commit is contained in:
AbrahamCastilloV
2024-01-26 04:03:49 -07:00
parent dc3af49e75
commit 6d18d1b394
6 changed files with 416 additions and 16 deletions

View File

@@ -10717,6 +10717,7 @@ Public Class ClsPaginas
PaginaDict.Add("/Transportes/RepViajes.aspx".ToUpper(), 599) PaginaDict.Add("/Transportes/RepViajes.aspx".ToUpper(), 599)
PaginaDict.Add("/Transportes/RepBoletos.aspx".ToUpper(), 600) PaginaDict.Add("/Transportes/RepBoletos.aspx".ToUpper(), 600)
PaginaDict.Add("/Transportes/Boletos.aspx".ToUpper(), 601) PaginaDict.Add("/Transportes/Boletos.aspx".ToUpper(), 601)
PaginaDict.Add("/Transportes/RepContratosCalendario.aspx".ToUpper(), 603)
#End Region #End Region
'Antes de aquí. 'Antes de aquí.

View File

@@ -45,6 +45,32 @@ Public Class CargaEventos : Implements IHttpHandler, IRequiresSessionState
End If End If
Exit Select
Case "contrato_transportes"
If context.Request("U").ToEntero > 0 Then
CveUsuario = context.Request("U").ToEntero
CveEmpresa = context.Request("E").ToEntero
Dim CveSubProyecto As Integer = If(context.Request("CveSubProyecto") IsNot Nothing, context.Request("CveSubProyecto").ToEntero, -1)
Dim CveUsuarioPara As Integer = If(context.Request("CveUsuarioPara") IsNot Nothing, context.Request("CveUsuarioPara").ToEntero, -1)
FI = context.Request("start").ToDate
FF = context.Request("end").ToDate
If Not GetContratos(context:=context) Then
'Convierte el objeto de Eventos en JSON
'Dim oSerializer As System.Web.Script.Serialization.JavaScriptSerializer = New System.Web.Script.Serialization.JavaScriptSerializer
Dim sJSON As String = Newtonsoft.Json.JsonConvert.SerializeObject(events)
context.Response.Write(sJSON)
End If
End If
Exit Select Exit Select
Case Else Case Else
Exit Select Exit Select
@@ -69,13 +95,6 @@ Public Class CargaEventos : Implements IHttpHandler, IRequiresSessionState
End If End If
End If End If
End Sub End Sub
Public ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable Public ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable
@@ -137,11 +156,7 @@ Public Class CargaEventos : Implements IHttpHandler, IRequiresSessionState
End If End If
Dim EsCoordinador As Boolean = False Dim EsCoordinador As Boolean = False
Dim usuarioActual_ As Usuario = UsuarioActual(context) Dim usuarioActual_ As Usuario = UsuarioActual(context)
If context IsNot Nothing AndAlso CveOS = -2 Then If context IsNot Nothing AndAlso CveOS = -2 Then
If usuarioActual_.TienePermisoProceso(348) Then If usuarioActual_.TienePermisoProceso(348) Then
@@ -265,7 +280,7 @@ Public Class CargaEventos : Implements IHttpHandler, IRequiresSessionState
'AGREGAMOS CUANDO NO ES RECURRENTE 'AGREGAMOS CUANDO NO ES RECURRENTE
Dim tFecha As DateTime = DateAdd(DateInterval.Month, -6, ClsPaginas.NowADS()) Dim tFecha As DateTime = DateAdd(DateInterval.Month, -6, ClsPaginas.NowADS())
'SI LA FECHA DEL EVENTO ES MENOR DE 6 MESES DE LA FECHA ACTUAL NO LO AGREGA 'SI LA FECHA DEL EVENTO ES MENOR DE 6 MESES DE LA FECHA ACTUAL NO LO AGREGA
If dr("FechaFin").ToString.ToDateTime > tFecha Or dr("FechaInicio").ToString.ToDateTime > tFecha Then If dr("FechaFinal").ToString.ToDateTime > tFecha Or dr("FechaInicio").ToString.ToDateTime > tFecha Then
events.Add(cevent) events.Add(cevent)
End If End If
Else Else
@@ -418,6 +433,172 @@ Public Class CargaEventos : Implements IHttpHandler, IRequiresSessionState
Return ErrorEventos Return ErrorEventos
End Function End Function
Private Function GetContratos(Optional context As HttpContext = Nothing) As Boolean
Dim ObjContratos As New ClsContratos
events = New List(Of CalendarEvent)
Dim DT_SubProyectos As New DataTable
Dim DT_EstatusOS As New DataTable
Dim usuarioActual_ As Usuario = UsuarioActual(context)
Dim ErrorEventos As Boolean = False
Dim Colores() As String = {"#006699", "#0099cc", "#0066cc", "#0033cc", "#0000ff", "#3333ff", "#3333ff", "#6600ff", "#9933ff", "#cc00ff", "#cc00cc", "#cc0099", "#cc3399", "#cc6699", "#cc0066", "#009933", "#00cc00", "#00cc66", "#009999", "#669900", "#99cc00", "#cccc00", "#cc9900", "#ff9900", "#006666", "#669999"}
DT_SubProyectos.Columns.Add("CveSubProyecto", GetType(Integer))
DT_SubProyectos.Columns.Add("backgroundColor")
DT_EstatusOS.Columns.Add("", GetType(Integer))
If ObjContratos.GetContratos(-1, usuarioActual_.CveEmpresa, TipoContrato:=2) Then
If ObjContratos.DtResultados.Rows.Count > 0 Then
Try
For Each dr As DataRow In ObjContratos.DtResultados.Rows
Dim cevent As CalendarEvent = New CalendarEvent()
cevent.id = dr("CveContrato").ToString.ToEntero
cevent.title = dr("DescripcionContrato").ToString
cevent.start = String.Format("{0:s}", dr("FechaInicial").ToString.ToDateTime)
cevent.end = String.Format("{0:s}", dr("FechaFinal").ToString.ToDateTime)
cevent.allDay = False
cevent.CveEventoEstatus = dr("NumeroContrato").ToString.ToEntero
If Not cevent.recurrenciatipo > 0 Then
'AGREGAMOS CUANDO NO ES RECURRENTE
Dim tFecha As DateTime = DateAdd(DateInterval.Month, -6, ClsPaginas.NowADS())
'SI LA FECHA DEL EVENTO ES MENOR DE 6 MESES DE LA FECHA ACTUAL NO LO AGREGA
If dr("FechaFinal").ToString.ToDateTime > tFecha Or dr("FechaInicial").ToString.ToDateTime > tFecha Then
events.Add(cevent)
End If
Else
'EMPIEZA METODO PARA AGREGAR CUANDO SI ES RECURRENTE
Dim FinRecurrencia As Integer = cevent.recurrenciafin.ToEntero
Dim FI As DateTime, FF As DateTime, FT As DateTime
Dim DiasSemana As String() = cevent.diassemana.Split(","c)
FI = cevent.start.ToDateTime
FF = cevent.end.ToDateTime
'OBTENEMOS LA FECHA TERMINO (FT) DE LA RECURRENCIA
Select Case FinRecurrencia
Case -1
FT = DateAdd(DateInterval.Year, 2, dr("FechaInicial").ToString.ToDateTime)
Case Is > 0
FinRecurrencia -= 1
Select Case cevent.recurrenciatipo
Case 1
FT = DateAdd(DateInterval.Hour, FinRecurrencia * cevent.frecuencia, dr("FechaInicial").ToString.ToDateTime)
Case 2
FT = DateAdd(DateInterval.Day, FinRecurrencia * cevent.frecuencia, dr("FechaInicial").ToString.ToDateTime)
Case 3
FT = DateAdd(DateInterval.WeekOfYear, FinRecurrencia * cevent.frecuencia, dr("FechaInicial").ToString.ToDateTime)
FT = DateAdd(DateInterval.Day, (7 - Weekday(FT)).ToString.ToDouble, FT)
Case 4
FT = DateAdd(DateInterval.Month, FinRecurrencia * cevent.frecuencia, dr("FechaInicial").ToString.ToDateTime)
Case 5
FT = DateAdd(DateInterval.Year, FinRecurrencia * cevent.frecuencia, dr("FechaInicial").ToString.ToDateTime)
End Select
End Select
'SI ES TIPO SEMANAL Y DIASSEMANA TIENE VALORES CHECKEA ESTOS VALORES
Do
If DiasSemana.Length > 0 AndAlso DiasSemana(0) <> "" Then
For Each drDias As String In DiasSemana
Dim FIT As Date = FI, FFT As Date = FF
FIT = DateAdd(DateInterval.Day, (drDias.ToEntero - Weekday(FI)).ToString.ToDouble, FI)
FFT = DateAdd(DateInterval.Day, (drDias.ToEntero - Weekday(FF)).ToString.ToDouble, FF)
cevent = New CalendarEvent()
cevent.id = dr("CveContrato").ToString.ToEntero
cevent.description = dr("DescripcionContrato").ToString
cevent.start = String.Format("{0:s}", dr("FechaInicial").ToString.ToDateTime)
cevent.end = String.Format("{0:s}", dr("FechaFinal").ToString.ToDateTime)
cevent.allDay = False
cevent.CveEventoEstatus = dr("NumeroContrato").ToString.ToEntero
'11/05/2018 - Evento Gasto Recurrente
cevent.CveTipoEvento = dr("CveTipoEvento").ToString.ToEntero
If cevent.CveTipoEvento = 10 Then
cevent.Importe = dr("Importe").ToString.ToDouble
End If
If cevent.CveEventoEstatus.ToString.ToEntero = 3 Then
cevent.backgroundColor = "#1BBC9B"
End If
'SI LA FECHA DEL EVENTO ES MENOR DE 6 MESES DE LA FECHA ACTUAL Y/0 SI LA FECHA INICIAL DE LA RECURRENCIA ES MENOR A LA FECHA QUE SE CREO EL EVENTO NO LO AGREGA
If FIT > DateAdd(DateInterval.Month, -6, ClsPaginas.NowADS()) And FIT >= dr("FechaInicial").ToString.ToDateTime Then
events.Add(cevent)
End If
Next
Else
cevent = New CalendarEvent()
cevent.id = dr("CveContrato").ToString.ToEntero
cevent.description = dr("DescripcionContrato").ToString
cevent.start = String.Format("{0:s}", dr("FechaInicial").ToString.ToDateTime)
cevent.end = String.Format("{0:s}", dr("FechaFinal").ToString.ToDateTime)
cevent.allDay = False
'cevent.CveEventoEstatus = dr("NumeroContrato").ToString.ToEntero
'cevent.CveEventoEstatus = dr("CveEventoEstatus").ToString.ToEntero
'cevent.cveagendatipo = dr("CveAgendaTipo").ToString
'cevent.prioridad = dr("CvePrioridad").ToString.ToEntero
'cevent.backgroundColor = dr("BackGroundColor").ToString
'cevent.recurrenciatipo = dr("RecurrenciaTipo").ToString.ToEntero
'cevent.frecuencia = dr("Frecuencia").ToString.ToEntero
'cevent.diassemana = dr("DiasSemana").ToString
'cevent.dia = dr("Dia").ToString.ToEntero
'cevent.mes = dr("Mes").ToString.ToEntero
'cevent.recurrenciafin = dr("RecurrenciaFin").ToString
'cevent.CveProspecto = dr("CveProspecto").ToString.ToEntero
'cevent.Prospecto = dr("Prospecto").ToString
'11/05/2018 - Evento Gasto Recurrente
'SI LA FECHA DEL EVENTO ES MENOR DE 6 MESES DE LA FECHA ACTUAL NO LO AGREGA
If FI > DateAdd(DateInterval.Month, -6, ClsPaginas.NowADS()) Then
events.Add(cevent)
End If
End If
Select Case cevent.recurrenciatipo
Case 1
FI = DateAdd(DateInterval.Hour, cevent.frecuencia, FI)
FF = DateAdd(DateInterval.Hour, cevent.frecuencia, FF)
Case 2
FI = DateAdd(DateInterval.Day, cevent.frecuencia, FI)
FF = DateAdd(DateInterval.Day, cevent.frecuencia, FF)
Case 3
FI = DateAdd(DateInterval.WeekOfYear, cevent.frecuencia, FI)
FF = DateAdd(DateInterval.WeekOfYear, cevent.frecuencia, FF)
Case 4
FI = DateAdd(DateInterval.Month, cevent.frecuencia, FI)
FF = DateAdd(DateInterval.Month, cevent.frecuencia, FF)
Case 5
FI = DateAdd(DateInterval.Year, cevent.frecuencia, FI)
FF = DateAdd(DateInterval.Year, cevent.frecuencia, FF)
End Select
Loop Until FI > FT
End If
Next
Catch ex As Exception
GuardaLog(ex.ToString())
End Try
End If
End If
ObjContratos.Dispose()
Return ErrorEventos
End Function
ReadOnly Property UsuarioActual(ByVal context As HttpContext) As Usuario ReadOnly Property UsuarioActual(ByVal context As HttpContext) As Usuario
Get Get
UsuarioActual = DirectCast(If(context IsNot Nothing, context.Session("UsuarioSIG"), Nothing), Usuario) UsuarioActual = DirectCast(If(context IsNot Nothing, context.Session("UsuarioSIG"), Nothing), Usuario)

View File

@@ -1,4 +1,4 @@
<%@ Page Language="VB" AutoEventWireup="false" Title="Transportes V&A - Contratos" <%@ Page Language="VB" AutoEventWireup="true" Title="Transportes V&A - Contratos"
MasterPageFile="~/Site.master" MasterPageFile="~/Site.master"
CodeFile="RepContratos.aspx.vb" CodeFile="RepContratos.aspx.vb"
Inherits="ListadoContratos" %> Inherits="ListadoContratos" %>
@@ -118,7 +118,7 @@
</asp:GridView> </asp:GridView>
</ContentTemplate> </ContentTemplate>
</asp:UpdatePanel> </asp:UpdatePanel>
<asp:UpdatePanel runat="server" ID="UpModal"> <asp:UpdatePanel runat="server" ID="UpModal" UpdateMode="Conditional">
<ContentTemplate> <ContentTemplate>
<div id="ModalAgregar" class="modal ADS fade" role="dialog"> <div id="ModalAgregar" class="modal ADS fade" role="dialog">
<div class="modal-dialog"> <div class="modal-dialog">
@@ -206,7 +206,7 @@
<div class="row margin-bottom-5" id="TrAF" runat="server"> <div class="row margin-bottom-5" id="TrAF" runat="server">
<label class="col-md-4 bold"> <label class="col-md-4 bold">
<asp:Label runat="server" Text="Tipo de Unidad:"></asp:Label></label><div <asp:Label runat="server" Text="Transporte:"></asp:Label></label><div
class="col-md-8"> class="col-md-8">
<asp:DropDownList ID="DdlTransporte" AppendDataBoundItems="true" DataTextField="Descripcion" <asp:DropDownList ID="DdlTransporte" AppendDataBoundItems="true" DataTextField="Descripcion"
@@ -223,6 +223,24 @@
</div> </div>
</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"> <div class="row my-1">
<label class="col-md-4 bold">Observaciones:</label> <label class="col-md-4 bold">Observaciones:</label>
<div class="col-md-8"> <div class="col-md-8">

View File

@@ -1,5 +1,6 @@
Option Explicit On Option Explicit On
Option Strict On Option Strict On
Imports Extensiones
Imports Extensiones.ModExtensiones Imports Extensiones.ModExtensiones
Partial Class ListadoContratos Partial Class ListadoContratos
@@ -15,12 +16,12 @@ Partial Class ListadoContratos
End Property End Property
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then If Not IsPostBack Then
DdlClientes.setEsWebService(True)
InicializaCombos() InicializaCombos()
CargaDatos() CargaDatos()
End If End If
End Sub End Sub
Private Sub InicializaCombos() Private Sub InicializaCombos()
DdlClientes.setEsWebService(True)
'Lista Activos Fijos' 'Lista Activos Fijos'
Dim ObjAF As New ClsAF() Dim ObjAF As New ClsAF()
If ObjAF.GetActivosFijos(-1, 13, "-1", "-1", -1, -1, "-1", -1, -1, -1, -1, 1, "-1", -1, -1, -1) Then If ObjAF.GetActivosFijos(-1, 13, "-1", "-1", -1, -1, "-1", -1, -1, -1, -1, 1, "-1", -1, -1, -1) Then
@@ -31,6 +32,14 @@ Partial Class ListadoContratos
End If End If
DdlTransporte.DataBind() DdlTransporte.DataBind()
ObjAF.Dispose() ObjAF.Dispose()
'Lista Chofer'
DdlChofer.DataSource = GlobalDTRHPersonal(185)
DdlChofer.DataBind()
DdlChofer.Items.Insert(0, New ListItem("Seleccione", ""))
UpModal.Update()
End Sub End Sub
Private Sub CargaDatos() Private Sub CargaDatos()
Dim ObjContratos As New ClsContratos Dim ObjContratos As New ClsContratos

View File

@@ -0,0 +1,170 @@
<%@ Page Title="Transportes V&A - Calendario" Language="VB" MasterPageFile="~/Site.master"
AutoEventWireup="false" CodeFile="RepContratosCalendario.aspx.vb" Inherits="RepContratosCalendario" %>
<%@ Register Assembly="TimePicker" Namespace="MKB.TimePicker" TagPrefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="Css" runat="Server">
<style type="text/css">
</style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="E" runat="Server">
Calendario de contratos
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="H" runat="Server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="C" runat="Server">
<div class="row">
<div class="col-md-12 col-sm-12">
<div class="portlet light calendar ">
<div class="portlet-title ">
<div class="caption">
<i class="icon-calendar font-green-sharp"></i>
<span class="caption-subject font-green-sharp bold uppercase">Contratos</span>
</div>
</div>
<div class="portlet-body">
<div id="calendar">
</div>
</div>
</div>
</div>
</div>
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="JS" runat="Server">
<script>
var PrimeraCargaCalendario = true;
var currentUpdateEvent;
var addStartDate;
var addEndDate;
var globalAllDay;
var view = null;
var date = null;
function InitCalendar() {
$(document).ready(function () {
Calendario();
});
}
function selectDate(start, end, allDay) {
}
function updateEvent(event, element) {
}
function RadionButtonSelectedValueSet(name, SelectdValue) {
$('input[name="' + name + '"][value="' + SelectdValue + '"]').prop('checked', true);
}
function updateEventOnDropResize(event, allDay) {
//alert("allday: " + allDay);
var eventToUpdate = {
id: event.id,
start: event.start
};
if (event.end === null) {
eventToUpdate.end = eventToUpdate.start;
}
else {
eventToUpdate.end = event.end;
}
// FullCalendar 2.x
var endDate;
if (!event.allDay) {
endDate = new Date(eventToUpdate.end + 60 * 60000);
endDate = endDate.toJSON();
}
else {
endDate = eventToUpdate.end.toJSON();
}
eventToUpdate.start = eventToUpdate.start.toJSON();
eventToUpdate.end = eventToUpdate.end.toJSON(); //endDate;
eventToUpdate.allDay = event.allDay;
PageMethods.ActualizaEvento(eventToUpdate, UpdateTimeSuccess);
}
function eventDropped(event, dayDelta, minuteDelta, allDay, revertFunc) {
if ($(this).data("qtip")) $(this).qtip("destroy");
updateEventOnDropResize(event);
}
function eventResized(event, dayDelta, minuteDelta, revertFunc) {
if ($(this).data("qtip")) $(this).qtip("destroy");
updateEventOnDropResize(event);
}
function Calendario() {
var date = new Date();
var d = date.getDate();
var m = date.getMonth();
var y = date.getFullYear();
var h = {};
if ($('#calendar').width() <= 400) {
$('#calendar').addClass("mobile");
h = {
left: 'title, prev, next',
center: '',
right: 'today,month,agendaWeek,agendaDay'
};
} else {
$('#calendar').removeClass("mobile");
h = {
left: 'title',
center: '',
right: 'prev,next,today,month,agendaWeek,agendaDay'
};
}
$('#calendar').fullCalendar('destroy'); // destroy the calendar
$('#calendar').fullCalendar({ //re-initialize the calendar
header: h,
monthNames: ["Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"],
monthNamesShort: ['Ene', 'Feb', 'Mar', 'Abr', 'May', 'Jun', 'Jul', 'Ago', 'Sep', 'Oct', 'Nov', 'Dic'],
dayNames: ['Domingo', 'Lunes', 'Martes', 'Miércoles', 'Jueves', 'Viernes', 'Sábado'],
dayNamesShort: ['Dom', 'Lun', 'Mar', 'Mié', 'Jue', 'Vie', 'Sáb'],
buttonText: {
today: 'Hoy',
week: 'Semana',
month: 'Mes',
day: 'Día'
},
eventClick: updateEvent,
selectable: true,
selectHelper: true,
select: selectDate,
editable: true,
minTime: "08:00:00",
maxTime: "19:00:00",
events: {
url: '/Ashx/CargaEventos.ashx',
type: 'GET',
data: {
U: ' <%= UsuarioActual.CveUsuario %>',
E: '<%= UsuarioActual.CveEmpresa %>',
METODO: 'contrato_transportes',
CveUsuarioPara: $('#DdlTecnico').val(),
CveSubProyecto: $('#DdlSubProyecto').val()
}
},
eventDrop: eventDropped,
eventResize: eventResized
});
clickSemana();
}
</script>
</asp:Content>

View File

@@ -0,0 +1,21 @@
Option Explicit On
Option Strict On
Partial Class RepContratosCalendario
Inherits ClsPaginas
#Region "PROPIEDADES"
#End Region
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
InicializaCalendar()
End If
End Sub
Private Sub InicializaCalendar()
RegistraScript("InitCalendar();")
DirectCast(Master.FindControl("TSM"), ScriptManager).EnablePageMethods = True
End Sub
End Class