示例#1
0
        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

            #region Permisos
            seg_Menu_x_Empresa_x_Usuario_Info info = bus_permisos.get_list_menu_accion(Convert.ToInt32(SessionFixed.IdEmpresa), SessionFixed.IdUsuario, "ActivoFijo", "RetiroActivo", "Index");
            ViewBag.Nuevo = info.Nuevo;
            #endregion

            Af_Retiro_Activo_Info model = new Af_Retiro_Activo_Info
            {
                IdTransaccionSession = Convert.ToDecimal(SessionFixed.IdTransaccionSession),
                IdEmpresa            = Convert.ToInt32(SessionFixed.IdEmpresa),
            };

            var lst = bus_retiro.get_list(model.IdEmpresa, true);
            Lista_Retiro.set_list(lst, model.IdTransaccionSession);

            return(View(model));
        }
示例#2
0
 public Boolean ModificarDB(Af_Retiro_Activo_Info InfoAf, ref string msjError)
 {
     try
     {
         using (EntitiesActivoFijo Context = new EntitiesActivoFijo())
         {
             var contact = Context.Af_Retiro_Activo.FirstOrDefault(af => af.IdEmpresa == InfoAf.IdEmpresa && af.IdRetiroActivo == InfoAf.IdRetiroActivo);
             if (contact != null)
             {
                 contact.NumComprobante  = InfoAf.NumComprobante;
                 contact.Concepto_Retiro = InfoAf.Concepto_Retiro;
                 contact.Fecha_Retiro    = InfoAf.Fecha_Retiro;
                 contact.IdUsuarioUltMod = InfoAf.IdUsuarioUltMod;
                 contact.Fecha_UltMod    = InfoAf.Fecha_UltMod;
                 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 ActionResult Anular(int IdEmpresa = 0, decimal IdRetiroActivo = 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
     Af_Retiro_Activo_Info model = bus_retiro.get_info(IdEmpresa, IdRetiroActivo);
     if (model == null)
     {
         return(RedirectToAction("Index"));
     }
     model.IdTransaccionSession = Convert.ToDecimal(SessionFixed.IdTransaccionSessionActual);
     model.lst_ct_cbtecble_det  = bus_comprobante_detalle.get_list(IdEmpresa, model.IdTipoCbte == null ? 0 : Convert.ToInt32(model.IdTipoCbte), model.IdCbteCble == null ? 0 : Convert.ToDecimal(model.IdCbteCble));
     list_ct_cbtecble_det.set_list(model.lst_ct_cbtecble_det, model.IdTransaccionSession);
     cargar_combos(IdEmpresa);
     #region Validacion Periodo
     ViewBag.MostrarBoton = true;
     if (!bus_periodo.ValidarFechaTransaccion(IdEmpresa, model.Fecha_Retiro, cl_enumeradores.eModulo.ACF, Convert.ToInt32(SessionFixed.IdSucursal), ref mensaje))
     {
         ViewBag.mensaje      = mensaje;
         ViewBag.MostrarBoton = false;
     }
     #endregion
     return(View(model));
 }
示例#4
0
        void LimpiarDatos()
        {
            try
            {
                InfoRetiro   = new Af_Retiro_Activo_Info();
                _Accion      = Cl_Enumeradores.eTipo_action.grabar;
                CbteCbleInfo = new ct_Cbtecble_Info();

                txtIdRetiro.EditValue    = "";
                txtCodRetiro.EditValue   = "";
                txtConcepto.EditValue    = "";
                txtComproVta.EditValue   = "";
                txtValorActivo.EditValue = "";
                txtValorBaja.EditValue   = "";
                txtValorMejora.EditValue = "";
                txtValorDepre.EditValue  = "";
                txtValorNeto.EditValue   = "";
                cmbActivoFijo.EditValue  = "";


                ucCon_GridDiarioContable.LimpiarGrid();
            }
            catch (Exception ex)
            {
                Log_Error_bus.Log_Error(ex.ToString());
                MessageBox.Show(ex.ToString(), param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        public bool modificarDB(Af_Retiro_Activo_Info info)
        {
            try
            {
                var af = odata_af.get_info(info.IdEmpresa, info.IdActivoFijo);
                //armar un diario pasando los parametros que pida
                var info_cbte = odata_ct.armar_info(info.lst_ct_cbtecble_det, info.IdEmpresa, af.IdSucursal, Convert.ToInt32(info.IdTipoCbte), 0, info.Concepto_Retiro, info.Fecha_Retiro);
                //modifico el diario
                if (odata_ct.modificarDB(info_cbte))
                {
                    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_Retiro_Activo_Bus", Metodo = "modificarDB", IdUsuario = info.IdUsuario
                });
                return(false);
            }
        }
示例#6
0
        public bool anularDB(Af_Retiro_Activo_Info info)
        {
            try
            {
                using (Entities_activo_fijo Context = new Entities_activo_fijo())
                {
                    Af_Retiro_Activo Entity = Context.Af_Retiro_Activo.FirstOrDefault(q => q.IdEmpresa == info.IdEmpresa && q.IdRetiroActivo == info.IdRetiroActivo);
                    if (Entity == null)
                    {
                        return(false);
                    }


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

                    Entity.IdUsuarioUltMod = info.IdUsuarioUltMod;
                    Entity.Fecha_UltMod    = DateTime.Now;
                    Context.SaveChanges();
                }
                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }
示例#7
0
 public Boolean GuardarDB(Af_Retiro_Activo_Info InfoAf, ct_Cbtecble_Info CbteCbleInfo, ref decimal IdRetiroActivo, ref decimal IdCbteCble, ref string msjError)
 {
     try
     {
         if (dataRet.GuardarDB(InfoAf, ref IdRetiroActivo, ref msjError))
         {
             dataActFijo.ModificarEstadoProceso(InfoAf.IdEmpresa, InfoAf.IdActivoFijo, Cl_Enumeradores.eEstadoActivoFijo.TIP_ESTADO_AF_RETIRO.ToString());
             InfoAf.IdRetiroActivo = IdRetiroActivo;
             if (busCbteCble.ValidarObjeto(CbteCbleInfo, ref msjError))
             {
                 busCbteCble.GrabarDB(CbteCbleInfo, ref IdCbteCble, ref msjError);
                 CbteCbleInfo.IdCbteCble = IdCbteCble;
                 return(busTranCta.GuardarTran_x_CbteCble(Get_Info_TipoTran_x_CtaCble(InfoAf, CbteCbleInfo), ref msjError));
             }
             else
             {
                 return(false);
             }
         }
         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("", "Get_List_PeriodoDepreciacion", ex.Message), ex)
               {
                   EntityType = typeof(Af_Retiro_Activo_Bus)
               };
     }
 }
示例#8
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", "RetiroActivo", "Index");
     if (!info.Nuevo)
     {
         return(RedirectToAction("Index"));
     }
     #endregion
     Af_Retiro_Activo_Info model = new Af_Retiro_Activo_Info
     {
         IdEmpresa            = IdEmpresa,
         Fecha_Retiro         = DateTime.Now,
         IdTransaccionSession = Convert.ToDecimal(SessionFixed.IdTransaccionSessionActual)
     };
     model.lst_ct_cbtecble_det = new List <ct_cbtecble_det_Info>();
     list_ct_cbtecble_det.set_list(model.lst_ct_cbtecble_det, model.IdTransaccionSession);
     cargar_combos_detalle();
     cargar_combos(IdEmpresa);
     return(View(model));
 }
 private bool validar(Af_Retiro_Activo_Info i_validar, ref string msg)
 {
     if (i_validar.lst_ct_cbtecble_det.Count == 0)
     {
         mensaje = "Debe ingresar registros en el detalle, por favor verifique";
         return(false);
     }
     if (i_validar.lst_ct_cbtecble_det.Sum(q => q.dc_Valor) != 0)
     {
         mensaje = "La suma de los detalles debe ser 0, por favor verifique";
         return(false);
     }
     foreach (var item in i_validar.lst_ct_cbtecble_det)
     {
         if (string.IsNullOrEmpty(item.IdCtaCble))
         {
             mensaje = "Faltan cuentas contables, por favor verifique";
             return(false);
         }
     }
     if (i_validar.lst_ct_cbtecble_det.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);
 }
示例#10
0
 public Boolean ModificarDB(Af_Retiro_Activo_Info InfoAf, ct_Cbtecble_Info CbteCbleInfo, ref string msjError)
 {
     try
     {
         if (dataRet.ModificarDB(InfoAf, ref msjError))
         {
             if (busCbteCble.ValidarObjeto(CbteCbleInfo, ref msjError))
             {
                 return(busCbteCble.ModificarDB(CbteCbleInfo, ref msjError));
             }
             else
             {
                 return(false);
             }
         }
         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("", "ModificarDB", ex.Message), ex)
               {
                   EntityType = typeof(Af_Retiro_Activo_Bus)
               };
     }
 }
示例#11
0
        public bool guardarDB(Af_Retiro_Activo_Info info)
        {
            try
            {
                //obtengo info de param AF
                var param = odata_af_param.get_info(info.IdEmpresa);
                var af    = odata_af.get_info(info.IdEmpresa, info.IdActivoFijo);
                //armar un diario pasando los parametros que pida
                var info_cbte = odata_ct.armar_info(info.lst_ct_cbtecble_det, info.IdEmpresa, af.IdSucursal, param.IdTipoCbteRetiro, 0, info.Concepto_Retiro, info.Fecha_Retiro);
                //guardo en el diario
                if (odata_ct.guardarDB(info_cbte))
                {
                    //Actualizo PK de mejora baja
                    info.IdEmpresa_ct = info_cbte.IdEmpresa;
                    info.IdTipoCbte   = info_cbte.IdTipoCbte;
                    info.IdCbteCble   = info_cbte.IdCbteCble;

                    //guarda mejora/baja
                    if (odata.guardarDB(info))
                    {
                        return(true);
                    }
                }

                return(false);
            }
            catch (Exception)
            {
                throw;
            }
        }
        public bool guardarDB(Af_Retiro_Activo_Info info)
        {
            try
            {
                //obtengo info de param AF
                var param = odata_af_param.get_info(info.IdEmpresa);
                var af    = odata_af.get_info(info.IdEmpresa, info.IdActivoFijo);
                //armar un diario pasando los parametros que pida
                var info_cbte = odata_ct.armar_info(info.lst_ct_cbtecble_det, info.IdEmpresa, af.IdSucursal, param.IdTipoCbteRetiro, 0, info.Concepto_Retiro, info.Fecha_Retiro);
                //guardo en el diario
                if (odata_ct.guardarDB(info_cbte))
                {
                    //Actualizo PK de mejora baja
                    info.IdEmpresa_ct = info_cbte.IdEmpresa;
                    info.IdTipoCbte   = info_cbte.IdTipoCbte;
                    info.IdCbteCble   = info_cbte.IdCbteCble;

                    //guarda mejora/baja
                    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_Retiro_Activo_Bus", Metodo = "guardarDB", IdUsuario = info.IdUsuario
                });
                return(false);
            }
        }
 public ActionResult Anular(Af_Retiro_Activo_Info model)
 {
     model.IdUsuarioUltAnu = SessionFixed.IdUsuario;
     if (!bus_retiro.anularDB(model))
     {
         cargar_combos(model.IdEmpresa);
         return(View(model));
     }
     return(RedirectToAction("Index"));
 }
 private void gridViewRetiroActivo_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
 {
     try
     {
         _InfoRt = gridViewRetiroActivo.GetRow(e.FocusedRowHandle) as Af_Retiro_Activo_Info;
     }
     catch (Exception ex)
     {
         Log_Error_bus.Log_Error(ex.ToString());
         MessageBox.Show(ex.ToString(), param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
 private void gridViewRetiroActivo_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e)
 {
     try
     {
         _InfoRt = 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);
     }
 }
示例#16
0
        public bool guardarDB(Af_Retiro_Activo_Info info)
        {
            try
            {
                using (Entities_activo_fijo Context = new Entities_activo_fijo())
                {
                    Af_Retiro_Activo Entity = new Af_Retiro_Activo
                    {
                        IdEmpresa        = info.IdEmpresa,
                        Cod_Ret_Activo   = info.Cod_Ret_Activo,
                        Concepto_Retiro  = info.Concepto_Retiro,
                        Estado           = info.Estado = "A",
                        Fecha_Retiro     = info.Fecha_Retiro.Date,
                        IdActivoFijo     = info.IdActivoFijo,
                        IdCbteCble       = info.IdCbteCble,
                        IdEmpresa_ct     = info.IdEmpresa_ct,
                        IdTipoCbte       = info.IdTipoCbte,
                        IdRetiroActivo   = info.IdRetiroActivo = get_id(info.IdEmpresa),
                        NumComprobante   = info.NumComprobante,
                        ValorActivo      = info.ValorActivo,
                        Valor_Depre_Acu  = info.Valor_Depre_Acu,
                        Valor_Neto       = info.Valor_Neto,
                        Valor_Tot_Bajas  = info.Valor_Tot_Bajas,
                        Valor_Tot_Mejora = info.Valor_Tot_Mejora,

                        IdUsuario     = info.IdUsuario,
                        Fecha_Transac = DateTime.Now
                    };
                    Context.Af_Retiro_Activo.Add(Entity);

                    Af_Activo_fijo Entity_A = Context.Af_Activo_fijo.Where(q => q.IdEmpresa == info.IdEmpresa && q.IdActivoFijo == info.IdActivoFijo).FirstOrDefault();
                    if (Entity_A == null)
                    {
                        return(false);
                    }
                    Entity_A.Estado_Proceso = "TIP_ESTADO_AF_RETIRO";

                    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_Retiro_Activo_Data", Metodo = "guardarDB", IdUsuario = info.IdUsuario
                });
                return(false);
            }
        }
示例#17
0
        public ActionResult Consultar(int IdEmpresa = 0, decimal IdRetiroActivo = 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_Retiro_Activo_Info model = bus_retiro.get_info(IdEmpresa, IdRetiroActivo);
            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", "RetiroActivo", "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.IdTransaccionSession = Convert.ToDecimal(SessionFixed.IdTransaccionSessionActual);
            model.lst_ct_cbtecble_det  = bus_comprobante_detalle.get_list(IdEmpresa, model.IdTipoCbte == null ? 0 : Convert.ToInt32(model.IdTipoCbte), model.IdCbteCble == null ? 0 : Convert.ToDecimal(model.IdCbteCble));
            list_ct_cbtecble_det.set_list(model.lst_ct_cbtecble_det, model.IdTransaccionSession);
            cargar_combos(IdEmpresa);
            if (Exito)
            {
                ViewBag.MensajeSuccess = MensajeSuccess;
            }
            #region Validacion Periodo
            ViewBag.MostrarBoton = true;
            if (!bus_periodo.ValidarFechaTransaccion(IdEmpresa, model.Fecha_Retiro, cl_enumeradores.eModulo.ACF, Convert.ToInt32(SessionFixed.IdSucursal), ref mensaje))
            {
                ViewBag.mensaje      = mensaje;
                ViewBag.MostrarBoton = false;
            }
            #endregion

            return(View(model));
        }
示例#18
0
        public List <Af_Retiro_Activo_Info> Get_List_Retiro_Activo(int IdEmpresa, DateTime FechaIni, DateTime FechaFin)
        {
            try
            {
                List <Af_Retiro_Activo_Info> lstInfo = new List <Af_Retiro_Activo_Info>();

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

                    foreach (var item in select)
                    {
                        Af_Retiro_Activo_Info infoAf = new Af_Retiro_Activo_Info();

                        infoAf.IdEmpresa        = item.IdEmpresa;
                        infoAf.IdRetiroActivo   = item.IdRetiroActivo;
                        infoAf.Cod_Ret_Activo   = item.Cod_Ret_Activo;
                        infoAf.IdActivoFijo     = item.IdActivoFijo;
                        infoAf.Af_Nombre        = item.Af_Nombre;
                        infoAf.Encargado        = item.NomCompleto;
                        infoAf.ValorActivo      = item.ValorActivo;
                        infoAf.Valor_Tot_Bajas  = item.Valor_Tot_Bajas;
                        infoAf.Valor_Tot_Mejora = Convert.ToDouble(item.Valor_Tot_Mejora);
                        infoAf.Valor_Depre_Acu  = item.Valor_Depre_Acu;
                        infoAf.Valor_Neto       = item.Valor_Neto;
                        infoAf.NumComprobante   = item.NumComprobante;
                        infoAf.Concepto_Retiro  = item.Concepto_Retiro;
                        infoAf.Estado           = item.Estado;
                        infoAf.Fecha_Retiro     = item.Fecha_Retiro;
                        lstInfo.Add(infoAf);
                    }
                }

                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());
            }
        }
 public ActionResult Nuevo(Af_Retiro_Activo_Info model)
 {
     model.lst_ct_cbtecble_det = list_ct_cbtecble_det.get_list(model.IdTransaccionSession);
     if (!validar(model, ref mensaje))
     {
         cargar_combos(model.IdEmpresa);
         ViewBag.mensaje = mensaje;
         return(View(model));
     }
     model.IdUsuario = SessionFixed.IdUsuario;
     if (!bus_retiro.guardarDB(model))
     {
         cargar_combos(model.IdEmpresa);
         return(View(model));
     }
     return(RedirectToAction("Index"));
 }
 public ActionResult Modificar(Af_Retiro_Activo_Info model)
 {
     model.lst_ct_cbtecble_det = list_ct_cbtecble_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_retiro.modificarDB(model))
     {
         cargar_combos(model.IdEmpresa);
         return(View(model));
     }
     return(RedirectToAction("Modificar", new { IdEmpresa = model.IdEmpresa, IdRetiroActivo = model.IdRetiroActivo, Exito = true }));
 }
示例#21
0
        public Af_Retiro_Activo_Info Get_Info_Retiro_Activo(int IdEmpresa, decimal IdRetiroActivo)
        {
            try
            {
                Af_Retiro_Activo_Info InfoAf = new Af_Retiro_Activo_Info();

                using (EntitiesActivoFijo listado = new EntitiesActivoFijo())
                {
                    var select = from q in listado.Af_Retiro_Activo
                                 where q.IdEmpresa == IdEmpresa &&
                                 q.IdRetiroActivo == IdRetiroActivo
                                 select q;

                    foreach (var item in select)
                    {
                        InfoAf.IdEmpresa        = item.IdEmpresa;
                        InfoAf.IdRetiroActivo   = item.IdRetiroActivo;
                        InfoAf.Cod_Ret_Activo   = item.Cod_Ret_Activo;
                        InfoAf.IdActivoFijo     = item.IdActivoFijo;
                        InfoAf.ValorActivo      = item.ValorActivo;
                        InfoAf.Valor_Tot_Bajas  = item.Valor_Tot_Bajas;
                        InfoAf.Valor_Tot_Mejora = Convert.ToDouble(item.Valor_Tot_Mejora);
                        InfoAf.Valor_Depre_Acu  = item.Valor_Depre_Acu;
                        InfoAf.Valor_Neto       = item.Valor_Neto;
                        InfoAf.NumComprobante   = item.NumComprobante;
                        InfoAf.Concepto_Retiro  = item.Concepto_Retiro;
                        InfoAf.Fecha_Retiro     = item.Fecha_Retiro;
                        InfoAf.IdUsuario        = item.IdUsuario;
                        InfoAf.Fecha_Transac    = Convert.ToDateTime(item.Fecha_Transac);
                        InfoAf.nom_pc           = item.nom_pc;
                        InfoAf.ip     = item.ip;
                        InfoAf.Estado = item.Estado;
                    }
                }
                return(InfoAf);
            }
            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());
            }
        }
示例#22
0
 public ActionResult Modificar(Af_Retiro_Activo_Info model)
 {
     model.lst_ct_cbtecble_det = list_ct_cbtecble_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_retiro.modificarDB(model))
     {
         cargar_combos(model.IdEmpresa);
         return(View(model));
     }
     return(RedirectToAction("Index"));
 }
示例#23
0
        public Boolean GuardarDB(Af_Retiro_Activo_Info InfoAf, ref decimal IdRetiroActivo, ref string msjError)
        {
            try
            {
                using (EntitiesActivoFijo Context = new EntitiesActivoFijo())
                {
                    var Address = new Af_Retiro_Activo();

                    Address.IdEmpresa        = InfoAf.IdEmpresa;
                    Address.IdRetiroActivo   = InfoAf.IdRetiroActivo = IdRetiroActivo = getId(InfoAf.IdEmpresa);
                    Address.Cod_Ret_Activo   = (InfoAf.Cod_Ret_Activo == "" || InfoAf.Cod_Ret_Activo == null) ? "Retiro_" + InfoAf.IdRetiroActivo : InfoAf.Cod_Ret_Activo;
                    Address.IdActivoFijo     = InfoAf.IdActivoFijo;
                    Address.ValorActivo      = InfoAf.ValorActivo;
                    Address.Valor_Tot_Bajas  = InfoAf.Valor_Tot_Bajas;
                    Address.Valor_Tot_Mejora = InfoAf.Valor_Tot_Mejora;
                    Address.Valor_Depre_Acu  = InfoAf.Valor_Depre_Acu;
                    Address.Valor_Neto       = InfoAf.Valor_Neto;
                    Address.NumComprobante   = InfoAf.NumComprobante;
                    Address.Concepto_Retiro  = InfoAf.Concepto_Retiro;
                    Address.Fecha_Retiro     = InfoAf.Fecha_Retiro;
                    Address.IdUsuario        = InfoAf.IdUsuario;
                    Address.Fecha_Transac    = InfoAf.Fecha_Transac;
                    Address.nom_pc           = InfoAf.nom_pc;
                    Address.ip     = InfoAf.ip;
                    Address.Estado = InfoAf.Estado;

                    Context.Af_Retiro_Activo.Add(Address);
                    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.InnerException + " " + ex.Message;
                msjError = mensaje;
                throw new Exception(ex.InnerException.ToString());
            }
        }
示例#24
0
        public bool modificarDB(Af_Retiro_Activo_Info info)
        {
            try
            {
                using (Entities_activo_fijo Context = new Entities_activo_fijo())
                {
                    Af_Retiro_Activo Entity = Context.Af_Retiro_Activo.FirstOrDefault(q => q.IdEmpresa == info.IdEmpresa && q.IdRetiroActivo == info.IdRetiroActivo);
                    if (Entity == null)
                    {
                        return(false);
                    }


                    Entity.Concepto_Retiro  = info.Concepto_Retiro;
                    Entity.Fecha_Retiro     = info.Fecha_Retiro.Date;
                    Entity.IdCbteCble       = info.IdCbteCble;
                    Entity.IdEmpresa_ct     = info.IdEmpresa_ct;
                    Entity.IdTipoCbte       = info.IdTipoCbte;
                    Entity.NumComprobante   = info.NumComprobante;
                    Entity.ValorActivo      = info.ValorActivo;
                    Entity.Valor_Depre_Acu  = info.Valor_Depre_Acu;
                    Entity.Valor_Neto       = info.Valor_Neto;
                    Entity.Valor_Tot_Bajas  = info.Valor_Tot_Bajas;
                    Entity.Valor_Tot_Mejora = info.Valor_Tot_Mejora;
                    Entity.Cod_Ret_Activo   = info.Cod_Ret_Activo;

                    Entity.IdUsuarioUltMod = info.IdUsuarioUltMod;
                    Entity.Fecha_UltMod    = DateTime.Now;
                    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_Retiro_Activo_Data", Metodo = "modificarDB", IdUsuario = info.IdUsuario
                });
                return(false);
            }
        }
示例#25
0
        public bool modificarDB(Af_Retiro_Activo_Info info)
        {
            try
            {
                var info_cbte = odata_ct.armar_info(info.lst_ct_cbtecble_det, info.IdEmpresa, Convert.ToInt32(info.IdTipoCbte), Convert.ToDecimal(info.IdCbteCble), info.Concepto_Retiro, info.Fecha_Retiro);
                //modifico el diario
                if (odata_ct.modificarDB(info_cbte))
                {
                    if (odata.modificarDB(info))
                    {
                        return(true);
                    }
                }

                return(false);
            }
            catch (Exception)
            {
                throw;
            }
        }
 public ActionResult Anular(int IdEmpresa = 0, decimal IdRetiroActivo = 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
     Af_Retiro_Activo_Info model = bus_retiro.get_info(IdEmpresa, IdRetiroActivo);
     if (model == null)
     {
         return(RedirectToAction("Index"));
     }
     model.IdTransaccionSession = Convert.ToDecimal(SessionFixed.IdTransaccionSessionActual);
     model.lst_ct_cbtecble_det  = bus_comprobante_detalle.get_list(IdEmpresa, model.IdTipoCbte == null ? 0 : Convert.ToInt32(model.IdTipoCbte), model.IdCbteCble == null ? 0 : Convert.ToDecimal(model.IdCbteCble));
     list_ct_cbtecble_det.set_list(model.lst_ct_cbtecble_det, model.IdTransaccionSession);
     cargar_combos(IdEmpresa);
     return(View(model));
 }
示例#27
0
 public Af_Retiro_Activo_Info get_info(int IdEmpresa, decimal IdRetiroActivo)
 {
     try
     {
         Af_Retiro_Activo_Info info = new Af_Retiro_Activo_Info();
         using (Entities_activo_fijo Context = new Entities_activo_fijo())
         {
             Af_Retiro_Activo Entity = Context.Af_Retiro_Activo.FirstOrDefault(q => q.IdEmpresa == IdEmpresa && q.IdRetiroActivo == IdRetiroActivo);
             if (Entity == null)
             {
                 return(null);
             }
             info = new Af_Retiro_Activo_Info
             {
                 IdEmpresa        = Entity.IdEmpresa,
                 Cod_Ret_Activo   = Entity.Cod_Ret_Activo,
                 Concepto_Retiro  = Entity.Concepto_Retiro,
                 Estado           = Entity.Estado,
                 Fecha_Retiro     = Entity.Fecha_Retiro.Date,
                 IdActivoFijo     = Entity.IdActivoFijo,
                 IdCbteCble       = Entity.IdCbteCble,
                 IdEmpresa_ct     = Entity.IdEmpresa_ct,
                 IdTipoCbte       = Entity.IdTipoCbte,
                 IdRetiroActivo   = Entity.IdRetiroActivo,
                 NumComprobante   = Entity.NumComprobante,
                 ValorActivo      = Entity.ValorActivo,
                 Valor_Depre_Acu  = Entity.Valor_Depre_Acu,
                 Valor_Neto       = Entity.Valor_Neto,
                 Valor_Tot_Bajas  = Entity.Valor_Tot_Bajas,
                 Valor_Tot_Mejora = Entity.Valor_Tot_Mejora
             };
         }
         return(info);
     }
     catch (Exception)
     {
         throw;
     }
 }
示例#28
0
 private Af_TipoTransac_x_Cta_CbteCble_Info Get_Info_TipoTran_x_CtaCble(Af_Retiro_Activo_Info InfoAf, ct_Cbtecble_Info CbteCbleInfo)
 {
     try
     {
         Af_TipoTransac_x_Cta_CbteCble_Info infoTranCtaCble = new Af_TipoTransac_x_Cta_CbteCble_Info();
         infoTranCtaCble.IdEmpresa            = InfoAf.IdEmpresa;
         infoTranCtaCble.IdTipTransActivoFijo = InfoAf.IdRetiroActivo;
         infoTranCtaCble.IdCatalogo           = Cl_Enumeradores.eTipoActivoFijo.Retiro_Acti.ToString();
         infoTranCtaCble.ct_IdEmpresa         = CbteCbleInfo.IdEmpresa;
         infoTranCtaCble.ct_IdCbteCble        = CbteCbleInfo.IdCbteCble;
         infoTranCtaCble.ct_IdTipoCbte        = CbteCbleInfo.IdTipoCbte;
         return(infoTranCtaCble);
     }
     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("", "getTipoTran_x_CtaCble", ex.Message), ex)
               {
                   EntityType = typeof(Af_Retiro_Activo_Bus)
               };
     }
 }
 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
     Af_Retiro_Activo_Info model = new Af_Retiro_Activo_Info
     {
         IdEmpresa            = IdEmpresa,
         Fecha_Retiro         = DateTime.Now,
         IdTransaccionSession = Convert.ToDecimal(SessionFixed.IdTransaccionSessionActual)
     };
     model.lst_ct_cbtecble_det = new List <ct_cbtecble_det_Info>();
     list_ct_cbtecble_det.set_list(model.lst_ct_cbtecble_det, model.IdTransaccionSession);
     cargar_combos_detalle();
     cargar_combos(IdEmpresa);
     return(View(model));
 }
示例#30
0
 public bool anularDB(Af_Retiro_Activo_Info info)
 {
     try
     {
         var info_cbte = odata_ct.get_info(info.IdEmpresa, Convert.ToInt32(info.IdTipoCbte), Convert.ToDecimal(info.IdCbteCble));
         if (info_cbte != null)
         {
             if (odata_ct.anularDB(info_cbte))
             {
                 return(odata.anularDB(info));
             }
         }
         else
         {
             return(odata.anularDB(info));
         }
         return(false);
     }
     catch (Exception)
     {
         throw;
     }
 }