public IEnumerable <DiasLaborables> GetDiasPorPeriodo(int Anio)
        {
            using (PlanillaContext entityContext = new PlanillaContext())
            {
                var lab = (from e in entityContext.DiasLaborablesSet
                           where e.Año == Anio
                           orderby e.CodMes ascending
                           select e).ToFullyLoaded();
                if (lab != null && lab.Count() > 0)
                {
                    return(lab);
                }
                else
                {
                    Add(new DiasLaborables("01", "01 ENERO", Anio, 0, "F"));
                    Add(new DiasLaborables("02", "02 FEBRERO", Anio, 0, "F"));
                    Add(new DiasLaborables("03", "03 MARZO", Anio, 0, "F"));
                    Add(new DiasLaborables("04", "04 ABRIL", Anio, 0, "F"));
                    Add(new DiasLaborables("05", "05 MAYO", Anio, 0, "F"));
                    Add(new DiasLaborables("06", "06 JUNIO", Anio, 0, "F"));
                    Add(new DiasLaborables("07", "07 JULIO", Anio, 0, "F"));
                    Add(new DiasLaborables("08", "08 AGOSTO", Anio, 0, "F"));
                    Add(new DiasLaborables("09", "09 SETIEMBRE", Anio, 0, "F"));
                    Add(new DiasLaborables("10", "10 OCTUBRE", Anio, 0, "F"));
                    Add(new DiasLaborables("11", "11 NOVIEMBRE", Anio, 0, "F"));
                    Add(new DiasLaborables("12", "12 DICIEMBRE", Anio, 0, "F"));

                    return(GetDiasPorPeriodo(Anio));
                }
            }
        }
 public IEnumerable <PlanillaRemuneracion> GetPlanillaGratificacionSimple(string Periodo)
 {
     using (PlanillaContext entityContext = new PlanillaContext())
     {
         return((from e in entityContext.PlanillaRemuneracionSet
                 where e.Periodo == Periodo && e.TipoPlan == "G"
                 select e).ToFullyLoaded());
     }
 }
        protected override PlanillaRemuneracion GetEntity(PlanillaContext entityContext, int id)
        {
            var query = (from e in entityContext.PlanillaRemuneracionSet
                         where e.IdPlanilla == id
                         select e);
            var results = query.FirstOrDefault();

            return(results);
        }
예제 #4
0
        protected override FondoPensiones GetEntity(PlanillaContext entityContext, int id)
        {
            var query = (from e in entityContext.FondoPensionesSet
                         where e.IdFondoPen == id
                         select e);
            var results = query.FirstOrDefault();

            return(results);
        }
        protected override Procedimiento GetEntity(PlanillaContext entityContext, int id)
        {
            var query = (from e in entityContext.ProcedimientoSet
                         where e.IdProcedimiento == id
                         select e);
            var results = query.FirstOrDefault();

            return(results);
        }
        protected override Especialidad GetEntity(PlanillaContext entityContext, int id)
        {
            var query = (from e in entityContext.EspecialidadSet
                         where e.IdEspecialidad == id
                         select e);
            var results = query.FirstOrDefault();

            return(results);
        }
        protected override TablaAnalisisVR GetEntity(PlanillaContext entityContext, int id)
        {
            var query = (from e in entityContext.TablaAnalisisVRSet
                         where e.IdValReferencial == id
                         select e);
            var results = query.FirstOrDefault();

            return(results);
        }
        protected override AporteEmpleador GetEntity(PlanillaContext entityContext, int id)
        {
            var query = (from e in entityContext.AporteEmpleadorSet
                         where e.IdAporteEmpleador == id
                         select e);
            var results = query.FirstOrDefault();

            return(results);
        }
예제 #9
0
        protected override AreaServicio GetEntity(PlanillaContext entityContext, int id)
        {
            var query = (from e in entityContext.AreaServicioSet
                         where e.IdAreaServicio == id
                         select e);
            var results = query.FirstOrDefault();

            return(results);
        }
        protected override DiasLaborables GetEntity(PlanillaContext entityContext, int id)
        {
            var query = (from e in entityContext.DiasLaborablesSet
                         where e.IdDiasLaborables == id
                         select e);
            var results = query.FirstOrDefault();

            return(results);
        }
예제 #11
0
        protected override Personal GetEntity(PlanillaContext entityContext, int id)
        {
            var query = (from e in entityContext.PersonalSet
                         where e.IdPersonal == id
                         select e);
            var results = query.FirstOrDefault();

            return(results);
        }
 public IEnumerable <PlanillaRemuneracion> GetPlanillaPorPeriodo(string Periodo, string Tipo, int?IdPersonal = 0)
 {
     using (PlanillaContext entityContext = new PlanillaContext())
     {
         return((from e in entityContext.PlanillaRemuneracionSet
                 where e.Periodo == Periodo && e.TipoPlan == Tipo && (IdPersonal == 0 || e.IdPersonal == IdPersonal)
                 orderby e.CodPer ascending
                 select e).ToFullyLoaded());
     }
 }
예제 #13
0
 public IEnumerable <Personal> GetPersonalActivo()
 {
     using (PlanillaContext entityContext = new PlanillaContext())
     {
         return((from e in entityContext.PersonalSet
                 where e.Estado == "A"
                 orderby e.CodPer descending
                 select e).ToFullyLoaded());
     }
 }
 public void EliminarPlanilla(string Periodo, string TipoPlanilla)
 {
     using (PlanillaContext entityContext = new PlanillaContext())
     {
         var planilla = (from e in entityContext.PlanillaRemuneracionSet
                         where e.Periodo == Periodo && e.TipoPlan == TipoPlanilla
                         select e);
         if (planilla != null)
         {
             foreach (var plan in planilla)
             {
                 Remove(plan);
             }
         }
     }
 }
        public DiasLaborables GetDiasPorPeriodo(string CodMes)
        {
            DiasLaborables dias = new DiasLaborables();

            using (PlanillaContext entityContext = new PlanillaContext())
            {
                dias = (from e in entityContext.DiasLaborablesSet
                        where e.CodMes == CodMes
                        select e).FirstOrDefault();
            }

            if (dias == null)
            {
                dias         = new DiasLaborables();
                dias.DiasLab = 27;
                dias.CodMes  = CodMes;
            }

            return(dias);
        }
예제 #16
0
        public TablaAnalisis AddTablaAnalisisComplete(TablaAnalisis entity)
        {
            using (PlanillaContext entityContext = new PlanillaContext())
            {
                string nCodAna = "A0001";
                var    topPro  = (from e in entityContext.TablaAnalisisSet
                                  orderby e.CodAna descending
                                  select e).FirstOrDefault();
                if (topPro != null)
                {
                    nCodAna = topPro.CodAna.Substring(1, topPro.CodAna.Length - 1);
                    int Cod = Convert.ToInt32(nCodAna) + 1;
                    nCodAna = 'P' + Utiles.CerosIzquierda(Cod.ToString(), 4);
                }

                entity.CodAna = nCodAna;

                return(Add(entity));
            }
        }
예제 #17
0
        public Personal AddPersonalComplete(Personal entity)
        {
            using (PlanillaContext entityContext = new PlanillaContext())
            {
                string nCodPer     = "P001";
                var    topPersonal = (from e in entityContext.PersonalSet
                                      orderby e.CodPer descending
                                      select e).FirstOrDefault();
                if (topPersonal != null)
                {
                    nCodPer = topPersonal.CodPer.Substring(1, topPersonal.CodPer.Length - 1);
                    int Cod = Convert.ToInt32(nCodPer) + 1;
                    nCodPer = 'P' + Utiles.CerosIzquierda(Cod.ToString(), 3);
                }

                entity.CodPer = nCodPer;

                return(Add(entity));
            }
        }
 public IEnumerable <PlanillaUnico> GetPlanillasAnio(int Anio)
 {
     using (PlanillaContext entityContext = new PlanillaContext())
     {
         List <PlanillaUnico> resultado = new List <PlanillaUnico>();
         var lista = (from planilla in entityContext.PlanillaRemuneracionSet
                      where planilla.Periodo.Substring(0, 4) == Anio.ToString()
                      select new
         {
             planilla.Periodo,
             planilla.TipoPlan,
             planilla.Cerrado
         }).Distinct();
         foreach (var unico in lista)
         {
             resultado.Add(new PlanillaUnico(unico.Periodo, unico.TipoPlan, unico.Cerrado));
         }
         return(resultado);
     }
 }
예제 #19
0
        public FondoPensiones AddFondoPensionesComplete(FondoPensiones entity)
        {
            using (PlanillaContext entityContext = new PlanillaContext())
            {
                string nCodFon  = "F01";
                var    topFondo = (from e in entityContext.FondoPensionesSet
                                   orderby e.CodFon descending
                                   select e).FirstOrDefault();
                if (topFondo != null)
                {
                    nCodFon = topFondo.CodFon.Substring(1, topFondo.CodFon.Length - 1);
                    int Cod = Convert.ToInt32(nCodFon) + 1;
                    nCodFon = 'F' + Utiles.CerosIzquierda(Cod.ToString(), 2);
                }

                entity.CodFon = nCodFon;

                return(Add(entity));
            }
        }
        public Procedimiento AddProcedimientoComplete(Procedimiento entity)
        {
            using (PlanillaContext entityContext = new PlanillaContext())
            {
                string nCodPro = "P001";
                var    topPro  = (from e in entityContext.ProcedimientoSet
                                  orderby e.CodPro descending
                                  select e).FirstOrDefault();
                if (topPro != null)
                {
                    nCodPro = topPro.CodPro.Substring(1, topPro.CodPro.Length - 1);
                    int Cod = Convert.ToInt32(nCodPro) + 1;
                    nCodPro = 'P' + Utiles.CerosIzquierda(Cod.ToString(), 3);
                }

                entity.CodPro = nCodPro;

                return(Add(entity));
            }
        }
예제 #21
0
        public Especialidad AddEspecialidadComplete(Especialidad entity)
        {
            using (PlanillaContext entityContext = new PlanillaContext())
            {
                string newCodEsp       = "E001";
                var    topEspecialidad = (from e in entityContext.EspecialidadSet
                                          orderby e.CodEsp descending
                                          select e).FirstOrDefault();
                if (topEspecialidad != null)
                {
                    newCodEsp = topEspecialidad.CodEsp.Substring(1, topEspecialidad.CodEsp.Length - 1);
                    int Cod = Convert.ToInt32(newCodEsp) + 1;
                    newCodEsp = 'E' + Utiles.CerosIzquierda(Cod.ToString(), 3);
                }

                entity.CodEsp = newCodEsp;

                return(Add(entity));
            }
        }
        public IEnumerable <PlanillaRemuneracion> PlanillasEnPeriodoPorGrati(int Mes, int Anio)
        {
            var Periodos = new string[] { };

            string PeriodoHasta = Anio.ToString();

            if (Mes == 7)
            {
                Periodos = new string[] { Anio.ToString() + "01", Anio.ToString() + "02", Anio.ToString() + "03", Anio.ToString() + "04", Anio.ToString() + "05", Anio.ToString() + "06" };
            }
            else
            {
                Periodos = new string[] { Anio.ToString() + "07", Anio.ToString() + "08", Anio.ToString() + "09", Anio.ToString() + "10", Anio.ToString() + "11", Anio.ToString() + "12" };
            }

            using (PlanillaContext entityContext = new PlanillaContext())
            {
                var planilla = (from e in entityContext.PlanillaRemuneracionSet
                                where Periodos.Contains(e.Periodo)
                                select e).ToFullyLoaded();
                return(planilla);
            }
        }
        public IEnumerable <PlanillaRemuneracion> PlanillasEnPeriodoPorCTS(int Mes, int Anio)
        {
            int    AnioAnterior = Anio - 1;
            var    Periodos     = new string[] { };
            string PeriodoGrati = (Mes == 5) ? (AnioAnterior + "12") : (Anio + "07");
            string PeriodoHasta = Anio.ToString();

            if (Mes == 5)
            {
                Periodos = new string[] { AnioAnterior.ToString() + "11", AnioAnterior.ToString() + "12", Anio.ToString() + "01", Anio.ToString() + "02", Anio.ToString() + "03", Anio.ToString() + "04" };
            }
            else
            {
                Periodos = new string[] { Anio.ToString() + "05", Anio.ToString() + "06", Anio.ToString() + "07", Anio.ToString() + "08", Anio.ToString() + "09", Anio.ToString() + "10" };
            }

            using (PlanillaContext entityContext = new PlanillaContext())
            {
                var planilla = (from e in entityContext.PlanillaRemuneracionSet
                                where (Periodos.Contains(e.Periodo) && e.TipoPlan == "N") || (e.Periodo == PeriodoGrati && e.TipoPlan == "G")
                                select e).ToFullyLoaded();
                return(planilla);
            }
        }
예제 #24
0
 protected override IEnumerable <AreaServicio> GetEntities(PlanillaContext entityContext)
 {
     return(from e in entityContext.AreaServicioSet
            select e);
 }
예제 #25
0
 protected override AreaServicio AddEntity(PlanillaContext entityContext, AreaServicio entity)
 {
     return(entityContext.AreaServicioSet.Add(entity));
 }
 protected override AporteEmpleador UpdateEntity(PlanillaContext entityContext, AporteEmpleador entity)
 {
     return((from e in entityContext.AporteEmpleadorSet
             where e.IdAporteEmpleador == entity.IdAporteEmpleador
             select e).FirstOrDefault());
 }
 protected override IEnumerable <AporteEmpleador> GetEntities(PlanillaContext entityContext)
 {
     return(from e in entityContext.AporteEmpleadorSet
            select e);
 }
 protected override AporteEmpleador AddEntity(PlanillaContext entityContext, AporteEmpleador entity)
 {
     return(entityContext.AporteEmpleadorSet.Add(entity));
 }
예제 #29
0
 protected override AreaServicio UpdateEntity(PlanillaContext entityContext, AreaServicio entity)
 {
     return((from e in entityContext.AreaServicioSet
             where e.IdAreaServicio == entity.IdAreaServicio
             select e).FirstOrDefault());
 }
예제 #30
0
 protected override Cargo UpdateEntity(PlanillaContext entityContext, Cargo entity)
 {
     return((from e in entityContext.CargoSet
             where e.IdCargo == entity.IdCargo
             select e).FirstOrDefault());
 }