vacaciones
This commit is contained in:
@@ -2700,6 +2700,32 @@ Public Class ClsNominas
|
||||
End Try
|
||||
Return retorno
|
||||
End Function
|
||||
|
||||
|
||||
Public Function ReporteVacaciones(CveProyecto As Integer, CveSubProyecto As Integer, cveEmpresa As Integer, fechaInicio As String, fechaFin As String) As Boolean
|
||||
Dim retorno As Boolean = False
|
||||
Try
|
||||
DTSet = New DataSet()
|
||||
DataAdapter("PA_Nom_ReporteVacaciones", CommandType.StoredProcedure)
|
||||
SqlAdapter.SelectCommand.CommandTimeout = 2400
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@CveProyecto", SqlDbType.Int).Value = CveProyecto
|
||||
.Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto
|
||||
.Add("@CveEmpresa", SqlDbType.Int).Value = cveEmpresa
|
||||
.Add("@FechaInicio", SqlDbType.Date).Value = fechaInicio
|
||||
.Add("@FechaFin", SqlDbType.Date).Value = fechaFin
|
||||
End With
|
||||
SqlAdapter.Fill(DTSet)
|
||||
retorno = True
|
||||
Catch sqEx As SqlException
|
||||
retorno = False
|
||||
OnError("Ocurrió un error al realizar el reporte de vacaciones.", sqEx, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
||||
Catch ex As Exception
|
||||
retorno = False
|
||||
OnError("Ocurrió un error al realizar el reporte de vacaciones.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
||||
End Try
|
||||
Return retorno
|
||||
End Function
|
||||
Public Function GetNominasSinTimbrar(CvePeriodo As Integer, CveEmpresa As Integer) As Boolean
|
||||
Dim retorno As Boolean = False
|
||||
Try
|
||||
|
||||
@@ -8452,7 +8452,7 @@ Public Class ClsPaginas
|
||||
RptParametro.Add(New ReportParameter("Fecha", ObjNomina.Fecha.ToString))
|
||||
RptParametro.Add(New ReportParameter("Periodo", ObjNomina.TipoPeriodo))
|
||||
RptParametro.Add(New ReportParameter("DiasPagados", ObjNomina.DiasPagados.ToString))
|
||||
RptParametro.Add(New ReportParameter("MetodoPago", ObjNomina.MetodoPago)) '"""PUE"" (Pago en una sola exhibición)"-
|
||||
RptParametro.Add(New ReportParameter("MetodoPago", """PUE"" (Pago en una sola exhibición)")) 'ObjNomina.MetodoPago
|
||||
RptParametro.Add(New ReportParameter("FormaPago", """99"" (Por definir)"))
|
||||
RptParametro.Add(New ReportParameter("Cantidad", "1"))
|
||||
RptParametro.Add(New ReportParameter("Unidad", "ACT"))
|
||||
@@ -9850,6 +9850,7 @@ Public Class ClsPaginas
|
||||
PaginaDict.Add("/Documentacion/TableroMaterialidadDetalle.aspx".ToUpper(), 965)
|
||||
PaginaDict.Add("/RH/DiasFestivos.aspx".ToUpper(), -1)
|
||||
PaginaDict.Add("/Nomina/FiniquitoB.aspx".ToUpper(), -1)
|
||||
PaginaDict.Add("/Nomina/ReporteVacaciones.aspx".ToUpper(), -1)
|
||||
|
||||
'------------ Páginas agregadas recientemente (Implementación Metronic) ------------
|
||||
PaginaDict.Add("/Default2.aspx".ToUpper(), -1)
|
||||
|
||||
154
Nomina/ReporteVacaciones.aspx
Normal file
154
Nomina/ReporteVacaciones.aspx
Normal file
@@ -0,0 +1,154 @@
|
||||
<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="ReporteVacaciones.aspx.cs" Inherits="Nomina_ReporteVacaciones" %>
|
||||
|
||||
<asp:Content ID="Content1" ContentPlaceHolderID="CP" runat="Server">
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content2" ContentPlaceHolderID="Css" runat="Server">
|
||||
<style>
|
||||
/*.text-right {
|
||||
text-align:right
|
||||
}*/
|
||||
td.borderleft,th.borderleft{
|
||||
border-left:1px solid black !important;
|
||||
}
|
||||
</style>
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content3" ContentPlaceHolderID="E" runat="Server">
|
||||
Reporte Vacaciones
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content4" ContentPlaceHolderID="HB" runat="Server">
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content5" ContentPlaceHolderID="H" runat="Server">
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content6" ContentPlaceHolderID="HA" runat="Server">
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content7" ContentPlaceHolderID="C" runat="Server">
|
||||
|
||||
<asp:UpdatePanel ID="UpContenido" runat="server" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
<div class="portlet solid grey-cascade portlet-filter">
|
||||
<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>--%>
|
||||
|
||||
<div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="width: 138px !important; padding: 0px; margin-bottom: -10px;">
|
||||
<asp:TextBox ID="TxtRpdFechaInicio" CssClass="form-control input-sm ADSMaskDate" Style="width: 80px" runat="server"></asp:TextBox>
|
||||
<span class="input-group-btn ">
|
||||
<asp:LinkButton ID="LnkRpdFechaInicio" class="btn default " Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
|
||||
</span>
|
||||
<ajax:MaskedEditExtender ID="MaskedEditExtender3" runat="server" TargetControlID="TxtRpdFechaInicio" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
|
||||
<ajax:CalendarExtender runat="server" ID="CalendarExtender3" TargetControlID="TxtRpdFechaInicio" PopupButtonID="LnkRpdFechaInicio" PopupPosition="BottomRight" Enabled="True" Format="dd/MM/yyyy"></ajax:CalendarExtender>
|
||||
<asp:RequiredFieldValidator ID="rfvRpdFechaInicio" runat="server" ControlToValidate="TxtRpdFechaInicio" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Fecha Inicio''</b> es necesario, por favor ingréselo." ValidationGroup="VGReporterepperde"></asp:RequiredFieldValidator>
|
||||
<ajax:ValidatorCalloutExtender ID="ValidatorCalloutExtender1" runat="server" HighlightCssClass="vco" TargetControlID="rfvRpdFechaInicio"></ajax:ValidatorCalloutExtender>
|
||||
</div>
|
||||
</div>
|
||||
<label class="col-md-1 mediocol">Fin:</label>
|
||||
<div class="col-md-1">
|
||||
<%--<asp:TextBox ID="TxtPeriodoFin" Text="99" CssClass="form-control" runat="server"></asp:TextBox>--%>
|
||||
<div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="width: 138px !important; padding: 0px; margin-bottom: -10px;">
|
||||
<asp:TextBox ID="TxtRpdFechaFin" CssClass="form-control input-sm ADSMaskDate" Style="width: 80px" runat="server"></asp:TextBox>
|
||||
<span class="input-group-btn ">
|
||||
<asp:LinkButton ID="LnkFechaFin" class="btn default " Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
|
||||
</span>
|
||||
<ajax:MaskedEditExtender ID="MaskedEditExtender5" runat="server" TargetControlID="TxtRpdFechaFin" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
|
||||
<ajax:CalendarExtender runat="server" ID="CalendarExtender4" TargetControlID="TxtRpdFechaFin" PopupButtonID="LnkFechaFin" PopupPosition="BottomRight" Enabled="True" Format="dd/MM/yyyy"></ajax:CalendarExtender>
|
||||
<asp:RequiredFieldValidator ID="rfvRpdFechaFin" runat="server" ControlToValidate="TxtRpdFechaFin" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Fecha Fin''</b> es necesario, por favor ingréselo." ValidationGroup="VGReporterepperde"></asp:RequiredFieldValidator>
|
||||
<ajax:ValidatorCalloutExtender ID="ValidatorCalloutExtender2" runat="server" HighlightCssClass="vco" TargetControlID="rfvRpdFechaFin"></ajax:ValidatorCalloutExtender>
|
||||
</div>
|
||||
</div>
|
||||
<asp:Label ID="LblProyecto" CssClass="col-md-1 compoonenlabel" runat="server" Text="Proyecto:" Style="max-width: 100px;"></asp:Label>
|
||||
<div runat="server" id="divddlproyeto" class="col-md-2">
|
||||
<asp:DropDownList ID="DdlProyecto" runat="server" AppendDataBoundItems="true" CssClass="select2me" AutoPostBack="true" DataTextField="Proyecto" DataValueField="CveProyecto" Style="width: 100% !important;" ValidationGroup="GrpGuardar">
|
||||
<asp:ListItem Selected="True" Text="Seleccione" Value="-1"></asp:ListItem>
|
||||
</asp:DropDownList>
|
||||
</div>
|
||||
<asp:Label ID="LblSubProyeccto" CssClass="col-md-1 compoonenlabel" runat="server" Text="SubProyecto:" Style="max-width: 103px;"></asp:Label>
|
||||
<div class="col-md-2">
|
||||
<asp:DropDownList ID="DdlSubProyecto" runat="server" AppendDataBoundItems="true" CssClass="select2me" DataTextField="SubProyecto" DataValueField="CveSubProyecto" Style="width: 100% !important;" ValidationGroup="GrpGuardar">
|
||||
<asp:ListItem Selected="True" Text="Todos" Value="-1"></asp:ListItem>
|
||||
</asp:DropDownList>
|
||||
</div>
|
||||
|
||||
<div class="col-md-1">
|
||||
<asp:LinkButton ID="LnkConsultar" OnClick="LnkConsultar_Click" runat="server" Text="Consultar" class="btn btn-primary" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tools">
|
||||
<a href="javascript:;" class="expand" data-original-title="" title=""></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="portlet-body" style="display: none">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div>
|
||||
<table id="gvReporteVacaciones" class="table table-striped table-advance table-hover ScrollAD Widthall gvReporteVacaciones" data-rows="2" data-heighterror="360">
|
||||
<%-- <thead>
|
||||
</thead>--%>
|
||||
<tbody>
|
||||
|
||||
<tr>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<%-- Encabezados dinámicos para los ejercicios --%>
|
||||
|
||||
<asp:Repeater ID="RepeaterEjerciciosH1" runat="server">
|
||||
<ItemTemplate>
|
||||
<th class="borderleft" colspan="3"><%# Eval("Ejercicio") %></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="RepeaterEjerciciosH2" runat="server">
|
||||
<ItemTemplate>
|
||||
<th class="borderleft">Antigüedad</th>
|
||||
<th>Días Vacaciones</th>
|
||||
<th>Días Pagados</th>
|
||||
</ItemTemplate>
|
||||
</asp:Repeater>
|
||||
</tr>
|
||||
<asp:Repeater ID="RepeaterPrincipal" runat="server">
|
||||
<HeaderTemplate>
|
||||
</HeaderTemplate>
|
||||
<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><%# Eval("FechaInicio", "{0:yyyy-MM-dd}") %></td>
|
||||
<%-- Subrepeater para los ejercicios --%>
|
||||
<asp:Repeater ID="RepeaterEjercicios" runat="server" DataSource='<%# Eval("Ejercicios") %>'>
|
||||
<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>
|
||||
</ItemTemplate>
|
||||
</asp:Repeater>
|
||||
</tr>
|
||||
</ItemTemplate>
|
||||
<FooterTemplate>
|
||||
</FooterTemplate>
|
||||
</asp:Repeater>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content8" ContentPlaceHolderID="JS" runat="Server">
|
||||
</asp:Content>
|
||||
|
||||
171
Nomina/ReporteVacaciones.aspx.cs
Normal file
171
Nomina/ReporteVacaciones.aspx.cs
Normal file
@@ -0,0 +1,171 @@
|
||||
using ADSNetLibrary.Helpers;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
public partial class Nomina_ReporteVacaciones : ClsPaginas
|
||||
{
|
||||
#region "Propiedades"
|
||||
protected int FiltCveProyecto
|
||||
{
|
||||
get
|
||||
{
|
||||
if (ViewState["FiltCveProyecto"] == null) { return -1; }
|
||||
else { return ViewState["FiltCveProyecto"].ToString().ToEntero(); }
|
||||
}
|
||||
|
||||
set { ViewState["FiltCveProyecto"] = value; }
|
||||
}
|
||||
protected int FiltCveSubProyecto
|
||||
{
|
||||
get
|
||||
{
|
||||
if (ViewState["FiltCveSubProyecto"] == null) { return -1; }
|
||||
else { return ViewState["FiltCveSubProyecto"].ToString().ToEntero(); }
|
||||
}
|
||||
|
||||
set { ViewState["FiltCveSubProyecto"] = value; }
|
||||
}
|
||||
protected string FiltFechaInicio
|
||||
{
|
||||
get
|
||||
{
|
||||
string fecha = $"{DateTime.Now.Year - 3}-01-01";
|
||||
if (ViewState["FiltFechaInicio"] == null) { return fecha ; }
|
||||
else { return ViewState["FiltFechaInicio"].ToString(); }
|
||||
}
|
||||
|
||||
set { ViewState["FiltFechaInicio"] = value; }
|
||||
}
|
||||
protected string FiltFechaFin
|
||||
{
|
||||
get
|
||||
{
|
||||
string fecha = $"{DateTime.Now.Year}-12-31";
|
||||
if (ViewState["FiltFechaFin"] == null) { return fecha; }
|
||||
else { return ViewState["FiltFechaFin"].ToString(); }
|
||||
}
|
||||
|
||||
set { ViewState["FiltFechaFin"] = value; }
|
||||
}
|
||||
#endregion
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
TxtRpdFechaInicio.Text = $"{FiltFechaInicio.ToDateTime():dd/MM/yyyy}";
|
||||
TxtRpdFechaFin.Text = $"{FiltFechaFin.ToDateTime():dd/MM/yyyy}";
|
||||
CargarCentrosDeCosto(DdlProyecto, DdlSubProyecto, LblProyecto, LblSubProyeccto);
|
||||
divddlproyeto.Visible = DdlProyecto.Visible;
|
||||
getinfo();
|
||||
}
|
||||
}
|
||||
public void getinfo()
|
||||
{
|
||||
using (ClsNominas objnom = new ClsNominas())
|
||||
{
|
||||
if (objnom.ReporteVacaciones(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;
|
||||
RepeaterEjerciciosH1.DataBind();
|
||||
RepeaterEjerciciosH2.DataBind();
|
||||
// Convertir Tabla 1 a Enumerable con un campo extra
|
||||
List<Registro> resultado = tabla1.AsEnumerable().Select(row1 => 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"),
|
||||
|
||||
// Campo extra: Enumerable para cada Ejercicio de Tabla 3
|
||||
Ejercicios = tabla3.AsEnumerable().Select(row3 =>
|
||||
{
|
||||
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)
|
||||
{
|
||||
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
|
||||
{
|
||||
// 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();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected void LnkConsultar_Click(object sender, EventArgs e)
|
||||
{
|
||||
FiltFechaInicio = $"{TxtRpdFechaInicio.Text.ToDateTime():yyyy-MM-dd}";
|
||||
FiltFechaFin = $"{TxtRpdFechaFin.Text.ToDateTime():yyyy-MM-dd}";
|
||||
getinfo();
|
||||
}
|
||||
}
|
||||
|
||||
public class Registro
|
||||
{
|
||||
public int CvePersonal { get; set; }
|
||||
public string Codigo { get; set; }
|
||||
public string NombreCompleto { get; set; }
|
||||
public DateTime FechaInicio { get; set; }
|
||||
public DateTime FechaFin { get; set; }
|
||||
public DateTime FechaAntiguedad { get; set; }
|
||||
public int Antiguedad { get; set; }
|
||||
public List<EjercicioInfo> Ejercicios { get; set; }
|
||||
}
|
||||
|
||||
public class EjercicioInfo
|
||||
{
|
||||
public int Ejercicio { get; set; }
|
||||
public DateTime FechaAntiguedad { get; set; }
|
||||
public int Antiguedad { get; set; }
|
||||
public int DiasVacaciones { get; set; }
|
||||
public int DiasPagados { get; set; }
|
||||
public int DiasDisfrutados { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user