This commit is contained in:
@@ -8062,6 +8062,146 @@ public partial class Nomina_Nomina2 : ClsPaginas
|
||||
{
|
||||
RegistraScript("$('#DmodalReportePercepcionesdeducciones').modal()");
|
||||
}
|
||||
protected void LnkProcesarReporteIncidenciaTabular_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.GetPeriodos(-1,UsuarioActual.CveEmpresa,-1,-1, DdlPeriodo.SelectedValue.ToEntero(),-1) && (nom.DtResultados.Rows.Count>0))
|
||||
{
|
||||
fechai = nom.DtResultados.Rows[0]["FechaInicio"].ToString().ToDateTime();
|
||||
fechaf = nom.DtResultados.Rows[0]["FechaFin"].ToString().ToDateTime();
|
||||
}
|
||||
|
||||
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");
|
||||
libroin.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 {0:dd-MM-yyyy} al {1:dd-MM-yyyy}.xlsx", fechai, fechaf));
|
||||
Response.BinaryWrite(memoryStream.ToArray());
|
||||
Response.End();
|
||||
}
|
||||
|
||||
//
|
||||
protected void LnkshowProsesarASistencia_Click(object sender, EventArgs e)
|
||||
{
|
||||
RegistraScript("$('#DModalAsistenciaTabular').modal()");
|
||||
}
|
||||
protected void LnkProcesarAsistenciaTabular_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
|
||||
int chkImporteValor = 1;
|
||||
int chkImporte = 1;
|
||||
int chkImporteGravado = 0;
|
||||
List<Archivo> Filesgral = TxtArchivoNomina.getfiles().Archivos;
|
||||
bool continuar = Filesgral.Count > 0;
|
||||
string stringError = "";
|
||||
Archivo fileItem = continuar ? Filesgral[0] : null;
|
||||
if (continuar)
|
||||
{
|
||||
string FileExtension = fileItem.Extension.ToUpper();
|
||||
if (FileExtension == "XLS" | FileExtension == "XLSX" | FileExtension == "CSV")
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
continuar = false;
|
||||
stringError = "No se inserto un archivo de tipo Excel";
|
||||
}
|
||||
|
||||
}
|
||||
if (!(CvePeriodoSeleccionado >= 0))
|
||||
{
|
||||
continuar = false;
|
||||
stringError = "debe cargar el periodo a actualizar";
|
||||
|
||||
}
|
||||
|
||||
DataTable DTEXcel = new DataTable();
|
||||
if (continuar)
|
||||
{
|
||||
try
|
||||
{
|
||||
DataTable dtxz = Extensiones.ModExtensiones.ReadExcelFile(fileItem.FileUrl, true,4);
|
||||
DTEXcel = dtxz.FiltraParametros(" LEN(Codigo)>0 AND Codigo <> 'Codigo'");
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
continuar = false;
|
||||
stringError = "Ocurrio un Error al procesar el excel ";
|
||||
string.Format("{0} \r\n{0}", stringError, ex.ToString()).GuardaLog();
|
||||
}
|
||||
}
|
||||
if (continuar && DTEXcel.Rows.Count == 0)
|
||||
{
|
||||
|
||||
continuar = false;
|
||||
stringError = "No se encontraron cambios";
|
||||
}
|
||||
if(continuar)
|
||||
{
|
||||
|
||||
for (int j = 2; j < DTEXcel.Rows.Count; j++)
|
||||
{
|
||||
for (int i = 1; i < DTEXcel.Columns.Count; i++)
|
||||
{
|
||||
/*
|
||||
//
|
||||
string conceptocodigo = drowx[i].ToString(); string CveConcepto;
|
||||
DataRow dconr = dtConceptos.FiltroPrimero(string.Format("codigo='{0}'", conceptocodigo));
|
||||
if (dconr != null)
|
||||
{
|
||||
CveConcepto = dconr["CveConcepto"].ToString();
|
||||
dtxz.Columns[i].ColumnName = CveConcepto;
|
||||
}
|
||||
else
|
||||
{
|
||||
continuar = false;
|
||||
stringError = string.Format("Ocurrio un Error al procesar el excel código no valido '{0}'({1}).", conceptocodigo, i);
|
||||
break;
|
||||
}*/
|
||||
//int CveConcepto = dtxz.Columns[i].ColumnName.ToEntero();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void LnkProcesarReporteIncidencia_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
@@ -8876,4 +9016,5 @@ public partial class Nomina_Nomina2 : ClsPaginas
|
||||
UpviewCorreos.Update();
|
||||
RegistraScript(string.Format("$('#ModalViewCorreo').modal();", TxtmcImporte.ClientID));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user