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>
</ajax:TabPanel>
<%--Contratos Tab--%>
<ajax:TabPanel ID="TabPanel1" runat="server" HeaderText="Contratos">
<ajax:TabPanel ID="TabCont" runat="server" HeaderText="Contratos">
<ContentTemplate>
<%-- Contratos --%>
<asp:UpdatePanel ID="UpTitulos" runat="server" UpdateMode="Conditional">
@@ -279,12 +279,37 @@
<%--Calendario Tab--%>
<ajax:TabPanel ID="TabGrantt" runat="server" HeaderText="Cronograma">
<ContentTemplate>
<div class="row">
<div class="col-md-12">
<div id="chartdiv">
<asp:UpdatePanel ID="UPPGantt" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<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>
</ContentTemplate>
</asp:UpdatePanel>
<div class="row">
<div class="col-md-12">
<div id="chartdiv" style="width:100%; min-height:300px;"></div>
</div>
</div>
</ContentTemplate>
</ajax:TabPanel>
</ajax:TabContainer>
@@ -541,7 +566,7 @@
layout: root.verticalLayout,
paddingLeft: 0
}));
// Add legend
// https://www.amcharts.com/docs/v5/charts/xy-chart/legend-xy-series/
var legend = chart.children.push(am5.Legend.new(root, {
@@ -625,6 +650,24 @@
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
// https://www.amcharts.com/docs/v5/concepts/animations/
series.appear();

View File

@@ -48,21 +48,21 @@ Partial Class RepContratosCalendario
If CveCliente = 0 Then CveCliente = -1
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
GvContratos.DataSource = DtAvance
ObjContratos.Dispose()
GvContratos.DataBind()
UpTitulos.Update()
CargaCronograma()
End Sub
Private Sub CargaCronograma()
Private Sub CargaCronograma(Optional TipoVista As Integer = -1)
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
' If String.IsNullOrEmpty(Row("CodigoAF").ToString()) Then
@@ -76,6 +76,7 @@ Partial Class RepContratosCalendario
Dim random = New Random()
'DATOS
Dim strAF As New StringBuilder
For Each Row As DataRow In DtAvance.FiltraParametros("CodigoAF <> ''").Rows
Dim obj As New JObject(
New JProperty("category", Row("CodigoAF")),
@@ -87,8 +88,13 @@ Partial Class RepContratosCalendario
New JProperty("task", Row("NombreAF"))
)
jsonData.Add(obj)
strAF.AppendFormat("{0},", Row("CveAF"))
Next
If TipoVista = 1 Then 'solo con viajes
DtUnidades = DtUnidades.FiltraParametros($"CveActivoFijo IN ({strAF.ToString})")
End If
'CATEGORIAS 'AGREGAR TODAS LAS UNIDADES
For Each Row As DataRow In DtUnidades.Rows
Dim obj As New JObject(
@@ -98,6 +104,7 @@ Partial Class RepContratosCalendario
Next
RegistraScript($"cargaDiagramaGrant({jsonData.ToString()},{jsonCategorias.ToString()});", "A1")
UPPGantt.Update()
End If
End Sub
Private Sub InicializaCalendar()
@@ -253,4 +260,8 @@ Partial Class RepContratosCalendario
InicializaCalendar()
CargaCronograma()
End Sub
Protected Sub DdlTipoVista_SelectedIndexChanged(sender As Object, e As EventArgs)
CargaCronograma(DdlTipoVista.SelectedValue.ToEntero)
End Sub
End Class