Пример #1
0
        public ActionResult Nuevo(int IdEmpresa = 0)
        {
            #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
            #region Permisos
            seg_Menu_x_Empresa_x_Usuario_Info info = bus_permisos.get_list_menu_accion(Convert.ToInt32(SessionFixed.IdEmpresa), SessionFixed.IdUsuario, "ActivoFijo", "DepreciacionAF", "Index");
            if (!info.Nuevo)
            {
                return(RedirectToAction("Index"));
            }
            #endregion
            Af_Depreciacion_Info model = new Af_Depreciacion_Info
            {
                IdEmpresa            = IdEmpresa,
                Fecha_Depreciacion   = DateTime.Now.Date,
                IdPeriodo            = Convert.ToInt32(DateTime.Now.Date.ToString("yyyyMM")),
                lst_detalle          = new List <Af_Depreciacion_Det_Info>(),
                lst_detalle_ct       = new List <ct_cbtecble_det_Info>(),
                IdTransaccionSession = Convert.ToDecimal(SessionFixed.IdTransaccionSessionActual)
            };

            lst_depreciacion_det.set_list(model.lst_detalle, model.IdTransaccionSession);
            lst_comprobante_detalle.set_list(model.lst_detalle_ct, model.IdTransaccionSession);
            cargar_combos(IdEmpresa);
            return(View(model));
        }
Пример #2
0
 public bool guardarDB(Af_Depreciacion_Info info)
 {
     try
     {
         var i_param          = odata_param.get_info(info.IdEmpresa);
         var info_ct_cbtecble = odata_ct.armar_info(info.lst_detalle_ct, info.IdEmpresa, 1, i_param.IdTipoCbte, 0, "Depreciación " + info.IdPeriodo.ToString() + info.Descripcion, info.Fecha_Depreciacion);
         if (odata_ct.guardarDB(info_ct_cbtecble))
         {
             info.IdEmpresa_ct = info_ct_cbtecble.IdEmpresa;
             info.IdTipoCbte   = info_ct_cbtecble.IdTipoCbte;
             info.IdCbteCble   = info_ct_cbtecble.IdCbteCble;
             if (odata.guardarDB(info))
             {
                 return(true);
             }
         }
         return(false);
     }
     catch (Exception ex)
     {
         tb_LogError_Bus LogData = new tb_LogError_Bus();
         LogData.GuardarDB(new tb_LogError_Info {
             Descripcion = ex.Message, InnerException = ex.InnerException == null ? null : ex.InnerException.Message, Clase = "Af_Depreciacion_Bus", Metodo = "guardarDB", IdUsuario = info.IdUsuario
         });
         return(false);
     }
 }
Пример #3
0
 public Boolean ModificarDB(Af_Depreciacion_Info Info, ref string msjError)
 {
     try
     {
         using (EntitiesActivoFijo Context = new EntitiesActivoFijo())
         {
             var contact = Context.Af_Depreciacion.FirstOrDefault(q => q.IdEmpresa == Info.IdEmpresa && q.IdDepreciacion == Info.IdDepreciacion && q.IdTipoDepreciacion == Info.IdTipoDepreciacion);
             if (Context != null)
             {
                 //contact.IdUsuarioUltMod = Info.IdUsuarioUltAnu;
                 //contact.Fecha_UltMod = Info.Fecha_UltAnu;
                 contact.Descripcion        = Info.Descripcion;
                 contact.Fecha_Depreciacion = Info.Fecha_Depreciacion;
                 Context.SaveChanges();
             }
         }
         return(true);
     }
     catch (Exception ex)
     {
         string arreglo = ToString();
         tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "",
                                                                                   "", "", "", "", DateTime.Now);
         oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
         mensaje  = ex.ToString() + " " + ex.Message;
         msjError = mensaje;
         throw new Exception(ex.ToString());
     }
 }
Пример #4
0
        private bool validar(Af_Depreciacion_Info i_validar, ref string msg)
        {
            i_validar.lst_detalle = lst_depreciacion_det.get_list(i_validar.IdTransaccionSession);
            if (i_validar.lst_detalle.Count == 0)
            {
                msg = "No existen activos a depreciarse";
                return(false);
            }
            i_validar.lst_detalle_ct = lst_comprobante_detalle.get_list(i_validar.IdTransaccionSession);
            if (i_validar.lst_detalle_ct.Count == 0)
            {
                mensaje = "Debe ingresar registros en el detalle, por favor verifique";
                return(false);
            }

            foreach (var item in i_validar.lst_detalle_ct)
            {
                if (string.IsNullOrEmpty(item.IdCtaCble))
                {
                    mensaje = "Faltan cuentas contables, por favor verifique";
                    return(false);
                }
            }
            if (i_validar.lst_detalle_ct.Sum(q => q.dc_Valor) != 0)
            {
                mensaje = "La suma de los detalles debe ser 0, por favor verifique";
                return(false);
            }
            if (i_validar.lst_detalle_ct.Where(q => q.dc_Valor == 0).Count() > 0)
            {
                mensaje = "Existen detalles con valor 0 en el debe o haber, por favor verifique";
                return(false);
            }
            return(true);
        }
Пример #5
0
        void LimpiarDatos()
        {
            try
            {
                _Accion = Cl_Enumeradores.eTipo_action.grabar;
                btnProcesarDepre.Enabled = true;
                btnContabilizar.Enabled  = false;
                lblContabilizado.Visible = false;
                InfoDepre            = new Af_Depreciacion_Info();
                cmbPeriodo.EditValue = null;
                txtIdDepre.EditValue = "";

                txtCodDepre.EditValue    = "";
                txtDescripcion.EditValue = "";

                txtCantActDepre.EditValue = "";
                txtTotActivo.EditValue    = "";
                txtTotDepre.EditValue     = "";
                txtTotDepreAcum.EditValue = "";
                txtTotImpLibros.EditValue = "";

                InfoDepre.ListDetalle      = new List <Af_Depreciacion_Det_Info>();
                gridActivoDepre.DataSource = new List <vwAf_ActivoFijo_Info>();

                CbteCbleInfo    = new ct_Cbtecble_Info();
                lstValoresDepre = new List <vwAf_Valores_Depre_Contabilizar_Info>();
            }
            catch (Exception ex)
            {
                Log_Error_bus.Log_Error(ex.ToString());
                MessageBox.Show(ex.ToString(), param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #6
0
        public bool anularDB(Af_Depreciacion_Info info)
        {
            try
            {
                using (Entities_activo_fijo Context = new Entities_activo_fijo())
                {
                    Af_Depreciacion Entity = Context.Af_Depreciacion.FirstOrDefault(q => q.IdEmpresa == info.IdEmpresa && q.IdDepreciacion == info.IdDepreciacion);
                    if (Entity == null)
                    {
                        return(false);
                    }

                    Entity.Estado = info.Estado = "I";

                    Entity.IdUsuarioUltAnu = info.IdUsuarioUltAnu;
                    Entity.Fecha_UltAnu    = DateTime.Now;
                    Context.SaveChanges();
                }
                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }
Пример #7
0
 public ActionResult Anular(int IdEmpresa = 0, decimal IdDepreciacion = 0)
 {
     #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
     #region Permisos
     seg_Menu_x_Empresa_x_Usuario_Info info = bus_permisos.get_list_menu_accion(Convert.ToInt32(SessionFixed.IdEmpresa), SessionFixed.IdUsuario, "ActivoFijo", "DepreciacionAF", "Index");
     if (!info.Anular)
     {
         return(RedirectToAction("Index"));
     }
     #endregion
     Af_Depreciacion_Info model = bus_depreciacion.get_info(IdEmpresa, IdDepreciacion);
     if (model == null)
     {
         return(RedirectToAction("Index"));
     }
     model.lst_detalle          = bus_depreciacion_det.get_list(IdEmpresa, IdDepreciacion);
     model.lst_detalle_ct       = bus_comprobante_detalle.get_list(IdEmpresa, Convert.ToInt32(model.IdTipoCbte), Convert.ToInt32(model.IdCbteCble));
     model.IdTransaccionSession = Convert.ToDecimal(SessionFixed.IdTransaccionSessionActual);
     lst_depreciacion_det.set_list(model.lst_detalle, model.IdTransaccionSession);
     lst_comprobante_detalle.set_list(model.lst_detalle_ct, model.IdTransaccionSession);
     cargar_combos(IdEmpresa);
     return(View(model));
 }
Пример #8
0
        public Boolean EliminarDB(Af_Depreciacion_Info Info, ref string msjError)
        {
            try
            {
                using (EntitiesActivoFijo Context = new EntitiesActivoFijo())
                {
                    foreach (var item in Info.ListDetalle)
                    {
                        item.IdDepreciacion     = Info.IdDepreciacion;
                        item.IdTipoDepreciacion = Info.IdTipoDepreciacion;
                    }
                    dataDetalle.EliminarDB(Info.ListDetalle, ref msjError);

                    var contact = Context.Af_Depreciacion.FirstOrDefault(q => q.IdEmpresa == Info.IdEmpresa && q.IdDepreciacion == Info.IdDepreciacion && q.IdTipoDepreciacion == Info.IdTipoDepreciacion);
                    if (contact != null)
                    {
                        Context.Af_Depreciacion.Remove(contact);
                        Context.SaveChanges();
                    }
                }
                return(true);
            }
            catch (Exception ex)
            {
                string arreglo = ToString();
                tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "",
                                                                                          "", "", "", "", DateTime.Now);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                mensaje  = ex.ToString() + " " + ex.Message;
                msjError = mensaje;
                throw new Exception(ex.ToString());
            }
        }
 public bool guardarDB(Af_Depreciacion_Info info)
 {
     try
     {
         using (Entities_activo_fijo Context = new Entities_activo_fijo())
         {
             Af_Depreciacion Entity = new Af_Depreciacion
             {
                 IdEmpresa           = info.IdEmpresa,
                 IdDepreciacion      = info.IdDepreciacion = get_id(info.IdEmpresa),
                 IdPeriodo           = info.IdPeriodo,
                 Cod_Depreciacion    = info.Cod_Depreciacion,
                 Descripcion         = info.Descripcion,
                 Estado              = info.Estado = "A",
                 Fecha_Depreciacion  = info.Fecha_Depreciacion.Date,
                 Num_Act_Depre       = info.Num_Act_Depre,
                 Valor_Tot_Act       = info.Valor_Tot_Act,
                 Valor_Tot_Depre     = info.Valor_Tot_Depre,
                 Valor_Tot_DepreAcum = info.Valor_Tot_DepreAcum,
                 Valot_Tot_Importe   = info.Valot_Tot_Importe,
                 IdEmpresa_ct        = info.IdEmpresa_ct,
                 IdTipoCbte          = info.IdTipoCbte,
                 IdCbteCble          = info.IdCbteCble,
                 IdUsuario           = info.IdUsuario,
                 Fecha_Transac       = DateTime.Now,
             };
             Context.Af_Depreciacion.Add(Entity);
             int secuencia = 1;
             foreach (var item in info.lst_detalle)
             {
                 Af_Depreciacion_Det Entity_d = new Af_Depreciacion_Det
                 {
                     IdEmpresa          = info.IdEmpresa,
                     IdActivoFijo       = item.IdActivoFijo,
                     IdDepreciacion     = info.IdDepreciacion,
                     Concepto           = item.Concepto,
                     Porc_Depreciacion  = item.Porc_Depreciacion,
                     Secuencia          = item.Secuencia = secuencia++,
                     Valor_Compra       = item.Valor_Compra,
                     Valor_Depreciacion = item.Valor_Depreciacion,
                     Valor_Depre_Acum   = item.Valor_Depre_Acum,
                     Valor_Salvamento   = item.Valor_Salvamento,
                     Vida_Util          = item.Vida_Util
                 };
                 Context.Af_Depreciacion_Det.Add(Entity_d);
             }
             Context.SaveChanges();
         }
         return(true);
     }
     catch (Exception ex)
     {
         tb_LogError_Data LogData = new tb_LogError_Data();
         LogData.GuardarDB(new tb_LogError_Info {
             Descripcion = ex.Message, InnerException = ex.InnerException == null ? null : ex.InnerException.Message, Clase = "Af_Depreciacion_Data", Metodo = "guardarDB", IdUsuario = info.IdUsuario
         });
         return(false);
     }
 }
Пример #10
0
        public ActionResult GridViewPartial_depreciacion_det()
        {
            SessionFixed.IdTransaccionSessionActual = Request.Params["TransaccionFixed"] != null ? Request.Params["TransaccionFixed"].ToString() : SessionFixed.IdTransaccionSessionActual;
            Af_Depreciacion_Info model = new Af_Depreciacion_Info();

            model.lst_detalle = lst_depreciacion_det.get_list(Convert.ToDecimal(SessionFixed.IdTransaccionSessionActual));
            return(PartialView("_GridViewPartial_depreciacion_det", model));
        }
        public bool modificarDB(Af_Depreciacion_Info info)
        {
            try
            {
                using (Entities_activo_fijo Context = new Entities_activo_fijo())
                {
                    Af_Depreciacion Entity = Context.Af_Depreciacion.FirstOrDefault(q => q.IdEmpresa == info.IdEmpresa && q.IdDepreciacion == info.IdDepreciacion);
                    if (Entity == null)
                    {
                        return(false);
                    }

                    Entity.IdPeriodo           = info.IdPeriodo;
                    Entity.Cod_Depreciacion    = info.Cod_Depreciacion;
                    Entity.Descripcion         = info.Descripcion;
                    Entity.Fecha_Depreciacion  = info.Fecha_Depreciacion.Date;
                    Entity.Num_Act_Depre       = info.Num_Act_Depre;
                    Entity.Valor_Tot_Act       = info.Valor_Tot_Act;
                    Entity.Valor_Tot_Depre     = info.Valor_Tot_Depre;
                    Entity.Valor_Tot_DepreAcum = info.Valor_Tot_DepreAcum;
                    Entity.Valot_Tot_Importe   = info.Valot_Tot_Importe;

                    Entity.IdUsuarioUltMod = info.IdUsuarioUltMod;
                    Entity.Fecha_UltMod    = DateTime.Now;
                    Context.Database.ExecuteSqlCommand("delete Af_Depreciacion_Det where IdEmpresa = " + info.IdEmpresa + "and IdDepreciacion = " + info.IdDepreciacion);
                    int secuencia = 1;
                    foreach (var item in info.lst_detalle)
                    {
                        Af_Depreciacion_Det Entity_d = new Af_Depreciacion_Det
                        {
                            IdEmpresa          = info.IdEmpresa,
                            IdActivoFijo       = item.IdActivoFijo,
                            IdDepreciacion     = info.IdDepreciacion,
                            Concepto           = item.Concepto,
                            Porc_Depreciacion  = item.Porc_Depreciacion,
                            Secuencia          = item.Secuencia = secuencia++,
                            Valor_Compra       = item.Valor_Compra,
                            Valor_Depreciacion = item.Valor_Depreciacion,
                            Valor_Depre_Acum   = item.Valor_Depre_Acum,
                            Valor_Salvamento   = item.Valor_Salvamento,
                            Vida_Util          = item.Vida_Util
                        };
                        Context.Af_Depreciacion_Det.Add(Entity_d);
                    }
                    Context.SaveChanges();
                }
                return(true);
            }
            catch (Exception ex)
            {
                tb_LogError_Data LogData = new tb_LogError_Data();
                LogData.GuardarDB(new tb_LogError_Info {
                    Descripcion = ex.Message, InnerException = ex.InnerException == null ? null : ex.InnerException.Message, Clase = "Af_Depreciacion_Data", Metodo = "modificarDB", IdUsuario = info.IdUsuario
                });
                return(false);
            }
        }
Пример #12
0
 private void gridViewDepreciacion_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e)
 {
     try
     {
         _Info = GetSelectedRow((DevExpress.XtraGrid.Views.Grid.GridView)sender);
     }
     catch (Exception ex)
     {
         Log_Error_bus.Log_Error(ex.ToString());
         MessageBox.Show(ex.ToString(), param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Пример #13
0
 private void gridViewDepreciacion_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
 {
     try
     {
         _Info = gridViewDepreciacion.GetRow(e.FocusedRowHandle) as Af_Depreciacion_Info;
     }
     catch (Exception ex)
     {
         Log_Error_bus.Log_Error(ex.ToString());
         MessageBox.Show(ex.ToString(), param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Пример #14
0
 public ActionResult Anular(Af_Depreciacion_Info model)
 {
     model.lst_detalle     = lst_depreciacion_det.get_list(model.IdTransaccionSession);
     model.IdUsuarioUltAnu = SessionFixed.IdUsuario;
     if (!bus_depreciacion.anularDB(model))
     {
         cargar_combos(model.IdEmpresa);
         ViewBag.mensaje = "No se ha podido anular el registro";
         return(View(model));
     }
     return(RedirectToAction("Index"));
 }
Пример #15
0
 public void SetInfo(Af_Depreciacion_Info InfoDeprec)
 {
     try
     {
         InfoDepre = InfoDeprec;
     }
     catch (Exception ex)
     {
         Log_Error_bus.Log_Error(ex.ToString());
         MessageBox.Show(ex.ToString(), param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Пример #16
0
        public Boolean Guardar_HistoricoDB(Af_Depreciacion_Info Info, ref string msjError)
        {
            try
            {
                int IdHisDepreciacion = 0;
                using (EntitiesActivoFijo Context = new EntitiesActivoFijo())
                {
                    var Address = new Af_Depreciacion_His_Anulacion();
                    Address.IdEmpresa           = Info.IdEmpresa;
                    Address.IdHisDepreciacion   = IdHisDepreciacion = Get_HistoricoId(Info.IdEmpresa);
                    Address.IdDepreciacion      = Info.IdDepreciacion;
                    Address.IdTipoDepreciacion  = Info.IdTipoDepreciacion;
                    Address.Cod_Depreciacion    = Info.Cod_Depreciacion;
                    Address.IdPeriodo           = Info.IdPeriodo;
                    Address.Descripcion         = Info.Descripcion;
                    Address.Fecha_Depreciacion  = Info.Fecha_Depreciacion;
                    Address.Num_Act_Depre       = Info.Num_Act_Depre;
                    Address.Valor_Tot_Act       = Info.Valor_Tot_Act;
                    Address.Valor_Tot_Depre     = Info.Valor_Tot_Depre;
                    Address.Valor_Tot_DepreAcum = Info.Valor_Tot_DepreAcum;
                    Address.Valot_Tot_Importe   = Info.Valot_Tot_Importe;
                    Address.IdUsuario           = Info.IdUsuario;
                    Address.Fecha_Transac       = Info.Fecha_Transac;
                    Address.nom_pc          = Info.nom_pc;
                    Address.ip              = Info.ip;
                    Address.Estado          = Info.Estado;
                    Address.IdUsuarioUltMod = Info.IdUsuarioUltAnu;
                    Address.Fecha_UltMod    = Info.Fecha_UltAnu;
                    Address.IdUsuarioUltAnu = Info.IdUsuarioUltAnu;
                    Address.Fecha_UltAnu    = Info.Fecha_UltAnu;
                    Address.MotivoAnula     = Info.MotivoAnula;

                    Context.Af_Depreciacion_His_Anulacion.Add(Address);
                    Context.SaveChanges();

                    dataDetalle.Guardar_HistoricoDB(Info.ListDetalle, IdHisDepreciacion, Info.IdDepreciacion, Info.IdTipoDepreciacion, ref msjError);
                }
                return(true);
            }
            catch (Exception ex)
            {
                string arreglo = ToString();
                tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "",
                                                                                          "", "", "", "", DateTime.Now);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                mensaje  = ex.InnerException + " " + ex.Message;
                msjError = mensaje;
                throw new Exception(ex.InnerException.ToString());
            }
        }
Пример #17
0
 public Boolean ModificarDB(Af_Depreciacion_Info Info, ref string msjError)
 {
     try
     {
         return(dataDepre.ModificarDB(Info, ref msjError));
     }
     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("", "ModificarDB", ex.Message), ex)
               {
                   EntityType = typeof(Af_Depreciacion_Bus)
               };
     }
 }
Пример #18
0
        public List <Af_Depreciacion_Info> Get_List_Depreciacion(int IdEmpresa, int IdTipoDepreciacion, DateTime FechaIni, DateTime FechaFin)
        {
            try
            {
                List <Af_Depreciacion_Info> lstInfo = new List <Af_Depreciacion_Info>();

                using (EntitiesActivoFijo listado = new EntitiesActivoFijo())
                {
                    var select = from q in listado.vwAf_Depreciacion
                                 where q.IdEmpresa == IdEmpresa &&
                                 q.IdTipoDepreciacion == IdTipoDepreciacion &&
                                 q.Fecha_Depreciacion >= FechaIni && q.Fecha_Depreciacion <= FechaFin
                                 select q;

                    foreach (var item in select)
                    {
                        Af_Depreciacion_Info InfoDepre = new Af_Depreciacion_Info();
                        InfoDepre.IdEmpresa             = item.IdEmpresa;
                        InfoDepre.IdDepreciacion        = item.IdDepreciacion;
                        InfoDepre.IdTipoDepreciacion    = item.IdTipoDepreciacion;
                        InfoDepre.Cod_Depreciacion      = item.Cod_Depreciacion;
                        InfoDepre.IdPeriodo             = item.IdPeriodo;
                        InfoDepre.Descripcion           = item.Descripcion;
                        InfoDepre.Fecha_Depreciacion    = item.Fecha_Depreciacion;
                        InfoDepre.IdUsuario             = item.IdUsuario;
                        InfoDepre.nom_tipo_depreciacion = item.nom_tipo_depreciacion;
                        InfoDepre.cod_tipo_depreciacion = item.cod_tipo_depreciacion;
                        InfoDepre.Valor_Depreciacion    = Convert.ToDouble(item.Valor_Depreciacion);
                        InfoDepre.Valor_Depre_Acum      = Convert.ToDouble(item.Valor_Depre_Acum);
                        InfoDepre.Valor_Importe         = Convert.ToDouble(item.Valor_Importe);
                        InfoDepre.Estado = item.Estado;

                        lstInfo.Add(InfoDepre);
                    }
                }
                return(lstInfo);
            }
            catch (Exception ex)
            {
                string arreglo = ToString();
                tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "",
                                                                                          "", "", "", "", DateTime.Now);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                mensaje = ex.InnerException + " " + ex.Message;
                throw new Exception(ex.InnerException.ToString());
            }
        }
Пример #19
0
        public Af_Depreciacion_Info Get_Info_Depreciacion(int IdEmpresa, decimal IdDepreciacion, int IdTipoDepreciacion)
        {
            try
            {
                Af_Depreciacion_Info InfoDepre = new Af_Depreciacion_Info();

                using (EntitiesActivoFijo listado = new EntitiesActivoFijo())
                {
                    var select = from q in listado.Af_Depreciacion
                                 where q.IdEmpresa == IdEmpresa &&
                                 q.IdDepreciacion == IdDepreciacion && q.IdTipoDepreciacion == IdTipoDepreciacion
                                 select q;

                    foreach (var item in select)
                    {
                        InfoDepre.IdEmpresa           = item.IdEmpresa;
                        InfoDepre.IdDepreciacion      = item.IdDepreciacion;
                        InfoDepre.IdTipoDepreciacion  = item.IdTipoDepreciacion;
                        InfoDepre.Cod_Depreciacion    = item.Cod_Depreciacion;
                        InfoDepre.IdPeriodo           = item.IdPeriodo;
                        InfoDepre.Descripcion         = item.Descripcion;
                        InfoDepre.Fecha_Depreciacion  = item.Fecha_Depreciacion;
                        InfoDepre.Num_Act_Depre       = item.Num_Act_Depre;
                        InfoDepre.Valor_Tot_Act       = item.Valor_Tot_Act;
                        InfoDepre.Valor_Tot_Depre     = item.Valor_Tot_Depre;
                        InfoDepre.Valor_Tot_DepreAcum = item.Valor_Tot_DepreAcum;
                        InfoDepre.Valot_Tot_Importe   = item.Valot_Tot_Importe;
                        InfoDepre.IdUsuario           = item.IdUsuario;
                        InfoDepre.Estado = item.Estado;

                        InfoDepre.lstGridDepre = dataDetalle.Get_List_Depreciacion_Detalle(InfoDepre.IdEmpresa, InfoDepre.IdDepreciacion, InfoDepre.IdTipoDepreciacion);
                    }
                }
                return(InfoDepre);
            }
            catch (Exception ex)
            {
                string arreglo = ToString();
                tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "",
                                                                                          "", "", "", "", DateTime.Now);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                mensaje = ex.InnerException + " " + ex.Message;
                throw new Exception(ex.InnerException.ToString());
            }
        }
Пример #20
0
 public ActionResult Nuevo(Af_Depreciacion_Info model)
 {
     model.lst_detalle = lst_depreciacion_det.get_list(model.IdTransaccionSession);
     if (!validar(model, ref mensaje))
     {
         ViewBag.mensaje = mensaje;
         cargar_combos(model.IdEmpresa);
         return(View(model));
     }
     model.IdUsuario = SessionFixed.IdUsuario;
     if (!bus_depreciacion.guardarDB(model))
     {
         ViewBag.mensaje = "No se ha podido guardar el registro";
         cargar_combos(model.IdEmpresa);
         return(View(model));
     }
     return(RedirectToAction("Index"));
 }
 public ActionResult Modificar(Af_Depreciacion_Info model)
 {
     model.lst_detalle = lst_depreciacion_det.get_list(model.IdTransaccionSession);
     if (!validar(model, ref mensaje))
     {
         cargar_combos(model.IdEmpresa);
         ViewBag.mensaje = mensaje;
         return(View(model));
     }
     model.IdUsuarioUltMod = Session["IdUsuario"].ToString();
     if (!bus_depreciacion.modificarDB(model))
     {
         cargar_combos(model.IdEmpresa);
         ViewBag.mensaje = "No se ha podido modificar el registro";
         return(View(model));
     }
     return(RedirectToAction("Index"));
 }
Пример #22
0
 public ActionResult Modificar(Af_Depreciacion_Info model)
 {
     model.lst_detalle = lst_depreciacion_det.get_list(model.IdTransaccionSession);
     if (!validar(model, ref mensaje))
     {
         cargar_combos(model.IdEmpresa);
         ViewBag.mensaje = mensaje;
         return(View(model));
     }
     model.IdUsuarioUltMod = SessionFixed.IdUsuario;
     if (!bus_depreciacion.modificarDB(model))
     {
         cargar_combos(model.IdEmpresa);
         ViewBag.mensaje = "No se ha podido modificar el registro";
         return(View(model));
     }
     return(RedirectToAction("Consultar", new { IdEmpresa = model.IdEmpresa, IdDepreciacion = model.IdDepreciacion, Exito = true }));
 }
Пример #23
0
 public bool modificarDB(Af_Depreciacion_Info info)
 {
     try
     {
         var info_ct_cbtecble = odata_ct.armar_info(info.lst_detalle_ct, info.IdEmpresa, Convert.ToInt32(info.IdTipoCbte), Convert.ToDecimal(info.IdCbteCble), info.Descripcion, info.Fecha_Depreciacion);
         if (odata_ct.modificarDB(info_ct_cbtecble))
         {
             if (odata.modificarDB(info))
             {
                 return(true);
             }
         }
         return(false);
     }
     catch (Exception)
     {
         throw;
     }
 }
Пример #24
0
 public bool anularDB(Af_Depreciacion_Info info)
 {
     try
     {
         var info_ct_cbtecble = odata_ct.get_info(info.IdEmpresa, Convert.ToInt32(info.IdTipoCbte), Convert.ToDecimal(info.IdCbteCble));
         if (odata_ct.anularDB(info_ct_cbtecble))
         {
             if (odata.anularDB(info))
             {
                 return(true);
             }
         }
         return(false);
     }
     catch (Exception)
     {
         throw;
     }
 }
Пример #25
0
        public ActionResult Consultar(int IdEmpresa = 0, decimal IdDepreciacion = 0, bool Exito = false)
        {
            #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

            Af_Depreciacion_Info model = bus_depreciacion.get_info(IdEmpresa, IdDepreciacion);
            if (model == null)
            {
                return(RedirectToAction("Index"));
            }

            #region Permisos
            seg_Menu_x_Empresa_x_Usuario_Info info = bus_permisos.get_list_menu_accion(Convert.ToInt32(SessionFixed.IdEmpresa), SessionFixed.IdUsuario, "ActivoFijo", "DepreciacionAF", "Index");
            if (model.Estado == "I")
            {
                info.Modificar = false;
                info.Anular    = false;
            }
            model.Nuevo     = (info.Nuevo == true ? 1 : 0);
            model.Modificar = (info.Modificar == true ? 1 : 0);
            model.Anular    = (info.Anular == true ? 1 : 0);
            #endregion

            model.lst_detalle          = bus_depreciacion_det.get_list(IdEmpresa, IdDepreciacion);
            model.lst_detalle_ct       = bus_comprobante_detalle.get_list(IdEmpresa, Convert.ToInt32(model.IdTipoCbte), Convert.ToInt32(model.IdCbteCble));
            model.IdTransaccionSession = Convert.ToDecimal(SessionFixed.IdTransaccionSessionActual);
            lst_depreciacion_det.set_list(model.lst_detalle, model.IdTransaccionSession);
            lst_comprobante_detalle.set_list(model.lst_detalle_ct, model.IdTransaccionSession);
            cargar_combos(IdEmpresa);

            if (Exito)
            {
                ViewBag.MensajeSuccess = MensajeSuccess;
            }
            return(View(model));
        }
Пример #26
0
 public Boolean AnularDB(Af_Depreciacion_Info Info, ct_Cbtecble_Info CbteCbleInfo, ref decimal IdCbteCble_Rev, ref string msjError)
 {
     try
     {
         if (dataDepre.AnularDB(Info, ref msjError))
         {
             return(CbteCbleBus.ReversoCbteCble(CbteCbleInfo.IdEmpresa, CbteCbleInfo.IdCbteCble, CbteCbleInfo.IdTipoCbte, Info.IdTipoCbte_Rev, ref IdCbteCble_Rev, ref msjError, Info.IdUsuarioUltAnu, Info.MotivoAnula));
         }
         else
         {
             return(false);
         }
     }
     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("", "AnularDB", ex.Message), ex)
               {
                   EntityType = typeof(Af_Depreciacion_Bus)
               };
     }
 }
Пример #27
0
 public Af_Depreciacion_Info get_info(int IdEmpresa, decimal IdDepreciacion)
 {
     try
     {
         Af_Depreciacion_Info info = new Af_Depreciacion_Info();
         using (Entities_activo_fijo Context = new Entities_activo_fijo())
         {
             Af_Depreciacion Entity = Context.Af_Depreciacion.FirstOrDefault(q => q.IdEmpresa == IdEmpresa && q.IdDepreciacion == IdDepreciacion);
             if (Entity == null)
             {
                 return(null);
             }
             info = new Af_Depreciacion_Info
             {
                 IdEmpresa           = Entity.IdEmpresa,
                 IdDepreciacion      = Entity.IdDepreciacion,
                 IdPeriodo           = Entity.IdPeriodo,
                 Cod_Depreciacion    = Entity.Cod_Depreciacion,
                 Descripcion         = Entity.Descripcion,
                 Estado              = Entity.Estado,
                 Fecha_Depreciacion  = Entity.Fecha_Depreciacion,
                 Num_Act_Depre       = Entity.Num_Act_Depre,
                 Valor_Tot_Act       = Entity.Valor_Tot_Act,
                 Valor_Tot_Depre     = Entity.Valor_Tot_Depre,
                 Valor_Tot_DepreAcum = Entity.Valor_Tot_DepreAcum,
                 Valot_Tot_Importe   = Entity.Valot_Tot_Importe,
                 IdEmpresa_ct        = Entity.IdEmpresa_ct,
                 IdTipoCbte          = Entity.IdTipoCbte,
                 IdCbteCble          = Entity.IdCbteCble
             };
         }
         return(info);
     }
     catch (Exception)
     {
         throw;
     }
 }
Пример #28
0
 public bool guardarDB(Af_Depreciacion_Info info)
 {
     try
     {
         var i_param          = odata_param.get_info(info.IdEmpresa);
         var info_ct_cbtecble = odata_ct.armar_info(info.lst_detalle_ct, info.IdEmpresa, i_param.IdTipoCbte, 0, "Depreciación " + info.IdPeriodo.ToString() + info.Descripcion, info.Fecha_Depreciacion);
         if (odata_ct.guardarDB(info_ct_cbtecble))
         {
             info.IdEmpresa_ct = info_ct_cbtecble.IdEmpresa;
             info.IdTipoCbte   = info_ct_cbtecble.IdTipoCbte;
             info.IdCbteCble   = info_ct_cbtecble.IdCbteCble;
             if (odata.guardarDB(info))
             {
                 return(true);
             }
         }
         return(false);
     }
     catch (Exception)
     {
         throw;
     }
 }
Пример #29
0
 public bool modificarDB(Af_Depreciacion_Info info)
 {
     try
     {
         var info_ct_cbtecble = odata_ct.armar_info(info.lst_detalle_ct, info.IdEmpresa, 1, Convert.ToInt32(info.IdTipoCbte), Convert.ToDecimal(info.IdCbteCble), info.Descripcion, info.Fecha_Depreciacion);
         if (odata_ct.modificarDB(info_ct_cbtecble))
         {
             if (odata.modificarDB(info))
             {
                 return(true);
             }
         }
         return(false);
     }
     catch (Exception ex)
     {
         tb_LogError_Bus LogData = new tb_LogError_Bus();
         LogData.GuardarDB(new tb_LogError_Info {
             Descripcion = ex.Message, InnerException = ex.InnerException == null ? null : ex.InnerException.Message, Clase = "Af_Depreciacion_Bus", Metodo = "modificarDB", IdUsuario = info.IdUsuario
         });
         return(false);
     }
 }