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, "Inventario", "DevolucionInventario", "Index");
            if (!info.Nuevo)
            {
                return(RedirectToAction("Index"));
            }
            #endregion
            in_devolucion_inven_Info model = new in_devolucion_inven_Info
            {
                IdEmpresa            = IdEmpresa,
                Fecha_ini            = DateTime.Now.Date.AddMonths(-1),
                Fecha_fin            = DateTime.Now.Date,
                Fecha                = DateTime.Now.Date,
                lst_det              = new List <in_devolucion_inven_det_Info>(),
                IdTransaccionSession = Convert.ToDecimal(SessionFixed.IdTransaccionSession),
            };
            List_det.set_list(new List <in_devolucion_inven_det_Info>(), model.IdTransaccionSession);
            Lista_IngEgr_Inven.set_list(new List <in_Ing_Egr_Inven_Info>(), model.IdTransaccionSession);
            //set_list(new List<in_Ing_Egr_Inven_Info>());
            cargar_combos(IdEmpresa);
            return(View(model));
        }
Пример #2
0
        public Boolean AnularDB(in_devolucion_inven_Info info, ref string msgs)
        {
            try
            {
                using (EntitiesInventario context = new EntitiesInventario())
                {
                    var contact = context.in_devolucion_inven.FirstOrDefault(q => q.IdEmpresa == info.IdEmpresa &&
                                                                             q.IdDev_Inven == info.IdDev_Inven);


                    if (contact != null)
                    {
                        contact.estado          = "I";
                        contact.IdusuarioUltAnu = info.IdusuarioUltAnu;
                        contact.Fecha_UltAnu    = info.Fecha_UltAnu;
                        contact.MotivoAnulacion = info.MotivoAnulacion;
                        contact.observacion     = "**Anulado**" + info.observacion;
                        context.SaveChanges();
                        msgs = "Se ha procedido a anular el registro Egreso varios  #: " + info.IdDev_Inven.ToString() + " exitosamente";
                    }
                }
                return(true);
            }
            catch (Exception ex)
            {
                string arreglo = ToString();
                tb_sis_Log_Error_Vzen_Data oDataLog      = new tb_sis_Log_Error_Vzen_Data();
                tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "", "", "", "", "", DateTime.Now);
                mensaje = ex.ToString() + " " + ex.Message;
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref msgs);

                msgs = "Se ha producido el siguiente error: " + ex.Message;
                throw new Exception(ex.ToString());
            }
        }
Пример #3
0
        public ActionResult Anular(int IdEmpresa = 0, decimal IdDev_Inven = 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

            in_devolucion_inven_Info model = bus_devolucion.get_info(IdEmpresa, IdDev_Inven);
            if (model == null)
            {
                return(RedirectToAction("Index"));
            }
            model.IdTransaccionSession = Convert.ToDecimal(SessionFixed.IdTransaccionSession);
            model.lst_det = bus_det.get_list(IdEmpresa, IdDev_Inven);
            List_det.set_list(model.lst_det, model.IdTransaccionSession);
            cargar_combos(IdEmpresa);
            #region Validacion Periodo
            ViewBag.MostrarBoton = true;
            if (!bus_periodo.ValidarFechaTransaccion(IdEmpresa, model.Fecha, cl_enumeradores.eModulo.FAC, 0, ref mensaje))
            {
                ViewBag.mensaje      = mensaje;
                ViewBag.MostrarBoton = false;
            }
            #endregion
            return(View(model));
        }
Пример #4
0
        void GetInfo()
        {
            try
            {
                infoDetDev = new in_devolucion_inven_Info();


                infoDetDev.IdEmpresa             = param.IdEmpresa;
                infoDetDev.IdSucursal_movi_inven = ucIn_Sucursal_Bodega.get_sucursal().IdSucursal;
                infoDetDev.Fecha            = Convert.ToDateTime(dtpFecha.Value.ToShortDateString());
                infoDetDev.observacion      = txtObservacion.Text;
                infoDetDev.IdDev_Inven      = (txtidDev.Text == "") ? 0 : Convert.ToDecimal(txtidDev.Text);
                infoDetDev.estado           = (lblAnulado.Visible == true) ? "I" : "A";
                infoDetDev.Fecha_UltMod     = param.GetDateServer();
                infoDetDev.IdUsuarioUltModi = param.IdUsuario;

                infoDetDev.cod_Dev_Inven      = txtCodDev.Text;
                infoDetDev.Devuelve_toda_tran = chkDevolver_toda_trans.Checked;
                infoDetDev.IdMovi_inven_tipo  = ucIn_TipoMoviInv_Cmb.get_TipoMoviInvInfo().IdMovi_inven_tipo;
                infoDetDev.IdNumMovi          = Convert.ToDecimal(txtIdMovi_Inv.Text);
                infoDetDev.IdUsuario          = param.IdUsuario;

                infoDetDev.lista_detalle = new List <in_devolucion_inven_det_Info>(Lista_dev_detalle.Where(q => q.Checked == true).ToList());
            }
            catch (Exception ex)
            {
                Log_Error_bus.Log_Error(ex.ToString());
                MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void Preparar_formulario(Cl_Enumeradores.eTipo_action _Accion)
        {
            try
            {
                frm  = new FrmIn_Devolucion_Inven_Mant();
                Info = (in_devolucion_inven_Info)gridViewDevol_Inven.GetFocusedRow();
                frm.event_FrmIn_Devolucion_Inven_Mant_FormClosing += frm_event_FrmIn_Devolucion_Inven_Mant_FormClosing;
                frm.set_accion(_Accion);

                if (_Accion != Cl_Enumeradores.eTipo_action.grabar)
                {
                    if (Info != null)
                    {
                        frm.set_info(Info);
                        frm.MdiParent = this.MdiParent;
                        frm.Show();
                    }
                    else
                    {
                        MessageBox.Show("Debe seleccionar un registro ", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                }
                else
                {
                    frm.MdiParent = this.MdiParent;
                    frm.Show();
                }
            }
            catch (Exception ex)
            {
                string NameMetodo = System.Reflection.MethodBase.GetCurrentMethod().Name;
                MessageBox.Show(param.Get_Mensaje_sys(enum_Mensajes_sys.Error_comunicarse_con_sistemas) + ex.Message + " ", param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
                Log_Error_bus.Log_Error(NameMetodo + " - " + ex.ToString());
            }
        }
Пример #6
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

            in_devolucion_inven_Info model = new in_devolucion_inven_Info
            {
                IdEmpresa            = IdEmpresa,
                Fecha_ini            = DateTime.Now.Date.AddMonths(-1),
                Fecha_fin            = DateTime.Now.Date,
                Fecha                = DateTime.Now.Date,
                lst_det              = new List <in_devolucion_inven_det_Info>(),
                IdTransaccionSession = Convert.ToDecimal(SessionFixed.IdTransaccionSession),
            };
            List_det.set_list(new List <in_devolucion_inven_det_Info>(), model.IdTransaccionSession);
            Lista_IngEgr_Inven.set_list(new List <in_Ing_Egr_Inven_Info>(), model.IdTransaccionSession);
            //set_list(new List<in_Ing_Egr_Inven_Info>());
            cargar_combos(IdEmpresa);
            return(View(model));
        }
        public bool anularDB(in_devolucion_inven_Info info)
        {
            try
            {
                using (Entities_inventario Context = new Entities_inventario())
                {
                    var Entity = Context.in_devolucion_inven.Where(q => q.IdEmpresa == info.IdEmpresa && q.IdDev_Inven == info.IdDev_Inven).FirstOrDefault();

                    Entity.Estado          = false;
                    Entity.IdusuarioUltAnu = info.IdusuarioUltAnu;
                    Entity.Fecha_UltAnu    = DateTime.Now;
                    in_Ing_Egr_Inven_Data odata_inv = new in_Ing_Egr_Inven_Data();
                    if (!odata_inv.anularDB(new in_Ing_Egr_Inven_Info {
                        IdEmpresa = info.dev_IdEmpresa, IdSucursal = info.dev_IdSucursal, IdMovi_inven_tipo = info.dev_IdMovi_inven_tipo, IdNumMovi = info.dev_IdNumMovi, IdusuarioUltAnu = info.IdusuarioUltAnu
                    }))
                    {
                        Entity.IdusuarioUltAnu = null;
                        Entity.Fecha_UltAnu    = null;
                        Entity.Estado          = true;
                    }

                    Context.SaveChanges();
                }

                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }
Пример #8
0
 public bool anularDB(in_devolucion_inven_Info info)
 {
     try
     {
         return(odata.anularDB(info));
     }
     catch (Exception)
     {
         throw;
     }
 }
        private bool validar(in_devolucion_inven_Info i_validar, ref string msg)
        {
            i_validar.lst_det = List_det.get_list().Where(q => q.cant_devuelta > 0).ToList();
            if (i_validar.lst_det.Count == 0)
            {
                msg = "No ha ingresado detalles a la devolución";
                return(false);
            }

            return(true);
        }
Пример #10
0
 public void set_info(in_devolucion_inven_Info _InfoDev)
 {
     try
     {
         infoDetDev = _InfoDev;
     }
     catch (Exception ex)
     {
         Log_Error_bus.Log_Error(ex.ToString());
         MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
        public ActionResult Anular(in_devolucion_inven_Info model)
        {
            model.IdusuarioUltAnu = SessionFixed.IdUsuario;
            if (!bus_devolucion.anularDB(model))
            {
                ViewBag.mensaje = "No se ha podido modificar el registro";
                cargar_combos(model.IdEmpresa);
                return(View(model));
            }

            return(RedirectToAction("Index"));
        }
Пример #12
0
        public List <in_devolucion_inven_Info> Get_List_in_devolucion_inven(int IdEmpresa, int IdSucursalIni, int IdSucursalFin,
                                                                            DateTime FechaIni, DateTime FechaFin)
        {
            List <in_devolucion_inven_Info> Lst = new List <in_devolucion_inven_Info>();

            try
            {
                FechaIni = Convert.ToDateTime(FechaIni.ToShortDateString());
                FechaFin = Convert.ToDateTime(FechaFin.ToShortDateString());
                EntitiesInventario oEnti = new EntitiesInventario();


                var Query = from q in oEnti.vwin_devolucion_inven
                            where q.IdEmpresa == IdEmpresa &&
                            q.IdSucursal_movi_inven >= IdSucursalIni && q.IdSucursal_movi_inven <= IdSucursalFin &&
                            FechaIni <= q.Fecha && q.Fecha <= FechaFin
                            select q;

                foreach (var item in Query)
                {
                    in_devolucion_inven_Info Obj = new in_devolucion_inven_Info();

                    Obj.IdEmpresa             = item.IdEmpresa;
                    Obj.IdSucursal_movi_inven = item.IdSucursal_movi_inven;
                    Obj.IdMovi_inven_tipo     = item.IdMovi_inven_tipo;
                    Obj.IdNumMovi             = item.IdNumMovi;
                    Obj.cod_Dev_Inven         = item.cod_Dev_Inven;
                    Obj.Fecha        = item.Fecha;
                    Obj.estado       = item.estado;
                    Obj.observacion  = item.observacion;
                    Obj.nom_sucursal = item.nom_sucursal;

                    Obj.Devuelve_toda_tran = item.Devuelve_toda_tran;
                    Obj.IdDev_Inven        = item.IdDev_Inven;
                    Obj.IdUsuario          = item.IdUsuario;


                    Lst.Add(Obj);
                }

                return(Lst);
            }
            catch (Exception ex)
            {
                string arreglo = ToString();
                tb_sis_Log_Error_Vzen_Data oDataLog      = new tb_sis_Log_Error_Vzen_Data();
                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;
                throw new Exception(ex.ToString());
            }
        }
 private void gridViewDevol_Inven_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
 {
     try
     {
         Info = gridViewDevol_Inven.GetRow(e.FocusedRowHandle) as in_devolucion_inven_Info;
     }
     catch (Exception ex)
     {
         string NameMetodo = System.Reflection.MethodBase.GetCurrentMethod().Name;
         MessageBox.Show(param.Get_Mensaje_sys(enum_Mensajes_sys.Error_comunicarse_con_sistemas) + ex.Message + " ", param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
         Log_Error_bus.Log_Error(NameMetodo + " - " + ex.ToString());
     }
 }
        public ActionResult Anular(int IdEmpresa = 0, decimal IdDev_Inven = 0)
        {
            in_devolucion_inven_Info model = bus_devolucion.get_info(IdEmpresa, IdDev_Inven);

            if (model == null)
            {
                return(RedirectToAction("Index"));
            }
            model.lst_det = bus_det.get_list(IdEmpresa, IdDev_Inven);
            List_det.set_list(model.lst_det);
            cargar_combos(IdEmpresa);
            return(View(model));
        }
 private bool validar(in_devolucion_inven_Info i_validar, ref string msg)
 {
     i_validar.lst_det = List_det.get_list().Where(q => q.cant_devuelta > 0).ToList();
     if (i_validar.lst_det.Count == 0)
     {
         msg = "No ha ingresado detalles a la devolución";
         return(false);
     }
     if (!bus_periodo.ValidarFechaTransaccion(i_validar.IdEmpresa, i_validar.Fecha, cl_enumeradores.eModulo.INV, ref msg))
     {
         return(false);
     }
     return(true);
 }
Пример #16
0
 public bool modificarDB(in_devolucion_inven_Info info)
 {
     try
     {
         return(odata.modificarDB(info));
     }
     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 = "in_devolucion_inven_Bus", Metodo = "modificarDB", IdUsuario = info.IdUsuario
         });
         return(false);
     }
 }
Пример #17
0
 public Boolean AnularDB(in_devolucion_inven_Info info, ref string msgs)
 {
     try
     {
         return(oDat.AnularDB(info, ref mensaje));
     }
     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(in_devolucion_inven_Bus)
               };
     }
 }
Пример #18
0
        public Boolean GuardarDB(in_devolucion_inven_Info info, ref decimal IdDev_Inven, ref string mensaje)
        {
            try
            {
                using (EntitiesInventario Context = new EntitiesInventario())
                {
                    var Address = new in_devolucion_inven();

                    Address.IdEmpresa     = info.IdEmpresa;
                    Address.IdDev_Inven   = info.IdDev_Inven = IdDev_Inven = GetId(info.IdEmpresa);
                    Address.cod_Dev_Inven = (info.cod_Dev_Inven == "") ? IdDev_Inven.ToString() : info.cod_Dev_Inven;
                    Address.Fecha         = Convert.ToDateTime(info.Fecha.ToShortDateString());

                    Address.Devuelve_toda_tran = info.Devuelve_toda_tran;
                    Address.estado             = "A";


                    Address.IdSucursal_movi_inven = info.IdSucursal_movi_inven;
                    Address.IdMovi_inven_tipo     = info.IdMovi_inven_tipo;
                    Address.IdNumMovi             = info.IdNumMovi;
                    Address.observacion           = (info.observacion == "") ? "" : info.observacion;
                    Address.IdUsuario             = info.IdUsuario;
                    Address.Fecha_Transac         = info.Fecha_Transac;
                    Address.IdUsuarioUltModi      = info.IdUsuarioUltModi;
                    Address.Fecha_UltMod          = info.Fecha_UltMod;
                    Address.IdusuarioUltAnu       = info.IdusuarioUltAnu;
                    Address.Fecha_UltAnu          = info.Fecha_UltAnu;
                    Address.nom_pc = info.nom_pc;
                    Address.ip     = info.ip;

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

                    mensaje = "Grabación ok..";
                }
                return(true);
            }
            catch (Exception ex)
            {
                string arreglo = ToString();
                tb_sis_Log_Error_Vzen_Data oDataLog      = new tb_sis_Log_Error_Vzen_Data();
                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;
                throw new Exception(ex.ToString());
            }
        }
        public ActionResult Consultar(int IdEmpresa = 0, decimal IdDev_Inven = 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

            in_devolucion_inven_Info model = bus_devolucion.get_info(IdEmpresa, IdDev_Inven);
            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, "Inventario", "DevolucionInventario", "Index");
            if (model.Estado == false)
            {
                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_det = bus_det.get_list(IdEmpresa, IdDev_Inven);
            List_det.set_list(model.lst_det, model.IdTransaccionSession);
            cargar_combos(IdEmpresa);
            if (Exito)
            {
                ViewBag.MensajeSuccess = MensajeSuccess;
            }

            #region Validacion Periodo
            ViewBag.MostrarBoton = true;
            if (!bus_periodo.ValidarFechaTransaccion(IdEmpresa, model.Fecha, cl_enumeradores.eModulo.FAC, 0, ref mensaje))
            {
                ViewBag.mensaje      = mensaje;
                ViewBag.MostrarBoton = false;
            }
            #endregion

            return(View(model));
        }
        public ActionResult Nuevo(int IdEmpresa = 0)
        {
            in_devolucion_inven_Info model = new in_devolucion_inven_Info
            {
                IdEmpresa = IdEmpresa,
                Fecha_ini = DateTime.Now.Date.AddMonths(-1),
                Fecha_fin = DateTime.Now.Date,
                Fecha     = DateTime.Now.Date,
                lst_det   = new List <in_devolucion_inven_det_Info>()
            };

            List_det.set_list(new List <in_devolucion_inven_det_Info>());
            set_list(new List <in_Ing_Egr_Inven_Info>());
            cargar_combos(IdEmpresa);
            return(View(model));
        }
        public ActionResult Modificar(in_devolucion_inven_Info model)
        {
            if (!validar(model, ref mensaje))
            {
                ViewBag.mensaje = mensaje;
                cargar_combos(model.IdEmpresa);
                return(View(model));
            }
            if (!bus_devolucion.modificarDB(model))
            {
                ViewBag.mensaje = "No se ha podido modificar el registro";
                cargar_combos(model.IdEmpresa);
                return(View(model));
            }

            return(RedirectToAction("Index"));
        }
        public ActionResult Nuevo(in_devolucion_inven_Info model)
        {
            if (!validar(model, ref mensaje))
            {
                ViewBag.mensaje = mensaje;
                cargar_combos(model.IdEmpresa);
                return(View(model));
            }
            model.IdUsuario = Convert.ToString(SessionFixed.IdUsuario);
            if (!bus_devolucion.guardarDB(model))
            {
                ViewBag.mensaje = "No se ha podido guardar el registro";
                cargar_combos(model.IdEmpresa);
                return(View(model));
            }

            return(RedirectToAction("Index"));
        }
 public in_Ing_Egr_Inven_Info armar_movi(in_devolucion_inven_Info info, int IdMoviInven_tipo, int IdMotivo_inv)
 {
     try
     {
         in_Ing_Egr_Inven_Info movi = new in_Ing_Egr_Inven_Info
         {
             IdEmpresa                = info.IdEmpresa_inv,
             IdSucursal               = info.IdSucursal_inv,
             IdBodega                 = info.lst_det[0].IdBodega,
             IdMovi_inven_tipo        = IdMoviInven_tipo,
             IdNumMovi                = 0,
             signo                    = info.dev_signo,
             cm_fecha                 = info.Fecha.Date,
             cm_observacion           = info.observacion,
             CodMoviInven             = "DEV",
             Estado                   = "A",
             IdMotivo_Inv             = IdMotivo_inv,
             IdUsuario                = info.IdUsuario,
             lst_in_Ing_Egr_Inven_det = new List <in_Ing_Egr_Inven_det_Info>()
         };
         int secuencia = 1;
         foreach (var item in info.lst_det)
         {
             movi.lst_in_Ing_Egr_Inven_det.Add(new in_Ing_Egr_Inven_det_Info
             {
                 IdBodega       = item.IdBodega,
                 Secuencia      = secuencia++,
                 IdProducto     = item.IdProducto,
                 IdUnidadMedida = item.IdUnidadMedida,
                 IdUnidadMedida_sinConversion = item.IdUnidadMedida,
                 mv_costo = item.mv_costo,
                 mv_costo_sinConversion    = item.mv_costo,
                 dm_cantidad               = Math.Abs(item.cant_devuelta) * (info.dev_signo == "+" ? 1 : -1),
                 dm_cantidad_sinConversion = Math.Abs(item.cant_devuelta) * (info.dev_signo == "+" ? 1 : -1),
             });
         }
         return(movi);
     }
     catch (Exception)
     {
         throw;
     }
 }
Пример #24
0
        public ActionResult Modificar(in_devolucion_inven_Info model)
        {
            if (!validar(model, ref mensaje))
            {
                ViewBag.mensaje = mensaje;
                SessionFixed.IdTransaccionSessionActual = model.IdTransaccionSession.ToString();
                cargar_combos(model.IdEmpresa);
                return(View(model));
            }
            model.IdUsuarioUltModi = Convert.ToString(SessionFixed.IdUsuario);
            if (!bus_devolucion.modificarDB(model))
            {
                ViewBag.mensaje = "No se ha podido modificar el registro";
                SessionFixed.IdTransaccionSessionActual = model.IdTransaccionSession.ToString();
                cargar_combos(model.IdEmpresa);
                return(View(model));
            }

            return(RedirectToAction("Index"));
        }
        public ActionResult Anular(int IdEmpresa = 0, decimal IdDev_Inven = 0)
        {
            in_devolucion_inven_Info model = bus_devolucion.get_info(IdEmpresa, IdDev_Inven);

            if (model == null)
            {
                return(RedirectToAction("Index"));
            }
            model.lst_det = bus_det.get_list(IdEmpresa, IdDev_Inven);
            List_det.set_list(model.lst_det);
            cargar_combos(IdEmpresa);
            #region Validacion Periodo
            ViewBag.MostrarBoton = true;
            if (!bus_periodo.ValidarFechaTransaccion(IdEmpresa, model.Fecha, cl_enumeradores.eModulo.FAC, 0, ref mensaje))
            {
                ViewBag.mensaje      = mensaje;
                ViewBag.MostrarBoton = false;
            }
            #endregion
            return(View(model));
        }
Пример #26
0
        public ActionResult Nuevo(in_devolucion_inven_Info model)
        {
            model.lst_det = List_det.get_list(Convert.ToDecimal(SessionFixed.IdTransaccionSessionActual));
            if (!validar(model, ref mensaje))
            {
                ViewBag.mensaje = mensaje;
                SessionFixed.IdTransaccionSessionActual = model.IdTransaccionSession.ToString();
                cargar_combos(model.IdEmpresa);
                return(View(model));
            }
            model.IdUsuario = Convert.ToString(SessionFixed.IdUsuario);
            if (!bus_devolucion.guardarDB(model))
            {
                ViewBag.mensaje = "No se ha podido guardar el registro";
                SessionFixed.IdTransaccionSessionActual = model.IdTransaccionSession.ToString();
                cargar_combos(model.IdEmpresa);
                return(View(model));
            }

            return(RedirectToAction("Index"));
        }
Пример #27
0
 private void LimpiarDatos()
 {
     try
     {
         txtidDev.Text                  = "0";
         txtCodDev.Text                 = "";
         txtObservacion.Text            = "";
         dtpFecha.Value                 = DateTime.Now;
         _Accion                        = Cl_Enumeradores.eTipo_action.grabar;
         Lista_dev_detalle              = new BindingList <in_devolucion_inven_det_Info>();
         gridDevolucion_det.DataSource  = Lista_dev_detalle;
         lblAnulado.Visible             = false;
         chkDevolver_toda_trans.Checked = false;
         infoDetDev                     = new in_devolucion_inven_Info();
     }
     catch (Exception ex)
     {
         Log_Error_bus.Log_Error(ex.ToString());
         MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Пример #28
0
        public in_devolucion_inven_Info Get_Info_in_devolucion_inven(int IdEmpresa, decimal IdDev_Inven)
        {
            try
            {
                in_devolucion_inven_Info Obj   = new in_devolucion_inven_Info();
                EntitiesInventario       oEnti = new EntitiesInventario();

                var Query = from q in oEnti.vwin_devolucion_inven
                            where q.IdEmpresa == IdEmpresa &&
                            q.IdDev_Inven == IdDev_Inven
                            select q;
                foreach (var item in Query)
                {
                    Obj.IdEmpresa             = item.IdEmpresa;
                    Obj.IdSucursal_movi_inven = item.IdSucursal_movi_inven;
                    Obj.IdMovi_inven_tipo     = item.IdMovi_inven_tipo;
                    Obj.IdNumMovi             = item.IdNumMovi;
                    Obj.cod_Dev_Inven         = item.cod_Dev_Inven;
                    Obj.Fecha        = item.Fecha;
                    Obj.estado       = item.estado;
                    Obj.observacion  = item.observacion;
                    Obj.nom_sucursal = item.nom_sucursal;

                    Obj.Devuelve_toda_tran = item.Devuelve_toda_tran;
                    Obj.IdDev_Inven        = item.IdDev_Inven;
                    Obj.IdUsuario          = item.IdUsuario;
                }

                return(Obj);
            }
            catch (Exception ex)
            {
                string arreglo = ToString();
                tb_sis_Log_Error_Vzen_Data oDataLog      = new tb_sis_Log_Error_Vzen_Data();
                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;
                throw new Exception(ex.ToString());
            }
        }
        public in_devolucion_inven_Info get_info(int IdEmpresa, decimal IdDev_Inven)
        {
            try
            {
                in_devolucion_inven_Info info;

                using (Entities_inventario Context = new Entities_inventario())
                {
                    in_devolucion_inven Entity = Context.in_devolucion_inven.Where(q => q.IdEmpresa == IdEmpresa && q.IdDev_Inven == IdDev_Inven).FirstOrDefault();
                    if (Entity == null)
                    {
                        return(null);
                    }
                    info = new in_devolucion_inven_Info
                    {
                        IdEmpresa             = Entity.IdEmpresa,
                        IdDev_Inven           = Entity.IdDev_Inven,
                        cod_Dev_Inven         = Entity.cod_Dev_Inven,
                        Fecha                 = Entity.Fecha,
                        IdEmpresa_inv         = Entity.IdEmpresa_inv,
                        IdSucursal_inv        = Entity.IdSucursal_inv,
                        IdMovi_inven_tipo_inv = Entity.IdMovi_inven_tipo_inv,
                        IdNumMovi_inv         = Entity.IdNumMovi_inv,
                        dev_IdEmpresa         = Entity.dev_IdEmpresa,
                        dev_IdSucursal        = Entity.dev_IdSucursal,
                        dev_IdMovi_inven_tipo = Entity.dev_IdMovi_inven_tipo,
                        dev_IdNumMovi         = Entity.dev_IdNumMovi,
                        dev_signo             = Entity.dev_signo,
                        observacion           = Entity.observacion,
                        Estado                = Entity.Estado
                    };
                }

                return(info);
            }
            catch (Exception)
            {
                throw;
            }
        }
Пример #30
0
        public Boolean ModificarDB(in_devolucion_inven_Info info, ref string msgs)
        {
            try
            {
                using (EntitiesInventario context = new EntitiesInventario())
                {
                    var contact = context.in_devolucion_inven.FirstOrDefault(q => q.IdEmpresa == info.IdEmpresa &&
                                                                             q.IdDev_Inven == info.IdDev_Inven);

                    if (contact != null)
                    {
                        contact.cod_Dev_Inven      = info.cod_Dev_Inven;
                        contact.Fecha              = info.Fecha;
                        contact.Devuelve_toda_tran = info.Devuelve_toda_tran;
                        contact.estado             = info.estado;
                        contact.observacion        = info.observacion;
                        contact.IdUsuarioUltModi   = info.IdUsuarioUltModi;
                        contact.Fecha_UltMod       = info.Fecha_UltMod;
                        context.SaveChanges();
                        msgs = "Se ha procedido a modificar el registro de Egreso Varios  #: " + info.IdNumMovi.ToString() + " exitosamente";
                    }
                }
                return(true);
            }
            catch (Exception ex)
            {
                string arreglo = ToString();
                tb_sis_Log_Error_Vzen_Data oDataLog      = new tb_sis_Log_Error_Vzen_Data();
                tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "", "", "", "", "", DateTime.Now);
                mensaje = ex.ToString() + " " + ex.Message;
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref msgs);

                msgs = "Se ha producido el siguiente error: " + ex.Message;
                throw new Exception(ex.ToString());
            }
        }