This commit is contained in:
2024-05-07 17:18:06 -07:00
parent a741090ad7
commit b5fccadf51
2 changed files with 64 additions and 10 deletions

View File

@@ -188,7 +188,7 @@
</ContentTemplate> </ContentTemplate>
</ajax:TabPanel> </ajax:TabPanel>
<%--Contratos Tab--%> <%--Contratos Tab--%>
<ajax:TabPanel ID="TabPanel1" runat="server" HeaderText="Contratos"> <ajax:TabPanel ID="TabCont" runat="server" HeaderText="Contratos">
<ContentTemplate> <ContentTemplate>
<%-- Contratos --%> <%-- Contratos --%>
<asp:UpdatePanel ID="UpTitulos" runat="server" UpdateMode="Conditional"> <asp:UpdatePanel ID="UpTitulos" runat="server" UpdateMode="Conditional">
@@ -279,12 +279,37 @@
<%--Calendario Tab--%> <%--Calendario Tab--%>
<ajax:TabPanel ID="TabGrantt" runat="server" HeaderText="Cronograma"> <ajax:TabPanel ID="TabGrantt" runat="server" HeaderText="Cronograma">
<ContentTemplate> <ContentTemplate>
<div class="row"> <asp:UpdatePanel ID="UPPGantt" runat="server" UpdateMode="Conditional">
<div class="col-md-12"> <ContentTemplate>
<div id="chartdiv">
<div class="portlet solid grey-cascade portlet-filter">
<div class="portlet-title portlet-filterT smalltitle">
<div class="tools">
<a href="javascript:;" class="expand"></a>
</div>
<div class="titlefiltros caption">
<div class="row" style="height: 32px;">
<label class="col-md-1 truncate">Vista</label>
<div class="col-md-1">
<asp:DropDownList ID="DdlTipoVista" AutoPostBack="true" OnSelectedIndexChanged ="DdlTipoVista_SelectedIndexChanged" CssClass="form-control select2me input-sm select2me Widthall"
Style="width: 100%;" runat="server">
<asp:ListItem Text="Todos" Value="-1"></asp:ListItem>
<asp:ListItem Text="solo viaje" Value="1"></asp:ListItem>
</asp:DropDownList>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>
</ContentTemplate>
</asp:UpdatePanel>
<div class="row">
<div class="col-md-12">
<div id="chartdiv" style="width:100%; min-height:300px;"></div>
</div>
</div>
</ContentTemplate> </ContentTemplate>
</ajax:TabPanel> </ajax:TabPanel>
</ajax:TabContainer> </ajax:TabContainer>
@@ -625,6 +650,24 @@
chart.set("scrollbarY", scrollbarY); chart.set("scrollbarY", scrollbarY);
/// evento para ajustar el alto del row
var cellSize = 30;
chart.events.on("datavalidated", function (ev) {
// Get objects of interest
var chart = ev.target;
var categoryAxis = chart.yAxes.getIndex(0);
// Calculate how we need to adjust chart height
var adjustHeight = chart.data.length * cellSize - categoryAxis.pixelHeight;
// get current chart height
var targetHeight = chart.pixelHeight + adjustHeight;
// Set it on chart's container
chart.svgContainer.htmlElement.style.height = targetHeight + "px";
});
// Make stuff animate on load // Make stuff animate on load
// https://www.amcharts.com/docs/v5/concepts/animations/ // https://www.amcharts.com/docs/v5/concepts/animations/
series.appear(); series.appear();

View File

@@ -49,6 +49,7 @@ Partial Class RepContratosCalendario
If ObjContratos.GetContratosReporte(UsuarioActual.CveEmpresa, txtFechaI.Text.ToDate, txtFechaF.Text.ToDate, DdlCliente.SelectedValue.ToEntero, CveSubProyecto:=DdlSubProyectos.SelectedValue.ToEntero, CveEstatus:=DdlEstatusConsulta.SelectedValue.ToEntero, CveTipoContrato:=34) Then If ObjContratos.GetContratosReporte(UsuarioActual.CveEmpresa, txtFechaI.Text.ToDate, txtFechaF.Text.ToDate, DdlCliente.SelectedValue.ToEntero, CveSubProyecto:=DdlSubProyectos.SelectedValue.ToEntero, CveEstatus:=DdlEstatusConsulta.SelectedValue.ToEntero, CveTipoContrato:=34) Then
DtAvance = ObjContratos.DtResultados.Copy() DtAvance = ObjContratos.DtResultados.Copy()
CargaCronograma(DdlTipoVista.SelectedValue.ToEntero)
End If End If
GvContratos.DataSource = DtAvance GvContratos.DataSource = DtAvance
@@ -56,13 +57,12 @@ Partial Class RepContratosCalendario
GvContratos.DataBind() GvContratos.DataBind()
UpTitulos.Update() UpTitulos.Update()
CargaCronograma()
End Sub End Sub
Private Sub CargaCronograma() Private Sub CargaCronograma(Optional TipoVista As Integer = -1)
If DtAvance IsNot Nothing Then If DtAvance IsNot Nothing Then
Dim DtUnidades As DataTable = GlobalDTActivoFijos(UsuarioActual.CveEmpresa).FiltraParametros("Codigo <> '' AND MedidaVehicular IN (2,3)", " SubTipoActivoFijo DESC ", {"Codigo"}) Dim DtUnidades As DataTable = GlobalDTActivoFijos(UsuarioActual.CveEmpresa).FiltraParametros("Codigo <> '' AND MedidaVehicular IN (2,3)", " SubTipoActivoFijo DESC ", {"Codigo", "CveActivoFijo"})
'For Each Row As DataRow In DtAvance.Rows 'For Each Row As DataRow In DtAvance.Rows
' If String.IsNullOrEmpty(Row("CodigoAF").ToString()) Then ' If String.IsNullOrEmpty(Row("CodigoAF").ToString()) Then
@@ -76,6 +76,7 @@ Partial Class RepContratosCalendario
Dim random = New Random() Dim random = New Random()
'DATOS 'DATOS
Dim strAF As New StringBuilder
For Each Row As DataRow In DtAvance.FiltraParametros("CodigoAF <> ''").Rows For Each Row As DataRow In DtAvance.FiltraParametros("CodigoAF <> ''").Rows
Dim obj As New JObject( Dim obj As New JObject(
New JProperty("category", Row("CodigoAF")), New JProperty("category", Row("CodigoAF")),
@@ -87,8 +88,13 @@ Partial Class RepContratosCalendario
New JProperty("task", Row("NombreAF")) New JProperty("task", Row("NombreAF"))
) )
jsonData.Add(obj) jsonData.Add(obj)
strAF.AppendFormat("{0},", Row("CveAF"))
Next Next
If TipoVista = 1 Then 'solo con viajes
DtUnidades = DtUnidades.FiltraParametros($"CveActivoFijo IN ({strAF.ToString})")
End If
'CATEGORIAS 'AGREGAR TODAS LAS UNIDADES 'CATEGORIAS 'AGREGAR TODAS LAS UNIDADES
For Each Row As DataRow In DtUnidades.Rows For Each Row As DataRow In DtUnidades.Rows
Dim obj As New JObject( Dim obj As New JObject(
@@ -98,6 +104,7 @@ Partial Class RepContratosCalendario
Next Next
RegistraScript($"cargaDiagramaGrant({jsonData.ToString()},{jsonCategorias.ToString()});", "A1") RegistraScript($"cargaDiagramaGrant({jsonData.ToString()},{jsonCategorias.ToString()});", "A1")
UPPGantt.Update()
End If End If
End Sub End Sub
Private Sub InicializaCalendar() Private Sub InicializaCalendar()
@@ -253,4 +260,8 @@ Partial Class RepContratosCalendario
InicializaCalendar() InicializaCalendar()
CargaCronograma() CargaCronograma()
End Sub End Sub
Protected Sub DdlTipoVista_SelectedIndexChanged(sender As Object, e As EventArgs)
CargaCronograma(DdlTipoVista.SelectedValue.ToEntero)
End Sub
End Class End Class