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 XtraReport GetReport() { string dataINI = string.Empty; string dataFIM = string.Empty; var report = new rel_SaldosContasBancos(); 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(",", "','") + "')"; } } else { Control.UsuariosControle ctrlUsu = new UsuariosControle(); bool parametro = Control.Configuracoes.Dados.getParametroGradeDIDComplementar(); string idUsu = ctrlUsu.GetUsuarioByLogin(HttpContext.Current.Session["pUId"].ToString()).UsuarioID.ToString(); string idUndFunc = Control.UndFuncionalCtrl.getUndFuncByUsuID(idUsu).ToString(); string unidOrcDefault = Control.UnidadeOrcamentariaCtrl.GetUnidadeOrcamentriaByUnidadeFuncional(idUndFunc).undUnificado; string sql = "select undunificado, undnome from unidadeorcamentaria UO where "; if (parametro == false) { sql = string.Concat(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 = '" + unidOrcDefault + "' " + " ) " + ") "); } else { sql += "uo.undunificado in (select UNDUNIFICADO from SCI_USUARIOS_UNDORC 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 + ")"; } } report.CreateDocument(); return report; }