This commit is contained in:
JORGE LUIS CAUDILLO ESPARZA
2021-04-16 09:49:45 -07:00
parent 9f89a3ba31
commit c31724b338
7 changed files with 332 additions and 34 deletions

View File

@@ -181,6 +181,7 @@ public partial class Nomina_Nomina2 : ClsPaginas
{
if (!IsPostBack)
{
TxtPeriodo.Text = $"{DateTime.Now :yyyyMM}";
CargarCentrosDeCosto(DdlProyecto, null, LblProyecto, LblSubProyeccto);
cargaEjercicios();
CargaTiposPeriodo();
@@ -390,6 +391,8 @@ public partial class Nomina_Nomina2 : ClsPaginas
UpAccciones.Update();
}
LnkListaRaya.Visible = true;
LnkAsistenciaIncidencias.Visible = true;
LnkFormatoTabular.Visible = true;
HypPDFSTimbrados.Visible = true;
if (objnom.GetNominaEmpleado(FiltCveProyecto, FiltCveSubProyecto, FiltCveTurno, FiltCvePeriodo, CveEmpresa, FiltAgrupador, DdlRegimenContratacion.SelectedValue.ToEntero()) && objnom.DTSetResultados.Tables.Count > 1)
@@ -5678,5 +5681,102 @@ public partial class Nomina_Nomina2 : ClsPaginas
}
}
protected void LnkAsistenciaIncidencias_Click(object sender, EventArgs e)
{
RegistraScript("$('#DmodalReporteInicidencia').modal()");
}
protected void LnkProcesarReporteIncidencia_Click(object sender, EventArgs e)
{
DateTime fechai = TxtRIFechaInicio.Text.ToDateTime();
DateTime fechaf = TxtRIFechaFin.Text.ToDateTime();
ClosedXML.Excel.XLWorkbook wb = new ClosedXML.Excel.XLWorkbook();
using (ClsNominas nom = new ClsNominas())
{
if (nom.ReportedeincidenciasGET(UsuarioActual.CveEmpresa, fechai, fechaf, 4))
{
var libro = wb.AddWorksheet(nom.DTSetResultados.Tables[2], "Incidencias");
libro.ColumnsUsed().AdjustToContents();
var libroin = wb.AddWorksheet(nom.DTSetResultados.Tables[1], "Descripción incidencias");
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 incidencias";
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}";
//ws.Row(1).InsertRowsAbove(1);
}
}
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)
{
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=incidencias del al{0}.xlsx", ""));
Response.BinaryWrite(memoryStream.ToArray());
Response.End();
}
protected void LnkProcesarReporteAcumulados_Click(object sender, EventArgs e)
{
DateTime fechai = TxtRIFechaInicio.Text.ToDateTime();
DateTime fechaf = TxtRIFechaFin.Text.ToDateTime();
ClosedXML.Excel.XLWorkbook wb = new ClosedXML.Excel.XLWorkbook();
using (ClsNominas nom = new ClsNominas())
{
if (nom.ReportedeAcumuladosGET(UsuarioActual.CveEmpresa, TxtPeriodo.Text.ToEntero(), 4))
{
var libro = wb.AddWorksheet(nom.DTSetResultados.Tables[0], "Acumulados");
libro.ColumnsUsed().AdjustToContents();
//ws.Row(1).InsertRowsAbove(1);
}
}
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)
{
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=Acumulados.xlsx", ""));
Response.BinaryWrite(memoryStream.ToArray());
Response.End();
}
protected void LnkReporteAcumulados_Click(object sender, EventArgs e)
{
RegistraScript("$('#DmodalReporteAcumulados').modal()");
}
}