This commit is contained in:
rakcsle
2024-10-14 08:16:44 -07:00
parent 94100af37d
commit d9cd4d4dc6
4 changed files with 659 additions and 136 deletions

View File

@@ -7753,25 +7753,23 @@ Partial Class OC_OC
TxtRetIVA.Text = TxtRetIVA.Text.FormatoNumero
HdnRetIVA.Value = TxtRetIVA.Text
Dim Porcentaje As Decimal = TxtRetIVA.Text.ToDecimal / DtDetalle.SUMD("Total")
Dim IvaTotal As Decimal = DtDetalle.FiltraParametros("IVA > 0").SUMD("Total")
Dim Porcentaje As Decimal = TxtRetIVA.Text.ToDecimal / IvaTotal
Dim LastDr As DataRow = Nothing
For Each Dr As DataRow In DtDetalle.Rows
'Dr("RetIVA") = (Math.Truncate((Dr("Total").ToString.ToDecimal * Porcentaje) * 100)) / 100
Dr("RetIVA") = Math.Round((Dr("Total").ToString.ToDecimal * Porcentaje), 2)
'Dr("RetIVA") = Math.Round((Dr("Cantidad").ToString.ToDecimal * Dr("Importe").ToString.ToDecimal * Porcentaje), 2)
Dr("RetIVAPorcentaje") = Porcentaje
' Tipo Dato '0' es Cuando es Nuevo, '1' para editar y '2' viene de la BD
Dr("TipoDato") = If(Dr("TipoDato").ToString.ToEntero = 0, 0, 1)
LastDr = Dr
Next
'If Not IsNothing(LastDr) Then
' Dim Fdes As Decimal = TxtRetIVA.Text.ToDecimal - DtDetalle.SUM("RetIVA").ToString.ToDecimal
' If Fdes > 0 Then
' LastDr("RetIVA") = LastDr("RetIVA").ToString.ToDecimal + Fdes
' End If
'End If
'Alert(String.Format("Descuento:{0}", DtDetalle.SUM("Descuento")))
If Dr("IVA").ToString.ToDecimal > 0 Then
'Dr("RetIVA") = (Math.Truncate((Dr("Total").ToString.ToDecimal * Porcentaje) * 100)) / 100
Dr("RetIVA") = Math.Round((Dr("Total").ToString.ToDecimal * Porcentaje), 2)
'Dr("RetIVA") = Math.Round((Dr("Cantidad").ToString.ToDecimal * Dr("Importe").ToString.ToDecimal * Porcentaje), 2)
Dr("RetIVAPorcentaje") = Porcentaje
' Tipo Dato '0' es Cuando es Nuevo, '1' para editar y '2' viene de la BD
Dr("TipoDato") = If(Dr("TipoDato").ToString.ToEntero = 0, 0, 1)
LastDr = Dr
End If
Next
CalculaGenerales()

View File

@@ -1,31 +1,38 @@
<%@ Page Title="Transportes V&A - Calendario" Language="VB" MasterPageFile="~/Site.master"
<%@ Page Title="Transportes V&A - Calendario" Language="VB" MasterPageFile="~/Site.master" EnableEventValidation="false"
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">
/* #chartdiv {
width: 100%;
height: 100%;
} */
/*
.tipo_vista {
display: flex;
align-items: center;
gap: 2rem;
}
}*/
.my-1 {
margin-block: 1rem;
}
.miGrid {
/* .miGrid {
color: white;
}
}*/
/*
#chartdiv {
width: 100%;
height: 600px;
}
}*/
.fc-month-view .fc-day {
/* .fc-month-view .fc-day {
border-left: 4px solid #464646;
border-right: 4px solid #464646
}
@@ -36,7 +43,7 @@
}
.fc-month-view .fc-row.fc-week.fc-widget-content:last-of-type {
border-bottom: 4px solid #464646!important;
}
} */
@@ -53,7 +60,7 @@
<style>
.gantt-samples-banner_controls_bar.controls_bar {
margin: 0;
//position: absolute;
/*position: absolute;*/
top: -30px;
width: 100%;
right: 0;
@@ -83,11 +90,21 @@
}
#gantt_here {
scroll-behavior: smooth; /* Aplica un desplazamiento suave */
overflow-y: auto; /* Asegura que el desplazamiento vertical esté activo */
}
width: 100%; /* El ancho será el 100% del contenedor padre */
height: 400px; /* Puedes ajustar esta altura según necesites */
border: 1px solid #ccc; /* Opcional: Un borde para visualizar mejor el área del Gantt */
box-sizing: border-box; /* Asegura que el padding y el borde no afecten el tamaño total */
}
.gantt_parent_task {
background-color: #ffcccc !important; /* Color para las tareas principales */
}
.gantt_child_task {
background-color: #cce5ff !important; /* Color para las sub-tareas */
}
</style>
<link rel="stylesheet" href="/Metronic/assets/global/plugins/dhtmlxgantt/dhtmlxgantt.css" type="text/css">
@@ -99,12 +116,21 @@
</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:UpdatePanel runat="server" ID="UpAcciones" UpdateMode="Conditional">
<ContentTemplate>
<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>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="LnkPdf" />
<asp:PostBackTrigger ControlID="LnkExcel" />
</Triggers>
</asp:UpdatePanel>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="C" runat="Server">
@@ -356,11 +382,35 @@
<ajax:TabPanel ID="TabGrantt" runat="server" HeaderText="Cronograma">
<ContentTemplate>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Always">
<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">Tipo Vista:</label>
<div class="col-md-1">
<asp:DropDownList ID="DdlTipoVistaCalendario" AutoPostBack="true" OnSelectedIndexChanged="DdlTipoVistaCalendario_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>
<asp:UpdatePanel ID="UPGat" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div>
<div class="gantt-samples-banner_controls_bar controls_bar">
<div style="display:none">
<div class="gantt-samples-banner_controls_bar controls_bar" style="display:none!important">
<strong>Formato: &nbsp; </strong>
<label>
@@ -403,7 +453,7 @@
</label>
</div>
</div>
<div id="gantt_here" style='width: 100%; height: 100vh;'></div>
<div id="gantt_here"></div>
</div>
@@ -412,7 +462,7 @@
<asp:UpdatePanel ID="UPPGantt" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div class="portlet solid grey-cascade portlet-filter">
<div class="portlet solid grey-cascade portlet-filter" style="display:none!important">
<div class="portlet-title portlet-filterT smalltitle">
<div class="tools">
<a href="javascript:;" class="expand"></a>
@@ -433,6 +483,7 @@
</div>
</ContentTemplate>
</asp:UpdatePanel>
<div class="row">
<div class="col-md-12">
<div id="chartdiv"></div>
@@ -716,10 +767,258 @@
"December": "Diciembre",
};
var dateAxis;
let dateAxis;
let yAxis;
function cargaDiagramaGrant(data, categorias, TipoVista) {
am5.ready(function () {
// SI YA HAY GRÁFICA, QUITA LA ACTUAL PARA HACER UNA NUEVA
root.container.children.clear();
root.dateFormatter.setAll({
dateFormat: "yyyy-MM-dd HH:mm:ss",
dateFields: ["valueX", "openValueX"]
});
root.locale = am5locales_es_ES;
// Establecer temas
root.setThemes([
am5themes_Animated.new(root)
]);
// Crear gráfico
let chart = root.container.children.push(am5xy.XYChart.new(root, {
panX: false,
panY: false, // Habilita el desplazamiento vertical
wheelX: "none",
wheelY: "none", // Habilita el scroll vertical con la rueda del mouse
layout: root.verticalLayout,
paddingLeft: 0
}));
// Deshabilitar el enmascaramiento en el plotContainer
//chart.plotContainer.set("mask", null); // quita rendimiento
// Agregar leyenda
let legend = chart.children.push(am5.Legend.new(root, {
centerX: am5.p50,
x: am5.p50
}));
let colors = chart.get("colors");
// Definir cellSize para el tamaño fijo de cada categoría en el eje Y
let cellSize = 45;
//if (TipoVista == 1) {
// cellSize = 60;
//}
// Crear eje Y (CategoryAxis)
chart.paddingTop = 40;
yAxis = chart.yAxes.push(
am5xy.CategoryAxis.new(root, {
categoryField: "category",
renderer: am5xy.AxisRendererY.new(root, {
inversed: false,
minGridDistance: cellSize, // Asigna el tamaño fijo a cada unidad
minorGridEnabled: true,
neverHide: true,
forceHidden: false,
oversizedBehavior: "none",
location: 0.5,
fontSize: 12, // Ajusta el tamaño de fuente si es necesario
visible: true, // Asegura que las etiquetas sean visibles
minPosition: 0.001,
maxPosition: 0.999,
minGridDistance: 1, // Reduced from cellSize to 1
}),
tooltip: am5.Tooltip.new(root, {
themeTags: ["axis"],
animationDuration: 200
})
})
);
//yAxis.renderer.grid.template.disabled = !showgrid;
//yAxis.paddingLeft = 10;
//yAxis.paddingRight = 10;
//yAxis.layout = "absolute";
// Set up axis title
//yAxis.title.text = "Unidades";
//yAxis.title.rotation = 0;
//yAxis.title.align = "center";
//yAxis.title.valign = "top";
yAxis.set('strictMinMax', true);
yAxis.set('maxDeviation', 0);
yAxis.set('start', 0);
yAxis.set('end', 1);
yAxis.data.setAll(categorias);
// Asegurar que las etiquetas del eje Y siempre se muestren
//yAxis.get("renderer").labels.template.setAll({
// forceHidden: false,
// oversizedBehavior: "none",
// location: 0.5,
// fontSize: 12, // Ajusta el tamaño de fuente si es necesario
// visible: true, // Asegura que las etiquetas sean visibles
// minPosition: 0.001,
// maxPosition: 0.999
//});
// Configurar el eje Y para evitar zoom automático
// Obtener valores de las cajas de texto
let fechaI = document.getElementById('<%= txtFechaI.ClientID %>').value;
let fechaF = document.getElementById('<%= txtFechaF.ClientID %>').value;
// Convertir valores a objetos Date
let minDate = new Date(fechaI.split("/").reverse().join("-"));
let maxDate = new Date(fechaF.split("/").reverse().join("-"));
maxDate.setHours(23, 59, 59, 999);
// Crear eje X (DateAxis)
let xAxis = am5xy.DateAxis.new(root, {
baseInterval: { timeUnit: "hour", count: 1 },
renderer: am5xy.AxisRendererX.new(root, {
opposite: true,
minorGridEnabled: true,
minGridDistance: 50 // Ajusta según sea necesario para evitar superposición
}),
min: minDate.getTime(),
max: maxDate.getTime(),
groupData: false,
markUnitChange: false
});
// Agregar el eje X al contenedor superior
chart.topAxesContainer.children.push(xAxis);
// Asegurar que todas las etiquetas se muestren
xAxis.get("renderer").labels.template.setAll({
forceHidden: false,
minPosition: 0.001,
maxPosition: 0.999,
location: 0.5,
fontSize: 14, // Tamaño de fuente
fontWeight: "bold"
});
// Formatear las etiquetas de fecha
xAxis.get("renderer").labels.template.adapters.add("text", function (text, target) {
let dataItem = target.dataItem;
if (dataItem) {
let value = dataItem.get('value');
let date = new Date(value);
let day = date.getDate().toString().padStart(2, '0');
let month = (date.getMonth() + 1).toString().padStart(2, '0');
return day + '/' + month;
} else {
return text;
}
});
// Añadir la serie
let series = chart.series.push(am5xy.ColumnSeries.new(root, {
xAxis: xAxis,
yAxis: yAxis,
openValueXField: "fromDate",
valueXField: "toDate",
categoryYField: "category"
/*, sequencedInterpolation: true*/
}));
series.columns.template.setAll({
templateField: "columnSettings",
strokeOpacity: 0,
tooltipText: "UNIDAD: {category}-{unidad} \nCONTRATO: {contrato} \nDURACIÓN: {openValueX} - {valueX}"
});
series.data.processor = am5.DataProcessor.new(root, {
dateFields: ["fromDate", "toDate"],
dateFormat: "yyyy-MM-dd HH:mm:ss"
});
series.data.setAll(data);
//// Scrollbar X
//var scrollbarX = am5.Scrollbar.new(root, {
// orientation: "horizontal"
//});
//chart.set("scrollbarX", scrollbarX);
//chart.bottomAxesContainer.children.push(scrollbarX);
// Scrollbar Y
//let scrollbarY = am5.Scrollbar.new(root, {
// orientation: "vertical"
//});
//chart.set("scrollbarY", scrollbarY);
//chart.rightAxesContainer.children.push(scrollbarY);
// MOSTRAR MODAL DE CONTRATO AL HACER CLICK
series.columns.template.events.on("click", e => {
let cveContrato = e.target.dataItem.dataContext.cveContrato;
$('#<%=HdnCveContrato.ClientID%>').val(cveContrato);
let url = '/Ashx/CargaEventos.ashx?METODO=contrato_transportes';
let parametros = '&cveContrato=' + cveContrato + '&U=' + '<%= UsuarioActual.CveUsuario %>' + '&E=' + '<%= UsuarioActual.CveEmpresa %>' + '&tipoVista=' + '<%= RBTipoVista.Text %>' + '&CveUsuarioPara:' + $('#DdlTecnico').val() + '&CveSubProyecto:' + $('#DdlSubProyecto').val();
fetch(url + parametros).then(response => response.json()).then(json => {
updateEvent(json[0], null, false);
}).catch(err => console.log('Solicitud fallida', err));
});
series.events.on("datavalidated", function (ev) {
let xAxisHeight = xAxis.height();
let chartHeight = categorias.length * cellSize + xAxisHeight + chart.get("paddingTop", 0) + chart.get("paddingBottom", 0);
// Establece la altura calculada en el contenedor del gráfico
chart.root.dom.style.height = chartHeight + "px";
// Asegurar que el eje Y no esté con zoom
yAxis.zoom(0, 1);
});
// Animaciones al cargar
series.appear();
chart.appear(1000, 100);
}); // end am5.ready()
}
function zoomAxisy(inicio,fin) {
setTimeout(() => {
//yAxis.zoomToIndexes(inicio, fin);
}, 100);
}
function zoomAxis(anioI, mesI, diaI, anioF, mesF, diaF) {
setTimeout(() => {
// dateAxis.zoomToDates(new Date(anioI, mesI, diaI), new Date(anioF, mesF, diaF));
}, 1500);
}
<%--function cargaDiagramaGrant(data, categorias, TipoVista) {
am5.ready(function () {
//SI YA HAY GRAFICA, QUITA LA ACTUAL PARA HACER UNA NUEVA
root.container.children.clear();
@@ -740,10 +1039,10 @@
// Create chart
// https://www.amcharts.com/docs/v5/charts/xy-chart/
var chart = root.container.children.push(am5xy.XYChart.new(root, {
panX: true,
panX: false,
panY: false,
wheelX: "panX",
wheelY: "zoomX",
wheelX: "none",
wheelY: "none",
layout: root.verticalLayout,
paddingLeft: 0
}));
@@ -783,23 +1082,46 @@
var minDate = new Date(fechaI.split("/").reverse().join("-"));
var maxDate = new Date(fechaF.split("/").reverse().join("-"));
dateAxis = am5xy.DateAxis.new(root, {
baseInterval: { timeUnit: "day", count: 1 },
renderer: am5xy.AxisRendererX.new(root, {
minorGridEnabled: true,
minGridDistance: 90
}),
min: minDate.getTime(),
max: maxDate.getTime()
//min: new Date(2024, 6, 15).getTime(),
//max: new Date(2024, 6, 31).getTime()
var xAxis = chart.xAxes.push(
am5xy.DateAxis.new(root, {
baseInterval: { timeUnit: "day", count: 1 },
renderer: am5xy.AxisRendererX.new(root, {
opposite: true,
minorGridEnabled: true,
minGridDistance: 30 // Ajusta según sea necesario
}),
min: minDate.getTime(),
max: maxDate.getTime(),
groupData: false,
markUnitChange: false
})
);
// Asegurar que todas las etiquetas se muestren
xAxis.get("renderer").labels.template.setAll({
forceHidden: false,
minPosition: 0.001,
maxPosition: 0.999,
location: 0.5 // Centra las etiquetas
});
var xAxis = chart.xAxes.push(
dateAxis
);
chart.topAxesContainer.children.push(dateAxis);
// Formatear las etiquetas de fecha
xAxis.get("renderer").labels.template.adapters.add("text", function (text, target) {
var dataItem = target.dataItem;
if (dataItem) {
var value = dataItem.get('value');
var date = new Date(value);
var day = date.getDate().toString().padStart(2, '0');
var month = (date.getMonth() + 1).toString().padStart(2, '0');
return day + '/' + month;
} else {
return text; // O puedes devolver una cadena vacía: return '';
}
});
//chart.topAxesContainer.children.push(dateAxis);
// Add series
// https://www.amcharts.com/docs/v5/charts/xy-chart/series/
@@ -812,6 +1134,7 @@
sequencedInterpolation: true
}));
series.columns.template.setAll({
templateField: "columnSettings",
strokeOpacity: 0,
@@ -824,11 +1147,7 @@
});
series.data.setAll(data);
// Add scrollbars
//chart.set("scrollbarX", am5.Scrollbar.new(root, {
// orientation: "horizontal"
//}));
// Scrollbar X
var scrollbarX = am5.Scrollbar.new(root, {
orientation: "horizontal"
@@ -884,14 +1203,9 @@
}); // end am5.ready()
}
}--%>
function zoomAxis(anioI, mesI, diaI, anioF, mesF, diaF) {
setTimeout(() => {
dateAxis.zoomToDates(new Date(anioI, mesI, diaI), new Date(anioF, mesF, diaF));
}, 1500);
}
var PrimeraCargaCalendario = true;
var currentUpdateEvent;
@@ -1332,22 +1646,22 @@
var datosGant = [];
function loadGant() {
gantt.config.date_format = "%Y-%m-%d %H:%i";
gantt.config.order_branch = true;
gantt.i18n.setLocale("es");
gantt.init("gantt_here");
gantt.config.order_branch = true;
gantt.config.order_branch_free = true;
gantt.config.open_tree_initially = true;
gantt.config.show_tasks_outside_timescale = true;
gantt.config.drag_move = false; // Desactiva mover tareas
gantt.config.drag_resize = false; // Desactiva redimensionar tareas
gantt.config.drag_progress = false; // Desactiva mover la barra de progreso
//gantt.config.smart_scales = false;// Desactiva el salto automático entre escalas de tiempo
//gantt.config.scroll_size = 1;
// gantt.config.scroll_on_click = false; // Desactiva el scroll automático al hacer clic
//gantt.config.autosize = "xy";
//gantt.config.smart_rendering = false;
gantt.i18n.setLocale("es");
gantt.init("gantt_here");
gantt.config.columns = [
//{ name: "text", label: "Contrato ", width: "*", min_width: 150, tree: true, resize: true, template: function (obj) { return "<a href=\"/Transportes/RepContratoDetalle.aspx?CveContrato=" + obj.id + "\" target=\"_Blank\">" + obj.text + " </a>" } },
{ name: "codigoaf", label: "Unidad", max_width: 50, align: "left" },
//{ name: "start_date", label: "Inicio", min_width: 90, align: "center" },
//{ name: "end_date", label: "Fin", min_width: 90, align: "center" }
@@ -1362,10 +1676,13 @@
data: datosGant
});
// Agregar evento para hover y mostrar tooltip
gantt.attachEvent("onMouseMove", function (id, e) {
if (id) {
var task = gantt.getTask(id);
var task = gantt.getTask(id);
// Mostrar el tooltip burbuja
var tooltip = document.getElementById("gantt_tooltip");
@@ -1401,36 +1718,34 @@
// Cancelar el comportamiento predeterminado
return false;
});
gantt.attachEvent("onBeforeTaskMove", function (id, parent, tindex) {
console.log(tindex)
var task = gantt.getTask(id);
if (task.parent != parent)
return false;
return true;
});
gantt.attachEvent("onRowDragEnd", function (id, target, tindex) {
console.log(tindex)
debugger;
drag_id = null;
gantt.render();
});
gantt.attachEvent("onTaskLoading", function (task) {
if (task.hidden) {
task.$rendered = false; // Evitar que la tarea se renderice
}
return true;
});
}
gantt.attachEvent("onBeforeTaskMove", function (id, parent, tindex) {
console.log(tindex)
var task = gantt.getTask(id);
if (task.parent != parent)
return false;
return true;
});
gantt.attachEvent("onRowDragEnd", function (id, target, tindex) {
console.log(tindex)
debugger;
drag_id = null;
gantt.render();
});
gantt.attachEvent("onGanttScroll", function (left, top) {
// var step = 50; // Define cuánto avanzar con cada paso del scroll
//var newTop = top + step; // Incrementa el scroll vertical en 50 píxeles
//gantt.scrollTo(left, newTop); // Establece el nuevo valor de scroll vertical
console.log("Scroll vertical: ", top);
return false; // Previene el scroll predeterminado para que solo se aplique el manual
//return true;
});
loadGant();

View File

@@ -72,7 +72,8 @@ Partial Class RepContratosCalendario
CveTipoAF:=DdlTipoUnidad.SelectedValue.ToEntero,
CveChofer:=DdlChoferFiltro.SelectedValue.ToEntero) Then
DtAvance = ObjContratos.DtResultados.Copy()
CargaCronograma(DdlTipoVista.SelectedValue.ToEntero)
CargaCronograma(DdlTipoVistaCalendario.SelectedValue.ToEntero)
CargaDiagramadeGant(DdlTipoVista.SelectedValue.ToEntero)
End If
GvContratos.DataSource = DtAvance
DdlEstatusContrato.Enabled = UsuarioActual.TienePermisoProceso(173)
@@ -91,9 +92,9 @@ Partial Class RepContratosCalendario
Private Sub CargaCronograma(Optional TipoVista As Integer = -1)
If DtAvance IsNot Nothing Then
Dim separator As String = ""
Dim str As New StringBuilder()
str.AppendLine("datosGant=[")
'Dim separator As String = ""
'Dim str As New StringBuilder()
'str.AppendLine("datosGant=[")
Dim StrFiltro As String = ""
@@ -110,30 +111,32 @@ Partial Class RepContratosCalendario
'DATOS
Dim strAF As New StringBuilder
'se quitan los estatus cancelados
Dim randomNumber As New Random
For Each Row As DataRow In DtAvance.FiltraParametros("CodigoAF <> '' AND TipoEstatus <> 3").Rows
Dim obj As New JObject(
New JProperty("category", Row("CodigoAF")),
New JProperty("fromDate", Row("FechaInicial").ToString().ToDateTime().ToString("dd/MM/yyyy HH:mm").ToDateTime()),
New JProperty("toDate", Row("FechaFinal").ToString().ToDateTime.ToString("dd/MM/yyyy HH:mm").ToDateTime()),
New JProperty("fromDate", Row("FechaInicial").ToString().ToDateTime().ToString("yyyy-MM-dd HH:mm:ss")),
New JProperty("toDate", Row("FechaFinal").ToString().ToDateTime.ToString("yyyy-MM-dd HH:mm:ss")),
New JProperty("columnSettings", New JObject(
New JProperty("fill", String.Format("#{0:X6}", random.Next(16777216)))
)),
New JProperty("unidad", Row("NombreAF")),
New JProperty("cveContrato", Row("CveContrato")),
New JProperty("contrato", Row("NumeroContrato")),
New JProperty("fechaFinalViaje", Row("FechaFinal").ToString().ToDateTime().ToString("dd/MM/yyyy HH:mm"))
New JProperty("fechaFinalViaje", Row("FechaFinal").ToString().ToDateTime().ToString("yyyy-MM-dd HH:mm:ss"))
)
jsonData.Add(obj)
strAF.AppendFormat("{0},", Row("CveAF"))
'uniad contrato y duracion
Dim unidad As String = $"{Row("CodigoAF")}-{Row("NombreAF")}"
Dim duracion As String = $"{Row("FechaInicial").ToString.ToDate.ToString("dd/MM/yyyy HH:mm")} - {Row("FechaFinal").ToString.ToDate.ToString("dd/MM/yyyy HH:mm")}"
'Dim unidad As String = $"{Row("CodigoAF")}-{Row("NombreAF")}"
'Dim duracion As String = $"{Row("FechaInicial").ToString.ToDate.ToString("dd/MM/yyyy HH:mm")} - {Row("FechaFinal").ToString.ToDate.ToString("dd/MM/yyyy HH:mm")}"
str.AppendLine(String.Format("{0}{{id: {1}, text: ""{2}"", start_date: ""{3:yyyy/MM/dd HH:mm}"", end_date: ""{4:yyyy/MM/dd HH:mm}"", parent: {5}, progress:{6}, open: true, unidad: ""{7}"",duracion: ""{8}""}}",
separator, Row("CveContrato"), Row("NumeroContrato").ToString().Replace("\\", "\\\\").Replace("""", "\"""), Row("FechaInicial"), Row("FechaFinal"), 0, 100, unidad, duracion))
separator = ","
'str.AppendLine(String.Format("{0}{{id: {1}, text: ""{2}"", start_date: ""{3:yyyy/MM/dd HH:mm}"", end_date: ""{4:yyyy/MM/dd HH:mm}"", parent: {5}, progress:{6}, open: true, unidad: ""{7}"",duracion: ""{8}"", color: ""{9}"",codigoaf: ""{10}""}}",
' separator, Row("CveContrato"), Row("NumeroContrato").ToString().Replace("\\", "\\\\").Replace("""", "\"""), Row("FechaInicial"), Row("FechaFinal"), 0, 100, unidad, duracion, ColorAleatorio(randomNumber), Row("CodigoAF").ToString))
'separator = ","
Next
@@ -151,18 +154,188 @@ Partial Class RepContratosCalendario
Dim FechaI = txtFechaI.Text.ToDateTime()
Dim FechaF = txtFechaF.Text.ToDateTime()
Dim ScriptZoom = $"zoomAxis({FechaI.Year},{FechaI.Month - 1},{FechaI.Day},{FechaF.Year},{FechaF.Month - 1},{FechaF.Day});"
RegistraScript($"cargaDiagramaGrant({jsonData.ToString()},{jsonCategorias.ToString()},{TipoVista});{ScriptZoom}", "A1")
Dim ScriptZoomx = $"zoomAxis({FechaI.Year},{FechaI.Month - 1},{FechaI.Day},{FechaF.Year},{FechaF.Month - 1},{FechaF.Day});"
Dim ScriptZoomy = $"zoomAxisy(0,{If(jsonCategorias.Count > 9, 9, jsonCategorias.Count - 1)});"
RegistraScript($"cargaDiagramaGrant({jsonData.ToString()},{jsonCategorias.ToString()},{TipoVista});{ScriptZoomx};{ScriptZoomy};", "A1")
'RegistraScript($"cargaDiagramaGrant({jsonData.ToString()},{jsonCategorias.ToString()},{TipoVista});", "A1")
str.AppendLine("];loadGant();")
RegistraScript(str.ToString())
'str.AppendLine("];loadGant();")
'RegistraScript(str.ToString())
UPPGantt.Update()
UPGat.Update()
End If
End Sub
Private Sub CargaDiagramadeGant(Optional TipoVista As Integer = -1)
Dim randomNumber As New Random
If DtAvance IsNot Nothing Then
Dim str As New StringBuilder()
str.AppendLine("datosGant=[")
If TipoVista = 1 Then 'solo con viajes
Else
Dim StrFiltro As String = ""
If DdlTipoUnidad.SelectedValue.ToEntero > 0 Then StrFiltro = " AND CveTipoActivoFijo = " & DdlTipoUnidad.SelectedValue
Dim DtUnidades As DataTable = GlobalDTActivoFijos(UsuarioActual.CveEmpresa).FiltraParametros("Codigo <> '' AND MedidaVehicular IN (2,3) " & StrFiltro, Orderby:=" TipoActivoFijo ASC, CodigoNumeroOrden ASC", DistinctColumns:={"Codigo", "CveActivoFijo"})
Dim separator As String = ""
Dim encontrados As Integer = 0
Dim CvePadre As Integer = -1
For Each dRowUnidad As DataRow In DtUnidades.Rows
Dim CveActivoFijo As Integer = dRowUnidad("CveActivoFijo").ToString.ToEntero
Dim CodigoAF As String = dRowUnidad("Codigo").ToString
'Dim unidad As String = $"{dRowUnidad("Codigo").ToString}-{dRowUnidad("Descripcion").tostring}"
Dim SeEncontro As Boolean = False
Dim EsHijo As Boolean = False
For Each Row As DataRow In DtAvance.FiltraParametros("CodigoAF <> '' AND TipoEstatus <> 3").Rows
Dim CveActivoFijoContrato As Integer = Row("CveAF").ToString.ToEntero
'If CveActivoFijo = CveActivoFijoContrato Then
' str.AppendLine(String.Format("{0}", separator))
' SeEncontro = True
' Dim unidad As String = $"{Row("CodigoAF")}-{Row("NombreAF")}"
' Dim duracion As String = $"{Row("FechaInicial").ToString.ToDate.ToString("dd/MM/yyyy HH:mm")} - {Row("FechaFinal").ToString.ToDate.ToString("dd/MM/yyyy HH:mm")}"
' str.AppendLine(String.Format("{{id: {1}, text: ""{2}"", start_date: ""{3:yyyy/MM/dd HH:mm}"", end_date: ""{4:yyyy/MM/dd HH:mm}"", parent: {5}, progress:{6}, open: true, unidad: ""{7}"",duracion: ""{8}"", color: ""{9}"",codigoaf: ""{10}""}} ",
' separator, Row("CveContrato"), Row("NumeroContrato").ToString().Replace("\\", "\\\\").Replace("""", "\"""), Row("FechaInicial"), Row("FechaFinal"), 0, 100, unidad, duracion, ColorAleatorio(randomNumber), Row("CodigoAF").ToString))
' separator = ","
' encontrados = encontrados + 1
'End If
If CveActivoFijo = CveActivoFijoContrato Then
str.AppendLine(String.Format("{0}", separator))
SeEncontro = True
Dim unidad As String = $"{Row("CodigoAF")}-{Row("NombreAF")}"
Dim duracion As String = $"{Row("FechaInicial").ToString.ToDate.ToString("dd/MM/yyyy HH:mm")} - {Row("FechaFinal").ToString.ToDate.ToString("dd/MM/yyyy HH:mm")}"
If EsHijo Then
str.AppendLine(String.Format("{{id: {1}, text: ""{2}"", start_date: ""{3:yyyy/MM/dd HH:mm}"", end_date: ""{4:yyyy/MM/dd HH:mm}"", progress:{6}, open: true, unidad: ""{7}"",duracion: ""{8}"", color: ""{9}"",codigoaf: ""{10}"", cvecontrato: ""{11}"", parent: {12} }} ",
separator, Row("CveContrato").ToString, Row("NumeroContrato").ToString().Replace("\\", "\\\\").Replace("""", "\"""), Row("FechaInicial"), Row("FechaFinal"), 0, 100, unidad, duracion, ColorAleatorio(randomNumber), Row("CodigoAF").ToString, Row("CveContrato").ToString, CvePadre)
)
Else
str.AppendLine(String.Format("{{id: {1}, text: ""{2}"", start_date: ""{3:yyyy/MM/dd HH:mm}"", end_date: ""{4:yyyy/MM/dd HH:mm}"", progress:{6}, open: true, unidad: ""{7}"",duracion: ""{8}"", color: ""{9}"",codigoaf: ""{10}"", cvecontrato: ""{11}"",parent: 0 }} ",
separator, Row("CveContrato").ToString, Row("NumeroContrato").ToString().Replace("\\", "\\\\").Replace("""", "\"""), Row("FechaInicial"), Row("FechaFinal"), 0, 100, unidad, duracion, ColorAleatorio(randomNumber), Row("CodigoAF").ToString, Row("CveContrato").ToString)
)
End If
If Not EsHijo Then
CvePadre = Row("CveContrato").ToString.ToEntero
EsHijo = True
End If
separator = ","
encontrados = encontrados + 1
Else
EsHijo = False
End If
Next
'If Not SeEncontro Then
' If encontrados > 0 Then
' separator = ","
' End If
' str.AppendLine(String.Format("{0}", separator))
' str.AppendLine(String.Format("{{id: {1}, text: ""{2}"", start_date: ""{3}"", end_date: ""{4}"", parent: {5}, progress:{6}, open: true, unidad: ""{7}"",duracion: ""{8}"", color: ""{9}"",codigoaf: ""{10}"", hidden: true}} ",
' "", CveActivoFijo, -1, txtFechaF.Text.ToDate.ToString("yyyy/MM/dd HH:mm"), txtFechaF.Text.ToDate.ToString("yyyy/MM/dd HH:mm"), 0, 100, "", "", ColorAleatorio(randomNumber), CodigoAF))
' separator = ","
'End If
'str.AppendLine(String.Format("}"))
Next
End If
str.AppendLine("];loadGant();")
'RegistraScript(str.ToString())
UPPGantt.Update()
UPGat.Update()
End If
End Sub
Private Function ColorAleatorio(randomNumber As Random) As String
Dim listaColores As New List(Of String)
listaColores.Add("#94f35a")
listaColores.Add("#1989a9")
listaColores.Add("#5a3c98")
listaColores.Add("#556855")
listaColores.Add("#e199cf")
listaColores.Add("#50cc77")
listaColores.Add("#559f9d")
listaColores.Add("#ede805")
listaColores.Add("#f1e489")
listaColores.Add("#c381f6")
listaColores.Add("#f2496b")
listaColores.Add("#c4d7dc")
listaColores.Add("#f3f9f9")
listaColores.Add("#fd8ffe")
listaColores.Add("#f2496b")
listaColores.Add("#5a8f9c")
listaColores.Add("#87bfbd")
listaColores.Add("#fb01fd")
listaColores.Add("#6836dc")
listaColores.Add("#67627e")
listaColores.Add("#1b9f44")
listaColores.Add("#3a54dc")
listaColores.Add("#fb66f1")
listaColores.Add("#24f6b4")
listaColores.Add("#60feee")
listaColores.Add("#82a199")
listaColores.Add("#93a9e1")
listaColores.Add("#ff8809")
listaColores.Add("#8379ba")
listaColores.Add("#f62ea2")
listaColores.Add("#41cf69")
listaColores.Add("#8624b2")
listaColores.Add("#f4948a")
listaColores.Add("#205da6")
listaColores.Add("#9f38b6")
listaColores.Add("#540466")
listaColores.Add("#7a4e49")
listaColores.Add("#bd22ce")
listaColores.Add("#6d89a0")
listaColores.Add("#7e6d8c")
listaColores.Add("#124a70")
listaColores.Add("#c3d2c2")
listaColores.Add("#506702")
listaColores.Add("#058106")
listaColores.Add("#0485f2")
listaColores.Add("#401685")
Dim ranNumber As Integer = randomNumber.Next(0, listaColores.Count - 1)
Return listaColores(ranNumber)
End Function
'Public Sub loadEvento()
' Dim separator As String = ""
' Dim str As New StringBuilder()
@@ -487,16 +660,47 @@ Partial Class RepContratosCalendario
End Sub
Protected Sub LnkExcel_Click(sender As Object, e As EventArgs) Handles LnkExcel.Click
GvContratos.ExportToExcel("ReporteCompras" & NowADS().ToShortDateString)
Protected Sub LnkExcel_Click(sender As Object, e As EventArgs) Handles LnkExcel.Click
Dim SubProyecto As String = ""
SubProyecto = DdlSubProyectos.SelectedItem.Text
Dim SbFiltros As New StringBuilder()
SbFiltros.AppendFormat($"Fecha Inicio: {txtFechaI.Text} Fecha Fin: {txtFechaF.Text}|")
SbFiltros.AppendFormat("SubProyecto: {0}|", SubProyecto)
GvContratos.ExportToExcelGembox($"Reporte_Contratos_{NowADS.ToString("yyyyMMddHHmmss")}", UsuarioActual, "Reporte Contratos", DatoTituloExtra:=$"", DatosFiltros:=SbFiltros.ToString())
End Sub
Public Overrides Sub VerifyRenderingInServerForm(ByVal control As Control)
' Esto es necesario para permitir la renderización del control fuera de un formulario servidor
' No se requiere implementación específica, solo la anulación.
End Sub
Protected Sub LnkPDF_Click(sender As Object, e As EventArgs) Handles LnkPdf.Click
Protected Sub LnkPDF_Click(sender As Object, e As EventArgs) Handles LnkPdf.Click
ImprimirReporte()
End Sub
Private Sub ImprimirReporte(Optional Formato As String = "PDF")
Dim ObjContratos As New ClsContratos
Dim DTDatos As New DataTable
If ObjContratos.GetContratos(-1, UsuarioActual.CveEmpresa, TipoContrato:=2) Then
DTDatos = ObjContratos.DtResultados
Else
Alert("No hay datos consultados", TipoMensaje.MsgAdvertencia)
End If
ObjContratos.Dispose()
If DTDatos IsNot Nothing 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 Cliente As String = If(DdlClientes.SelectedValue = "-1", "", $"&emsp;<b>Cliente:</b>&nbsp;{DdlClientes.SelectedText}")
Dim params As New List(Of ReportParameter) From {
New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa),
New ReportParameter("FechaInicio", "-1"),
@@ -506,23 +710,25 @@ Partial Class RepContratosCalendario
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
ObjContratos.Dispose()
ImprimirPDF("Empresas/Grales/Formatos/RepContratos.rdlc", DTDatos, params, NombreArchivo:="Reporte Contratos", Formato:=Formato)
End If
End Sub
Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs)
CargaDatos()
End Sub
Protected Sub RBTipoVista_SelectedIndexChanged(sender As Object, e As EventArgs)
InicializaCalendar()
CargaCronograma()
CargaDiagramadeGant()
End Sub
Protected Sub DdlTipoVista_SelectedIndexChanged(sender As Object, e As EventArgs)
CargaCronograma(DdlTipoVista.SelectedValue.ToEntero)
CargaDiagramadeGant(DdlTipoVista.SelectedValue.ToEntero)
End Sub
@@ -537,4 +743,8 @@ Partial Class RepContratosCalendario
End Sub
Protected Sub DdlTipoVistaCalendario_SelectedIndexChanged(sender As Object, e As EventArgs)
CargaCronograma(DdlTipoVistaCalendario.SelectedValue.ToEntero)
End Sub
End Class

View File

@@ -158,7 +158,7 @@ Partial Class Ventas_Promociones
PermisoAutorizPromocionPorcentaje = UsuarioActual.TienePermisoProceso(386)
EmpresaGrupoDiaz = If(UsuarioActual.Empresa.Funcionalidad(382) = "1", True, False) 'Grupo díaz
'EmpresaGrupoDiaz = True ''Para pruebas
EmpresaGrupoDiaz = True ''Para pruebas
If EmpresaGrupoDiaz Then
DVModalClasificacion.Visible = False