예제 #1
0
 public ActionResult Anular(int IdEmpresa = 0, int IdSucursal = 0, int IdMovi_inven_tipo = 0, decimal IdNumMovi = 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
     bus_ing_inv     = new in_Ing_Egr_Inven_Bus();
     bus_det_ing_inv = new in_Ing_Egr_Inven_det_Bus();
     in_Ing_Egr_Inven_Info model = bus_ing_inv.get_info(IdEmpresa, IdSucursal, IdMovi_inven_tipo, IdNumMovi);
     if (model == null)
     {
         return(RedirectToAction("Index"));
     }
     model.lst_in_Ing_Egr_Inven_det = bus_det_ing_inv.get_list(IdEmpresa, IdSucursal, IdMovi_inven_tipo, IdNumMovi);
     model.IdTransaccionSession     = Convert.ToDecimal(SessionFixed.IdTransaccionSession);
     List_in_Ing_Egr_Inven_det.set_list(model.lst_in_Ing_Egr_Inven_det, model.IdTransaccionSession);
     cargar_combos(model);
     #region Validacion Periodo
     ViewBag.MostrarBoton = true;
     if (!bus_periodo.ValidarFechaTransaccion(IdEmpresa, model.cm_fecha, cl_enumeradores.eModulo.INV, model.IdSucursal, ref mensaje))
     {
         ViewBag.mensaje      = mensaje;
         ViewBag.MostrarBoton = false;
     }
     #endregion
     return(View(model));
 }
        private void ucGe_Menu_Mantenimiento_x_usuario_event_btnModificar_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            try
            {
                InfoOC = (com_ordencompra_local_Info)gridViewOrdenCompra.GetFocusedRow();
                if (InfoOC != null)
                {
                    in_Ing_Egr_Inven_det_Bus         bus_IngEgr  = new in_Ing_Egr_Inven_det_Bus();
                    List <in_Ing_Egr_Inven_det_Info> list_IngEgr = new List <in_Ing_Egr_Inven_det_Info>();
                    list_IngEgr = bus_IngEgr.Get_List_Ing_Egr_Inven_det_x_OrdenCompra(InfoOC.IdEmpresa, InfoOC.IdSucursal, InfoOC.IdOrdenCompra);

                    if (InfoOC.Estado == "I")
                    {
                        MessageBox.Show("No se puede modificar Orden de Compra Anulada ");
                    }
                    else
                    {
                        if (list_IngEgr.Count != 0)
                        {
                            MessageBox.Show("La Orden de compra Nº " + InfoOC.oc_NumDocumento +
                                            " tiene Ingresos a Bodega. No se puede modificar.");
                        }
                        else
                        {
                            frm         = new FrmCom_GeneracionOrdenCompraMantenimiento();
                            frm.InfoCab = InfoOC;
                            frm.set_Accion(Cl_Enumeradores.eTipo_action.actualizar);
                            frm.Text = frm.Text + " ***MODIFICAR***";
                            frm.Show(); frm.MdiParent = this.MdiParent;
                            frm.event_frmCom_OrdenCompra_Mant_FormClosing += frm_event_frmCom_OrdenCompra_Mant_FormClosing;
                        }
                    }
                }
                else
                {
                    MessageBox.Show("Seleccione un Registro a Modificar", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return;
                }
            }
            catch (Exception ex)
            {
                Log_Error_bus.Log_Error(ex.ToString());
            }
        }
        public void setInfo()
        {
            try
            {
                //Info = _Info;
                if (info_IngEgr == null)
                {
                    return;
                }
                ucGe_Sucursal.set_SucursalInfo(info_IngEgr.IdSucursal);
                txtNumIngreso.Text = Convert.ToString(info_IngEgr.IdNumMovi);
                dtpFecha.Value     = info_IngEgr.cm_fecha;
                cmbTipoMovi.set_TipoMoviInvInfo(info_IngEgr.IdMovi_inven_tipo);
                txtObservacion.Text = info_IngEgr.cm_observacion;
                txtCodigo.Text      = info_IngEgr.CodMoviInven;
                cmbMotivoInv.set_MotivoInvInfo(Convert.ToInt32(info_IngEgr.IdMotivo_Inv));
                lblAnulado.Visible = info_IngEgr.Estado == "I" ? true : false;

                lista         = new List <in_Ing_Egr_Inven_det_Info>();
                bus_IngEgrDet = new in_Ing_Egr_Inven_det_Bus();
                lista         = bus_IngEgrDet.Get_List_Ing_Egr_Inven_det(info_IngEgr.IdEmpresa, info_IngEgr.IdSucursal, info_IngEgr.IdMovi_inven_tipo, info_IngEgr.IdNumMovi);

                foreach (var items in lista)
                {
                    items.dm_cantidad = items.dm_cantidad < 0 ? items.dm_cantidad * -1 : items.dm_cantidad;
                    items.dm_cantidad_sinConversion = items.dm_cantidad_sinConversion < 0 ? items.dm_cantidad_sinConversion * -1 : items.dm_cantidad_sinConversion;
                }

                ListaBind = new BindingList <in_Ing_Egr_Inven_det_Info>(lista);
                gridControlProductos.DataSource = ListaBind;
            }
            catch (Exception ex)
            {
                Log_Error_bus = new tb_sis_Log_Error_Vzen_Bus();
                Log_Error_bus.Log_Error(ex.ToString());
                MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
 public ActionResult Anular(int IdEmpresa = 0, int IdSucursal = 0, int IdMovi_inven_tipo = 0, decimal IdNumMovi = 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
     bus_ing_inv     = new in_Ing_Egr_Inven_Bus();
     bus_det_ing_inv = new in_Ing_Egr_Inven_det_Bus();
     in_Ing_Egr_Inven_Info model = bus_ing_inv.get_info(IdEmpresa, IdSucursal, IdMovi_inven_tipo, IdNumMovi);
     if (model == null)
     {
         return(RedirectToAction("Index"));
     }
     model.lst_in_Ing_Egr_Inven_det = bus_det_ing_inv.get_list(IdEmpresa, IdSucursal, IdMovi_inven_tipo, IdNumMovi);
     model.IdTransaccionSession     = Convert.ToDecimal(SessionFixed.IdTransaccionSession);
     List_in_Ing_Egr_Inven_det.set_list(model.lst_in_Ing_Egr_Inven_det, model.IdTransaccionSession);
     cargar_combos(IdEmpresa);
     return(View(model));
 }
        public ActionResult Consultar(int IdEmpresa = 0, int IdSucursal = 0, int IdMovi_inven_tipo = 0, decimal IdNumMovi = 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

            bus_ing_inv     = new in_Ing_Egr_Inven_Bus();
            bus_det_ing_inv = new in_Ing_Egr_Inven_det_Bus();
            in_Ing_Egr_Inven_Info model = bus_ing_inv.get_info(IdEmpresa, IdSucursal, IdMovi_inven_tipo, IdNumMovi);
            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", "EgresoInventario", "Index");
            if (model.Estado == "I")
            {
                info.Modificar = false;
                info.Anular    = false;
            }
            else
            {
                if (model.Estado == "A" && model.EstadoAprobacion == "APRO" && model.FechaDespacho == null)
                {
                    info.Modificar = 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_in_Ing_Egr_Inven_det = bus_det_ing_inv.get_list(IdEmpresa, IdSucursal, IdMovi_inven_tipo, IdNumMovi);
            model.IdTransaccionSession     = Convert.ToDecimal(SessionFixed.IdTransaccionSession);
            List_in_Ing_Egr_Inven_det.set_list(model.lst_in_Ing_Egr_Inven_det, model.IdTransaccionSession);
            cargar_combos(model);
            if (Exito)
            {
                ViewBag.MensajeSuccess = MensajeSuccess;
            }
            #region Validacion Periodo
            ViewBag.MostrarBoton = true;
            if (!bus_periodo.ValidarFechaTransaccion(IdEmpresa, model.cm_fecha, cl_enumeradores.eModulo.INV, model.IdSucursal, ref mensaje))
            {
                ViewBag.mensaje      = mensaje;
                ViewBag.MostrarBoton = false;
            }

            if (model.IdEstadoAproba == "APRO" || model.IdEstadoAproba == "REP")
            {
                ViewBag.MostrarBoton = false;
            }
            #endregion

            return(View(model));
        }
예제 #6
0
        private void Preparar_Formulario(Cl_Enumeradores.eTipo_action iAccion)
        {
            try
            {
                string mensajeFrm = "";

                Info_OC = new com_ordencompra_local_Info();

                switch (iAccion)
                {
                case Cl_Enumeradores.eTipo_action.grabar:
                    mensajeFrm = "REGISTRO NUEVO";
                    break;

                case Cl_Enumeradores.eTipo_action.actualizar:
                    mensajeFrm = "MODIFICAR REGISTRO";
                    Info_OC    = (com_ordencompra_local_Info)gridViewOrdenCompra.GetFocusedRow();
                    in_Ing_Egr_Inven_det_Bus         bus_IngEgr  = new in_Ing_Egr_Inven_det_Bus();
                    List <in_Ing_Egr_Inven_det_Info> list_IngEgr = new List <in_Ing_Egr_Inven_det_Info>();
                    if (Info_OC != null)
                    {
                        list_IngEgr = bus_IngEgr.Get_List_Ing_Egr_Inven_det_x_OrdenCompra(Info_OC.IdEmpresa, Info_OC.IdSucursal, Info_OC.IdOrdenCompra);

                        if (Info_OC.IdEstadoAprobacion_cat == "APRO")
                        {
                            MessageBox.Show("La Orden de compra Nº " + Info_OC.oc_NumDocumento +
                                            " ya fue Aprobada. No se puede modificar.");
                            return;
                        }
                        else
                        {
                            if (list_IngEgr.Count != 0)
                            {
                                MessageBox.Show("La Orden de compra Nº " + Info_OC.oc_NumDocumento +
                                                " tiene Ingresos a Bodega. No se puede modificar.");
                                return;
                            }
                        }
                    }
                    else
                    {
                        MessageBox.Show("Seleccione un Registro ", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return;
                    }
                    break;

                case Cl_Enumeradores.eTipo_action.Anular:
                    mensajeFrm = "ANULAR REGISTRO";
                    Info_OC    = (com_ordencompra_local_Info)gridViewOrdenCompra.GetFocusedRow();
                    break;

                case Cl_Enumeradores.eTipo_action.consultar:
                    mensajeFrm = "CONSULTAR REGISTRO";
                    Info_OC    = (com_ordencompra_local_Info)gridViewOrdenCompra.GetFocusedRow();
                    break;

                default:
                    break;
                }

                if (Info_OC != null)
                {
                    frm      = new frmCom_OrdenCompra_Mant();
                    frm.Text = frm.Text + "***" + mensajeFrm + "***";
                    frm.Set_Accion(iAccion);
                    frm.Set_Info(Info_OC);
                    frm.Show();
                    frm.MdiParent = this.MdiParent;
                    frm.event_frmCom_OrdenCompra_Mant_FormClosing += frm_event_frmCom_OrdenCompra_Mant_FormClosing;
                }
                else
                {
                    MessageBox.Show("Seleccione un Registro ", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return;
                }
            }
            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());
            }
        }