This commit is contained in:
@@ -151,22 +151,33 @@ public partial class Nomina_Nomina2 : ClsPaginas
|
||||
}
|
||||
}
|
||||
DdlEjercicios.DataSource = dtejercicio;
|
||||
DdlEjerciciosCM.DataSource = dtejercicio;
|
||||
DdlEjercicios.DataBind();
|
||||
DdlEjerciciosCM.DataBind();
|
||||
ListItem litem = null;
|
||||
if ((dtejercicio != null) && dtejercicio.Rows.Count > 0)
|
||||
{
|
||||
if (dtejercicio.COUNT("Ejercicio", string.Format("Ejercicio={0}", EjercicioActual)) == 0)
|
||||
{
|
||||
DdlEjercicios.Items.Insert(0, new ListItem(EjercicioActual.ToString(), EjercicioActual.ToString()));
|
||||
litem = new ListItem(EjercicioActual.ToString(), EjercicioActual.ToString());
|
||||
DdlEjercicios.Items.Insert(0, litem);
|
||||
DdlEjerciciosCM.Items.Insert(0, litem);
|
||||
}
|
||||
if (dtejercicio.COUNT("Ejercicio", string.Format("Ejercicio={0}", (EjercicioActual - 1))) == 0)
|
||||
{
|
||||
DdlEjercicios.Items.Insert(1, new ListItem((EjercicioActual - 1).ToString(), (EjercicioActual - 1).ToString()));
|
||||
litem = new ListItem((EjercicioActual - 1).ToString(), (EjercicioActual - 1).ToString());
|
||||
DdlEjercicios.Items.Insert(1, litem);
|
||||
DdlEjerciciosCM.Items.Insert(1, litem);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DdlEjercicios.Items.Add(new ListItem(EjercicioActual.ToString(), EjercicioActual.ToString()));
|
||||
DdlEjercicios.Items.Add(new ListItem((EjercicioActual - 1).ToString(), (EjercicioActual - 1).ToString()));
|
||||
litem = new ListItem(EjercicioActual.ToString(), EjercicioActual.ToString());
|
||||
DdlEjercicios.Items.Insert(0, litem);
|
||||
DdlEjerciciosCM.Items.Insert(0, litem);
|
||||
litem = new ListItem((EjercicioActual - 1).ToString(), (EjercicioActual - 1).ToString());
|
||||
DdlEjercicios.Items.Insert(0, litem);
|
||||
DdlEjerciciosCM.Items.Insert(0, litem);
|
||||
|
||||
}
|
||||
if (DdlEjercicios.Items.Count > 0)
|
||||
@@ -177,6 +188,8 @@ public partial class Nomina_Nomina2 : ClsPaginas
|
||||
private void CargaTiposPeriodo()
|
||||
{
|
||||
DdlTipoPeriodo.DataSource = GlobalDTTipoPeriodo.FiltraParametros("Estatus = 'Activo'");
|
||||
DdlTipoPeriodoCM.DataSource = DdlTipoPeriodo.DataSource;
|
||||
DdlTipoPeriodoCM.DataBind();
|
||||
DdlTipoPeriodo.DataBind();
|
||||
DdlTipoPeriodo.Items.Insert(0, new ListItem("Seleccione", "-1"));
|
||||
if (DdlTipoPeriodo.Items.Count > 0)
|
||||
@@ -700,37 +713,38 @@ public partial class Nomina_Nomina2 : ClsPaginas
|
||||
{
|
||||
try
|
||||
{
|
||||
using (System.Data.Odbc.OdbcConnection conn = new System.Data.Odbc.OdbcConnection("Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};DBQ=" + fileItem.FileUrl))
|
||||
{
|
||||
conn.Open();
|
||||
string exceltableName = "Nomina";
|
||||
DataTable tables = conn.GetSchema("Tables");
|
||||
if (tables.FiltraParametros(string.Format("TABLE_NAME LIKE'%{0}%'", exceltableName)).Rows.Count == 0)
|
||||
{
|
||||
continuar = false;
|
||||
stringError = "El documento no contiene la hoja nomina";
|
||||
//using (System.Data.Odbc.OdbcConnection conn = new System.Data.Odbc.OdbcConnection("Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};DBQ=" + fileItem.FileUrl))
|
||||
//{
|
||||
// conn.Open();
|
||||
// string exceltableName = "Nomina";
|
||||
// DataTable tables = conn.GeaaffotSchema("Tables");
|
||||
// if (tables.FiltraParametros(string.Format("TABLE_NAME LIKE'%{0}%'", exceltableName)).Rows.Count == 0)
|
||||
// {
|
||||
// continuar = false;
|
||||
// stringError = "El documento no contiene la hoja nomina";
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
|
||||
exceltableName = tables.FiltroPrimero(string.Format("TABLE_NAME LIKE'%{0}%'", exceltableName))["TABLE_NAME"].ToString();
|
||||
}
|
||||
if (continuar)
|
||||
{
|
||||
using (System.Data.Odbc.OdbcCommand cmd = conn.CreateCommand())
|
||||
{
|
||||
// exceltableName = tables.FiltroPrimero(string.Format("TABLE_NAME LIKE'%{0}%'", exceltableName))["TABLE_NAME"].ToString();
|
||||
// }
|
||||
// if (continuar)
|
||||
// {
|
||||
// using (System.Data.Odbc.OdbcCommand cmd = conn.CreateCommand())
|
||||
// {
|
||||
|
||||
cmd.CommandType = CommandType.Text;
|
||||
cmd.CommandText = $"SELECT * FROM [{exceltableName}] WHERE LEN(Codigo)>0 AND Codigo <> 'Codigo'";
|
||||
using (System.Data.Odbc.OdbcDataAdapter da = new System.Data.Odbc.OdbcDataAdapter(cmd))
|
||||
{
|
||||
da.Fill(DTEXcel);
|
||||
// cmd.CommandType = CommandType.Text;
|
||||
// cmd.CommandText = $"SELECT * FROM [{exceltableName}] WHERE LEN(Codigo)>0 AND Codigo <> 'Codigo'";
|
||||
// using (System.Data.Odbc.OdbcDataAdapter da = new System.Data.Odbc.OdbcDataAdapter(cmd))
|
||||
// {
|
||||
// da.Fill(DTEXcel);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
DTEXcel = Extensiones.ModExtensiones.ReadExcelFile(fileItem.FileUrl, true).FiltraParametros(" LEN(Codigo)>0 AND Codigo <> 'Codigo'");
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -738,7 +752,7 @@ public partial class Nomina_Nomina2 : ClsPaginas
|
||||
|
||||
continuar = false;
|
||||
stringError = "Ocurrio un Error al procesar el excel ";
|
||||
string.Format(stringError, ex.ToString()).GuardaLog();
|
||||
string.Format("{0} \r\n{0}", stringError, ex.ToString()).GuardaLog();
|
||||
}
|
||||
}
|
||||
if (continuar && DTEXcel.Rows.Count == 0)
|
||||
@@ -795,7 +809,7 @@ public partial class Nomina_Nomina2 : ClsPaginas
|
||||
else
|
||||
{
|
||||
if (objNomina.AddNom_Nominas(-1, 1, CvePersonal, CvePeriodoSeleccionado, SubTotal, 0, 0, Total, CveMoneda, 1, CveMetodoPago, DateTime.Now, "Deducciones nómina",
|
||||
"", "", "", "", 0, 0, 0, new DateTime(), new DateTime(), new DateTime(), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa))
|
||||
"", "", "", "", 0, 0, 0, new DateTime(), new DateTime(), new DateTime(), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, false))
|
||||
{
|
||||
CveNomina = objNomina.CveNomina;
|
||||
}
|
||||
@@ -859,6 +873,7 @@ public partial class Nomina_Nomina2 : ClsPaginas
|
||||
if (rollback)
|
||||
{
|
||||
objpersonal.RollBack();
|
||||
continuar = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -972,7 +987,7 @@ public partial class Nomina_Nomina2 : ClsPaginas
|
||||
LblDiasLaborados.Text = DiasLaborados;
|
||||
LblDiasFaltados.Text = DiasFaltados;
|
||||
LblDiasVacaciones.Text = DiasVacaciones;
|
||||
LblFecha.Text = string.Format("{0} al {1}",FechaInicio, FechaFin);
|
||||
LblFecha.Text = string.Format("{0} al {1}", FechaInicio, FechaFin);
|
||||
LblDiasRetardos.Text = DiasRetardos;
|
||||
LblDiasIncapacidad.Text = DiasIncapacidad;
|
||||
#endregion
|
||||
@@ -3193,11 +3208,6 @@ public partial class Nomina_Nomina2 : ClsPaginas
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if (continuar)
|
||||
{
|
||||
dtconp = dtempleadosConceptos.FiltraParametros(string.Format("CvePersonal={0}", CvePersonal));
|
||||
@@ -3205,8 +3215,8 @@ public partial class Nomina_Nomina2 : ClsPaginas
|
||||
{
|
||||
|
||||
CveConcepto = rcon["CveConcepto"].ToString().ToEntero();
|
||||
ImporteConcepto = rcon["ImporteConcepto"].ToString().ToDecimal();
|
||||
ImporteGravadoConcepto = rcon["ImporteGravadoConcepto"].ToString().ToDecimal();
|
||||
ImporteConcepto = rcon["Importe"].ToString().ToDecimal();
|
||||
ImporteGravadoConcepto = rcon["ImporteGravado"].ToString().ToDecimal();
|
||||
ImporteExentoConcepto = ImporteConcepto - ImporteGravadoConcepto;
|
||||
if (continuar)
|
||||
{
|
||||
@@ -3221,6 +3231,14 @@ public partial class Nomina_Nomina2 : ClsPaginas
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (continuar)
|
||||
{
|
||||
continuar = objNomina.AutorizaNom_Nominas(-1, CvePeriodoSeleccionado, true);
|
||||
}
|
||||
|
||||
if (continuar)
|
||||
{
|
||||
objNomina.Commit();
|
||||
@@ -3235,4 +3253,69 @@ public partial class Nomina_Nomina2 : ClsPaginas
|
||||
dtconp.Dispose();
|
||||
Alert("Termine");
|
||||
}
|
||||
|
||||
protected void LnkCargaAsistenciaMasiva_Click(object sender, EventArgs e)
|
||||
{
|
||||
RegistraScript("$('#DModalCargaASistenciaMasiva').modal();");
|
||||
}
|
||||
|
||||
protected void LnkCargarAsistenciaMasiva_Click(object sender, EventArgs e)
|
||||
{
|
||||
using (ClsRH ObjPersonal = new ClsRH())
|
||||
{
|
||||
ObjPersonal.IniciaTransacSQL();
|
||||
bool OcurrioError = false;
|
||||
|
||||
if (!ObjPersonal.AddAsistenciaMasiva2(DdlPeriodoCM.SelectedValue.ToEntero(), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa))
|
||||
OcurrioError = true;
|
||||
|
||||
if (OcurrioError)
|
||||
{
|
||||
ObjPersonal.RollBack();
|
||||
Alert("Ocurrió un error al guardar las Asistencias.", ModExtensiones.TipoMensaje.MsgError);
|
||||
}
|
||||
else
|
||||
{
|
||||
ObjPersonal.Commit();
|
||||
Alert("Las Asistencias se guardaron correctamente.", ModExtensiones.TipoMensaje.ToastInformacion);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void cargaPeriodosCM()
|
||||
{
|
||||
int tipoPeriodo = DdlTipoPeriodoCM.SelectedValue.ToEntero();
|
||||
int ejercicio = DdlEjerciciosCM.SelectedValue.ToEntero();
|
||||
DataTable dtPeriodos = null;
|
||||
if (tipoPeriodo > 0)
|
||||
{
|
||||
using (ClsNominas objperiodos = new ClsNominas())
|
||||
{
|
||||
if (objperiodos.GetPeriodos(tipoPeriodo, UsuarioActual.CveEmpresa, ejercicio, -1, -1))
|
||||
{
|
||||
dtPeriodos = objperiodos.DtResultados;
|
||||
}
|
||||
}
|
||||
}
|
||||
DdlPeriodoCM.DataSource = dtPeriodos;
|
||||
DdlPeriodoCM.DataBind();
|
||||
DdlPeriodoCM.Items.Insert(0, new ListItem("Seleccione", "-1"));
|
||||
UpModalAsistenciaMasiva.Update();
|
||||
}
|
||||
|
||||
protected void DdlEjerciciosCM_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
cargaPeriodosCM();
|
||||
}
|
||||
protected void DdlTipoPeriodoCM_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
cargaPeriodosCM();
|
||||
}
|
||||
|
||||
protected void DdlTipoPeriodoCM_SelectedIndexChanged1(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user