diff --git a/Nomina/ChecadorAsistencia.aspx.cs b/Nomina/ChecadorAsistencia.aspx.cs
index ca9af647e..afcd74f96 100644
--- a/Nomina/ChecadorAsistencia.aspx.cs
+++ b/Nomina/ChecadorAsistencia.aspx.cs
@@ -23,6 +23,10 @@ public partial class Nomina_ChecadorAsistencia : ClsPaginas
{
if (!IsPostBack)
{
+
+ DdlTurno.DataSource = GlobalDTTurno.FiltraParametros("CveEmpresa = " + UsuarioActual.CveEmpresa);
+ DdlTurno.DataBind();
+
CargaTiposPeriodo();
TxtRpdFechaInicio.Text = "01/09/2021";
TxtRpdFechaFin.Text = "15/09/2021";
@@ -66,6 +70,20 @@ public partial class Nomina_ChecadorAsistencia : ClsPaginas
DataTable dtCon = new DataTable();
dtCon.Columns.Add(new DataColumn("Codigo", typeof(string)));
dtCon.Columns.Add(new DataColumn("Empleado", typeof(string)));
+ string strasis = "
";
+ string strdescanso = "
";
+ string strretardo = "
";
+ string strfaltaretardo = "
";
+ string strfalta = "
❌
";
+
+ if (salto == "\r\n")
+ {
+ strasis = "✅";
+ strdescanso = "🌣";
+ strretardo = "🕖";
+ strfaltaretardo = "❌";
+ strfalta = "--";
+ }
DateTime CFecha = FechaI;
while (FechaF > CFecha)
{
@@ -90,7 +108,7 @@ public partial class Nomina_ChecadorAsistencia : ClsPaginas
{
int Fecha = string.Format("{0:yyyyMMdd}", CFecha).ToEntero();
string FechaCol = string.Format("{0:dd-MM-yyyy}", CFecha);
- if (UsuarioActual.CveEmpresa == 119)
+ if (DdlTipoVista.SelectedValue == "2")
{
DataTable Dtb = objnom.DTSetResultados.Tables[4];
StringBuilder str = new StringBuilder();
@@ -109,7 +127,7 @@ public partial class Nomina_ChecadorAsistencia : ClsPaginas
}
else
{
- string TipoAsis = "(Faltó)";
+ string TipoAsis = "--";
DataRow drfec = dtASis.FiltroPrimero(string.Format("CvePersonal={0} AND Agrupador ={1}", item["CvePersonal"], Fecha), "Salida");
if (drfec != null)
{
@@ -129,22 +147,22 @@ public partial class Nomina_ChecadorAsistencia : ClsPaginas
switch (drf["Tipo"].ToString().ToEntero())
{
case 1:
- asistencia2 = "
";
+ asistencia2 = strasis;
break;
case 2:
- asistencia2 = "
";
+ asistencia2 = strretardo;
break;
case 3:
- asistencia2 = "
";
+ asistencia2 = strretardo;
break;
case 4:
- asistencia2 = "
";
+ asistencia2 = strfaltaretardo;
break;
case 5:
- asistencia2 = "
";
+ asistencia2 = strfaltaretardo;
break;
case 6:
- asistencia2 = "
❌
";
+ asistencia2 = strfalta;
break;
default:
@@ -157,43 +175,58 @@ public partial class Nomina_ChecadorAsistencia : ClsPaginas
switch (drfec["Tipo"].ToString().ToEntero())
{
case 1:
- asistencia = "
";
+ asistencia = strasis;
break;
case 2:
- asistencia = "
";
+ asistencia = strretardo;
break;
case 3:
- asistencia = "
";
+ asistencia = strretardo;
break;
case 4:
- asistencia = "
";
+ asistencia = strfaltaretardo;
break;
case 5:
- asistencia = "
";
+ asistencia = strfaltaretardo;
break;
case 6:
- asistencia = "
❌
";
+ asistencia = strfalta;
break;
default:
break;
}
- drow[FechaCol] = string.Format("
{0}
{1}{2}
{3}
{4}{5}
", asistencia, drfec["Horas"], HoraExtraPorAutorizar, asistencia2, Horas2, HoraExtraPorAutorizar2);
+ if (salto == "\r\n")
+ {
+ drow[FechaCol] = string.Format("{0}{1}", asistencia, asistencia2, salto);
+ //drow[FechaCol] = string.Format("{0}{6}{1}{2}{3}{6}{4}{5}", asistencia, drfec["Horas"], HoraExtraPorAutorizar, asistencia2, Horas2, HoraExtraPorAutorizar2, salto);
+ }
+ else
+ {
+ drow[FechaCol] = string.Format("
{0}{6}{1}{2}
{3}{6}{4}{5}
", asistencia, drfec["Horas"], HoraExtraPorAutorizar, asistencia2, Horas2, HoraExtraPorAutorizar2, salto);
+ }
//drow[FechaCol] = string.Format("{0}
{1:HH}:{1:mm} - {2:HH}:{2:mm}", asistencia, drfec["Entrada"], drfec["Salida"]);
}
else
{
if (CFecha.DayOfWeek == DayOfWeek.Sunday)
{
- drow[FechaCol] = "
";
+ drow[FechaCol] = strdescanso;
TipoAsis = "(Descanso)";
}
else
{
- drow[FechaCol] = "
❌
";
+ drow[FechaCol] = salto; // "
❌
";
}
}
- drow[FechaCol] = string.Format("
{0}
{1}
", drow[FechaCol], TipoAsis, FechaCol, item["CvePersonal"]);
+ if (salto == "\r\n")
+ {
+ drow[FechaCol] = string.Format("{0}{4}{1}", drow[FechaCol], TipoAsis, FechaCol, item["CvePersonal"], salto);
+ }
+ else
+ {
+ drow[FechaCol] = string.Format("
{0}{4}{1}
", drow[FechaCol], TipoAsis, FechaCol, item["CvePersonal"], salto);
+ }
//dtCon.Columns.Add(new DataColumn(FechaCol, typeof(string)));Widthall
@@ -275,6 +308,7 @@ public partial class Nomina_ChecadorAsistencia : ClsPaginas
{
TxtCodigolabel.Text = drow["Codigo"].ToString();
TxtEmpleadolabel.Text = drow["NombreCompleto"].ToString();
+ DdlTurno.SelectedValueExist(drow["CveTurno"].ToString());
}
TxtFechalabel.Text = string.Format("{0:dd/MM/yyyy}", fechai);
DataTable dtTurno = GlobalDTTurno.FiltraParametros(string.Format("CveEmpresa = {0}", UsuarioActual.CveEmpresa));
@@ -407,9 +441,16 @@ public partial class Nomina_ChecadorAsistencia : ClsPaginas
DateTime fecha = TxtFecha.Text.ToDateTime();
int CvePersonal = TxtCvePersonal.Text.ToEntero();
List
registros = new List();
+ int CveTurnoNEW = DdlTurno.SelectedValue.ToEntero();
+ using (ClsClaseBase objbase = new ClsClaseBase())
+ {
+ objbase.runQuerystr(string.Format("UPDATE RH_Personal SET CveTurno={1} WHERE CvePersonal ={0}", CvePersonal, CveTurnoNEW));
+
+ }
foreach (GridViewRow row in GvAsistenciaUp.Rows)
{
-
+ int CveTurno = row.DataKey("CveTurno").ToEntero();
+ string Fecha = row.DataKey("Fecha");
int CveAsistenciaDetalle = row.DataKey("CveAsistenciaDetalle").ToEntero();
int CveAsistenciasInasistencias = row.DataKey("CveAsistenciasInasistencias").ToEntero();
int CveProyecto = row.DataKey("CveProyecto").ToEntero();
@@ -425,6 +466,15 @@ public partial class Nomina_ChecadorAsistencia : ClsPaginas
obj.CvePersonal = CvePersonal;
obj.Fecha = fecha;
obj.Motivo = TxtMotivo.Text.Trim();
+ if (CveTurno != CveTurnoNEW)
+ {
+ using (ClsClaseBase objbase = new ClsClaseBase())
+ {
+ objbase.runQuerystr(string.Format("UPDATE RH_PersonalAsistenciasDetalle SET CveTurno={1} WHERE CveAsistenciaDetalle ={0}", CveAsistenciaDetalle, CveTurnoNEW));
+ objbase.runQuerystr(string.Format("UPDATE D SET CveTurno={1} FROM RH_PersonalAsistencias A INNER JOIN RH_PersonalAsistenciasDetalle D ON D.CveAsistencia =A.CveAsistencia AND D.CveTurno = {2} WHERE A.Fecha > '{0}' AND A.CvePersonal ={3}", Fecha, CveTurnoNEW, CveTurno, CvePersonal));
+
+ }
+ }
if (obj.Motivo.Length == 0 && CveAsistenciasInasistencias != obj.CveAsistenciasInasistencias)
{
continuar = false;
@@ -468,6 +518,76 @@ public partial class Nomina_ChecadorAsistencia : ClsPaginas
{
DataTable dtCon = generateTable("\r\n");
- dtCon.ExportToExcel("Formato");
+
+
+ ClosedXML.Excel.XLWorkbook wb = new ClosedXML.Excel.XLWorkbook();
+ var libro = wb.AddWorksheet(dtCon, "Asistencia");
+
+ //string strinicio;
+ //string strfin;
+ //ClosedXML.Excel.IXLFontBase fini;
+ //for (int r = 2; r < dtCon.Rows.Count + 2; r++)
+ //{
+ // for (int c = 3; c < dtCon.Columns.Count + 1; c++)
+ // {
+ // var ccell = libro.Cell(r, c);
+
+ // if (ccell.Value.ToString().Substring(0, 1) != "")
+ // {
+ // //ccell.RichText.Substring(0, 1).SetFontColor(ClosedXML.Excel.XLColor.Green);
+ // strinicio = ccell.Value.ToString().Substring(0, 1);
+ // switch (strinicio)
+ // {
+ // case "✅":
+ // //ccell.RichText.Substring(0, 1).SetFontColor(ClosedXML.Excel.XLColor.Green);
+ // //ccell.RichText.AddText(ccell.RichText);
+ // //ClosedXML.Excel.IXLFontBase ffin = new ClosedXML.Excel.XLFontBase();
+ // ccell.RichText.SetFontColor(ClosedXML.Excel.XLColor.Green);
+ // break;
+ // case "🌣":
+ // //ccell.RichText.Substring(0, 1).SetFontColor(ClosedXML.Excel.XLColor.Green);
+ // ccell.RichText.SetFontColor(ClosedXML.Excel.XLColor.Green);
+ // break;
+ // case "🕖":
+ // //ccell.RichText.Substring(0, 1).SetFontColor(ClosedXML.Excel.XLColor.Orange);
+ // ccell.RichText.SetFontColor(ClosedXML.Excel.XLColor.Orange);
+ // break;
+ // case "❌":
+ // //ccell.RichText.Substring(0, 1).SetFontColor(ClosedXML.Excel.XLColor.Red);
+ // ccell.RichText.SetFontColor(ClosedXML.Excel.XLColor.Red);
+ // break;
+ // default:
+ // break;
+ // }
+ // }
+ // }
+
+ //}
+
+ libro.Tables.FirstOrDefault().ShowAutoFilter = false;
+ libro.SheetView.Freeze(1, 2);
+ libro.ColumnsUsed().AdjustToContents();
+ libro.Range(1, 3, dtCon.Rows.Count, dtCon.Columns.Count).Style.Alignment.Horizontal = ClosedXML.Excel.XLAlignmentHorizontalValues.Center;
+
+
+
+ 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={0} del {1} al {2}.xlsx", "Asistencia", TxtRpdFechaInicio.Text.Replace("/", "-"), TxtRpdFechaFin.Text.Replace("/", "-")));
+ Response.BinaryWrite(memoryStream.ToArray());
+ Response.End();
}
}
\ No newline at end of file
diff --git a/Nomina/Finiquito.aspx b/Nomina/Finiquito.aspx
index ee03668bd..fe6c4da19 100644
--- a/Nomina/Finiquito.aspx
+++ b/Nomina/Finiquito.aspx
@@ -147,6 +147,19 @@