vacacciones
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="ReporteVacaciones.aspx.cs" Inherits="Nomina_ReporteVacaciones" %>
|
||||
|
||||
<%@ Import Namespace="Extensiones" %>
|
||||
<asp:Content ID="Content1" ContentPlaceHolderID="CP" runat="Server">
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content2" ContentPlaceHolderID="Css" runat="Server">
|
||||
@@ -7,8 +8,112 @@
|
||||
/*.text-right {
|
||||
text-align:right
|
||||
}*/
|
||||
td.borderleft,th.borderleft{
|
||||
border-left:1px solid black !important;
|
||||
td.borderleft, th.borderleft {
|
||||
border-left: 1px solid black !important;
|
||||
}
|
||||
|
||||
.hiddentth, .hiddentth th {
|
||||
background-color: #fff !important;
|
||||
}
|
||||
|
||||
.showMesDia {
|
||||
display: none;
|
||||
}
|
||||
table tr th.diac {
|
||||
font-size: 4px;
|
||||
padding-left: 1px !important;
|
||||
padding-right: 1px !important;
|
||||
}
|
||||
|
||||
table tr th.mesc{
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.mes1 {
|
||||
background-color: #ffcccc;
|
||||
border-color: #ffcccc;
|
||||
}
|
||||
/* Enero - Rojo claro */
|
||||
.mes2 {
|
||||
background-color: #ffebcc;
|
||||
border-color: #ffcccc;
|
||||
}
|
||||
/* Febrero - Naranja claro */
|
||||
.mes3 {
|
||||
background-color: #ffffcc;
|
||||
border-color: #ffcccc;
|
||||
}
|
||||
/* Marzo - Amarillo claro */
|
||||
.mes4 {
|
||||
background-color: #ccffcc;
|
||||
border-color: #ffcccc;
|
||||
}
|
||||
/* Abril - Verde claro */
|
||||
.mes5 {
|
||||
background-color: #ccffff;
|
||||
border-color: #ffcccc;
|
||||
}
|
||||
/* Mayo - Azul cielo */
|
||||
.mes6 {
|
||||
background-color: #ccccff;
|
||||
border-color: #ffcccc;
|
||||
}
|
||||
/* Junio - Azul suave */
|
||||
.mes7 {
|
||||
background-color: #e6ccff;
|
||||
border-color: #ffcccc;
|
||||
}
|
||||
/* Julio - Morado claro */
|
||||
.mes8 {
|
||||
background-color: #ffccff;
|
||||
border-color: #ffcccc;
|
||||
}
|
||||
/* Agosto - Rosa claro */
|
||||
.mes9 {
|
||||
background-color: #ffb3b3;
|
||||
border-color: #ffcccc;
|
||||
}
|
||||
/* Septiembre - Rojo pastel */
|
||||
.mes10 {
|
||||
background-color: #ff9966;
|
||||
border-color: #ffcccc;
|
||||
}
|
||||
/* Octubre - Naranja pastel */
|
||||
.mes11 {
|
||||
background-color: #cccc99;
|
||||
border-color: #ffcccc;
|
||||
}
|
||||
/* Noviembre - Verde oliva */
|
||||
.mes12 {
|
||||
background-color: #e6e6e6;
|
||||
border-color: #ffcccc;
|
||||
}
|
||||
/* Diciembre - Gris claro */
|
||||
|
||||
.TContainer {
|
||||
width:100%;
|
||||
height: calc(100vh - 200px);
|
||||
overflow:scroll;
|
||||
}
|
||||
.VacClass{
|
||||
background-color:darkslateblue;
|
||||
}
|
||||
.borderyear{
|
||||
border-left: 1px solid #FFF !important;
|
||||
|
||||
}
|
||||
.yearclass{
|
||||
background-color:#444;
|
||||
color:#FFF;text-align: center;
|
||||
font-size: 6px;
|
||||
}
|
||||
.yearclassB{
|
||||
background-color:#999;
|
||||
color:#FFF;text-align: center;
|
||||
font-size: 6px;
|
||||
}
|
||||
tr.aniorow td{
|
||||
height:8px;
|
||||
}
|
||||
</style>
|
||||
</asp:Content>
|
||||
@@ -29,7 +134,7 @@
|
||||
<div class="portlet-title portlet-filterT smalltitle">
|
||||
<div class="titlefiltros caption">
|
||||
<div class="row">
|
||||
|
||||
|
||||
<label class="col-md-1 mediocol">Inicio:</label>
|
||||
<div class="col-md-1">
|
||||
<%--<asp:TextBox ID="TxtPeriodoInicio" Text="0" CssClass="form-control" runat="server"></asp:TextBox>--%>
|
||||
@@ -85,9 +190,94 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="TContainer">
|
||||
<table id="gvReporteVacacionesCalendar" class="table table-hover ScrollADig Widthall gvReporteVacacionesCalendar" data-rows="4" data-cols="3" data-heighterror="360">
|
||||
<tbody>
|
||||
|
||||
<div>
|
||||
<table id="gvReporteVacaciones" class="table table-striped table-advance table-hover ScrollAD Widthall gvReporteVacaciones" data-rows="2" data-heighterror="360">
|
||||
<tr class="hiddentth">
|
||||
<th class="showMesDia"></th>
|
||||
<th class="showMesDia"></th>
|
||||
<th class="showMesDia"></th>
|
||||
<%-- Encabezados dinámicos para los ejercicios --%>
|
||||
|
||||
<asp:Repeater ID="rptx" runat="server">
|
||||
<ItemTemplate>
|
||||
<%--<th class="showMes" runat="server" Visible='<%# Eval("Campo").ToString() == "1" %>'></th>--%>
|
||||
<th class="showMesDia"></th>
|
||||
</ItemTemplate>
|
||||
</asp:Repeater>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<%-- Encabezados dinámicos para los ejercicios --%>
|
||||
|
||||
<asp:Repeater ID="rptanio" runat="server">
|
||||
<ItemTemplate>
|
||||
<th class="borderleft" data-toggle="tooltip" title='<%# Eval("Anio") %>' colspan='<%# Eval("DiasEjercicio") %>'><%# Eval("Anio") %></th>
|
||||
</ItemTemplate>
|
||||
</asp:Repeater>
|
||||
</tr>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<%-- Encabezados dinámicos para los ejercicios --%>
|
||||
<%-- data-toggle="tooltip"
|
||||
title='<%# new System.Globalization.CultureInfo("es-ES").DateTimeFormat.GetMonthName(Eval("Mes").ToString().ToEntero()).ToUpper() %>'--%>
|
||||
<asp:Repeater ID="rptMeses" runat="server">
|
||||
<ItemTemplate>
|
||||
<th class='<%# string.Format("{0} diac mes{1} mesc","borderleft",Eval("Mes")) %>' colspan='<%# Eval("DiasMes") %>'>
|
||||
<%# new System.Globalization.CultureInfo("es-ES").DateTimeFormat.GetMonthName(Eval("Mes").ToString().ToEntero()).ToUpper() %></th>
|
||||
</ItemTemplate>
|
||||
</asp:Repeater>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>Código</th>
|
||||
<th>Nombre Completo</th>
|
||||
<th>Fecha Inicio</th>
|
||||
<%-- Encabezados dinámicos para los ejercicios --%>
|
||||
|
||||
<asp:Repeater ID="RepetDias" runat="server">
|
||||
<ItemTemplate>
|
||||
<th class='<%# string.Format("{0} diac mes{1}",(Eval("MinMes").ToString().ToUpper()=="1"?"borderleft":""),Eval("Mes")) %>'><%# Eval("Dia") %></th>
|
||||
</ItemTemplate>
|
||||
</asp:Repeater>
|
||||
</tr>
|
||||
|
||||
<asp:Repeater ID="RepeaterPrincipalCalendar" runat="server">
|
||||
<HeaderTemplate>
|
||||
</HeaderTemplate>
|
||||
<ItemTemplate>
|
||||
<tr class="aniorow">
|
||||
<%--<td><%# Eval("CvePersonal") %></td>--%>
|
||||
<td rowspan="3"><asp:HyperLink runat="server" Text='<%# Eval("Codigo") %>' NavigateUrl='<%# Eval("CvePersonal", "~/RH/Personal.aspx?CvePersonal={0}") %>'></asp:HyperLink></td>
|
||||
<td rowspan="3"><asp:HyperLink runat="server" Text='<%# Eval("NombreCompleto") %>' NavigateUrl='<%# Eval("CvePersonal", "~/RH/Personal.aspx?CvePersonal={0}") %>'></asp:HyperLink></td>
|
||||
<td rowspan="3"><%# Eval("FechaInicio", "{0:yyyy-MM-dd}") %></td>
|
||||
<%-- Subrepeater para los ejercicios --%>
|
||||
<asp:Literal Text='<%# Eval("ColumnasinicioFin" ) %>' runat="server"></asp:Literal>
|
||||
</tr>
|
||||
<tr>
|
||||
<asp:Literal Text='<%# Eval("ColumnasVacaciones" ) %>' runat="server"></asp:Literal>
|
||||
<%-- <asp:Repeater ID="RepeaterEjercicios" runat="server" DataSource='<%# tabladias %>'>
|
||||
<ItemTemplate>
|
||||
<asp:Literal Text='<%# columnapersonal((int)Eval("FechaNum" ),(System.Data.DataTable )Eval("TDiaspersonal")) %>' runat="server"></asp:Literal>
|
||||
</ItemTemplate>
|
||||
</asp:Repeater>--%>
|
||||
</tr>
|
||||
</ItemTemplate>
|
||||
<FooterTemplate>
|
||||
</FooterTemplate>
|
||||
</asp:Repeater>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="hidden">
|
||||
<table id="gvReporteVacaciones" class="table table-striped table-advance table-hover ScrollAD Widthall gvReporteVacaciones" data-rows="2" data-heighterror="360">
|
||||
<%-- <thead>
|
||||
</thead>--%>
|
||||
<tbody>
|
||||
@@ -112,7 +302,7 @@
|
||||
<%-- Encabezados dinámicos para los ejercicios --%>
|
||||
|
||||
<asp:Repeater ID="RepeaterEjerciciosH2" runat="server">
|
||||
<ItemTemplate>
|
||||
<ItemTemplate>
|
||||
<th class="borderleft">Antigüedad</th>
|
||||
<th>Días Vacaciones</th>
|
||||
<th>Días Pagados</th>
|
||||
@@ -125,17 +315,17 @@
|
||||
<ItemTemplate>
|
||||
<tr>
|
||||
<%--<td><%# Eval("CvePersonal") %></td>--%>
|
||||
<td>
|
||||
<asp:HyperLink runat="server" Text='<%# Eval("Codigo") %>' NavigateUrl='<%# Eval("CvePersonal", "~/RH/Personal.aspx?CvePersonal={0}") %>'></asp:HyperLink></td>
|
||||
<td>
|
||||
<asp:HyperLink runat="server" Text='<%# Eval("NombreCompleto") %>' NavigateUrl='<%# Eval("CvePersonal", "~/RH/Personal.aspx?CvePersonal={0}") %>'></asp:HyperLink></td>
|
||||
<td>
|
||||
<asp:HyperLink runat="server" Text='<%# Eval("Codigo") %>' NavigateUrl='<%# Eval("CvePersonal", "~/RH/Personal.aspx?CvePersonal={0}") %>'></asp:HyperLink></td>
|
||||
<td>
|
||||
<asp:HyperLink runat="server" Text='<%# Eval("NombreCompleto") %>' NavigateUrl='<%# Eval("CvePersonal", "~/RH/Personal.aspx?CvePersonal={0}") %>'></asp:HyperLink></td>
|
||||
<td><%# Eval("FechaInicio", "{0:yyyy-MM-dd}") %></td>
|
||||
<%-- Subrepeater para los ejercicios --%>
|
||||
<asp:Repeater ID="RepeaterEjercicios" runat="server" DataSource='<%# Eval("Ejercicios") %>'>
|
||||
<ItemTemplate>
|
||||
<ItemTemplate>
|
||||
<td class="text-right borderleft"><%# Convert.ToInt32(Eval("Antiguedad")) > 0 ? Eval("Antiguedad") : "" %></td>
|
||||
<td class="text-right "><%# Convert.ToInt32(Eval("Antiguedad")) > 0 ? Eval("DiasVacaciones") : "" %></td>
|
||||
<td class="text-right "><%# Convert.ToInt32(Eval("Antiguedad")) > 0 ? Eval("DiasPagados") : "" %></td>
|
||||
<td class="text-right "><%# Convert.ToInt32(Eval("Antiguedad")) > 0 ? Eval("DiasVacaciones") : "" %></td>
|
||||
<td class="text-right "><%# Convert.ToInt32(Eval("Antiguedad")) > 0 ? Eval("DiasPagados") : "" %></td>
|
||||
</ItemTemplate>
|
||||
</asp:Repeater>
|
||||
</tr>
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
using ADSNetLibrary.Helpers;
|
||||
using Extensiones;
|
||||
using iText.Html2pdf.Attach.Impl.Layout.Form.Element;
|
||||
using Microsoft.Extensions.Primitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
@@ -34,8 +37,8 @@ public partial class Nomina_ReporteVacaciones : ClsPaginas
|
||||
{
|
||||
get
|
||||
{
|
||||
string fecha = $"{DateTime.Now.Year - 3}-01-01";
|
||||
if (ViewState["FiltFechaInicio"] == null) { return fecha ; }
|
||||
string fecha = $"{DateTime.Now.Year - 1}-01-01";
|
||||
if (ViewState["FiltFechaInicio"] == null) { return fecha; }
|
||||
else { return ViewState["FiltFechaInicio"].ToString(); }
|
||||
}
|
||||
|
||||
@@ -52,6 +55,18 @@ public partial class Nomina_ReporteVacaciones : ClsPaginas
|
||||
|
||||
set { ViewState["FiltFechaFin"] = value; }
|
||||
}
|
||||
|
||||
|
||||
protected DataTable tabladias
|
||||
{
|
||||
get
|
||||
{
|
||||
if (ViewState["tabladias"] == null) { return new DataTable(); }
|
||||
else { return (DataTable)ViewState["tabladias"]; }
|
||||
}
|
||||
|
||||
set { ViewState["tabladias"] = value; }
|
||||
}
|
||||
#endregion
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
@@ -68,75 +83,214 @@ public partial class Nomina_ReporteVacaciones : ClsPaginas
|
||||
{
|
||||
using (ClsNominas objnom = new ClsNominas())
|
||||
{
|
||||
if (objnom.ReporteVacaciones(FiltCveProyecto, FiltCveSubProyecto, UsuarioActual.CveEmpresa, FiltFechaInicio, FiltFechaFin))
|
||||
if (objnom.ReporteVacacionesCalendario(FiltCveProyecto, FiltCveSubProyecto, UsuarioActual.CveEmpresa, FiltFechaInicio, FiltFechaFin))
|
||||
{
|
||||
DataTable tabla1 = objnom.DTSetResultados.Tables[0]; // Simula tu tabla 1
|
||||
DataTable tabla2 = objnom.DTSetResultados.Tables[1]; // Simula tu tabla 2
|
||||
DataTable tabla3 = objnom.DTSetResultados.Tables[2]; // Simula tu tabla 3
|
||||
RepeaterEjerciciosH1.DataSource= tabla3;
|
||||
RepeaterEjerciciosH2.DataSource= tabla3;
|
||||
DataTable tabla1 = objnom.DTSetResultados.Tables[0]; //
|
||||
DataTable tabla2 = objnom.DTSetResultados.Tables[1]; //
|
||||
DataTable tabla3 = objnom.DTSetResultados.Tables[2]; //
|
||||
tabladias = objnom.DTSetResultados.Tables[3];
|
||||
DataTable tabladiasPersonal = objnom.DTSetResultados.Tables[4];
|
||||
RepeaterEjerciciosH1.DataSource = tabla3;
|
||||
RepeaterEjerciciosH2.DataSource = tabla3;
|
||||
RepeaterEjerciciosH1.DataBind();
|
||||
RepeaterEjerciciosH2.DataBind();
|
||||
// Convertir Tabla 1 a Enumerable con un campo extra
|
||||
List<Registro> resultado = tabla1.AsEnumerable().Select(row1 => new Registro()
|
||||
List<Registro> resultado = tabla1.AsEnumerable().Select(row1 =>
|
||||
{
|
||||
CvePersonal = row1.Field<int>("CvePersonal"),
|
||||
Codigo = row1.Field<string>("Codigo"),
|
||||
NombreCompleto = row1.Field<string>("NombreCompleto"),
|
||||
//FechaFin = (row1("FechaFin")).ToString().,
|
||||
FechaInicio = row1.Field<DateTime>("FechaInicio"),
|
||||
FechaAntiguedad = row1.Field<DateTime>("FechaAntiguedad"),
|
||||
Antiguedad = row1.Field<int>("Antiguedad"),
|
||||
int cvePersonal = Convert.ToInt32(row1["CvePersonal"]);
|
||||
DataRow[] filasFiltradas = tabladiasPersonal.Select($"CvePersonal = {cvePersonal}");
|
||||
|
||||
// Campo extra: Enumerable para cada Ejercicio de Tabla 3
|
||||
Ejercicios = tabla3.AsEnumerable().Select(row3 =>
|
||||
// Crear un nuevo DataTable con la misma estructura
|
||||
DataTable TDiaspersonal = tabladiasPersonal.Clone();
|
||||
|
||||
// Importar las filas filtradas
|
||||
foreach (DataRow fila in filasFiltradas)
|
||||
{
|
||||
var ejercicio = row3.Field<int>("Ejercicio");
|
||||
TDiaspersonal.ImportRow(fila);
|
||||
//DataRow nuevaFila = TDiaspersonal.NewRow();
|
||||
|
||||
// Buscar en Tabla 2 si existe el registro para CvePersonal y Ejercicio
|
||||
var registro = tabla2.AsEnumerable().FirstOrDefault(row2 =>
|
||||
row2.Field<int>("CvePersonal") == row1.Field<int>("CvePersonal") &&
|
||||
row2.Field<int>("EJercicio") == ejercicio);
|
||||
//// Copiar manualmente cada columna
|
||||
//foreach (DataColumn columna in tabladiasPersonal.Columns)
|
||||
//{
|
||||
// nuevaFila[columna.ColumnName] = fila[columna.ColumnName];
|
||||
//}
|
||||
|
||||
// Si no existe, crear un nuevo registro
|
||||
if (registro == null)
|
||||
//TDiaspersonal.Rows.Add(nuevaFila);
|
||||
}
|
||||
TDiaspersonal.AcceptChanges();
|
||||
//DataTable TDiaspersonal = tabladiasPersonal.FiltraParametros(string.Format("CvePersonal = '{0}'", row1["CvePersonal"]));
|
||||
int contador = tabladiasPersonal.Rows.Count;
|
||||
return new Registro()
|
||||
{
|
||||
CvePersonal = row1.Field<int>("CvePersonal"),
|
||||
Codigo = row1.Field<string>("Codigo"),
|
||||
NombreCompleto = row1.Field<string>("NombreCompleto"),
|
||||
//FechaFin = (row1("FechaFin")).ToString().,
|
||||
FechaInicio = row1.Field<DateTime>("FechaInicio"),
|
||||
FechaAntiguedad = row1.Field<DateTime>("FechaAntiguedad"),
|
||||
Antiguedad = row1.Field<int>("Antiguedad"),
|
||||
|
||||
ColumnasinicioFin = strColumnasinicioFin(tabladias, tabla2.FiltraParametros(string.Format("CvePersonal = {0}", row1["CvePersonal"])), row1["anio"].ToString().ToEntero(), row1["Mes"].ToString(), row1["Dia"].ToString()),
|
||||
ColumnasVacaciones = strColumnasVacaciones(tabladias, TDiaspersonal),
|
||||
// Campo extra: Enumerable para cada Ejercicio de Tabla 3
|
||||
Ejercicios = tabla3.AsEnumerable().Select(row3 =>
|
||||
{
|
||||
return new EjercicioInfo()
|
||||
var ejercicio = row3.Field<int>("Ejercicio");
|
||||
|
||||
// Buscar en Tabla 2 si existe el registro para CvePersonal y Ejercicio
|
||||
var registro = tabla2.AsEnumerable().FirstOrDefault(row2 =>
|
||||
row2.Field<int>("CvePersonal") == row1.Field<int>("CvePersonal") &&
|
||||
row2.Field<int>("EJercicio") == ejercicio);
|
||||
|
||||
// Si no existe, crear un nuevo registro
|
||||
if (registro == null)
|
||||
{
|
||||
Ejercicio = ejercicio,
|
||||
FechaAntiguedad = row1.Field<DateTime>("FechaAntiguedad"),
|
||||
Antiguedad = 0,
|
||||
DiasVacaciones = 0, // Valor predeterminado
|
||||
DiasPagados = 0, // Valor predeterminado
|
||||
DiasDisfrutados = 0 // Valor predeterminado
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
// Si existe, devolver los datos de la Tabla 2
|
||||
return new EjercicioInfo()
|
||||
return new EjercicioInfo()
|
||||
{
|
||||
Ejercicio = ejercicio,
|
||||
FechaAntiguedad = row1.Field<DateTime>("FechaAntiguedad"),
|
||||
Antiguedad = 0,
|
||||
DiasVacaciones = 0, // Valor predeterminado
|
||||
DiasPagados = 0, // Valor predeterminado
|
||||
DiasDisfrutados = 0 // Valor predeterminado
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
Ejercicio = registro.Field<int>("EJercicio"),
|
||||
FechaAntiguedad = registro.Field<DateTime>("FechaAntiguedad"),
|
||||
Antiguedad = registro.Field<int>("Antiguedad"),
|
||||
DiasVacaciones = registro.Field<int>("DiasVacaciones"),
|
||||
DiasPagados = registro.Field<int>("DiasPagados"),
|
||||
DiasDisfrutados = registro.Field<int>("DiasDisfrutados")
|
||||
};
|
||||
}
|
||||
}).ToList()
|
||||
}).ToList();
|
||||
// Si existe, devolver los datos de la Tabla 2
|
||||
return new EjercicioInfo()
|
||||
{
|
||||
Ejercicio = registro.Field<int>("EJercicio"),
|
||||
FechaAntiguedad = registro.Field<DateTime>("FechaAntiguedad"),
|
||||
Antiguedad = registro.Field<int>("Antiguedad"),
|
||||
DiasVacaciones = registro.Field<int>("DiasVacaciones"),
|
||||
DiasPagados = registro.Field<int>("DiasPagados"),
|
||||
DiasDisfrutados = registro.Field<int>("DiasDisfrutados")
|
||||
};
|
||||
}
|
||||
}).ToList()
|
||||
};
|
||||
}
|
||||
).ToList();
|
||||
|
||||
|
||||
|
||||
RepeaterPrincipal.DataSource = resultado;
|
||||
RepeaterPrincipal.DataBind();
|
||||
|
||||
RepeaterPrincipalCalendar.DataSource = resultado;
|
||||
RepeaterPrincipalCalendar.DataBind();
|
||||
|
||||
|
||||
rptanio.DataSource = tabladias.FiltraParametros("MinEjercicio = 1");
|
||||
rptanio.DataBind();
|
||||
rptMeses.DataSource = tabladias.FiltraParametros("MinMes = 1");
|
||||
rptMeses.DataBind();
|
||||
RepetDias.DataSource = tabladias;
|
||||
RepetDias.DataBind();
|
||||
rptx.DataSource = tabladias;
|
||||
rptx.DataBind();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
public string rightstr(string str,int cantidad)
|
||||
{
|
||||
return str.Length >= cantidad ? str.Substring(str.Length - cantidad) : str;
|
||||
}
|
||||
public string strColumnasinicioFin(DataTable tabladias, DataTable TEjercicio, int anio, string Mes, string Dia)
|
||||
{
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
StringBuilder strbuilderB = new StringBuilder();
|
||||
strbuilderB.AppendFormat(" </tr><tr>");
|
||||
int FechaNum =string.Format("{0}{1}{2}", anio, Mes, Dia).ToEntero();
|
||||
int Mesdia =string.Format("{0}{1}", Mes, Dia).ToEntero();
|
||||
foreach (DataRow dr in tabladias.Rows)
|
||||
{
|
||||
int colspan = dr["DiasMes"].ToString().ToEntero();
|
||||
int mesidias = rightstr(dr["FechaNum"].ToString(),4).ToEntero();
|
||||
int mesa = dr["Mes"].ToString().ToEntero();
|
||||
int ania = dr["Anio"].ToString().ToEntero()-(mesidias >= Mesdia?0:1);
|
||||
DataRow hdrow = TEjercicio.FiltroPrimero(string.Format("Ejercicio = {0}", ania));
|
||||
int drFechaNum = dr["FechaNum"].ToString().ToEntero();
|
||||
string classtd = drFechaNum < FechaNum ? "": ((ania % 2) > 0 ? "yearclass" : "yearclassB");
|
||||
string antiguedad = "";
|
||||
string classvac = "borderleft";
|
||||
string vacacionestomadas = "";
|
||||
if(hdrow != null)
|
||||
{
|
||||
antiguedad = string.Format("({0})", hdrow["Antiguedad"]);
|
||||
//DiasVacaciones EJercicio EJercicioVac DiasPagados DiasDisfrutados
|
||||
int DiasVacaciones = hdrow["DiasVacaciones"].ToString().ToEntero();
|
||||
int DiasPagados = hdrow["DiasPagados"].ToString().ToEntero();
|
||||
int DiasDisfrutados = hdrow["DiasDisfrutados"].ToString().ToEntero();
|
||||
int mitadDiasVacaciones = DiasVacaciones / 2;
|
||||
classvac = DiasDisfrutados > 0 ? (DiasDisfrutados > mitadDiasVacaciones ? (DiasDisfrutados >= DiasVacaciones ? "success" : "info") : "warning") : "danger";
|
||||
vacacionestomadas = string.Format("{0}/{1}",DiasDisfrutados, DiasVacaciones);
|
||||
}
|
||||
if (dr["MinMes"].ToString() == "1" && Mesdia != mesidias)
|
||||
{
|
||||
if(mesa == Mes.ToEntero())
|
||||
{
|
||||
colspan = Dia.ToEntero() - 1;
|
||||
}
|
||||
string canio = drFechaNum >= FechaNum && colspan>5 ? (ania.ToString()) :"";
|
||||
stringBuilder.AppendFormat("<td class='{2}' colspan='{0}'>{1} {3}</td>", colspan, canio, classtd, antiguedad);
|
||||
strbuilderB.AppendFormat("<td class='{1}' colspan='{0}'>{2}</td>", colspan, classvac, vacacionestomadas);
|
||||
}
|
||||
if (mesidias == Mesdia)
|
||||
{
|
||||
string canio = drFechaNum >= FechaNum && colspan > 5 ? (ania.ToString()) : "";
|
||||
if (mesa == Mes.ToEntero())
|
||||
{
|
||||
colspan = colspan-(Dia.ToEntero() - 1);
|
||||
}
|
||||
stringBuilder.AppendFormat("<td class='{2} borderyear' colspan='{0}'>{1} {3}</td>", colspan, canio, classtd, antiguedad);
|
||||
strbuilderB.AppendFormat("<td class='{1}' colspan='{0}'>{2}</td>", colspan, classvac, vacacionestomadas);
|
||||
}
|
||||
}
|
||||
stringBuilder.AppendFormat("{0}", strbuilderB.ToString());
|
||||
return stringBuilder.ToString();
|
||||
}
|
||||
public string strColumnasVacaciones(DataTable tabladias, DataTable TDiaspersonal)
|
||||
{
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
foreach (DataRow dr in tabladias.Rows)
|
||||
{
|
||||
|
||||
DataRow hdr = TDiaspersonal.FiltroPrimero(string.Format("FechaNum={0}", dr["FechaNum"]));
|
||||
if (hdr != null)
|
||||
{
|
||||
if (hdr["InicioM"].ToString() == "1")
|
||||
{
|
||||
stringBuilder.AppendFormat("<td class='VacClass{1}' colspan='{0}'></td>", hdr["DiasMesAnio"], (dr["MinMes"].ToString() == "1" ? " borderleft " : ""));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (TDiaspersonal.FiltroPrimero(string.Format("Anio={0} AND Mes ={1}", dr["Anio"], dr["Mes"])) != null)
|
||||
{
|
||||
stringBuilder.AppendFormat("<td class='{0}'></td>", (dr["MinMes"].ToString() == "1" ? " borderleft " : ""));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (dr["MinMes"].ToString() == "1")
|
||||
{
|
||||
|
||||
stringBuilder.AppendFormat("<td class='borderleft' colspan='{0}'></td>", dr["DiasMes"]);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
return stringBuilder.ToString();
|
||||
}
|
||||
public string columnapersonal(int dia, DataTable TDiaspersonal)
|
||||
{
|
||||
return string.Format("<td></td>");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -158,6 +312,9 @@ public class Registro
|
||||
public DateTime FechaAntiguedad { get; set; }
|
||||
public int Antiguedad { get; set; }
|
||||
public List<EjercicioInfo> Ejercicios { get; set; }
|
||||
//public DataTable TDiaspersonal { get; set; }
|
||||
public string ColumnasinicioFin { get; set; }
|
||||
public string ColumnasVacaciones { get; set; }
|
||||
}
|
||||
|
||||
public class EjercicioInfo
|
||||
|
||||
Reference in New Issue
Block a user