public ReportesLogic(int pcodEmpresa) { oPersonasLogic = new PersonasLogic(); oMarcacionesLogic = new MarcacionesLogic(); oMaestroLogic = new MaestroLogic(); oPersonasAgendaLogic = new PersonasAgendaLogic(); oFeriadosLogic = new FeriadosLogic(); oReturnValor = new ReturnValor(); CodArguTipoEntidad = ConfigCROM.AppConfig(pcodEmpresa, ConfigTool.DEFAULT_PersonaPorDefecto); listaFeriados = oFeriadosLogic.List(DateTime.Now.Year.ToString(), string.Empty, null, true); listaPersonasAgenda = oPersonasAgendaLogic.List(string.Empty, string.Empty, true); SeCalculaTiempoEn60 = GlobalSettings.GetDEFAULT_Time60(); }
public static int DiasDePrestamo(DateTime prmFechaInicio, int DefaultDiasPrestamo, int DIAS_TOLERANCIA) { int DIAS_DE_PRESTAMO = 0; List <BEFeriado> lstFeriados = new List <BEFeriado>(); FeriadosLogic oFeriadosLogic = new FeriadosLogic(); lstFeriados = oFeriadosLogic.List(DateTime.Now.AddHours(GlobalSettings.GetDEFAULT_HorasFechaActualCloud()).Year.ToString(), string.Empty, null, true); int TOTAL_DIAS_A_CONTAR = (DefaultDiasPrestamo + DIAS_TOLERANCIA); DateTime Fecha_Final = DateTime.Now.AddHours(GlobalSettings.GetDEFAULT_HorasFechaActualCloud()); for (int dia = 1; dia <= TOTAL_DIAS_A_CONTAR; ++dia) { DateTime FechaABuscar = prmFechaInicio.AddDays(dia); string FechaFijaAnual = "0000" + FechaABuscar.Month.ToString().Trim().PadLeft(2, '0') + FechaABuscar.Day.ToString().Trim().PadLeft(2, '0'); string FechaVariaAnual = DateTime.Now.Year.ToString().Trim() + FechaABuscar.Month.ToString().Trim().PadLeft(2, '0') + FechaABuscar.Day.ToString().Trim().PadLeft(2, '0'); if (FechaABuscar.DayOfWeek == DayOfWeek.Sunday) { ++TOTAL_DIAS_A_CONTAR; } else { if (lstFeriados.Exists(x => x.Feriado == FechaFijaAnual)) { ++TOTAL_DIAS_A_CONTAR; } if (lstFeriados.Exists(x => x.Feriado == FechaVariaAnual)) { ++TOTAL_DIAS_A_CONTAR; } } Fecha_Final = FechaABuscar; } double ndiasx = HelpTime.CantidadDias(Convert.ToDateTime(DateTime.Now.AddHours(GlobalSettings.GetDEFAULT_HorasFechaActualCloud()).ToShortDateString()), Convert.ToDateTime(Fecha_Final.ToShortDateString()), HelpTime.TotalTiempo.Dias, true); return(DIAS_DE_PRESTAMO = Convert.ToInt32(ndiasx)); }