Ejemplo n.º 1
0
 public ActionResult Nuevo(ro_empleado_proyeccion_gastos_Info info)
 {
     try
     {
         if (ModelState.IsValid)
         {
             info.list_proyeciones = ro_empleado_proyeccion_gastos_det_Info_lis.get_list(info.IdTransaccionSession);
             int IdEmpresa = Convert.ToInt32(SessionFixed.IdEmpresa);
             info.IdEmpresa = IdEmpresa;
             if (!bus_proyeccion.guardarDB(info))
             {
                 return(View(info));
             }
             else
             {
                 return(RedirectToAction("Index"));
             }
         }
         else
         {
             return(View(info));
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
        public ActionResult Modificar(ro_empleado_proyeccion_gastos_Info info)
        {
            try
            {
                ro_tipo_gastos_personales_maxim_x_anio_Bus bus_detalle_techo_x_anio = new ro_tipo_gastos_personales_maxim_x_anio_Bus();

                if (ModelState.IsValid)
                {
                    var gastos = bus_detalle_techo_x_anio.get_list_gastos_tope_x_anio(info.AnioFiscal);

                    if (gastos == null)
                    {
                        cargar_combo();
                        ViewBag.mensaje = "No existen valores maximo registrado para el periodo fiscal";
                        return(View(info));
                    }
                    else
                    {
                        if (gastos.Count() == 0)
                        {
                            cargar_combo();
                            ViewBag.mensaje = "No existen valores maximo registrado para el periodo fiscal";
                            return(View(info));
                        }
                    }
                    info.list_proyeciones = ro_empleado_proyeccion_gastos_det_Info_lis.get_list(info.IdTransaccionSession);

                    foreach (var item in info.list_proyeciones)
                    {
                        gastos = bus_detalle_techo_x_anio.get_list_gastos_tope_x_anio(info.AnioFiscal);

                        if (gastos.Where(v => v.AnioFiscal == info.AnioFiscal && v.IdTipoGasto == item.IdTipoGasto && v.Monto_max < item.Valor).Count() > 0)
                        {
                            cargar_combo();
                            ViewBag.mensaje = "El tipo de gasto " + item.IdTipoGasto + " supera el valor maximo deducible";
                            return(View(info));
                        }
                    }

                    if (!bus_proyeccion.modificarDB(info))
                    {
                        SessionFixed.IdTransaccionSessionActual = info.IdTransaccionSession.ToString();
                        cargar_combo();
                        return(View(info));
                    }
                    else
                    {
                        return(RedirectToAction("Index"));
                    }
                }
                else
                {
                    return(View(info));
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 3
0
 public ActionResult Modificar(ro_empleado_proyeccion_gastos_Info info)
 {
     try
     {
         if (ModelState.IsValid)
         {
             info.list_proyeciones = ro_empleado_proyeccion_gastos_det_Info_lis.get_list(info.IdTransaccionSession);
             if (!bus_proyeccion.modificarDB(info))
             {
                 return(View(info));
             }
             else
             {
                 return(RedirectToAction("Index"));
             }
         }
         else
         {
             return(View(info));
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Ejemplo n.º 4
0
        public ActionResult Anular(decimal IdEmpleado = 0, int IdTransaccion = 0)
        {
            try
            {
                #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

                int IdEmpresa = Convert.ToInt32(SessionFixed.IdEmpresa);
                ro_empleado_proyeccion_gastos_Info model = bus_proyeccion.get_info(IdEmpresa, IdEmpleado, IdTransaccion);
                model.list_proyeciones = bus_det.get_list(IdEmpresa, model.IdTransaccion);
                ro_empleado_proyeccion_gastos_det_Info_lis.set_list(model.list_proyeciones, Convert.ToDecimal(SessionFixed.IdTransaccionSessionActual));
                model.IdTransaccion = Convert.ToDecimal(SessionFixed.IdTransaccionSession);
                return(View(model));
            }
            catch (Exception)
            {
                throw;
            }
        }
        public ro_empleado_proyeccion_gastos_Info get_info(int IdEmpresa, decimal IdEmpleado, int IdTransaccion)
        {
            try
            {
                ro_empleado_proyeccion_gastos_Info info = new ro_empleado_proyeccion_gastos_Info();

                using (Entities_rrhh Context = new Entities_rrhh())
                {
                    ro_empleado_proyeccion_gastos Entity = Context.ro_empleado_proyeccion_gastos.FirstOrDefault(q => q.IdEmpresa == IdEmpresa && q.IdEmpleado == IdEmpleado && q.IdTransaccion == IdTransaccion);
                    if (Entity == null)
                    {
                        return(null);
                    }

                    info = new ro_empleado_proyeccion_gastos_Info
                    {
                        IdEmpresa     = Entity.IdEmpresa,
                        IdTransaccion = Entity.IdTransaccion,
                        IdEmpleado    = Entity.IdEmpleado,
                        AnioFiscal    = Entity.AnioFiscal,
                        Observacion   = Entity.Observacion,
                    };
                }

                return(info);
            }
            catch (Exception)
            {
                throw;
            }
        }
        public bool anularDB(ro_empleado_proyeccion_gastos_Info info)
        {
            try
            {
                using (Entities_rrhh Context = new Entities_rrhh())
                {
                    ro_empleado_proyeccion_gastos Entity = Context.ro_empleado_proyeccion_gastos.FirstOrDefault(q => q.IdEmpresa == info.IdEmpresa && q.IdTransaccion == info.IdTransaccion);
                    if (Entity == null)
                    {
                        return(false);
                    }
                    Entity.estado          = info.estado = false;
                    Entity.Fecha_UltAnu    = info.Fecha_UltAnu = DateTime.Now;
                    Entity.IdUsuarioUltAnu = info.IdUsuarioUltAnu;



                    Context.SaveChanges();
                }

                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 7
0
 public ActionResult Nuevo()
 {
     try
     {
         #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_empleado_proyeccion_gastos_Info info = new ro_empleado_proyeccion_gastos_Info
         {
             AnioFiscal           = DateTime.Now.Year,
             IdTransaccionSession = Convert.ToDecimal(SessionFixed.IdTransaccionSession)
         };
         cargar_combo();
         return(View(info));
     }
     catch (Exception)
     {
         throw;
     }
 }
Ejemplo n.º 8
0
        public bool anularDB(ro_empleado_proyeccion_gastos_Info info)
        {
            try
            {
                using (Entities_rrhh Context = new Entities_rrhh())
                {
                    //ro_empleado_proyeccion_gastos Entity = Context.ro_empleado_proyeccion_gastos.FirstOrDefault(q => q.IdEmpresa == info.IdEmpresa && q.IdTransaccion == info.IdTransaccion);

                    //ro_empleado_proyeccion_gastos_det EntityDet = Context.ro_empleado_proyeccion_gastos_det.FirstOrDefault(q => q.IdEmpresa == info.IdEmpresa && q.IdTransaccion == info.IdTransaccion);
                    //if (Entity == null)
                    //    return false;
                    //Entity.estado = info.estado = false;
                    //Entity.Fecha_UltAnu = info.Fecha_UltAnu = DateTime.Now;
                    //Entity.IdUsuarioUltAnu = info.IdUsuarioUltAnu;

                    var sql_cab = "delete from ro_empleado_proyeccion_gastos_det where IdEmpresa =" + info.IdEmpresa + " and IdTransaccion = " + info.IdTransaccion;
                    var sql_det = "delete from ro_empleado_proyeccion_gastos where IdEmpresa =" + info.IdEmpresa + " and IdTransaccion = " + info.IdTransaccion;

                    Context.Database.ExecuteSqlCommand(sql_cab);
                    Context.Database.ExecuteSqlCommand(sql_det);
                    //Context.SaveChanges();
                }

                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 9
0
        public ActionResult EditingDelete([ModelBinder(typeof(DevExpressEditorsBinder))] ro_empleado_proyeccion_gastos_det_Info info_det)
        {
            ro_empleado_proyeccion_gastos_det_Info_lis.DeleteRow(info_det.Secuencia, Convert.ToDecimal(SessionFixed.IdTransaccionSessionActual));
            ro_empleado_proyeccion_gastos_Info model = new ro_empleado_proyeccion_gastos_Info();

            model.list_proyeciones = ro_empleado_proyeccion_gastos_det_Info_lis.get_list(Convert.ToDecimal(SessionFixed.IdTransaccionSessionActual));
            cargar_combo();
            return(PartialView("_GridViewPartial_proyeccion_gastos_det", model));
        }
 public bool anularDB(ro_empleado_proyeccion_gastos_Info info)
 {
     try
     {
         return(odata.anularDB(info));
     }
     catch (Exception)
     {
         throw;
     }
 }
Ejemplo n.º 11
0
 public ActionResult GridViewPartial_proyeccion_gastos_det(int IdEmpresa, decimal IdTransaccion)
 {
     try
     {
         cargar_combo();
         ro_empleado_proyeccion_gastos_Info model = new ro_empleado_proyeccion_gastos_Info();
         SessionFixed.IdTransaccionSessionActual = Request.Params["TransaccionFixed"] != null ? Request.Params["TransaccionFixed"].ToString() : SessionFixed.IdTransaccionSessionActual;
         model.list_proyeciones = ro_empleado_proyeccion_gastos_det_Info_lis.get_list(Convert.ToDecimal(SessionFixed.IdTransaccionSessionActual));
         return(PartialView("_GridViewPartial_proyeccion_gastos_det", model));
     }
     catch (Exception)
     {
         throw;
     }
 }
Ejemplo n.º 12
0
        public ActionResult EditingAddNew([ModelBinder(typeof(DevExpressEditorsBinder))] ro_empleado_proyeccion_gastos_det_Info info_det)
        {
            ro_empleado_proyeccion_gastos_Info model = new ro_empleado_proyeccion_gastos_Info();

            if (ModelState.IsValid)
            {
                var lista_tmp = ro_empleado_proyeccion_gastos_det_Info_lis.get_list(Convert.ToDecimal(SessionFixed.IdTransaccionSessionActual));
                if (lista_tmp.Where(v => v.IdTipoGasto == info_det.IdTipoGasto).Count() == 0)
                {
                    ro_empleado_proyeccion_gastos_det_Info_lis.AddRow(info_det, Convert.ToDecimal(SessionFixed.IdTransaccionSessionActual));
                }
                model.list_proyeciones = ro_empleado_proyeccion_gastos_det_Info_lis.get_list(Convert.ToDecimal(SessionFixed.IdTransaccionSessionActual));
            }
            cargar_combo();
            return(PartialView("_GridViewPartial_proyeccion_gastos_det", model));
        }
Ejemplo n.º 13
0
 public ActionResult Anular(ro_empleado_proyeccion_gastos_Info info)
 {
     try
     {
         if (!bus_proyeccion.anularDB(info))
         {
             return(View(info));
         }
         else
         {
             return(RedirectToAction("Index"));
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
 public ActionResult Anular(ro_empleado_proyeccion_gastos_Info info)
 {
     try
     {
         if (!bus_proyeccion.anularDB(info))
         {
             SessionFixed.IdTransaccionSessionActual = info.IdTransaccionSession.ToString();
             cargar_combo();
             return(View(info));
         }
         else
         {
             return(RedirectToAction("Index"));
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
        public bool guardarDB(ro_empleado_proyeccion_gastos_Info info)
        {
            try
            {
                using (Entities_rrhh Context = new Entities_rrhh())
                {
                    ro_empleado_proyeccion_gastos Entity = new ro_empleado_proyeccion_gastos
                    {
                        IdEmpresa     = info.IdEmpresa,
                        IdTransaccion = info.IdTransaccion = get_id(info.IdEmpresa),
                        IdEmpleado    = info.IdEmpleado,
                        AnioFiscal    = info.AnioFiscal,
                        Observacion   = info.Observacion,
                        estado        = true,
                        Fecha_Transac = DateTime.Now
                    };
                    Context.ro_empleado_proyeccion_gastos.Add(Entity);

                    foreach (var item in info.list_proyeciones)
                    {
                        ro_empleado_proyeccion_gastos_det Entity_det = new ro_empleado_proyeccion_gastos_det
                        {
                            IdEmpresa     = info.IdEmpresa,
                            IdTransaccion = info.IdTransaccion,
                            IdTipoGasto   = item.IdTipoGasto,
                            Valor         = item.Valor,
                            Observacion   = item.Observacion,
                            Secuencia     = item.Secuencia
                        };
                        Context.ro_empleado_proyeccion_gastos_det.Add(Entity_det);
                    }
                    Context.SaveChanges();
                }
                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }
        public bool modificarDB(ro_empleado_proyeccion_gastos_Info info)
        {
            try
            {
                using (Entities_rrhh Context = new Entities_rrhh())
                {
                    ro_empleado_proyeccion_gastos Entity = Context.ro_empleado_proyeccion_gastos.FirstOrDefault(q => q.IdEmpresa == info.IdEmpresa && q.IdTransaccion == info.IdTransaccion);
                    if (Entity == null)
                    {
                        return(false);
                    }
                    Entity.Observacion = info.Observacion;
                    Entity.IdEmpleado  = info.IdEmpleado;
                    Entity.AnioFiscal  = info.AnioFiscal;

                    var select = Context.ro_empleado_proyeccion_gastos_det.Where(q => q.IdEmpresa == info.IdEmpresa && q.IdTransaccion == info.IdTransaccion);
                    Context.ro_empleado_proyeccion_gastos_det.RemoveRange(select);
                    foreach (var item in info.list_proyeciones)
                    {
                        ro_empleado_proyeccion_gastos_det Entity_det = new ro_empleado_proyeccion_gastos_det
                        {
                            IdEmpresa     = info.IdEmpresa,
                            IdTransaccion = info.IdTransaccion,
                            IdTipoGasto   = item.IdTipoGasto,
                            Valor         = item.Valor,
                            Observacion   = item.Observacion,
                            Secuencia     = item.Secuencia
                        };
                        Context.ro_empleado_proyeccion_gastos_det.Add(Entity_det);
                    }
                    Context.SaveChanges();
                }

                return(true);
            }
            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_empleado_proyeccion_gastos_Info model = new ro_empleado_proyeccion_gastos_Info
            {
                IdEmpresa            = Convert.ToInt32(SessionFixed.IdEmpresa),
                IdTransaccionSession = Convert.ToDecimal(SessionFixed.IdTransaccionSession)
            };

            List <ro_empleado_proyeccion_gastos_Info> lista = bus_proyeccion.get_list(model.IdEmpresa);
            Lista_Proyeccion.set_list(lista, Convert.ToDecimal(SessionFixed.IdTransaccionSession));

            return(View(model));
        }
Ejemplo n.º 18
0
        public ActionResult CmbEmpleado_proyeccion()
        {
            ro_empleado_proyeccion_gastos_Info model = new ro_empleado_proyeccion_gastos_Info();

            return(PartialView("_CmbEmpleado_proyeccion", model));
        }