示例#1
0
        public ActionResult Approval(string empleado, decimal axo, bool ismanager = false)
        {
            if (!Login())
            {
                return(RedirectToAction("NoUser", "Home", null));
            }

            if (!ismanager)
            {
                empleado = Convert.ToString(Session["EmployeeNo"]);
            }

            var objetivoHeader = db.t_objetivos.Include(t => t.t_empleados).Include(t => t.t_plantas).Where(x => x.empleado == empleado && x.axo == axo).ToList().ElementAt(0);

            if (objetivoHeader.estatus != "EN")
            {
                return(RedirectToAction("Create", new { empleado = objetivoHeader.empleado, axo = objetivoHeader.axo }));
            }

            ViewBag.Objective = objetivoHeader;

            try
            {
                ViewBag.Manager = objetivoHeader.t_empleados.t_empleados2.nombre;

                if (objetivoHeader.t_empleados.t_empleados2.empleado == Convert.ToString(Session["EmployeeNo"]))
                {
                    ViewBag.FirstManager = true;
                }
                else
                {
                    ViewBag.FirstManager = false;
                }
            }
            catch
            {
                ViewBag.Manager = null;
            }

            try
            {
                ViewBag.Manager2 = objetivoHeader.t_empleados.t_empleados2.t_empleados2.nombre;
            }
            catch
            {
                ViewBag.Manager2 = null;
            }

            var ObjectivesDet = db.t_objetidet.Include(t => t.t_objetivos).Where(x => x.empleado == objetivoHeader.empleado && x.axo == objetivoHeader.axo);

            ViewBag.ObjectivesDet = ObjectivesDet;

            empleadoTress add = new empleadoTress();

            add = add.datosTress(empleado.Substring(3, empleado.Length - 3), empleado.Substring(0, 3));

            ViewBag.infoTress = add;

            return(View());
        }
示例#2
0
        // GET: t_usuarios/Details/5
        public ActionResult Details(string empleado)
        {
            MyDirects     ndirect = new MyDirects();
            empleadoTress add     = new empleadoTress();

            add = add.datosTress(empleado.Substring(3, empleado.Length - 3), empleado.Substring(0, 3));

            t_empleados t_empleados = db.t_empleados.Find(empleado);

            ndirect.nombre   = t_empleados.nombre;
            ndirect.empleado = t_empleados.empleado;
            ndirect.usuario  = t_empleados.t_usuarios.usuario;
            ndirect.sextra1  = t_empleados.t_usuarios.email;
            ndirect.depto    = add.depto;
            ndirect.puesto   = add.puesto;
            try
            {
                ndirect.manager1 = t_empleados.t_empleados21.nombre;
            }
            catch
            {
                ndirect.manager1 = "";
            }

            ViewBag.details = ndirect;

            return(View());
        }
示例#3
0
        public ActionResult DirectReports()
        {
            if (!Login())
            {
                return(RedirectToAction("NoUser", "Home", null));
            }

            string empleado = Convert.ToString(Session["EmployeeNo"]);

            //Si el empleado que quiere ingresar no esta como supervisor y el año de los objetivos no es el actual, regresar al menu
            var t_merit = db.t_merit.Include(t => t.t_empleados).Include(t => t.t_empleados1).Where(x => x.supervisor == empleado && x.axo == System.DateTime.Now.Year).ToList();

            if (!t_merit.Any())
            {
                return(RedirectToAction("Index", "Home", null));
            }

            var t_meridet = db.t_meridet.Include(t => t.t_califica).Include(t => t.t_empleados).Include(t => t.t_jobcode).Include(t => t.t_merit).Where(x => x.supervisor == empleado && x.axo == System.DateTime.Today.Year).ToList();

            var directs = new List <MyDirects>();

            string estado = "";

            foreach (var item in t_meridet)
            {
                switch (item.estatus)
                {
                case "PE":
                    estado = "Waiting For Aproval";
                    break;

                case "AP":
                    estado = "Approved";
                    break;

                default:
                    estado = "No Merit";
                    break;
                }

                MyDirects     ndirect = new MyDirects();
                empleadoTress add     = new empleadoTress();
                add = add.datosTress(item.empleado.Substring(3, item.empleado.Length - 3), item.empleado.Substring(0, 3));
                ndirect.empleado  = item.empleado;
                ndirect.nombre    = item.nombre;
                ndirect.estatusm4 = estado;
                ndirect.axom4     = item.axo;
                ndirect.puesto    = add.puesto;
                ndirect.foto      = add.btImagen;
                ndirect.meritrec  = Convert.ToDecimal(item.sugerido_porc);
                directs.Add(ndirect);
            }


            ViewBag.Directos = directs;
            return(View());
        }
示例#4
0
        public bool Login()
        {
            string username = Convert.ToString(User.Identity.Name).Substring(11).ToLower();

            Session["userAccount"] = username;
            var t_usuarios = db.t_usuarios.Find(username);

            Session["Rol"] = t_usuarios.rol;
            if (t_usuarios == null)
            {
                //si usuario no esta
                return(false);
            }
            else
            {
                var nombreusuario = t_usuarios.nombre.Split(' ');
                ViewBag.userFirstName = nombreusuario[0];
                ViewBag.userRol       = t_usuarios.rol.ToString();

                var empleado = db.t_empleados.Where(x => x.usuario == username).ToList();
                if (empleado.Any())
                {
                    var config1 = db.t_config_m1.Where(x => x.clave == "01").ToList();
                    ViewBag.Axo = config1[0].axo_activo;

                    Session["userNo"] = empleado[0].empleado;
                    ViewBag.userNo    = empleado[0].empleado;
                    string numempleado = empleado[0].empleado;
                    if (empleado[0].planta == "686")
                    {
                        empleadoTress add = new empleadoTress();

                        add = add.datosTress(numempleado.Substring(3, numempleado.Length - 3), numempleado.Substring(0, 3));
                        ViewBag.userJobPosition = add.puesto;
                        ViewBag.userImage       = "data:image/png;base64," + Convert.ToBase64String(add.btImagen, 0, add.btImagen.Length);
                    }

                    Session["EmployeeNo"] = empleado[0].empleado;
                    return(true);
                }
                else
                {
                    //si el nombre del usuario no existe en empleados
                    return(false);
                }
            }
        }
示例#5
0
        public bool Login()
        {
            string username = Convert.ToString(User.Identity.Name).Substring(11).ToLower();

            Session["userAccount"] = username;
            var t_usuarios = db.t_usuarios.Find(username);

            Session["Rol"] = t_usuarios.rol;
            if (t_usuarios == null)
            {
                //si usuario no esta
                return(false);
            }
            else
            {
                var nombreusuario = t_usuarios.nombre.Split(' ');
                ViewBag.userFirstName = nombreusuario[0];
                var empleado = db.t_empleados.Where(x => x.usuario == username).ToList();
                if (empleado.Any())
                {
                    Session["userNo"] = empleado[0].empleado;

                    string numempleado = empleado[0].empleado;
                    if (empleado[0].planta == "686")
                    {
                        empleadoTress add = new empleadoTress();

                        add = add.datosTress(numempleado.Substring(3, numempleado.Length - 3), numempleado.Substring(0, 3));
                        ViewBag.userJobPosition = add.puesto;
                    }

                    Session["EmployeeNo"] = empleado[0].empleado;
                    return(true);
                }
                else
                {
                    //si el nombre del usuario no existe en empleados
                    return(false);
                }
            }
        }
示例#6
0
        // GET: t_usuarios/Delete/5
        public ActionResult Delete(string empleado)
        {
            if (!Login())
            {
                return(RedirectToAction("NoUser", "Home", null));
            }

            t_usuarios user = db.t_usuarios.Find(Convert.ToString(Session["userAccount"]));

            if (user.rol != "ADMCO")
            {
                return(RedirectToAction("Index", "Home", null));
            }

            MyDirects     ndirect = new MyDirects();
            empleadoTress add     = new empleadoTress();

            add = add.datosTress(empleado.Substring(3, empleado.Length - 3), empleado.Substring(0, 3));

            t_empleados t_empleados = db.t_empleados.Find(empleado);

            ndirect.nombre   = t_empleados.nombre;
            ndirect.empleado = t_empleados.empleado;
            ndirect.usuario  = t_empleados.t_usuarios.usuario;
            ndirect.sextra1  = t_empleados.t_usuarios.email;
            ndirect.depto    = add.depto;
            ndirect.puesto   = add.puesto;
            try
            {
                ndirect.manager1 = t_empleados.t_empleados21.nombre;
            }
            catch
            {
                ndirect.manager1 = "";
            }

            ViewBag.details = ndirect;

            return(View());
        }
示例#7
0
        public ActionResult Start(string sparame, int sparamx)
        {
            if (!Login())
            {
                return(RedirectToAction("NoUser", "Home", null));
            }

            var     budgetAxo = db.t_budget_pta.Where(x => x.axo == sparamx).ToList();
            decimal dBudget   = 0;

            if (budgetAxo.Any())
            {
                if (decimal.TryParse(budgetAxo[0].budget.ToString(), out dBudget))
                {
                    ViewBag.Budget = dBudget;
                }
            }


            ViewBag.userNo = sparame;
            ViewBag.Axo    = sparamx;
            var meritList = db.sp_view_merit_year(sparamx).ToList();

            ViewBag.Merit = meritList;

            ViewBag.craeteMerit = true;
            if (meritList.ToList().Count > 0)
            {
                ViewBag.craeteMerit = false;
            }

            empleadoTress add = new empleadoTress();

            add = add.datosTress(sparame.Substring(3, sparame.Length - 3), sparame.Substring(0, 3));
            ViewBag.infoTress = add;

            return(View());
        }
示例#8
0
        public ActionResult DirectReports()
        {
            if (!Login())
            {
                return(RedirectToAction("NoUser", "Home", null));
            }

            string empleado    = Convert.ToString(Session["EmployeeNo"]);
            var    t_empleados = db.t_empleados.Include(t => t.t_plantas).Include(t => t.t_usuarios).Include(t => t.t_empleados2).Where(x => x.supervisor == empleado).ToList();
            var    t_objetivos = db.t_objetivos.Include(t => t.t_empleados).Include(t => t.t_plantas).Where(x => x.t_empleados.t_empleados2.empleado == empleado && x.estatus != "CA").ToList();

            var query = (from l1 in t_empleados
                         join l2 in t_objetivos on l1.empleado equals l2.empleado into leftJ
                         from lj in leftJ.DefaultIfEmpty()
                         select new MyDirects {
                empleado = l1.empleado, nombre = l1.nombre, axo = lj?.axo ?? Decimal.Zero, estatus = lj?.estatus ?? String.Empty
            }).ToList();


            int i = 0;

            foreach (var item in query)
            {
                empleadoTress add = new empleadoTress();
                add = add.datosTress(item.empleado.Substring(3, item.empleado.Length - 3), item.empleado.Substring(0, 3));
                query.ElementAt(i).puesto = add.puesto;
                query.ElementAt(i).foto   = add.btImagen;
                i++;
            }


            ViewBag.Directos = query;


            return(View());
        }
示例#9
0
        public ActionResult NewUser(string planta, int iempleado, string usuario, string email, string rol, string supervisor, string manager)
        {
            string empleado = Convert.ToString(iempleado);

            usuario = usuario.ToLower();

            if (existeUser(usuario))
            {
                return(RedirectToAction("NewUser", "t_usuarios", new { alert = "1" }));
            }

            if (existeEmployee(planta + empleado))
            {
                return(RedirectToAction("NewUser", "t_usuarios", new { alert = "2" }));
            }

            empleadoTress add = new empleadoTress();

            add = add.datosTress(empleado, planta);

            if (add.nombre == null)
            {
                return(RedirectToAction("NewUser", "t_usuarios", new { alert = "3" }));
            }

            t_usuarios  t_usuarios = new t_usuarios();
            t_empleados t_empleado = new t_empleados();

            t_usuarios.usuario = usuario;
            t_usuarios.nombre  = add.nombre;
            t_usuarios.planta  = planta;
            t_usuarios.email   = email;
            t_usuarios.activo  = "1";
            t_usuarios.rol     = rol;
            t_usuarios.f_id    = System.DateTime.Now;

            t_empleado.empleado = planta + empleado;
            t_empleado.nombre   = add.nombre;
            t_empleado.usuario  = usuario;
            t_empleado.f_id     = System.DateTime.Now;
            t_empleado.planta   = planta;
            if (supervisor == "")
            {
                t_empleado.supervisor = null;
            }
            else
            {
                t_empleado.supervisor = supervisor;
            }

            if (manager == "")
            {
                t_empleado.gerente = null;
            }
            else
            {
                t_empleado.gerente = manager;
            }



            if (ModelState.IsValid)
            {
                db.t_usuarios.Add(t_usuarios);
                db.SaveChanges();
                db.t_empleados.Add(t_empleado);
                db.SaveChanges();
                return(RedirectToAction("Index", "t_usuarios", null));
            }

            return(View());
        }
示例#10
0
        public ActionResult IndexModule4D()
        {
            if (!Login())
            {
                return(RedirectToAction("NoUser", "Home", null));
            }

            string planta = Convert.ToString(Session["Plant"]);

            var configplanta = db.t_plantas.Find(planta);

            if (Convert.ToString(Session["userAccount"]) != configplanta.direct_email)
            {
                return(RedirectToAction("Index", "Home", null));
            }

            string empleado = Convert.ToString(Session["EmployeeNo"]);

            var t_merit    = db.t_merit.Include(t => t.t_empleados).Include(t => t.t_empleados1).Where(x => x.axo == System.DateTime.Now.Year && (x.autoriza == empleado || x.supervisor == empleado)).OrderBy(x => x.supervisor).ToList();
            var t_meridet  = db.t_meridet.Include(t => t.t_califica).Include(t => t.t_empleados).Include(t => t.t_jobcode).Include(t => t.t_merit).Where(x => x.supervisor == empleado && x.axo == System.DateTime.Today.Year).OrderBy(x => x.supervisor).ToList();
            var t_meridet2 = db.t_meridet.Include(t => t.t_califica).Include(t => t.t_empleados).Include(t => t.t_jobcode).Include(t => t.t_merit).Where(x => x.axo == System.DateTime.Today.Year && x.supervisor.Substring(0, 3) == planta).OrderBy(x => x.supervisor).ToList();


            double  approve        = 0;
            decimal totalbudget    = 0;
            decimal totalspent     = 0;
            decimal totalavailable = 0;
            bool    mstatus        = true;
            string  smstatus       = "";
            string  istatus        = "";
            string  estado         = "";
            string  iconocal       = "";
            string  colorcal       = "";
            var     departments    = new List <MyDirects>();
            var     directs        = new List <MyDirects>();

            foreach (var item in t_meridet2)
            {
                if (item.estatus == "AP")
                {
                    approve++;
                }
            }

            foreach (var item in t_merit)
            {
                totalbudget = Convert.ToDecimal(totalbudget + item.budget_imp);
                totalspent  = Convert.ToDecimal(totalspent + item.budget_spen);

                switch (item.estatus)
                {
                case "PE":
                    istatus = "In Process";
                    mstatus = false;
                    break;

                case "AP":
                    istatus = "Completed";
                    mstatus = false;
                    break;

                default:
                    istatus = "Autorized";
                    break;
                }

                MyDirects     ndirect = new MyDirects();
                empleadoTress add     = new empleadoTress();
                add = add.datosTress(item.supervisor.Substring(3, item.supervisor.Length - 3), item.supervisor.Substring(0, 3));

                ndirect.empleado  = item.supervisor;
                ndirect.depto     = item.depto;
                ndirect.nombre    = item.nombre;
                ndirect.foto      = add.btImagen;
                ndirect.dextra1   = Convert.ToDecimal(item.budget_imp);
                ndirect.dextra2   = Convert.ToDecimal(item.budget_spen);
                ndirect.estatusm4 = istatus;
                ndirect.sextra1   = (Math.Round((ndirect.dextra2 / ndirect.dextra1) * 100)).ToString() + "%";
                departments.Add(ndirect);
            }

            if (mstatus)
            {
                smstatus = "Completed";
            }
            else
            {
                smstatus = "In Process";
            }

            foreach (var item in t_meridet)
            {
                switch (item.estatus)
                {
                case "PE":
                    estado = "Pending";
                    break;

                case "AP":
                    estado = "Approved";
                    break;

                default:
                    estado = "No Merit";
                    break;
                }

                switch (item.calificacion)
                {
                case "EE":
                    iconocal = "<i class='fas fa-medal'></i>";
                    colorcal = "warning-color-dark";
                    break;

                case "ME":
                    iconocal = "<i class='fas fa-thumbs-up'></i>";
                    colorcal = "success-color";
                    break;

                case "NI":
                    iconocal = "<i class='fas fa-exclamation'></i>";
                    colorcal = "warning-color";
                    break;

                case "FE":
                    iconocal = "<i class='fas fa-thumbs-down'></i>";
                    colorcal = "danger-color";
                    break;

                default:
                    iconocal = "<i class='fas fa-minus'></i>";
                    colorcal = "stylish-color";
                    break;
                }

                MyDirects     ndirect = new MyDirects();
                empleadoTress add     = new empleadoTress();
                add = add.datosTress(item.empleado.Substring(3, item.empleado.Length - 3), item.empleado.Substring(0, 3));
                ndirect.manager1         = item.supervisor;
                ndirect.empleado         = item.empleado;
                ndirect.nombre           = item.nombre;
                ndirect.estatusm4        = estado;
                ndirect.axom4            = item.axo;
                ndirect.puesto           = item.puesto;
                ndirect.foto             = add.btImagen;
                ndirect.meritrec         = Convert.ToDecimal(item.sugerido_porc);
                ndirect.iconoresult      = iconocal;
                ndirect.coloriconoresult = colorcal;
                ndirect.lump             = Convert.ToDecimal(item.lump_imp);
                directs.Add(ndirect);
            }

            totalavailable      = totalbudget - totalspent;
            ViewBag.budgetper   = t_merit.ElementAt(0).budget_porc;
            ViewBag.tbudget     = totalbudget;
            ViewBag.tspent      = totalspent;
            ViewBag.tavailable  = totalavailable;
            ViewBag.statusmerit = smstatus;

            ViewBag.ApproveCount = approve;
            string aper = Math.Round((approve / t_meridet2.Count) * 100).ToString() + "%";

            ViewBag.ApprovePer = aper;
            ViewBag.MCount     = t_meridet2.Count;

            ViewBag.percent     = Math.Round((ViewBag.tspent / ViewBag.tbudget) * 100);
            ViewBag.departments = departments;
            ViewBag.directs     = directs;


            return(View());
        }
示例#11
0
        public ActionResult IndexModule4(string empleado = "")
        {
            if (!Login())
            {
                return(RedirectToAction("NoUser", "Home", null));
            }

            if (empleado == "")
            {
                empleado = Convert.ToString(Session["EmployeeNo"]);

                var configplanta = db.t_plantas.Find(Convert.ToString(Session["Plant"]));

                if (Convert.ToString(Session["userAccount"]) == configplanta.direct_email)
                {
                    return(RedirectToAction("IndexModule4D", "t_merit", null));
                }
            }


            var t_merit = db.t_merit.Include(t => t.t_empleados).Include(t => t.t_empleados1).Where(x => x.supervisor == empleado && x.axo == System.DateTime.Now.Year).ToList();

            if (!t_merit.Any())
            {
                return(RedirectToAction("Index", "Home", null));
            }

            var t_meridet = db.t_meridet.Include(t => t.t_califica).Include(t => t.t_empleados).Include(t => t.t_jobcode).Include(t => t.t_merit).Where(x => x.supervisor == empleado && x.axo == System.DateTime.Today.Year).ToList();
            var directs   = new List <MyDirects>();

            string estado   = "";
            string iconocal = "";
            string colorcal = "";

            double approve = 0;

            foreach (var item in t_meridet)
            {
                switch (item.estatus)
                {
                case "PE":
                    estado = "Pending";
                    break;

                case "AP":
                    estado = "Approved";
                    approve++;
                    break;

                default:
                    estado = "No Merit";
                    break;
                }

                switch (item.calificacion)
                {
                case "EE":
                    iconocal = "<i class='fas fa-medal'></i>";
                    colorcal = "warning-color-dark";
                    break;

                case "ME":
                    iconocal = "<i class='fas fa-thumbs-up'></i>";
                    colorcal = "success-color";
                    break;

                case "NI":
                    iconocal = "<i class='fas fa-exclamation'></i>";
                    colorcal = "warning-color";
                    break;

                case "FE":
                    iconocal = "<i class='fas fa-thumbs-down'></i>";
                    colorcal = "danger-color";
                    break;

                default:
                    iconocal = "<i class='fas fa-minus'></i>";
                    colorcal = "stylish-color";
                    break;
                }

                MyDirects     ndirect = new MyDirects();
                empleadoTress add     = new empleadoTress();
                add = add.datosTress(item.empleado.Substring(3, item.empleado.Length - 3), item.empleado.Substring(0, 3));
                ndirect.manager1         = item.supervisor;
                ndirect.empleado         = item.empleado;
                ndirect.nombre           = item.nombre;
                ndirect.estatusm4        = estado;
                ndirect.axom4            = item.axo;
                ndirect.puesto           = item.puesto;
                ndirect.foto             = add.btImagen;
                ndirect.meritrec         = Convert.ToDecimal(item.sugerido_porc);
                ndirect.iconoresult      = iconocal;
                ndirect.coloriconoresult = colorcal;
                ndirect.lump             = Convert.ToDecimal(item.lump_imp);
                directs.Add(ndirect);
            }

            ViewBag.ApproveCount = approve;
            ViewBag.Directos     = directs;
            string aper = Math.Round((approve / directs.Count) * 100).ToString() + "%";

            ViewBag.ApprovePer = aper;

            ViewBag.merit     = t_merit.ElementAt(0);
            ViewBag.available = t_merit.ElementAt(0).budget_imp - t_merit.ElementAt(0).budget_spen;
            ViewBag.percent   = Convert.ToString(Math.Round(Convert.ToDouble((t_merit.ElementAt(0).budget_spen / t_merit.ElementAt(0).budget_imp) * 100)));

            string statusmerit = "";

            switch (t_merit.ElementAt(0).estatus)
            {
            case "PE":
                statusmerit = "In Process";
                break;

            case "AP":
                statusmerit = "Completed";
                break;

            case "AU":
                statusmerit = "Autorized";
                break;

            case "AA":
                statusmerit = "Aplied";
                break;

            default:
                statusmerit = "No Merit";
                break;
            }



            ViewBag.statusmerit = statusmerit;

            return(View());
        }
示例#12
0
        public ActionResult MeritProcess(string empleado, decimal axo, string supervisor)
        {
            if (!Login())
            {
                return(RedirectToAction("NoUser", "Home", null));
            }

            var t_merit = db.t_merit.Include(t => t.t_empleados).Include(t => t.t_empleados1).Where(x => x.supervisor == supervisor && x.axo == System.DateTime.Now.Year).ToList();

            if (!t_merit.Any())
            {
                return(RedirectToAction("Index", "Home", null));
            }


            ViewBag.spent     = t_merit.ElementAt(0).budget_spen;
            ViewBag.available = t_merit.ElementAt(0).budget_imp - t_merit.ElementAt(0).budget_spen;
            ViewBag.percent   = Convert.ToString(Math.Round((ViewBag.available / t_merit.ElementAt(0).budget_imp) * 100));

            var t_meridet = db.t_meridet.Find(supervisor, axo, empleado);

            MyDirects     ndirect = new MyDirects();
            empleadoTress add     = new empleadoTress();

            add = add.datosTress(empleado.Substring(3, empleado.Length - 3), empleado.Substring(0, 3));
            ndirect.empleado = empleado;
            ndirect.nombre   = t_meridet.nombre;
            ndirect.depto    = add.depto;
            ndirect.puesto   = add.puesto;
            ndirect.foto     = add.btImagen;
            string iconocal = "";
            string colorcal = "";

            switch (t_meridet.calificacion)
            {
            case "EE":
                iconocal = "<i class='fas fa-medal'></i>";
                colorcal = "warning-color-dark";
                break;

            case "ME":
                iconocal = "<i class='fas fa-thumbs-up'></i>";
                colorcal = "success-color";
                break;

            case "NI":
                iconocal = "<i class='fas fa-exclamation'></i>";
                colorcal = "warning-color";
                break;

            case "FE":
                iconocal = "<i class='fas fa-thumbs-down'></i>";
                colorcal = "danger-color";
                break;

            default:
                iconocal = "<i class='fas fa-minus'></i>";
                colorcal = "stylish-color";
                break;
            }

            ViewBag.colorcal = colorcal;
            ViewBag.iconocal = iconocal;

            try
            {
                ndirect.manager1 = t_meridet.t_empleados.t_empleados2.nombre;
            }
            catch
            {
                ndirect.manager1 = null;
            }
            try
            {
                ndirect.manager2 = t_meridet.t_empleados.t_empleados2.t_empleados2.nombre;
            }
            catch
            {
                ndirect.manager2 = null;
            }

            ViewBag.direct   = ndirect;
            ViewBag.merit    = t_meridet;
            ViewBag.bamount  = Math.Truncate(100 * (Convert.ToDouble((t_meridet.salario_axo * t_meridet.budget_porc) / 100))) / 100;
            ViewBag.maxmerit = ViewBag.bamount * 2;


            decimal meritg1 = Convert.ToDecimal((t_meridet.t_califica.rango_ini * t_merit.ElementAt(0).budget_porc)) / 100;
            decimal meritg2 = Convert.ToDecimal((t_meridet.t_califica.rango_fin * t_merit.ElementAt(0).budget_porc)) / 100;

            ViewBag.merithstatus = t_merit.ElementAt(0).estatus;
            ViewBag.meritg1      = meritg1;
            ViewBag.meritg2      = meritg2;
            return(View());
        }
示例#13
0
        // GET: t_objetidet/Create
        public ActionResult Create(string empleado, decimal axo)
        {
            if (!Login())
            {
                return(RedirectToAction("NoUser", "Home", null));
            }

            empleado = Convert.ToString(Session["EmployeeNo"]);
            int totalweight    = 0;
            var objetivoHeader = db.t_objetivos.Include(t => t.t_empleados).Include(t => t.t_plantas).Where(x => x.empleado == empleado && x.axo == axo).ToList().ElementAt(0);

            if (objetivoHeader.estatus != "PE")
            {
                return(RedirectToAction("Approval", new { empleado = objetivoHeader.empleado, axo = objetivoHeader.axo }));
            }

            ViewBag.Objective = objetivoHeader;

            try
            {
                ViewBag.Manager = objetivoHeader.t_empleados.t_empleados2.nombre;
            }
            catch
            {
                ViewBag.Manager = null;
            }

            try
            {
                ViewBag.Manager2 = objetivoHeader.t_empleados.t_empleados2.t_empleados2.nombre;
            }
            catch
            {
                ViewBag.Manager2 = null;
            }

            var ObjectivesDet = db.t_objetidet.Include(t => t.t_objetivos).Where(x => x.empleado == objetivoHeader.empleado && x.axo == objetivoHeader.axo);

            foreach (var item in ObjectivesDet)
            {
                totalweight = totalweight + Convert.ToInt16(item.peso);
            }

            ViewBag.TotalWeight   = totalweight;
            ViewBag.ObjectivesQty = ObjectivesDet.ToList().Count();
            ViewBag.ObjectivesDet = ObjectivesDet;
            try
            {
                ViewBag.NextObjective = ObjectivesDet.OrderByDescending(x => x.consec).ToList().ElementAt(0).consec + 1;
            }
            catch
            {
                ViewBag.NextObjective = 1;
            }

            if (objetivoHeader.n_aprobado != null)
            {
                ViewBag.Rechazado = "1";
            }
            else
            {
                ViewBag.Rechazado = "0";
            }

            empleadoTress add = new empleadoTress();

            add = add.datosTress(empleado.Substring(3, empleado.Length - 3), empleado.Substring(0, 3));

            ViewBag.infoTress = add;

            ViewBag.folio  = new SelectList(db.t_objetivos, "folio", "folio");
            ViewBag.planta = new SelectList(db.t_plantas, "planta", "planta");
            return(View());
        }
示例#14
0
        public ActionResult MenuModule1()
        {
            if (!Login())
            {
                return(RedirectToAction("NoUser", "Home", null));
            }

            bool newobj = false;

            string empleado = Convert.ToString(Session["EmployeeNo"]);

            ViewBag.empleado = empleado;

            var t_objetivos = db.t_objetivos.Include(t => t.t_empleados).Include(t => t.t_plantas).Where(x => x.empleado == empleado).OrderByDescending(x => x.axo).ToList();
            var t_empleados = db.t_empleados.Include(t => t.t_plantas).Include(t => t.t_usuarios).Include(t => t.t_empleados2).Where(x => x.supervisor == empleado).ToList();
            var t_empleado  = db.t_empleados.Find(empleado);

            ViewBag.Empoyee = t_empleado;
            try
            {
                ViewBag.Manager = t_empleado.t_empleados2.nombre;
            }
            catch
            {
                ViewBag.Manager = null;
            }

            try
            {
                ViewBag.Manager2 = t_empleado.t_empleados2.t_empleados2.nombre;
            }
            catch
            {
                ViewBag.Manager2 = null;
            }
            var t_config_m1 = db.t_config_m1.ToList().ElementAt(0);

            int i = 0;

            if (t_objetivos.Any())
            {
                foreach (var item in t_objetivos)
                {
                    if (item.axo == t_config_m1.axo_activo)
                    {
                        i++;
                    }
                }
            }
            else
            {
                newobj = true;
            }

            if (i == 0)
            {
                newobj = true;
            }

            if (System.DateTime.Now >= t_config_m1.f_objini && newobj)
            {
                ViewBag.NewObjective = "1";
                ViewBag.NewYear      = t_config_m1.axo_activo;
            }
            if (t_empleados.Any())
            {
                ViewBag.DReports = "1";
            }

            empleadoTress add = new empleadoTress();

            ViewBag.DTRESS = add.datosTress(empleado.Substring(3, empleado.Length - 3), empleado.Substring(0, 3));

            return(View(t_objetivos));
        }