public bool guardar_periodos_generadosDB(ro_periodo_Info info) { try { if (si_existe_periodo(info.IdEmpresa, info.IdPeriodo)) { return(false); } using (Entities_rrhh Context = new Entities_rrhh()) { ro_periodo Entity = new ro_periodo { IdEmpresa = info.IdEmpresa, IdPeriodo = info.IdPeriodo, pe_FechaIni = info.pe_FechaIni.Date, pe_FechaFin = info.pe_FechaFin.Date, Carga_Todos_Empleados = info.Carga_Todos_Empleados, pe_anio = info.pe_anio, pe_mes = info.pe_mes, Cod_region = info.Cod_region, IdUsuario = info.IdUsuario, pe_estado = "A", Fecha_Transac = info.Fecha_Transac = DateTime.Now }; Context.ro_periodo.Add(Entity); Context.SaveChanges(); } return(true); } catch (Exception) { throw; } }
public Boolean AnularDB(ro_periodo_Info Info, ref string msg) { try { using (EntitiesRoles context = new EntitiesRoles()) { var contact = context.ro_periodo.FirstOrDefault(dinfo => dinfo.IdPeriodo == Info.IdPeriodo && dinfo.IdEmpresa == Info.IdEmpresa); contact.pe_estado = "I"; contact.IdUsuarioUltAnu = Info.IdUsuarioUltAnu; contact.FechaHoraAnul = Info.FechaHoraAnul; contact.MotivoAnulacion = Info.MotivoAnulacion; context.SaveChanges(); } return(true); } catch (Exception ex) { string array = ToString(); tb_sis_Log_Error_Vzen_Data oDataLog = new tb_sis_Log_Error_Vzen_Data(); tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", array, "", "", "", "", "", DateTime.Now); oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje); mensaje = ex.InnerException + " " + ex.Message; throw new Exception(ex.InnerException.ToString()); } }
void pu_AbrirNovedad() { try { ro_Empleado_Novedad_Info cab = new ro_Empleado_Novedad_Info(); ro_periodo_Info period = new ro_periodo_Info(); if (_idPeriodo != null) { cab.Fecha = period.pe_FechaIni; } cab.IdEmpleado = Info.IdEmpleado; cab.IdNomina_Tipo = _idNominaTipo; cab.IdNomina_TipoLiqui = _idNominaTipoLiqui; frmRo_Empleado_Novedad_Mant frm = new frmRo_Empleado_Novedad_Mant(); frm.set_Accion(Cl_Enumeradores.eTipo_action.grabar); frm.setCab(cab); frm.ShowDialog(); //this.CargaEmpSalNeg(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); Log_Error_bus.Log_Error(ex.ToString()); } }
public ro_periodo_Info get_info(int IdEmpresa, int IdPeriodo) { try { ro_periodo_Info info = new ro_periodo_Info(); using (Entities_rrhh Context = new Entities_rrhh()) { ro_periodo Entity = Context.ro_periodo.FirstOrDefault(q => q.IdEmpresa == IdEmpresa && q.IdPeriodo == IdPeriodo); if (Entity == null) { return(null); } info = new ro_periodo_Info { IdEmpresa = Entity.IdEmpresa, IdPeriodo = Entity.IdPeriodo, pe_FechaIni = Entity.pe_FechaIni, pe_FechaFin = Entity.pe_FechaFin, Carga_Todos_Empleados = (Entity.Carga_Todos_Empleados) == null?false:Convert.ToBoolean(Entity.Carga_Todos_Empleados), Cod_region = Entity.Cod_region, pe_mes = Entity.pe_mes, pe_anio = Entity.pe_anio, pe_estado = Entity.pe_estado }; } return(info); } catch (Exception) { throw; } }
private void btnDerechaUno_Click(object sender, EventArgs e) { try { if (Validar()) { ro_periodo_Info Item = (ro_periodo_Info)gridViewPerDisponible.GetFocusedRow(); if (Item != null) { if (Item.check == true) { PeriodoAsig = new BindingList <ro_periodo_Info>(); PeriodoAsig.Add(Item); ro_periodo_x_ro_Nomina_TipoLiqui_Info Info = new ro_periodo_x_ro_Nomina_TipoLiqui_Info(); Info.IdEmpresa = param.IdEmpresa; Info.IdPeriodo = Item.IdPeriodo; Info.IdNomina_Tipo = Convert.ToInt32(this.cmbNomina.EditValue); Info.IdNomina_TipoLiqui = Convert.ToInt32(this.cmbProceso.EditValue); Bus_PerNomTipoliq.GuardarDB(Info); cmbNomina.EditValue = null; cmbProceso.EditValue = null; cmbNomina.EditValue = Info.IdNomina_Tipo; cmbProceso.EditValue = Info.IdNomina_TipoLiqui; } } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); Log_Error_bus.Log_Error(ex.ToString()); } }
private void pu_AbrirPrestamos() { try { ro_prestamo_Info cab = new ro_prestamo_Info(); ro_periodo_Info period = new ro_periodo_Info(); if (period != null) { cab.IdEmpleado = Info.IdEmpleado; } cab.IdNomina_Tipo = _idNominaTipo; frmRo_Prestamos frmPrestamo = new frmRo_Prestamos(); frmPrestamo = new frmRo_Prestamos(Cl_Enumeradores.eTipo_action.grabar); frmPrestamo.setCabPrestamo(cab); frmPrestamo.ShowDialog(); //btnRefresh_Click(sender, e); //setInfo(); //this.CargaEmpSalNeg(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); Log_Error_bus.Log_Error(ex.ToString()); } }
public ActionResult Generar_Periodos(ro_periodo_Info info) { try { if (ModelState.IsValid) { info.IdEmpresa = GetIdEmpresa(); info.IdUsuario = GetIdUsuario(); if (!bus_periodo.Generar_Periodos(info)) { cargar_combo(); return(View(info)); } else { return(RedirectToAction("Index")); } } else { cargar_combo(); return(View(info)); } } catch (Exception) { throw; } }
public ActionResult Modificar(ro_periodo_Info info) { try { if (ModelState.IsValid) { info.IdUsuarioUltMod = GetIdUsuario(); if (!bus_periodo.modificarDB(info)) { return(View(info)); } else { return(RedirectToAction("Index")); } } else { return(View(info)); } } catch (Exception) { throw; } }
public ActionResult Nuevo(ro_periodo_Info info) { try { if (ModelState.IsValid) { info.IdEmpresa = GetIdEmpresa(); if (!bus_periodo.guardarDB(info)) { return(View(info)); } else { return(RedirectToAction("Index")); } } else { return(View(info)); } } catch (Exception) { throw; } }
public void set_Info(ro_periodo_Info _Info) { try { Info = _Info; txtIdPeriodo.Text = Info.IdPeriodo.ToString(); dtFechaIni.Text = Convert.ToString(Info.pe_FechaIni); dtFechaFin.Text = Convert.ToString(Info.pe_FechaFin); CheckEstado.Checked = (Info.pe_estado == "A") ? true : false; lblEstado.Visible = (Info.pe_estado == "I") ? true : false; cmb_region.EditValue = Info.Cod_region; if (Info.pe_estado == "I") { lblEstado.Visible = true; } else { lblEstado.Visible = false; } if (Info.Carga_Todos_Empleados != null) { check_pasico.Checked = Convert.ToBoolean(Info.Carga_Todos_Empleados); } } catch (Exception ex) { Log_Error_bus.Log_Error(ex.ToString()); } }
private void cmb_consultar_Click(object sender, EventArgs e) { try { if (info_Periodo == null) { info_Periodo = lista_periodo.Where(v => v.IdPeriodo == Info_planificacion.IdPeriodo).FirstOrDefault(); } // si no exite departamento y cargo selecionado if (cmb_division.EditValue == null) { lista_empleado = Bus_empleado.Get_list_empleado_con_jornada_desfasada(param.IdEmpresa, Convert.ToInt32(cmbnomina.EditValue), info_Periodo, Convert.ToInt32(cmb_turnos_cambia_usuario.EditValue)); gridControl_Turnos.DataSource = lista_empleado; } if (cmb_division.EditValue != null) { lista_empleado = Bus_empleado.Get_list_empleado_con_jornada_desfasada_car(param.IdEmpresa, Convert.ToInt32(cmbnomina.EditValue), info_Periodo, Convert.ToDecimal(cmb_division.EditValue), Convert.ToInt32(cmb_turnos_cambia_usuario.EditValue)); gridControl_Turnos.DataSource = lista_empleado; } } catch (Exception ex) { Log_Error_bus.Log_Error(ex.ToString()); MessageBox.Show(ex.ToString()); } }
public Boolean ModificarDB(ro_periodo_Info info, ref string msg) { try { using (EntitiesRoles context = new EntitiesRoles()) { var contact = context.ro_periodo.First(minfo => minfo.IdPeriodo == info.IdPeriodo && minfo.IdEmpresa == info.IdEmpresa); contact.IdEmpresa = info.IdEmpresa; contact.IdPeriodo = info.IdPeriodo; contact.pe_FechaIni = info.pe_FechaIni; contact.pe_FechaFin = info.pe_FechaFin; contact.pe_estado = info.pe_estado; contact.MotivoAnulacion = ""; context.SaveChanges(); } return(true); } catch (Exception ex) { string array = ToString(); tb_sis_Log_Error_Vzen_Data oDataLog = new tb_sis_Log_Error_Vzen_Data(); tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", array, "", "", "", "", "", DateTime.Now); oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje); mensaje = ex.InnerException + " " + ex.Message; throw new Exception(ex.InnerException.ToString()); } }
public bool guardarDB(ro_periodo_Info info) { try { using (Entities_rrhh Context = new Entities_rrhh()) { ffin = info.pe_FechaFin.Date.Day; anio = Convert.ToInt32(info.pe_anio); mes = Convert.ToInt32(info.pe_mes); ro_periodo Entity = new ro_periodo { IdEmpresa = info.IdEmpresa, IdPeriodo = get_id(info.IdEmpresa), pe_FechaIni = info.pe_FechaIni.Date, pe_FechaFin = info.pe_FechaFin.Date, pe_anio = info.pe_anio, pe_mes = info.pe_mes, Carga_Todos_Empleados = info.Carga_Todos_Empleados, Cod_region = info.Cod_region, IdUsuario = info.IdUsuario, pe_estado = "A", Fecha_Transac = info.Fecha_Transac = DateTime.Now }; Context.ro_periodo.Add(Entity); Context.SaveChanges(); } return(true); } catch (Exception) { throw; } }
public bool modificarDB(ro_periodo_Info info) { try { using (Entities_rrhh Context = new Entities_rrhh()) { ro_periodo Entity = Context.ro_periodo.FirstOrDefault(q => q.IdEmpresa == info.IdEmpresa && q.IdPeriodo == info.IdPeriodo); if (Entity == null) { return(false); } Entity.IdEmpresa = info.IdEmpresa; Entity.IdPeriodo = info.IdPeriodo; Entity.pe_FechaIni = info.pe_FechaIni.Date; Entity.pe_FechaFin = info.pe_FechaFin.Date; Entity.Carga_Todos_Empleados = info.Carga_Todos_Empleados; Entity.Cod_region = info.Cod_region; Entity.Fecha_UltMod = info.Fecha_UltMod = DateTime.Now; Context.SaveChanges(); } return(true); } catch (Exception) { throw; } }
public bool anularDB(ro_periodo_Info info) { try { return(odata.anularDB(info)); } catch (Exception) { throw; } }
private void gridViewPeriodo_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) { try { Info = (ro_periodo_Info)gridViewPeriodo.GetFocusedRow(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); Log_Error_bus.Log_Error(ex.ToString()); } }
public ActionResult Nuevo() { try { ro_periodo_Info info = new ro_periodo_Info(); cargar_combo(); return(View(info)); } catch (Exception) { throw; } }
public Boolean Guardar() { try { if (Validar() == false) { return(false); } string msg = ""; List <ro_periodo_Info> list_Periodo = new List <ro_periodo_Info>(); for (int i = 0; i <= gridViewPeriodo.RowCount; i++) { var inf = (ro_periodo_Info)gridViewPeriodo.GetRow(i); if (inf != null) { ro_periodo_Info Item = new ro_periodo_Info(); Item.IdEmpresa = param.IdEmpresa; Item.IdPeriodo = inf.IdPeriodo; Item.pe_anio = inf.pe_anio; Item.pe_mes = inf.pe_mes; Item.pe_FechaIni = inf.pe_FechaIni; Item.pe_FechaFin = inf.pe_FechaFin; Item.pe_estado = inf.pe_estado; list_Periodo.Add(Item); } } if (Bus_Periodos.GuardarPeriodos(list_Periodo, ref msg)) { MessageBox.Show("Periodos guardados correctamente", "Sistemas"); Limpiar(); } return(true); } catch (Exception ex) { MessageBox.Show(ex.ToString()); Log_Error_bus.Log_Error(ex.ToString()); return(false); } }
public List <ro_participacion_utilidad_empleado_Info> calcular(int IdEmpresa, int IdNomina, int IdPeriodo, double valorIndividual, double valorCarga) { try { ro_periodo_Info info_periodo = bus_periodo.get_info(IdEmpresa, IdPeriodo); DateTime FechaInicio = info_periodo.pe_FechaIni; DateTime FechaFin = info_periodo.pe_FechaFin; double factorB = 0; lista = odata.get_list(IdEmpresa, IdNomina, FechaInicio, FechaFin); int DiasTrabajados = 0; foreach (var item in lista) // calculando dias trabajados { if (item.num_contratos == 1) // si el empleado tiene un solo contrato dentro del año { item.DiasTrabajados = Dias_trabajados_x_un_contrato(item, FechaInicio, FechaFin); } else// traeigo todos los contratos que tenga el empleado en ese año activos y liquidados { lista_contratos = bus_contrato.get_list(item.IdEmpresa, item.IdEmpleado, FechaInicio, FechaFin); item.DiasTrabajados = Dias_trabajados_x_n_contrato(lista_contratos, FechaInicio, FechaFin); } } DiasTrabajados = Convert.ToInt32(lista.Sum(v => v.DiasTrabajados)); // sumar el total de los dias trabajados foreach (var item in lista) // calculando las utilidades individual { item.ValorIndividual = ((valorIndividual / DiasTrabajados) * item.DiasTrabajados); if (item.CargasFamiliares > 0) { item.FactorA = item.CargasFamiliares * item.DiasTrabajados; factorB = factorB + item.FactorA; } item.ValorCargaFamiliar = Math.Round(item.ValorCargaFamiliar, 2); } foreach (var item in lista) // calculando valor por carga { if (factorB > 0) { item.ValorCargaFamiliar = (valorCarga * (item.FactorA / factorB)); } item.ValorTotal = item.ValorIndividual + item.ValorCargaFamiliar; item.ValorTotal = Math.Round(item.ValorTotal, 2); item.ValorIndividual = Math.Round(item.ValorIndividual, 2); } return(lista); } catch (Exception) { throw; } }
public ActionResult Nuevo(int IdEmpresa = 0) { try { ro_periodo_Info info = new ro_periodo_Info(); info.IdEmpresa = Convert.ToInt32(SessionFixed.IdEmpresa); cargar_combo(); return(View(info)); } catch (Exception) { throw; } }
public bool Generar_Periodos(ro_periodo_Info info) { try { bool si_grabo = false; lista_periodos = new List <ro_periodo_Info>(); if (info.CodCatalogo == cl_enumeradores.eTipoPeriodoRRHH.MEN.ToString()) { if (generarMensual(Convert.ToInt32(info.pe_anio))) { foreach (var item in lista_periodos) { item.IdEmpresa = info.IdEmpresa; item.IdUsuario = info.IdUsuario; si_grabo = odata.guardar_periodos_generadosDB(item); } } } if (info.CodCatalogo == cl_enumeradores.eTipoPeriodoRRHH.QUINCE.ToString()) { if (generarQuincenal(Convert.ToInt32(info.pe_anio))) { foreach (var item in lista_periodos) { item.IdEmpresa = info.IdEmpresa; item.IdUsuario = info.IdUsuario; si_grabo = odata.guardar_periodos_generadosDB(item); } } } if (info.CodCatalogo == cl_enumeradores.eTipoPeriodoRRHH.SEM.ToString()) { if (generarSemanal(Convert.ToInt32(info.pe_anio))) { foreach (var item in lista_periodos) { item.IdEmpresa = info.IdEmpresa; item.IdUsuario = info.IdUsuario; si_grabo = odata.guardar_periodos_generadosDB(item); } } } return(si_grabo); } catch (Exception) { throw; } }
private bool generarMensual(int anio) { try { int periodo = 12; for (int i = 1; i <= periodo; i++) { DateTime k = new DateTime(anio, i, 1); int mes = k.Month; int dayMes = System.DateTime.DaysInMonth(anio, mes); DateTime p = new DateTime(anio, i, 1); DateTime q = new DateTime(anio, i, dayMes); string Id = ""; int IdPeriodo = 0; if (i >= 1 && i <= 9) { Id = Convert.ToString(anio) + 0 + mes; IdPeriodo = Convert.ToInt32(Id); } else { Id = Convert.ToString(anio) + mes; IdPeriodo = Convert.ToInt32(Id); } ro_periodo_Info item = new ro_periodo_Info { IdPeriodo = IdPeriodo, pe_anio = anio, pe_mes = mes, pe_FechaIni = p, pe_FechaFin = q, pe_estado = "A", }; lista_periodos.Add(item); } return(true); } catch (Exception) { throw; } }
private void cmb_periodo_EditValueChanged(object sender, EventArgs e) { try { info_Periodo = (ro_periodo_Info)cmb_periodo.Properties.View.GetFocusedRow(); if (info_Periodo == null) { info_Periodo = lista_periodo.Where(v => v.IdPeriodo == Info_planificacion.IdPeriodo).FirstOrDefault(); } } catch (Exception ex) { Log_Error_bus.Log_Error(ex.ToString()); MessageBox.Show(ex.ToString()); } }
public bool guardarDB(ro_periodo_Info info) { try { if (info.pe_FechaIni.Month == info.pe_FechaFin.Month) { info.pe_mes = info.pe_FechaIni.Month; info.pe_anio = info.pe_FechaIni.Year; } return(odata.guardarDB(info)); } catch (Exception) { throw; } }
public Boolean GrabarDB(ro_periodo_Info info, ref string msg) { try { using (EntitiesRoles context = new EntitiesRoles()) { var que = from C in context.ro_periodo where C.IdPeriodo == info.IdPeriodo select C; if (que.Count() == 0) { var address = new ro_periodo(); info.IdPeriodo = getId(info.IdEmpresa); address.IdEmpresa = info.IdEmpresa; address.IdPeriodo = info.IdPeriodo; address.pe_FechaIni = Convert.ToDateTime(info.pe_FechaIni.ToShortDateString()); address.pe_FechaFin = Convert.ToDateTime(info.pe_FechaFin.ToShortDateString()); address.pe_anio = Convert.ToInt32(info.pe_anio); address.pe_mes = Convert.ToByte(info.pe_mes); address.pe_estado = info.pe_estado; address.Cod_region = info.Cod_region; address.Carga_Todos_Empleados = info.Carga_Todos_Empleados; context.ro_periodo.Add(address); context.SaveChanges(); } else { msg = "Error en el ingreso; código Existente"; return(false); } } return(true); } catch (Exception ex) { string array = ToString(); tb_sis_Log_Error_Vzen_Data oDataLog = new tb_sis_Log_Error_Vzen_Data(); tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", array, "", "", "", "", "", DateTime.Now); oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje); mensaje = ex.InnerException + " " + ex.Message; throw new Exception(ex.InnerException.ToString()); } }
public Boolean Modificar(ro_periodo_Info Info, ref string msg) { try { Info.IdUsuarioUltMod = param.IdUsuario; Info.Fecha_UltMod = param.GetDateServer(); return(Odata.ModificarDB(Info, ref msg)); } catch (Exception ex) { Core.Erp.Info.Log_Exception.LoggingManager.Logger.Log(Core.Erp.Info.Log_Exception.LoggingCategory.Error, ex.Message); throw new Core.Erp.Info.Log_Exception.DalException(string.Format("", "Modificar", ex.Message), ex) { EntityType = typeof(ro_periodo_Bus) }; } }
public List <ro_periodo_Info> ObtenerPeriodo(int idcompany, int IdPeriodo) { List <ro_periodo_Info> lM = new List <ro_periodo_Info>(); try { EntitiesRoles OEPeriodo = new EntitiesRoles(); var selectPeriodo = from C in OEPeriodo.ro_periodo where C.IdEmpresa == idcompany && C.IdPeriodo == IdPeriodo select C; foreach (var item in selectPeriodo) { ro_periodo_Info Cbt = new ro_periodo_Info(); Cbt.IdEmpresa = item.IdEmpresa; Cbt.IdPeriodo = item.IdPeriodo; Cbt.pe_anio = Convert.ToInt32(item.pe_anio); Cbt.pe_mes = Convert.ToInt32(item.pe_mes); Cbt.pe_FechaIni = Convert.ToDateTime(item.pe_FechaIni.ToShortDateString()); Cbt.pe_FechaFin = Convert.ToDateTime(item.pe_FechaFin.ToShortDateString()); Cbt.pe_Descripcion = item.pe_FechaIni.ToShortDateString() + " - " + item.pe_FechaFin.ToShortDateString(); Cbt.pe_estado = item.pe_estado; Cbt.MotivoAnulacion = item.MotivoAnulacion; Cbt.Cod_region = item.Cod_region; Cbt.Carga_Todos_Empleados = item.Carga_Todos_Empleados; lM.Add(Cbt); } return(lM); } catch (Exception ex) { string array = ToString(); tb_sis_Log_Error_Vzen_Data oDataLog = new tb_sis_Log_Error_Vzen_Data(); tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", array, "", "", "", "", "", DateTime.Now); oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje); mensaje = ex.InnerException + " " + ex.Message; throw new Exception(ex.InnerException.ToString()); } }
public ActionResult Anular(ro_periodo_Info info) { try { info.IdUsuarioUltAnu = GetIdUsuario(); if (!bus_periodo.anularDB(info)) { return(View(info)); } else { return(RedirectToAction("Index")); } } catch (Exception) { throw; } }
public ActionResult Index() { #region Validar Session if (string.IsNullOrEmpty(SessionFixed.IdTransaccionSession)) { return(RedirectToAction("Login", new { Area = "", Controller = "Account" })); } SessionFixed.IdTransaccionSession = (Convert.ToDecimal(SessionFixed.IdTransaccionSession) + 1).ToString(); SessionFixed.IdTransaccionSessionActual = SessionFixed.IdTransaccionSession; #endregion ro_periodo_Info model = new ro_periodo_Info { IdEmpresa = Convert.ToInt32(SessionFixed.IdEmpresa), IdTransaccionSession = Convert.ToDecimal(SessionFixed.IdTransaccionSession) }; List <ro_periodo_Info> lista = bus_periodo.get_list(model.IdEmpresa, true); Lista_Periodo.set_list(lista, Convert.ToDecimal(SessionFixed.IdTransaccionSession)); return(View(model)); }
public bool anularDB(ro_periodo_Info info) { try { using (Entities_rrhh Context = new Entities_rrhh()) { ro_periodo Entity = Context.ro_periodo.FirstOrDefault(q => q.IdEmpresa == info.IdEmpresa && q.IdPeriodo == info.IdPeriodo); if (Entity == null) { return(false); } Entity.pe_estado = "I"; Entity.IdUsuarioUltAnu = info.IdUsuarioUltAnu; Entity.FechaHoraAnul = DateTime.Now; Context.SaveChanges(); } return(true); } catch (Exception) { throw; } }