protected void btn_guardar_ServerClick(object sender, EventArgs e)
        {
            try
            {
                if (FormAccion == "Agregar")
                {
                    WSGestion.WSGestion wsgest = new WSGestion.WSGestion();
                    wsgest.Url = ConfigurationManager.AppSettings.Get("dirWs");
                    WSGestion.MOD_Entrada_Inventario obj = new WSGestion.MOD_Entrada_Inventario();

                    obj.ENT_inv_id_centro_atencion = Convert.ToInt32(txt_cea_codigo.Value);
                    obj.ENT_inv_id_bodega = Convert.ToInt32(dl_id_bodega.SelectedValue);
                    obj.ENT_inv_id_sucursal = Convert.ToInt32(dl_id_sucursal.SelectedValue);
                    obj.ENT_inv_fecha = Convert.ToDateTime(txt_fecha.Text).ToString("dd/MM/yyyy hh:mm:ss");
                    obj.ENT_inv_aplicada = "N";
                    obj.ENT_inv_origen = "INVENTARIO";

                    wsgest.CRE_Entrada_Inventario(obj);
                    Response.Redirect("frm_Grid_Entrada_Inventario.aspx");
                }

                if (FormAccion == "Editar")
                {
                    WSGestion.WSGestion wsgest = new WSGestion.WSGestion();
                    wsgest.Url = ConfigurationManager.AppSettings.Get("dirWs");
                    WSGestion.MOD_Entrada_Inventario obj = new WSGestion.MOD_Entrada_Inventario();

                    obj.ENT_inv_id_entrada_inventario = Convert.ToInt32(txt_codigo.Value);
                    obj.ENT_inv_id_centro_atencion = Convert.ToInt32(txt_cea_codigo.Value);
                    obj.ENT_inv_id_bodega = Convert.ToInt32(dl_id_bodega.SelectedValue);
                    obj.ENT_inv_id_sucursal = Convert.ToInt32(dl_id_sucursal.SelectedValue);
                    obj.ENT_inv_fecha = Convert.ToDateTime(txt_fecha.Text).ToString("dd/MM/yyyy hh:mm:ss");
                    obj.ENT_inv_aplicada = dl_estado.SelectedValue;

                    wsgest.UPD_Entrada_Inventario(obj);
                    Response.Redirect("frm_Grid_Entrada_Inventario.aspx");
                }
            }

            catch (Exception exc)
            {
                Alert_Mensaje.Attributes["class"] = "alert alert-danger";
                mensaje_alerta = exc.ToString();
                titulo_mensaje_alerta = "Error: ";
                Alert_Mensaje.Visible = true;
            }
        }
        private void Cargar_Datos()
        {
            try
            {
                WSGestion.WSGestion wsgest = new WSGestion.WSGestion();
                wsgest.Url = ConfigurationManager.AppSettings.Get("dirWs");
                WSGestion.MOD_Entrada_Inventario obj = new WSGestion.MOD_Entrada_Inventario();
                obj = wsgest.SEL_GRID_BY_ID_Entrada_Inventario(codigo_seleccionado,centro_seleccionado);
                lbl_id_entradad.Text = obj.ENT_inv_id_entrada_inventario.ToString();
                lbl_codigo_titulo.Text = lbl_id_entradad.Text;
                lbl_centro_atencion.Text = obj.ENT_inv_id_centro_atencion.ToString() + " " + obj.CEA_nombre;
                lbl_sucursal.Text = obj.ENT_inv_id_sucursal.ToString() + " " + obj.SUC_nombre;
                lbl_bodega.Text = obj.ENT_inv_id_bodega.ToString() + " " + obj.BOD_descripcion;
                lbl_fecha.Text = obj.ENT_inv_fecha.ToString();
                if (obj.ENT_inv_aplicada == "S")
                {
                    btn_agregar_linea.Enabled = false;
                    btn_eliminar.Disabled = true;
                    txt_articulo.Disabled = true;
                    txt_cantidad.Disabled = true;
                    btn_aplicar.Disabled = true;

                }

            }
            catch (Exception exc)
            {
                WSGestion.WSGestion wsgest = new WSGestion.WSGestion();
                wsgest.Url = ConfigurationManager.AppSettings.Get("dirWs");
                Session[wsgest.Get_usu_id_session(Session.SessionID.ToString())+"Codigo_Select"] = "0";
                Alert_Mensaje.Attributes["class"] = "alert alert-danger";
                mensaje_alerta = exc.ToString();
                titulo_mensaje_alerta = "Error: ";
                Alert_Mensaje.Visible = true;
            }
        }
        private void Carga_Editar()
        {
            try
            {
                WSGestion.WSGestion wsgest = new WSGestion.WSGestion();
                wsgest.Url = ConfigurationManager.AppSettings.Get("dirWs");
                WSGestion.MOD_Entrada_Inventario obj = new WSGestion.MOD_Entrada_Inventario();
                obj = wsgest.SEL_GRID_BY_ID_Entrada_Inventario(codigo_seleccionado, centro_seleccionado);

                txt_codigo.Value = obj.ENT_inv_id_entrada_inventario.ToString();
                dl_id_sucursal.Text = obj.ENT_inv_id_sucursal.ToString();
                dl_id_bodega.Text = obj.ENT_inv_id_bodega.ToString();
                DateTime Fecha = Convert.ToDateTime(obj.ENT_inv_fecha);
                Fecha_Formato = Fecha.ToString("MM/dd/yyyy hh:mm:ss tt");
                txt_fecha.Text = Fecha_Formato;
                dl_estado.Text = obj.ENT_inv_aplicada.ToString();

                txt_codigo.Disabled = true;
                dl_id_bodega.Enabled = false;
                dl_id_sucursal.Enabled = false;

            }
            catch (Exception exc)
            {
                WSGestion.WSGestion wsgest = new WSGestion.WSGestion();
                wsgest.Url = ConfigurationManager.AppSettings.Get("dirWs");
                Session[wsgest.Get_usu_id_session(Session.SessionID.ToString())+"Codigo_Select"] = "0";
                Alert_Mensaje.Attributes["class"] = "alert alert-danger";
                mensaje_alerta = exc.ToString();
                titulo_mensaje_alerta = "Error: ";
                Alert_Mensaje.Visible = true;
            }
        }