示例#1
0
            //Grava os dados do DID Finalizado e persiste no tramite
            public string[] gravaDID(string procNumero)
            {
                //retorno[0] = Mensagem;
                //retorno[1] = Numero do processo;

                int procID = 0;
                string[] retorno = new string[2];

                var conn = new FbConnection();
                conn = Persist.GetConn.getConn();

                using (conn) {
                    conn.Open();

                    string query = "Select id from webprocesso where numero =" + procNumero;
                    var cmd = new FbCommand(query, conn);
                    var dr = cmd.ExecuteReader();
                    while (dr.Read())
                    {
                        procID = (int)dr["id"];
                    }
                }

                var tramiteCtrl = new TramiteCtrl();

                if (!tramiteCtrl.processoTemPrimeiroTramite(procID.ToString()))
                {

                    string idUsu = "";
                    string idUndFunc = "";
                    string undOrc = "";
                    var usuarioCtrl = new UsuariosControle();
                    var controleTramite = new TramiteCtrl();
                    var usuarioInfo = usuarioCtrl.getSessionUsuarioInfo();
                    idUsu = usuarioInfo.Item2;
                    idUndFunc = usuarioInfo.Item3;
                    undOrc = usuarioInfo.Item4;

                    var tra = new Tramite();
                    tra._dataEnvio = DateTime.Now;
                    tra._dataRecebimento = DateTime.Now;
                    tra._despacho = null;
                    tra.UsuOrigem.UsuarioID = int.Parse(idUsu);
                    tra.UsuDestino.UsuarioID = int.Parse(idUsu);
                    tra.UndFuncOrigem.ID = int.Parse(idUndFunc);
                    tra.UndFuncDestino.ID = int.Parse(idUndFunc);
                    tra.Proc._IDPROC = procID;
                    tra.Fluxo._ID = FluxoAssuntoCtrl.getPrimeiroFluxo("1")._ID;
                    tra.Situacao._id = 46;//Novo Fluxo Maranguape
                    controleTramite.TramitarProcesso(tra);
                }
                retorno[0] = "Processo "+ procNumero + " gravado com sucesso!!!";
                retorno[1] = procNumero;

                return retorno;
            }
        protected void SqlDataSource1_Init(object sender, EventArgs e)
        {
            string idUsu = "";
            string idUndFunc = "";
            string undOrc = "";

            Control.UsuariosControle ctrlUsu = new UsuariosControle();

            var usuarioCtrl = new UsuariosControle();
            var usuarioInfo = usuarioCtrl.getSessionUsuarioInfo();
            idUsu = usuarioInfo.Item2;
            idUndFunc = usuarioInfo.Item3;
            undOrc = usuarioInfo.Item4;

            bool parametro = Control.Configuracoes.Dados.getParametroGradeDIDComplementar();

            Control.PerfilCtrl perfil = new Control.PerfilCtrl();
            bool perfilConsultaGeral = perfil.getPermissaoConsultaProcessos(idUsu);

            string sql = "select undunificado, undnome from unidadeorcamentaria UO where ";

            if (!perfilConsultaGeral)
            {
                //if (!parametro)
                //{
                //    sql += "uo.undunificado in (SELECT UO.undunificado " +
                //    "    FROM unidadeorcamentaria UO " +
                //    "    JOIN und_orc_und_ges UOG ON UOG.uogorgao = UO.undcodorgao AND UOG.uogunidade = UO.undcodigo " +
                //    "    WHERE " +
                //    "    uog.uogunidadegestora = " +
                //    "    (SELECT UOG.uogunidadegestora " +
                //    "        FROM unidadeorcamentaria UO " +
                //    "        JOIN und_orc_und_ges UOG ON UOG.uogorgao = UO.undcodorgao AND UOG.uogunidade = UO.undcodigo " +
                //    "        where uo.undunificado = '" + undOrc + "' " +
                //    "    ) " +
                //    ")";
                //}
                //else
                //{
                    sql += "uo.undunificado in (select UNDUNIFICADO from SCI_USUARIOS_UNDORC where usu_codigo = " + idUsu + " )";
                //}
            }
            else
            {
                sql += "uo.undunificado = uo.undunificado";
            }
            SqlDataSource1.SelectCommand = sql;
            SqlDataSource1.DataBind();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            string idUsu = "";
            string idUndFunc = "";
            string undOrc = "";
            float saldoDID = 0;

            if (HttpContext.Current.Session["pUId"] != null)
            {
                var usuarioCtrl = new UsuariosControle();
                var usuarioInfo = usuarioCtrl.getSessionUsuarioInfo();
                idUsu = usuarioInfo.Item2;
                idUndFunc = usuarioInfo.Item3;
                undOrc = usuarioInfo.Item4;

                if (!IsPostBack && !IsCallback)
                {
                    hdfDadosDotacao.Set("CONTROLASALDO", string.Empty);
                    hdfContratosInfo.Set("NUMEROCONTRATO", string.Empty);
                    hdfContratosInfo.Set("NUMEROLICITACAO", string.Empty);
                    hdfContratosInfo.Set("CONTROLESALDOITENS", string.Empty);
                    hdfReconhecimentoDivida.Set("RECONHECIMENTO", string.Empty);

                    odsUnidOrcamentaria.SelectParameters["IDUSU"].DefaultValue = idUsu;
                    odsUnidadeFuncional.SelectParameters["undFuncID"].DefaultValue = idUndFunc;

                    string undOrcOrgao = undOrc.ToString().Substring(0, 2);
                    string unidade = undOrc.ToString().Substring(2, 2);

                    hdfInfoUsuario.Set("IDUSUARIO", idUsu);
                    hdfInfoUsuario.Set("IDUNDFUNCIONAL", idUndFunc);

                    hdfContratosInfo.Set("CTRCOD", string.Empty);
                    hdfContratosInfo.Set("LICCOD", string.Empty);
                    hdfContratosInfo.Set("IDMODALIDADE", string.Empty);
                    hdfContratosInfo.Set("CTRCONTROLEPORUO", string.Empty);

                    if (Request.QueryString["op"].ToString() == "edt") {
                        if (Request.QueryString["id"] != null)
                        {
                            var did = new string[51];
                            var dadosDID = new WEBDID.Dados();
                            string idDID = Request.QueryString["id"].ToString();
                            var retornoDID = dadosDID.recuperaDadosDID(idDID);

                            did = retornoDID.Item2;

                            hdfDadosProcesso.Set("DID_ID", did[0].ToString());
                            txtProcessoID.Text = did[12].ToString();
                            txtContrato.Text = did[1].ToString();
                            txtDataDID.Date = DateTime.Parse(did[2].ToString());
                            ASPxMemo1.Text = did[3].ToString();
                            dxtxtValorDID.Text = did[5].ToString();

                            cbbModalidadeEmpenho.Value = did[7].ToString();
                            hfdDadosFornecedor.Set("PESCOD", did[17].ToString());
                            txtFornecedorNome.Text = did[15].ToString();

                            cbbUndOrcamentaria.Value = did[44].ToString();
                            txtDotacao.Text = did[32].ToString();

                            foreach (System.Data.DataRow dr in retornoDID.Item1.listOrigensRecurso.Rows)
                            {
                                hdfDadosDotacao.Set("FONCOD", dr["FONCOD"].ToString());
                                hdfDadosDotacao.Set("FONNOME", dr["FONNOME"].ToString());
                                hdfDadosDotacao.Set("CONTROLASALDO", dr["CONTROLASALDO"].ToString());
                                txtFonteRecursoCodigo.Text = dr["FONCOD"].ToString();
                                txtFonteRecursoNome.Text = dr["FONNOME"].ToString();
                            }

                            txtNatureza.Text = String.Format(@"{0:0\.0\.00\.00\.00}", Convert.ToInt64(did[35].ToString()));
                            txtNatDescricao.Text = did[36].ToString();
                            txtPA.Text = did[33].ToString();
                            txtProjAtiv.Text = did[34].ToString();

                            hdfInfoUsuario.Set("IDUSUARIO",idUsu);
                            hdfInfoUsuario.Set("IDUNDFUNCIONAL", idUndFunc);

                            txtContratoNumero.Text = did[49].ToString();
                            txtLicitacaoNumero.Text = did[48].ToString();
                            txtModalidade.Text = did[51].ToString();

                            hdfContratosInfo.Set("CTRCOD", did[1].ToString());
                            hdfContratosInfo.Set("LICCOD", did[50].ToString());
                            hdfContratosInfo.Set("IDMODALIDADE", did[9].ToString());
                            hdfContratosInfo.Set("CTRCONTROLEPORUO", did[52].ToString());
                            hdfContratosInfo.Set("NUMEROCONTRATO", did[49].ToString());
                            hdfContratosInfo.Set("NUMEROLICITACAO", did[48].ToString());

                            CarregaCentroCustos();
                            cbbCentroCusto.Value = did[6].ToString();
                            var evento = new ASPxGridViewCustomCallbackEventArgs("Refresh");
                            GRIDITENSINSERIDOS_CustomCallback(null, evento);

                            saldoDID = CarregaSaldoDID() + float.Parse(dxtxtValorDID.Value.ToString());
                            txtSaldo.Text = saldoDID.ToString();
                            Session[SessionTotalDID] = saldoDID;

                        }
                    }
                }

            }
            else
            {
                if (!IsCallback)
                {
                    GC.Collect();
                    GC.WaitForPendingFinalizers();
                    GC.Collect();
                    Response.Redirect("../Default1.aspx");
                }
                else
                {
                    GC.Collect();
                    GC.WaitForPendingFinalizers();
                    GC.Collect();
                    ASPxWebControl.RedirectOnCallback("../Default1.aspx");
                }
            }
        }
        protected XtraReport GetReport()
        {
            string dataINI = string.Empty;
            string dataFIM = string.Empty;
            var report = new rel_SaldosContasBancos();

            if (txtData.Value != null)
                report.Parameters["DATASEL"].Value = Convert.ToDateTime(txtData.Value).ToShortDateString().Replace("/", ".");
            else
                report.Parameters["DATASEL"].Value = DateTime.Now.ToShortDateString().Replace("/", ".");

            if (chbMostrarContasComSaldo.Checked)
            {
                report.Parameters["MOSTRARCONTASCOMSALDO"].Value = true;
                report.FilterString += " [SALDO] <> 0 ";

            }

            if (chbRelatorioSintetico.Checked)
            {
                report.Parameters["RELATORIOSINTETICO"].Value = true;
            }

            if (ASPxTokenBox1.Value != null && ASPxTokenBox1.Text.ToString() != string.Empty)
            {
                if (report.FilterString == string.Empty || report.FilterString == "")
                {
                    string undOrc = ASPxTokenBox1.Value.ToString();
                    //report.Parameters.Add(new DevExpress.XtraReports.Parameters.Parameter() { Name = "UNDORCAMENTARIA", Value = undOrc, Type = typeof(string), Visible = false });
                    report.FilterString += "[UNDUNIFICADO] In ('" + undOrc.Replace(",", "','") + "')";
                }
                else
                {
                    string undOrc = ASPxTokenBox1.Value.ToString();
                    //report.Parameters.Add(new DevExpress.XtraReports.Parameters.Parameter() { Name = "UNDORCAMENTARIA", Value = undOrc, Type = typeof(string), Visible = false });
                    report.FilterString += " And [UNDUNIFICADO] In ('" + undOrc.Replace(",", "','") + "')";
                }

                if (ASPxTokenBox2.Value != null && ASPxTokenBox2.Text.ToString() != string.Empty)
                {
                    if (report.FilterString == string.Empty || report.FilterString == "")
                    {
                        string fonte = ASPxTokenBox2.Value.ToString();
                        //report.Parameters.Add(new DevExpress.XtraReports.Parameters.Parameter() { Name = "UNDORCAMENTARIA", Value = undOrc, Type = typeof(string), Visible = false });
                        report.FilterString += " [FONCOD] In ('" + fonte.Replace(",", "','") + "')";
                    }
                    else {
                        string fonte = ASPxTokenBox2.Value.ToString();
                        //report.Parameters.Add(new DevExpress.XtraReports.Parameters.Parameter() { Name = "UNDORCAMENTARIA", Value = undOrc, Type = typeof(string), Visible = false });
                        report.FilterString += " And [FONCOD] In ('" + fonte.Replace(",", "','") + "')";
                    }
                }
            }
            else
            {
                string idUsu = "";
                string idUndFunc = "";
                //string undOrc = "";
                bool consultageral = false;

                var usuarioCtrl = new UsuariosControle();
                var usuarioInfo = usuarioCtrl.getSessionUsuarioInfo();
                idUsu = usuarioInfo.Item2;
                idUndFunc = usuarioInfo.Item3;
                //undOrc = usuarioInfo.Item4;
                consultageral = Convert.ToBoolean(usuarioInfo.Item6);

                string sql = "select undunificado, undnome from unidadeorcamentaria UO ";

                if (!consultageral)
                {
                    sql += "where ";
                    sql += "uo.undunificado in (select UNDUNIFICADO from SCI_USUARIOS_UNDORC where usu_codigo = " + idUsu;
                    sql += " union ";
                    sql += "Select UNDUNIFICADO from unidadeorcamentaria uo join webunidadefuncional uf on (uf.unidorcorg||uf.unidorccod) = uo.undunificado ";
                    sql += "join sci_usuarios usu on usu.USU_IDUNDFUNCIONAL = uf.UNIDFUNCID ";
                    sql += "where usu_codigo =" + idUsu + ")";
                }

                AcessoDados.AcessoDados.abrirConn();

                FirebirdSql.Data.FirebirdClient.FbDataReader dr = AcessoDados.AcessoDados.DataReader(sql);
                string und = string.Empty;
                while (dr.Read())
                {
                    if (und == string.Empty)
                    {
                        und = "'" + dr["UNDUNIFICADO"].ToString() + "'";
                    }
                    else
                    {
                        und += ",'" + dr["UNDUNIFICADO"].ToString() + "'";
                    }
                }

                dr.Close();
                AcessoDados.AcessoDados.fecharConn();

                if (report.FilterString == string.Empty || report.FilterString == "")
                {
                    string undOrc = ASPxTokenBox1.Value.ToString();
                    report.Parameters.Add(new DevExpress.XtraReports.Parameters.Parameter() { Name = "UNDORCAMENTARIA", Value = undOrc, Type = typeof(string), Visible = false });
                    report.FilterString += "[UNDUNIFICADO] In (" + und + ")";
                }
                else
                {
                    string undOrc = ASPxTokenBox1.Value.ToString();
                    report.Parameters.Add(new DevExpress.XtraReports.Parameters.Parameter() { Name = "UNDORCAMENTARIA", Value = undOrc, Type = typeof(string), Visible = false });
                    report.FilterString += " And [UNDUNIFICADO] In (" + und + ")";
                }

                if (ASPxTokenBox2.Value != null && ASPxTokenBox2.Text.ToString() != string.Empty)
                {
                    if (report.FilterString == string.Empty || report.FilterString == "")
                    {
                        string fonte = ASPxTokenBox2.Value.ToString();
                        //report.Parameters.Add(new DevExpress.XtraReports.Parameters.Parameter() { Name = "UNDORCAMENTARIA", Value = undOrc, Type = typeof(string), Visible = false });
                        report.FilterString += " [FONCOD] In ('" + fonte.Replace(",", "','") + "')";
                    }
                    else
                    {
                        string fonte = ASPxTokenBox2.Value.ToString();
                        //report.Parameters.Add(new DevExpress.XtraReports.Parameters.Parameter() { Name = "UNDORCAMENTARIA", Value = undOrc, Type = typeof(string), Visible = false });
                        report.FilterString += " And [FONCOD] In ('" + fonte.Replace(",", "','") + "')";
                    }
                }
            }

            report.CreateDocument();
            return report;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            //Label lblNomeUsuario = new Label();

            string idUsu = "";
            string idUndFunc = "";
            string undOrc = "";

            Control.UsuariosControle ctrlUsu = new UsuariosControle();

            var usuarioCtrl = new UsuariosControle();
            var usuarioInfo = usuarioCtrl.getSessionUsuarioInfo();
            idUsu = usuarioInfo.Item2;
            idUndFunc = usuarioInfo.Item3;
            undOrc = usuarioInfo.Item4;

            if (!Page.IsPostBack && !IsCallback)
            {
                sqlDSCXEntrada.SelectParameters["@usuRecebimento"].DefaultValue = idUsu;
                sqlDSCXEntrada.SelectParameters["@undFuncDestino"].DefaultValue = idUndFunc;
            }
            else {
                sqlDSCXAnalise.SelectParameters["@usuRecebimento"].DefaultValue = idUsu;
                sqlDSCXAnalise.SelectParameters["@undFuncDestino"].DefaultValue = idUndFunc;

                sqlDSCXSaida.SelectParameters["@usuEnvio"].DefaultValue = idUsu;
                sqlDSCXEnviados.SelectParameters["@usuEnvio"].DefaultValue = idUsu;

                sqlDSCXExternos.SelectParameters["@usuEnvio"].DefaultValue = idUsu;
                sqlDSCXExternos.SelectParameters["@undFuncEnvio"].DefaultValue = idUndFunc;

                sqlSituacao.SelectParameters["@usuario"].DefaultValue = idUsu;
                sqlSituacaoExterno.SelectParameters["@usuario"].DefaultValue = idUsu;
            }
            ctrlUsu = null;
            GC.Collect();
        }
示例#6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Session.Timeout = 60;

            string idUsu = string.Empty;

            var usuarioCtrl = new UsuariosControle();
            var usuarioInfo = usuarioCtrl.getSessionUsuarioInfo();
            idUsu = usuarioInfo.Item2;

            UsuariosControle ctrlUsu = new UsuariosControle();

            if (!Convert.ToBoolean(usuarioInfo.Item1))
            {
                if (!Page.IsCallback)
                {
                    GC.Collect();
                    GC.WaitForPendingFinalizers();
                    GC.Collect();
                    Response.Redirect("../Default1.aspx");
                }
                else {
                    GC.Collect();
                    GC.WaitForPendingFinalizers();
                    GC.Collect();
                    ASPxWebControl.RedirectOnCallback("../Default1.aspx");
                }
            }
            else
            {
                if (!Page.IsPostBack)
                {
                    var ctrlUsuario = new UsuariosControle();

                    ctrlUsuario.BuildMenu(ASPxMenu1, idUsu, sqlDataMenu);
                    lbUsuario.Text = usuarioInfo.Item7;

                    //lbPool.Text = FirebirdSql.Data.FirebirdClient.FbConnection.ConnectionPoolsCount.ToString();

                    int hora = int.Parse(DateTime.Now.Hour.ToString());
                    if (hora >= 18)
                    {
                        lbHora.Text = "Boa Noite, ";
                    }
                    else {
                        if (hora >= 12)
                        {
                            lbHora.Text = "Boa Tarde, ";
                        }
                        else {
                            lbHora.Text = "Bom Dia, ";
                        }
                    }
                }
            }

            //Response.Cache.VaryByParams["*"] = true;
            //Response.Cache.VaryByParams.IgnoreParams = false;

            //Response.Cache.VaryByHeaders.UserAgent = true;

            //Response.Cache.SetCacheability(HttpCacheability.ServerAndPrivate);
            //Response.Cache.SetExpires(DateTime.Now.AddDays(10));
        }
示例#7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //Label lblNomeUsuario = new Label();
            //UsuariosControle ctrlUsu = new UsuariosControle();
            //if (!ctrlUsu.VerificaSession(lblNomeUsuario))
            //{
            //    if (!Page.IsCallback)
            //    {
            //        GC.Collect();
            //        GC.WaitForPendingFinalizers();
            //        GC.Collect();
            //        Response.Redirect("../Default1.aspx");
            //    }
            //    else
            //    {
            //        GC.Collect();
            //        GC.WaitForPendingFinalizers();
            //        GC.Collect();
            //        ASPxWebControl.RedirectOnCallback("../Default1.aspx");
            //    }
            //}
            //else
            //{
            //    if (!Page.IsPostBack)
            //    {
            //        var usuarioMenu = new UsuariosControle();

            //        string idUsu = usuarioMenu.GetUsuarioByLogin(HttpContext.Current.Session["pUId"].ToString()).UsuarioID.ToString();

            //        usuarioMenu.BuildMenu(ASPxMenu1, idUsu, sqlDataMenu);

            //        lbUsuario.Text = lblNomeUsuario.Text;
            //        int hora = int.Parse(DateTime.Now.Hour.ToString());
            //        if (hora >= 18)
            //        {
            //            lbHora.Text = "Boa Noite, ";
            //        }
            //        else
            //        {
            //            if (hora >= 12)
            //            {
            //                lbHora.Text = "Boa Tarde, ";
            //            }
            //            else
            //            {
            //                lbHora.Text = "Bom Dia, ";
            //            }
            //        }
            //    }
            //}
            Session.Timeout = 60;

            string idUsu = string.Empty;

            var usuarioCtrl = new UsuariosControle();
            var usuarioInfo = usuarioCtrl.getSessionUsuarioInfo();
            idUsu = usuarioInfo.Item2;

            UsuariosControle ctrlUsu = new UsuariosControle();

            if (!Convert.ToBoolean(usuarioInfo.Item1))
            {
                if (!Page.IsCallback)
                {
                    GC.Collect();
                    GC.WaitForPendingFinalizers();
                    GC.Collect();
                    Response.Redirect("../Default1.aspx");
                }
                else
                {
                    GC.Collect();
                    GC.WaitForPendingFinalizers();
                    GC.Collect();
                    ASPxWebControl.RedirectOnCallback("../Default1.aspx");
                }
            }
            else
            {
                if (!Page.IsPostBack)
                {
                    var ctrlUsuario = new UsuariosControle();

                    ctrlUsuario.BuildMenu(ASPxMenu1, idUsu, sqlDataMenu);
                    lbUsuario.Text = usuarioInfo.Item7;

                    //lbPool.Text = FirebirdSql.Data.FirebirdClient.FbConnection.ConnectionPoolsCount.ToString();

                    int hora = int.Parse(DateTime.Now.Hour.ToString());
                    if (hora >= 18)
                    {
                        lbHora.Text = "Boa Noite, ";
                    }
                    else
                    {
                        if (hora >= 12)
                        {
                            lbHora.Text = "Boa Tarde, ";
                        }
                        else
                        {
                            lbHora.Text = "Bom Dia, ";
                        }
                    }
                }
            }
        }
        protected void cbbDotacoes_Callback(object sender, DevExpress.Web.ASPxClasses.CallbackEventArgsBase e)
        {
            string idUsu = "";

            Control.UsuariosControle ctrlUsu = new UsuariosControle();

            var usuarioCtrl = new UsuariosControle();
            var usuarioInfo = usuarioCtrl.getSessionUsuarioInfo();
            idUsu = usuarioInfo.Item2;

            dsDotacoes.SelectCommand = "SELECT distinct DOTREDUZIDO, DOTCODORGAO||DOTCODUNIDADE AS UO, " +
                    "UDF_COPY(DOTNUMEROPROJETO,1,9) AS FUNCIONAL, " +
                    "UDF_COPY(DOTNUMEROPROJETO,10,4) AS PA, " +
                    "PA.prjnome," +
                    "DOTVALOR, UNINOME, " +
                    "UNDNOME, " +
                    "UO.undabrev, " +
                    "DOTELEMENTO, " +
                    "NATNOME," +
                    "(select total from sp_saldo_dotacao('31.12.9999', DOT.DOTREDUZIDO,'31.12.9999','0',0)) as total " +
                    "FROM DOTACOES DOT JOIN naturezadespesa NAT ON NAT.natcod = DOT.dotelemento " +
                    "JOIN UNIDADEORCAMENTARIA UO ON UO.undcodorgao = DOT.dotcodorgao AND UO.undcodigo = DOT.dotcodunidade " +
                    "join und_orc_und_ges UOG ON UOG.uogorgao = UO.undcodorgao AND UO.undcodigo = UOG.uogunidade " +
                    "    AND UOG.uogorgao = DOT.DOTCODORGAO AND DOT.DOTCODUNIDADE = UOG.uogunidade " +
                    "JOIN unidadegestora UG ON UG.unicod = UOG.uogunidadegestora " +
                    "JOIN projetosatividades PA ON PA.prjnumident = UDF_COPY(DOTNUMEROPROJETO,10,4) " +
                    "WHERE (DOTCODORGAO||DOTCODUNIDADE) "+ //=  '" + cbbUndOrcamentaria.Value.ToString() + "' " +
                    //        "IN (" +
                    //        "    SELECT UO.undunificado " +
                    //        "    FROM unidadeorcamentaria UO " +
                    //        "    JOIN und_orc_und_ges UOG ON UOG.uogorgao = UO.undcodorgao AND UOG.uogunidade = UO.undcodigo " +
                    //        "    WHERE " +
                    //        "    uog.uogunidadegestora in " +
                    //        "    (SELECT UOG.uogunidadegestora " +
                    //        "        FROM unidadeorcamentaria UO " +
                    //        "        JOIN und_orc_und_ges UOG ON UOG.uogorgao = UO.undcodorgao AND UOG.uogunidade = UO.undcodigo " +
                    //        "        where uo.undunificado = '" + cbbUndOrcamentaria.Value.ToString() + "' " +
                    //        "    ) )" +

                    " in (select UNDUNIFICADO from SCI_USUARIOS_UNDORC where usu_codigo = " + idUsu + " "+
                        "union " +
                        "SELECT UNDUNIFICADO FROM unidadeorcamentaria UN " +
                        "JOIN webunidadefuncional UF ON UF.unidorccod = UN.undcodigo AND UF.unidorcorg = UN.undcodorgao " +
                        "JOIN sci_usuarios USU ON USU.usu_idundfuncional = UF.unidfuncid " +
                        "WHERE USU.usu_codigo = " + idUsu + " )" +
                    "ORDER BY DOT.dotnumident";

            dsDotacoes.DataBind();
            cbbDotacoes.DataBind();
        }