This commit is contained in:
HECTOR RODRIGUEZ
2021-05-22 12:11:51 -07:00
56 changed files with 4818 additions and 2520 deletions

View File

@@ -4,11 +4,11 @@
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Css" runat="Server">
<style>
.GVCalculosSBC tr th:nth-child(n+9):not(:nth-child(n+13)) {
.GVCalculosSBC tr th:nth-child(n+6):not(:nth-child(n+10)) {
background-color: #a9a9e8 !important;
}
.GVCalculosSBC tr th:nth-child(n+13):not(:nth-child(n+16)) {
.GVCalculosSBC tr th:nth-child(n+10):not(:nth-child(n+13)) {
background-color: #88d6cd !important;
}
</style>
@@ -88,7 +88,7 @@
<ContentTemplate>
<table id="tableheader" style="display: none">
<tr>
<th colspan="8"></th>
<th colspan="5"></th>
<th colspan="4" style="background-color: #a9a9e8 !important;">Actual</th>
<th colspan="3" style="background-color: #88d6cd !important;">Nuevo</th>
<th></th>
@@ -117,24 +117,9 @@
<asp:Label ID="lblfechaInicio" runat="server" Text='<%# Eval("FechaInicio","{0:dd/MM/yyyy}")%>'> </asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Antiguedad">
<asp:TemplateField HeaderText="NSS">
<ItemTemplate>
<asp:Label ID="lblnumeroSS" runat="server" Text='<%# Eval("Antiguedad")%>'> </asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Días aguinaldo">
<ItemTemplate>
<asp:Label ID="lblDiasAguinaldo" runat="server" Text='<%# Eval("NumDiasAguinaldo")%>'> </asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Días vacaciones">
<ItemTemplate>
<asp:Label ID="lblDiasVacaciones" runat="server" Text='<%# Eval("diasVacaciones")%>'> </asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Prima vacacional">
<ItemTemplate>
<asp:Label ID="LblPrimaVacacional" runat="server" Text='<%# Eval("PorPrimaVacacional","{0:P2}")%>'> </asp:Label>
<asp:Label ID="lblnumeroSS" runat="server" Text='<%# Eval("NumeroSS")%>'> </asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Tipo salario">

View File

@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
@@ -27,12 +28,12 @@ public partial class RH_CalculoSBC : ClsPaginas
{
using (ClsNominas objnom = new ClsNominas())
{
if (objnom.GetCalculoSBC(UsuarioActual.CveEmpresa,DdlTipo.SelectedValue.ToEntero(), TxtFechaPago.Text))
if (objnom.GetCalculoSBC(UsuarioActual.CveEmpresa, DdlTipo.SelectedValue.ToEntero(), TxtFechaPago.Text))
{
GVCalculosSBC.DataSource = objnom.DTSetResultados.Tables[0];
GVCFija.DataSource = objnom.DTSetResultados.Tables[0];
GVPV.DataSource = objnom.DTSetResultados.Tables[0];
if(objnom.DTSetResultados.Tables.Count > 0)
if (objnom.DTSetResultados.Tables.Count >1)
{
GVDetalleParteVariable.DataSource = objnom.DTSetResultados.Tables[1];
GVDetalleParteVariable.DataBind();
@@ -75,8 +76,8 @@ public partial class RH_CalculoSBC : ClsPaginas
//}
foreach (GridViewRow item in GVCalculosSBC.Rows)
{
double SalarioDiarioSSNuevo =Math.Round( item.DataKey("SalarioDiarioSSNuevo").ToDouble(),2);
double SalarioDiarioSS = Math.Round(item.DataKey("SalarioDiarioSS").ToDouble(),2);
double SalarioDiarioSSNuevo = Math.Round(item.DataKey("SalarioDiarioSSNuevo").ToDouble(), 2);
double SalarioDiarioSS = Math.Round(item.DataKey("SalarioDiarioSS").ToDouble(), 2);
if (SalarioDiarioSSNuevo != SalarioDiarioSS)
{
MovtosmodSalario = string.Format("{0}{1}{2}", MovtosmodSalario, concater, item.DataKey("Movtotxt"));
@@ -113,9 +114,9 @@ public partial class RH_CalculoSBC : ClsPaginas
int CvePersonal = item.DataKey("CvePersonal").ToEntero();//,,,
double SalarioDiario = item.DataKey("SalarioDiario").ToDouble();
double SDINuevo = item.DataKey("SDINuevo").ToDouble();
double SalarioDiarioSSNuevo = Math.Round(item.DataKey("SalarioDiarioSSNuevo").ToDouble(),2);
double SalarioDiarioSSNuevo = Math.Round(item.DataKey("SalarioDiarioSSNuevo").ToDouble(), 2);
double SalarioVariableNuevo = item.DataKey("SalarioVariableNuevo").ToDouble();
double SalarioDiarioSS = Math.Round(item.DataKey("SalarioDiarioSS").ToDouble(),2);
double SalarioDiarioSS = Math.Round(item.DataKey("SalarioDiarioSS").ToDouble(), 2);
if (continuar && SalarioDiarioSSNuevo != SalarioDiarioSS && (continuar = objrh.UpdateSalarios(CvePersonal, fecha, UsuarioActual.CveEmpresa, SalarioDiario, SDINuevo, SalarioDiarioSSNuevo, SalarioDiario)))
{
@@ -141,22 +142,118 @@ public partial class RH_CalculoSBC : ClsPaginas
protected void LnkDescargar_Click(object sender, EventArgs e)
{
if (Tab.ActiveTab == TabSBC)
DataTable dt = GVToDT(GVCalculosSBC,"Salario");
DataTable dtPF = GVToDT(GVCFija, "Parte fija");
DataTable dtPV = GVToDT(GVPV, "Parte variable");
DataTable dtPVD = GVToDT(GVDetalleParteVariable, "Detalle parte variable");
ClosedXML.Excel.XLWorkbook wb = new ClosedXML.Excel.XLWorkbook();
var libro = wb.AddWorksheet(dt);
var libroPF = wb.AddWorksheet(dtPF);
var libroPV = wb.AddWorksheet(dtPV);
var libroPVD = wb.AddWorksheet(dtPVD);
libro.ColumnsUsed().AdjustToContents();
libroPF.ColumnsUsed().AdjustToContents();
libroPV.ColumnsUsed().AdjustToContents();
libroPVD.ColumnsUsed().AdjustToContents();
libro.ColumnsUsed().AdjustToContents();
libro.Row(1).InsertRowsAbove(5);
libro.Range(1, 2, 1, 6).Merge().Value = UsuarioActual.Empresa.Empresa;
libro.Range(2, 2, 2, 6).Merge().Value = $"Reporte de calculo de sbc {TxtFechaPago.Text}.";
libro.Range(1, 2, 2, 6).Style.Font.SetBold(true);
libro.Range(1, 2, 2, 6).Style.Font.SetFontSize(16);
libro.Range(2, 2, 2, 6).Style.Font.SetFontSize(14);
libro.Range(1, 2, 2, 6).Style.Alignment.Horizontal = ClosedXML.Excel.XLAlignmentHorizontalValues.Center;
//libro.Range(3, 2, 3, 6).Merge().Value = $"del {fechai:dd/MM/yyyy} al {fechaf:dd/MM/yyyy}";
libro.Range(2, 7, 2, 9).Merge().Value = $"Fecha:{DateTime.Now:dd/MM/yyyy}";
libro.Range(3, 7, 3, 9).Merge().Value = $"Hora:{DateTime.Now:HH:mm}";
libro.Range(5, 6, 5, 9).Merge().Value = "Actual";
libro.Range(5, 10, 5, 12).Merge().Value = "Nuevo";
libro.Range(5, 1, 6, 14).Style.Alignment.Horizontal = ClosedXML.Excel.XLAlignmentHorizontalValues.Center;
libro.Range(5, 1, 6, 13).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(79, 129, 189));
libro.Range(5, 1, 5, 13).Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.None;
libro.Range(5, 6, 6, 9).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(128, 100, 162));
libro.Range(5, 6, 6, 9).Style.Font.FontColor = ClosedXML.Excel.XLColor.White;
libro.Range(5, 10, 6, 12).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(136, 214, 205));
libro.Range(5, 10, 6, 12).Style.Font.FontColor = ClosedXML.Excel.XLColor.White;
libro.Range(7, 6, 7 + dt.Rows.Count, 12).Style.Alignment.Horizontal = ClosedXML.Excel.XLAlignmentHorizontalValues.Right;
libro.Range(7, 6, 7+ dt.Rows.Count, 12).Style.NumberFormat.Format = "$##,###,###,0.00";
System.IO.Stream fs = new System.IO.MemoryStream();
wb.SaveAs(fs);
fs.Position = 0;
System.IO.MemoryStream memoryStream = new System.IO.MemoryStream();
using (System.IO.Stream input = fs)
{
GVCalculosSBC.ExportToExcel("Salario");
}
if (Tab.ActiveTab == TabParteFija)
{
GVCFija.ExportToExcel("Salario");
}
if (Tab.ActiveTab == TabParteVariable)
{
GVPV.ExportToExcel("Salario");
}
if (Tab.ActiveTab == TabDetalleParteVariable)
{
GVDetalleParteVariable.ExportToExcel("Salario");
input.CopyTo(memoryStream);
}
memoryStream.Position = 0;
Response.Clear();
Response.Buffer = true;
Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
Response.AddHeader("content-disposition", string.Format("attachment;filename={0}.xlsx", "Salario"));
Response.BinaryWrite(memoryStream.ToArray());
Response.End();
}
public string limpiarcelda( string celdatext)
{
celdatext = celdatext.Replace("<br />", "\r\n").Replace(" ", " ");
while (celdatext.Contains(" ")){
celdatext = celdatext.Replace(" ", " ");
}
celdatext = celdatext.Replace("\n ", " ");
celdatext = celdatext.Replace("\r ", " ");
return celdatext;
}
public DataTable GVToDT(GridView GridView, string NombreArchivoXLSX)
{
DataTable dt = new DataTable(NombreArchivoXLSX);
if (GridView != null && GridView.Rows.Count > 0)
{
int i = 0;
List<int> ArrColumnasVisibles = new List<int>(); // solo recorro las columnas visibles
foreach (TableCell cell in GridView.HeaderRow.Cells)
{
string titulo = HttpUtility.HtmlDecode(Extensiones.ModExtensiones.TextoCelda(cell)).Trim();
titulo = limpiarcelda( titulo);
if (GridView.Columns[i].Visible && titulo.Length > 0)
{
if (dt.Columns.Contains(titulo))
titulo = titulo + i;
dt.Columns.Add(titulo);
ArrColumnasVisibles.Add(i);
}
i += 1;
}
i = 0;
foreach (GridViewRow row in GridView.Rows)
{
dt.Rows.Add();
i = 0;
foreach (int j in ArrColumnasVisibles)
{
dt.Rows[dt.Rows.Count - 1][i] = limpiarcelda(Extensiones.ModExtensiones.TextoCelda(row.Cells[j]).Replace("<br />", "\r\n"));
i = i + 1;
}
}
}
return dt;
}
}

View File

@@ -62,6 +62,9 @@
<li>
<asp:LinkButton ID="LnkExportar" runat="server"><i class="fa fa-file-excel-o" style="margin-right:5px;font-weight:bold"></i>Descargar Excel</asp:LinkButton>
</li>
<li>
<asp:LinkButton ID="LnkCargaMasiva" OnClick="LnkCargaMasiva_Click" runat="server"><i class="fa fa-file-excel-o" style="margin-right:5px;font-weight:bold"></i>Formato saldos iniciales</asp:LinkButton>
</li>
<li>
<asp:HyperLink NavigateUrl="#" data-toggle="modal" data-target="#DivPersonalizar" ID="HyperLink1" runat="server" Style="color: #686868;"><i class="fa fa-pencil" style="color:#686868;margin-left:3px;margin-right:2px"></i>Personalizar</asp:HyperLink>
</li>
@@ -77,6 +80,7 @@
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="LnkDescarPersonalizados" />
<asp:PostBackTrigger ControlID="LnkCargaMasiva" />
</Triggers>
</asp:UpdatePanel>
<li>

View File

@@ -680,4 +680,366 @@ Partial Class RH_CatPersonal
End If
End Sub
Protected Sub LnkCargaMasiva_Click(sender As Object, e As EventArgs)
Dim wb As ClosedXML.Excel.XLWorkbook = New ClosedXML.Excel.XLWorkbook()
Dim libro = wb.AddWorksheet("Personal")
Dim crow As Integer = 1
Dim ccol As Integer = 1
Dim colLugarNacimiento As Integer = 1
Dim rowLugarNacimiento As Integer = 1
#Region "Regimen de contratación"
Dim Catalogos = wb.AddWorksheet("Catalogos")
crow = 1
ccol = 1
Dim colRegimenContratacion As Integer = 1
Dim rowRegimenContratacion As Integer = 1
Catalogos.Cell(crow, ccol).Value = "Regimen de contratación"
For Each row As DataRow In GlobalDTNomSatRegimenContratacion.Rows
crow = crow + 1
Catalogos.Cell(crow, ccol).Value = String.Format("{0}: {1}", row("CveSATRegimenContratacion"), row("RegimenContratacion"))
Next
colRegimenContratacion = ccol
rowRegimenContratacion = crow
#End Region
#Region "Estado civil"
Dim colEstadoCivil As Integer = 1
Dim rowEstadoCivil As Integer = 1
crow = 1
ccol = ccol + 1
Catalogos.Cell(crow, ccol).Value = "Estado civil"
For Each row As DataRow In GlobalDTEstadoCivil.Rows
crow = crow + 1
Catalogos.Cell(crow, ccol).Value = String.Format("{0}: {1}", row("CveEstadoCivil"), row("EstadoCivil"))
Next
colEstadoCivil = ccol
rowEstadoCivil = crow
#End Region
#Region "Escolaridad"
Dim colEscolaridad As Integer = 1
Dim rowEscolaridad As Integer = 1
crow = 1
ccol = ccol + 1
Catalogos.Cell(crow, ccol).Value = "Escolaridad"
For Each row As DataRow In GlobalDTEscolaridad.Rows
crow = crow + 1
Catalogos.Cell(crow, ccol).Value = String.Format("{0}: {1}", row("CveEscolaridad"), row("Escolaridad"))
Next
colEscolaridad = ccol
rowEscolaridad = crow
#End Region
#Region "Tipo Periodo"
Dim colTipoPeriodo As Integer = 1
Dim rowTipoPeriodo As Integer = 1
crow = 1
ccol = ccol + 1
Catalogos.Cell(crow, ccol).Value = "Tipo Periodo"
For Each row As DataRow In GlobalDTTipoPeriodo.Rows
crow = crow + 1
Catalogos.Cell(crow, ccol).Value = String.Format("{0}: {1}", row("CveTipoPeriodo"), row("TipoPeriodo"))
Next
colTipoPeriodo = ccol
rowTipoPeriodo = crow
#End Region
#Region "Estatus"
Dim colEstatusPersonal As Integer = 1
Dim rowEstatusPersonal As Integer = 1
crow = 1
ccol = ccol + 1
Catalogos.Cell(crow, ccol).Value = "Estatus"
For Each row As DataRow In GlobalDTEstatusPersonal.Rows
crow = crow + 1
Catalogos.Cell(crow, ccol).Value = String.Format("{0}: {1}", row("CveEstatusPersonal"), row("EstatusPersonal"))
Next
colEstatusPersonal = ccol
rowEstatusPersonal = crow
#End Region
#Region "Tipo Contratro"
Dim colTipoContrato As Integer = 1
Dim rowTipoContrato As Integer = 1
crow = 1
ccol = ccol + 1
Catalogos.Cell(crow, ccol).Value = "Tipo Contratro"
For Each row As DataRow In GlobalDTTiposContrato.Rows
crow = crow + 1
Catalogos.Cell(crow, ccol).Value = String.Format("{0}", row("TipoContrato"))
Next
colTipoContrato = ccol
rowTipoContrato = crow
#End Region
#Region "Departamento"
Dim colDepartamento As Integer = 1
Dim rowDepartamento As Integer = 1
crow = 1
ccol = ccol + 1
Catalogos.Cell(crow, ccol).Value = "Departamento"
For Each row As DataRow In GlobalDTDepartamentos.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa).Rows
crow = crow + 1
Catalogos.Cell(crow, ccol).Value = String.Format("{0}: {1}", row("CveDepartamento"), row("Departamento"))
Next
colDepartamento = ccol
rowDepartamento = crow
#End Region
#Region "Turno"
Dim colTurno As Integer = 1
Dim rowTurno As Integer = 1
crow = 1
ccol = ccol + 1
Catalogos.Cell(crow, ccol).Value = "Turno"
For Each row As DataRow In GlobalDTTurno.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa).Rows
crow = crow + 1
Catalogos.Cell(crow, ccol).Value = String.Format("{0}: {1}", row("CveTurno"), row("Turno"))
Next
colTurno = ccol
rowTurno = crow
#End Region
#Region "Puesto"
Dim colPuesto As Integer = 1
Dim rowPuesto As Integer = 1
crow = 1
ccol = ccol + 1
Catalogos.Cell(crow, ccol).Value = "Puesto"
For Each row As DataRow In GlobalDTRHPuestos(UsuarioActual.CveEmpresa).Rows
crow = crow + 1
Catalogos.Cell(crow, ccol).Value = String.Format("{0}: {1}", row("CvePuesto"), row("Puesto"))
Next
colPuesto = ccol
rowPuesto = crow
#End Region
#Region "Estado"
Dim colEstado As Integer = 1
Dim rowEstado As Integer = 1
crow = 1
ccol = ccol + 1
Catalogos.Cell(crow, ccol).Value = "Estado"
For Each row As DataRow In GlobalDTGralEstados(1).Rows
crow = crow + 1
Catalogos.Cell(crow, ccol).Value = String.Format("{0}: {1}", row("CveEstado"), row("Estado"))
Next
colEstado = ccol
rowEstado = crow
#End Region
#Region "Tipo salario"
Dim colTipoSalario As Integer = 1
Dim rowTipoSalario As Integer = 1
crow = 1
ccol = ccol + 1
Catalogos.Cell(crow, ccol).Value = "Tipo salario"
crow = crow + 1
Catalogos.Cell(crow, ccol).Value = "1: Salario fijo"
crow = crow + 1
Catalogos.Cell(crow, ccol).Value = "2: Salario variable"
crow = crow + 1
Catalogos.Cell(crow, ccol).Value = "3: Salario mixto"
colTipoSalario = ccol
rowTipoSalario = crow
#End Region
#Region "Genero"
Dim colSexo As Integer = 1
Dim rowSexo As Integer = 1
crow = 1
ccol = ccol + 1
Catalogos.Cell(crow, ccol).Value = "Genero"
crow = crow + 1
Catalogos.Cell(crow, ccol).Value = "1: Masculino"
crow = crow + 1
Catalogos.Cell(crow, ccol).Value = "2: Femenino"
colSexo = ccol
rowSexo = crow
#End Region
#Region "Sindicalizado"
Dim colsindicalizado As Integer = 1
Dim rowsindicalizado As Integer = 1
crow = 1
ccol = ccol + 1
Catalogos.Cell(crow, ccol).Value = "Sindicalizado"
crow = crow + 1
Catalogos.Cell(crow, ccol).Value = "1: Sí"
crow = crow + 1
Catalogos.Cell(crow, ccol).Value = "0: No"
colsindicalizado = ccol
rowsindicalizado = crow
#End Region
#Region "Area geografica"
Dim colAreaGeografica As Integer = 1
Dim rowAreaGeografica As Integer = 1
crow = 1
ccol = ccol + 1
Catalogos.Cell(crow, ccol).Value = "Area geografica"
crow = crow + 1
Catalogos.Cell(crow, ccol).Value = "A"
crow = crow + 1
Catalogos.Cell(crow, ccol).Value = "B"
crow = crow + 1
Catalogos.Cell(crow, ccol).Value = "C"
colAreaGeografica = ccol
rowAreaGeografica = crow
#End Region
#Region "Metodo pago"
Dim colmetodopago = 0
Dim rowmetodopago = 0
crow = 1
ccol = ccol + 1
Catalogos.Cell(crow, ccol).Value = "Metodo pago"
For Each row As DataRow In GlobalDTMetodosPago.Rows
crow = crow + 1
Catalogos.Cell(crow, ccol).Value = String.Format("{0}: {1}", row("CveMetodoPago"), row("MetodoPago"))
Next
colmetodopago = ccol
rowmetodopago = crow
#End Region
#Region "subproyecto"
Dim colsubproyecto = 0
Dim rowsubproyecto = 0
crow = 1
ccol = ccol + 1
Catalogos.Cell(crow, ccol).Value = "subproyecto"
Dim dtsubproyecto = If(Not UsuarioActual.TienePermisoProceso(110), GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, 1), GlobalDTSubProyectos(-1, -1, UsuarioActual.CveEmpresa, 1))
For Each row As DataRow In dtsubproyecto.Rows
crow = crow + 1
Catalogos.Cell(crow, ccol).Value = String.Format("{0}: {1}", row("CveSubProyecto"), row("SubProyecto"))
Next
colsubproyecto = ccol
rowsubproyecto = crow
#End Region
Catalogos.Range(1, 1, 1, ccol).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(79, 129, 189))
Catalogos.Range(1, 1, 1, ccol).Style.Font.FontColor = ClosedXML.Excel.XLColor.White
crow = 1
ccol = 1
libro.Cell(crow, ccol).Value = "Código" : ccol = ccol + 1
libro.Cell(crow, ccol).Value = "Apellido Paterno" : ccol = ccol + 1
libro.Cell(crow, ccol).Value = "Apellido Materno" : ccol = ccol + 1
libro.Cell(crow, ccol).Value = "Nombre" : ccol = ccol + 1
libro.Cell(crow, ccol).Value = "Correo Electronico" : ccol = ccol + 1
libro.Cell(crow, ccol).Value = "Fecha Nacimiento" : ccol = ccol + 1
libro.Cell(crow, ccol).Value = "Sexo" : libro.Range(crow + 1, ccol, 50000, ccol).SetDataValidation().List(Catalogos.Range(2, colSexo, rowSexo, colSexo), True) : ccol = ccol + 1
libro.Cell(crow, ccol).Value = "Lugar Nacimiento" : ccol = ccol + 1
libro.Cell(crow, ccol).Value = "Dirección" : ccol = ccol + 1
libro.Cell(crow, ccol).Value = "Ciudad" : ccol = ccol + 1
libro.Cell(crow, ccol).Value = "Estado Civil" : libro.Range(crow + 1, ccol, 50000, ccol).SetDataValidation().List(Catalogos.Range(2, colEstadoCivil, rowEstadoCivil, colEstadoCivil), True) : ccol = ccol + 1
libro.Cell(crow, ccol).Value = "Teléfono" : ccol = ccol + 1
libro.Cell(crow, ccol).Value = "Celular" : ccol = ccol + 1
libro.Cell(crow, ccol).Value = "RFC" : ccol = ccol + 1
libro.Cell(crow, ccol).Value = "CURP" : ccol = ccol + 1
libro.Cell(crow, ccol).Value = "Numero SS" : ccol = ccol + 1
libro.Cell(crow, ccol).Value = "CLABE" : ccol = ccol + 1
libro.Cell(crow, ccol).Value = "Fecha Ingreso" : ccol = ccol + 1
libro.Cell(crow, ccol).Value = "Fecha Baja" : ccol = ccol + 1
libro.Cell(crow, ccol).Value = "Alta IMSS" : ccol = ccol + 1
libro.Cell(crow, ccol).Value = "Código Postal" : ccol = ccol + 1
libro.Cell(crow, ccol).Value = "Estatus Personal" : libro.Range(crow + 1, ccol, 50000, ccol).SetDataValidation().List(Catalogos.Range(2, colEstatusPersonal, rowEstatusPersonal, colEstatusPersonal), True) : ccol = ccol + 1
libro.Cell(crow, ccol).Value = "Estado" : libro.Range(crow + 1, ccol, 50000, ccol).SetDataValidation().List(Catalogos.Range(2, colEstado, rowEstado, colEstado), True) : ccol = ccol + 1
libro.Cell(crow, ccol).Value = "Nombre Padre" : ccol = ccol + 1
libro.Cell(crow, ccol).Value = "Nombre Madre" : ccol = ccol + 1
libro.Cell(crow, ccol).Value = "Puesto" : libro.Range(crow + 1, ccol, 50000, ccol).SetDataValidation().List(Catalogos.Range(2, colPuesto, rowPuesto, colPuesto), True) : ccol = ccol + 1
libro.Cell(crow, ccol).Value = "Turno" : libro.Range(crow + 1, ccol, 50000, ccol).SetDataValidation().List(Catalogos.Range(2, colTurno, rowTurno, colTurno), True) : ccol = ccol + 1
libro.Cell(crow, ccol).Value = "Tipo Contrato" : libro.Range(crow + 1, ccol, 50000, ccol).SetDataValidation().List(Catalogos.Range(2, colTipoContrato, rowTipoContrato, colTipoContrato), True) : ccol = ccol + 1
libro.Cell(crow, ccol).Value = "Departamento" : libro.Range(crow + 1, ccol, 50000, ccol).SetDataValidation().List(Catalogos.Range(2, colDepartamento, rowDepartamento, colDepartamento), True) : ccol = ccol + 1
libro.Cell(crow, ccol).Value = "Tipo Periodo" : libro.Range(crow + 1, ccol, 50000, ccol).SetDataValidation().List(Catalogos.Range(2, colTipoPeriodo, rowTipoPeriodo, colTipoPeriodo), True) : ccol = ccol + 1
libro.Cell(crow, ccol).Value = "Escolaridad" : libro.Range(crow + 1, ccol, 50000, ccol).SetDataValidation().List(Catalogos.Range(2, colEscolaridad, rowEscolaridad, colEscolaridad), True) : ccol = ccol + 1
libro.Cell(crow, ccol).Value = "Salario Diario" : ccol = ccol + 1
libro.Cell(crow, ccol).Value = "Tipo Salario" : libro.Range(crow + 1, ccol, 50000, ccol).SetDataValidation().List(Catalogos.Range(2, colTipoSalario, rowTipoSalario, colTipoSalario), True) : ccol = ccol + 1
libro.Cell(crow, ccol).Value = "Salario variable" : ccol = ccol + 1
libro.Cell(crow, ccol).Value = "Sindicalizado" : libro.Range(crow + 1, ccol, 50000, ccol).SetDataValidation().List(Catalogos.Range(2, colsindicalizado, rowsindicalizado, colsindicalizado), True) : ccol = ccol + 1
libro.Cell(crow, ccol).Value = "SubProyecto " : libro.Range(crow + 1, ccol, 50000, ccol).SetDataValidation().List(Catalogos.Range(2, colsubproyecto, rowsubproyecto, colsubproyecto), True) : ccol = ccol + 1
libro.Cell(crow, ccol).Value = "RegimenContratacion" : libro.Range(crow + 1, ccol, 50000, ccol).SetDataValidation().List(Catalogos.Range(2, colRegimenContratacion, rowRegimenContratacion, colRegimenContratacion), True) : ccol = ccol + 1
libro.Cell(crow, ccol).Value = "Area Geografica" : libro.Range(crow + 1, ccol, 50000, ccol).SetDataValidation().List(Catalogos.Range(2, colAreaGeografica, rowAreaGeografica, colAreaGeografica), True) : ccol = ccol + 1
libro.Cell(crow, ccol).Value = "Prima vacacional" : ccol = ccol + 1
libro.Cell(crow, ccol).Value = "Dias aguinaldo" : ccol = ccol + 1
libro.Cell(crow, ccol).Value = "Metodo Pago" : libro.Range(crow + 1, ccol, 50000, ccol).SetDataValidation().List(Catalogos.Range(2, colmetodopago, rowmetodopago, colmetodopago), True) : ccol = ccol + 1
libro.Range(crow, 1, crow, ccol - 1).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(79, 129, 189))
libro.Range(crow, 1, crow, ccol - 1).Style.Font.FontColor = ClosedXML.Excel.XLColor.White
Catalogos.ColumnsUsed().AdjustToContents()
libro.ColumnsUsed().AdjustToContents()
'AreaGeografica ABC
'GlobalDTMetodosPago MetodoPago" DataValueField="CveMetodoPago
Dim fs As System.IO.Stream = New System.IO.MemoryStream()
wb.SaveAs(fs)
fs.Position = 0
Dim memoryStream As System.IO.MemoryStream = New System.IO.MemoryStream()
Using input As System.IO.Stream = fs
input.CopyTo(memoryStream)
End Using
memoryStream.Position = 0
Response.Clear()
Response.Buffer = True
Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
Response.AddHeader("content-disposition", String.Format("attachment;filename=SaldosInicialesRH.xlsx", ""))
Response.BinaryWrite(memoryStream.ToArray())
Response.[End]()
'Using nom As ClsNominas = New ClsNominas()
' If nom.ReportedePercepcionesDeduccionesGet(UsuarioActual.CveEmpresa, fechai, fechaf, 4) Then
' Dim dt As DataTable = nom.DTSetResultados.Tables(0)
' Dim libro = wb.AddWorksheet(nom.DTSetResultados.Tables(0), "Percepciones y deducciones")
' libro.Tables.FirstOrDefault().Theme = ClosedXML.Excel.XLTableTheme.None
' Dim crow As Integer = 1
' For Each item As DataRow In dt.Rows
' crow += 1
' Select Case item("Grupoid").ToString()
' Case "10"
' libro.Range(crow, 1, crow, 9).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(184, 204, 228))
' Case "8", "11"
' libro.Range(crow, 1, crow, 9).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(79, 129, 189))
' libro.Range(crow, 1, crow, 11).Style.Font.FontColor = ClosedXML.Excel.XLColor.White
' Case "6"
' libro.Range(crow, 1, crow, 9).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(216, 228, 188))
' Case "5", "7"
' libro.Range(crow, 1, crow, 9).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(155, 187, 89))
' libro.Range(crow, 1, crow, 9).Style.Font.FontColor = ClosedXML.Excel.XLColor.White
' Case "2"
' Case "1", "3"
' libro.Range(crow, 1, crow, 9).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(75, 172, 198))
' libro.Range(crow, 1, crow, 9).Style.Font.FontColor = ClosedXML.Excel.XLColor.White
' End Select
' Next
' libro.Range(2, 4, crow, 9).Style.NumberFormat.Format = "$##,###,###,0.00"
' libro.Range(2, 4, crow, 9).DataType = ClosedXML.Excel.XLDataType.Number
' libro.Column(1).Delete()
' libro.ColumnsUsed().AdjustToContents()
' libro.Row(1).InsertRowsAbove(4)
' libro.Range(1, 2, 1, 6).Merge().Value = UsuarioActual.Empresa.Empresa
' libro.Range(2, 2, 2, 6).Merge().Value = $"Reporte de percepciones y deducciones del {fechai} al {fechaf}"
' libro.Range(1, 2, 2, 6).Style.Font.SetBold(True)
' libro.Range(1, 2, 2, 6).Style.Font.SetFontSize(16)
' libro.Range(2, 2, 2, 6).Style.Font.SetFontSize(14)
' libro.Range(1, 2, 2, 6).Style.Alignment.Horizontal = ClosedXML.Excel.XLAlignmentHorizontalValues.Center
' libro.Range(2, 7, 2, 9).Merge().Value = $"Fecha:{DateTime.Now}"
' libro.Range(3, 7, 3, 9).Merge().Value = $"Hora:{DateTime.Now}"
' End If
'End Using
End Sub
End Class
S

79
RH/DiasFestivos.aspx Normal file
View File

@@ -0,0 +1,79 @@
<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="DiasFestivos.aspx.cs" Inherits="RH_DiasFestivos" %>
<asp:Content ID="Content1" ContentPlaceHolderID="CP" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Css" Runat="Server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="E" Runat="Server">
Catalogo de días festivos
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="HB" Runat="Server">
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="H" Runat="Server">
<li ><asp:LinkButton ID = "LnkAgregarDiasFestivos" OnClick ="LnkAgregarDias_Click" runat = "server" ><i class="fa fa-plus"></i>días festivos</asp:LinkButton></li>
</asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="HA" Runat="Server">
</asp:Content>
<asp:Content ID="Content7" ContentPlaceHolderID="C" Runat="Server">
<asp:UpdatePanel ID="upDatosDias" runat ="server" UpdateMode="Conditional" >
<ContentTemplate>
<asp:GridView ID="GVDiasFestivos" runat="server" GridLines="None" CssClass ="table table-hover table-striped ScrollAD Widthall" AutoGenerateColumns="False"
datakeynames="CveDiainabil,Fecha,CveEmpresa">
<Columns>
<asp:TemplateField HeaderText="Fecha">
<ItemTemplate>
<asp:Label ID="lblfecha" runat="server" Text='<%# Eval("Fecha","{0:dd/MM/yyyy}")%>'> </asp:Label>
</ItemTemplate>
</asp:TemplateField>
<%--<asp:TemplateField ItemStyle-Width="25">
<ItemTemplate>
<asp:LinkButton data-toggle="tooltip" title="Editar" ID="LnkEditar" OnClick="LnkEditarDias_Click" CssClass="btn btn-circle btn-sm green" runat="server" Text="<i class='fa fa-pencil'></i>"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>--%>
<asp:TemplateField ItemStyle-Width="25">
<ItemTemplate>
<asp:LinkButton ID="imgD" runat="server" OnClick="LnkEliminarDias_Click" CssClass="btn btn-circle btn-sm red" Text="<i class='icon-trash'></i>" data-toggle="confirmation" data-popout="true" data-original-title="¿Está seguro que desea eliminar el DiasFestivos?" data-btn-ok-label="si" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
<div id="DModalDiasFestivos" class="modal ADS fade" role="dialog">
<asp:UpdatePanel class="modal-dialog" runat="server" ID="UPModalDias" UpdateMode="Conditional">
<ContentTemplate>
<div class="modal-content" >
<div class="modal-header ">
<h4 class="modal-title"><asp:Literal ID="ltlDiastitulo" runat="server"> </asp:Literal></h4>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-4 truncate ">Fecha</div>
<div class="col-md-8">
<div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="width: 120px !important; padding: 0px; ">
<asp:TextBox ID="TxtDiasfecha" CssClass="form-control input-sm ADSMaskDate" Style="width: 118px" runat="server"></asp:TextBox>
<span class="input-group-btn "> <asp:LinkButton ID="LnkDiasfecha" class="btn default " Text=" <i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton> </span>
</div>
<ajax:MaskedEditExtender ID="MEEDiasfecha" runat="server" TargetControlID="TxtDiasfecha" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
<ajax:CalendarExtender runat="server" ID="CEEDiasfecha" TargetControlID="TxtDiasfecha" PopupButtonID="LnkDiasfecha" PopupPosition="BottomRight" Enabled="True" Format="dd/MM/yyyy"></ajax:CalendarExtender>
<asp:RequiredFieldValidator ID="RfvDiasfecha" runat="server" ControlToValidate="TxtDiasfecha" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Fecha''</b> es necesario, por favor ingréselo." ValidationGroup="VGMDias"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VcoDiasfecha" runat="server" HighlightCssClass="vco" TargetControlID="RfvDiasfecha"></ajax:ValidatorCalloutExtender>
</div>
</div>
</div>
<div class="modal-footer ">
<div class="modal-btn">
<asp:Button ID="BtnDiasADD" OnClick="BtnDiasADD_Click" runat="server" Text="Agregar" CssClass="btn btn-primary" ValidationGroup="VGMDias" />
<%--<asp:Button ID="BtnDiasEdit" OnClick="BtnDiasEdit_Click" runat="server" Text="Actualizar" CssClass="btn btn-primary" ValidationGroup="VGMDias" ></asp:Button>--%>
<button type="button" class="btn btn-danger" data-dismiss="modal">Cancelar</button>
</div>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</asp:Content>
<asp:Content ID="Content8" ContentPlaceHolderID="JS" Runat="Server">
</asp:Content>

74
RH/DiasFestivos.aspx.cs Normal file
View File

@@ -0,0 +1,74 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Extensiones;
public partial class RH_DiasFestivos : ClsPaginas
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
CargaDiasFestivos();
}
}
protected void CargaDiasFestivos()
{
ClsRH ObjDias = new ClsRH();
ObjDias.DiasFestivosGet(UsuarioActual.CveEmpresa );
GVDiasFestivos.DataSource = ObjDias.DtResultados;
ObjDias.Dispose();
GVDiasFestivos.DataBind();
upDatosDias.Update();
}
protected void LimpiaDiasFestivos()
{
TxtDiasfecha.Text = "";
UPModalDias.Update();
}
protected void LnkAgregarDias_Click(object sender, EventArgs e)
{
this.RegistraScript("$('#DModalDiasFestivos').modal();");
LimpiaDiasFestivos();
BtnDiasADD.Visible = true;
UPModalDias.Update();
}
protected void BtnDiasADD_Click(object sender, EventArgs e)
{
DateTime fecha = TxtDiasfecha.Text.ToDate();
ClsRH ObjDias = new ClsRH();
bool Continuar = ObjDias.DiasFestivosAdd(fecha, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario);
ObjDias.Dispose();
if (Continuar)
{
this.RegistraScript("$('#DModalDiasFestivos').modal('hide');");
LimpiaDiasFestivos();
CargaDiasFestivos();
UPModalDias.Update();
this.Alert("El dìa festivos se ha agregado");
}
}
protected void LnkEliminarDias_Click(object sender, EventArgs e)
{
GridViewRow gvRow = (GridViewRow)(((LinkButton)sender).NamingContainer);
DateTime fecha = gvRow.DataKey("CveDiainabil").ToDateTime();
ClsRH ObjDias = new ClsRH();
bool Continuar = ObjDias.DiasFestivosRemove(fecha, UsuarioActual.CveEmpresa);
ObjDias.Dispose();
if (Continuar)
{
CargaDiasFestivos();
this.Alert("El dìa festivos se ha Eliminado");
}
}
}