Exemplo n.º 1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (IsPostBack)
     {
         Session[relatorio_nome] = relatorio;
         ReportCrystal.DataBind();
     }
     if (!IsPostBack)
     {
         Session[relatorio_nome] = relatorio;
     }
 }
Exemplo n.º 2
0
        private void VisualizarBoleto(int PK_BOLETO)
        {
            //ReportCrystal.VisualizaRelatorio();
            //ReportCrystal.Visible = true;
            ArquivoDownload adExtratoPdf = new ArquivoDownload();

            adExtratoPdf.nome_arquivo    = nome_anexo + PK_BOLETO.ToString() + ".pdf";
            adExtratoPdf.caminho_arquivo = Server.MapPath(@"UploadFile\") + DateTime.Now.ToFileTime() + "_" + PK_BOLETO.ToString() + "_" + adExtratoPdf.nome_arquivo;
            adExtratoPdf.modo_abertura   = System.Net.Mime.DispositionTypeNames.Inline;
            ReportCrystal.ExportarRelatorioPdf(adExtratoPdf.caminho_arquivo);

            Session[ValidaCaracteres(adExtratoPdf.nome_arquivo)] = adExtratoPdf;
            string fullUrl = "WebFile.aspx?dwFile=" + ValidaCaracteres(adExtratoPdf.nome_arquivo);

            AdicionarAcesso(fullUrl);
            AbrirNovaAba(UpdatePanel, fullUrl, adExtratoPdf.nome_arquivo);
        }
        private bool InicializaDadosEMail(string CodEmpresa, string CodMatricula, string DataBase)
        {
            txtEMail.Text = txtEMail.Text.Trim();

            if (String.IsNullOrEmpty(txtEMail.Text))
            {
                MostraMensagemTelaUpdatePanel(UpdatePanel, "Atenção\\n\\nE-Mail obrigatório");
                return(false);
            }
            else if (!Util.ValidaEmail(txtEMail.Text))
            {
                MostraMensagemTelaUpdatePanel(UpdatePanel, "Atenção\\n\\nE-Mail inválido");
                return(false);
            }

            if (epDados == null)
            {
                extratoPrevidenciarioBLL extPrevBLL = new extratoPrevidenciarioBLL();
                epDados = extPrevBLL.Consultar(int.Parse(CodEmpresa), int.Parse(CodMatricula));
            }
            ArquivoDownload newAd = new ArquivoDownload();

            switch (optTipo.SelectedValue)
            {
            case "1":
                newAd.nome_arquivo = nome_anexo_extrato + DateTime.Today.ToString("yyyy_MM_dd") + ".pdf";
                break;

            case "2":
                newAd.nome_arquivo = nome_anexo_extrato + DateTime.Parse(DataBase).ToString("yyyy_MM_dd") + ".pdf";
                break;

            case "3":
                newAd.nome_arquivo = nome_anexo_ficha + DateTime.Today.ToString("yyyy_MM_dd") + ".pdf";
                break;

            case "4":
                MostraMensagemTelaUpdatePanel(UpdatePanel, "Atenção\\n\\nOpção inválida");
                ReportCrystal.Visible = false;
                return(false);
            }

            newAd.dados = ReportCrystal.ExportarRelatorioPdf();
            lstAdPdf.Add(newAd);
            return(true);
        }
Exemplo n.º 4
0
 protected void btnRelatorio_Click(object sender, EventArgs e)
 {
     try
     {
         Resultado res = ValidaCampos(relatorio);
         if (res.Ok)
         {
             ReportCrystal.VisualizaRelatorio();
         }
         else
         {
             throw new Exception(res.Mensagem);
         }
     }
     catch (Exception ex)
     {
         ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "alert", "alert('" + ex.Message + "');", true);
     }
 }
        private void Gera_Pdf(ArquivoDownload adExtratoPdf, bool Download = false)
        {
            List <String> listaSubMatricula = new List <String>();

            foreach (GridViewRow row in grdCancelPlano.Rows)
            {
                if (row.RowType == DataControlRowType.DataRow)
                {
                    string[] planos = new string[3];

                    CheckBox    chkSelect       = (CheckBox)row.FindControl("chkSelect");
                    HiddenField hidSubMatricula = (HiddenField)row.FindControl("hidSubMatricula");

                    if (chkSelect.Checked == true)
                    {
                        listaSubMatricula.Add(hidSubMatricula.Value);
                    }
                }
            }

            if (listaSubMatricula.Count > 0)
            {
                String SubMats = String.Join(",", listaSubMatricula.ToArray());

                if (InicializaRelatorio(empresa.ToString(), matricula.ToString(), SubMats, ResponsavelPlano, hfProtocolo.Value))
                {
                    //ArquivoDownload adExtratoPdf = new ArquivoDownload();
                    //adExtratoPdf.nome_arquivo = "Rel_Carta_Cancelamento.pdf";
                    //adExtratoPdf.caminho_arquivo = Server.MapPath(@"UploadFile\") + DateTime.Now.ToFileTime() + "_" + empresa.ToString() + "_" + matricula.ToString() + "_" + adExtratoPdf.nome_arquivo;
                    //adExtratoPdf.modo_abertura = System.Net.Mime.DispositionTypeNames.Inline;
                    ReportCrystal.ExportarRelatorioPdf(adExtratoPdf.caminho_arquivo);

                    if (Download)
                    {
                        Session[ValidaCaracteres(adExtratoPdf.nome_arquivo)] = adExtratoPdf;
                        string fullUrl = "WebFile.aspx?dwFile=" + ValidaCaracteres(adExtratoPdf.nome_arquivo);
                        AdicionarAcesso(fullUrl);
                        AbrirNovaAba(UpdatePanel, fullUrl, adExtratoPdf.nome_arquivo);
                    }
                }
            }
        }
        protected void btnEnviarSelecao_Click(object sender, EventArgs e)
        {
            if (verificarEmail())
            {
                enviarEmail = 1;
                email       = txtEmail.Text;

                ArquivoDownload adExtratoPdf = new ArquivoDownload();
                adExtratoPdf.nome_arquivo    = "Rel_Carta_Cancelamento.pdf";
                adExtratoPdf.caminho_arquivo = Server.MapPath(@"UploadFile\") + DateTime.Now.ToFileTime() + "_" + empresa.ToString() + "_" + matricula.ToString() + "_" + adExtratoPdf.nome_arquivo;
                adExtratoPdf.modo_abertura   = System.Net.Mime.DispositionTypeNames.Inline;
                Gera_Pdf(adExtratoPdf);

                enviarEmailPdf(ReportCrystal.ExportarRelatorioPdf());

                if (File.Exists(adExtratoPdf.caminho_arquivo))
                {
                    File.Delete(adExtratoPdf.caminho_arquivo);
                }
            }
        }
Exemplo n.º 7
0
        protected void Page_Init(object sender, EventArgs e)
        {
            string relatorio_nome = Request.QueryString["Relatorio_nome"];

            if (!String.IsNullOrEmpty(relatorio_nome))
            {
                if (Request.QueryString["Alert"] != null)
                {
                    exibe_alerta_verifica = Request.QueryString["Alert"];
                }
                if (Request.QueryString["PromptParam"] != null)
                {
                    PromptParam = Boolean.Parse(Request.QueryString["PromptParam"]);
                }
                btnRelatorio.Visible = PromptParam;
                tabelaPagina.Visible = PromptParam;
                //Relatorio res = null;
                ReportCrystal.RelatorioID = relatorio_nome;
                if (Session[relatorio_nome] != null && (IsPostBack || !PromptParam))
                {
                    relatorio = (Relatorio)Session[relatorio_nome];
                    //ReportCrystal.GeraRelatorio();
                    ReportCrystal.VisualizaRelatorio();
                }
                else
                {
                    relatorio = rel.Listar(relatorio_nome);
                    Session[relatorio_nome] = relatorio;
                    NomeRelatorio.Text      = relatorio.titulo;
                    GeraHtml(table, relatorio);
                }
                NomeRelatorio.Text = "Relatorio " + relatorio.titulo;
            }
            else
            {
                MostraMensagemTela(this.Page, "Atenção \\n\\n Para acessar o relatório é necessário estar logado.");
            }
        }
Exemplo n.º 8
0
        protected void grdExtratoUtilizacao_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            string[] Args = e.CommandArgument.ToString().Split(',');

            if (e.CommandName != "Sort")
            {
                switch (e.CommandName)
                {
                case "Visualizar":

                    if (InicializaRelatorio(Args[0], Args[1], Args[2], Args[3], Args[4], Args[5]))
                    {
                        //ReportCrystal.VisualizaRelatorio();
                        //ReportCrystal.Visible = true;
                        ArquivoDownload adExtratoPdf = new ArquivoDownload();
                        adExtratoPdf.nome_arquivo    = nome_anexo + Args[5].Replace("/", "_") + ".pdf";
                        adExtratoPdf.caminho_arquivo = Server.MapPath(@"UploadFile\") + DateTime.Now.ToFileTime() + "_" + Args[0] + "_" + Args[1] + "_" + adExtratoPdf.nome_arquivo;
                        adExtratoPdf.modo_abertura   = System.Net.Mime.DispositionTypeNames.Inline;
                        ReportCrystal.ExportarRelatorioPdf(adExtratoPdf.caminho_arquivo);

                        Session[ValidaCaracteres(adExtratoPdf.nome_arquivo)] = adExtratoPdf;
                        string fullUrl = "WebFile.aspx?dwFile=" + ValidaCaracteres(adExtratoPdf.nome_arquivo);
                        AdicionarAcesso(fullUrl);
                        AbrirNovaAba(UpdatePanel, fullUrl, adExtratoPdf.nome_arquivo);
                    }
                    break;

                case "Email":

                    if (InicializaDadosEMail(Args[0], Args[1], Args[2], Args[3], Args[4], Args[6]))
                    {
                        EnviaEmailExtratoUtil(txtEMail.Text);
                    }

                    break;
                }
            }
        }
Exemplo n.º 9
0
        private bool InicializaDadosEMail(string CodEmpresa, string CodMatricula, string NumIdntfRptant, string NumSubMatric, string Semestre, string DatEmissao, string DatIni = " ")
        {
            txtEMail.Text = txtEMail.Text.Trim();

            if (String.IsNullOrEmpty(txtEMail.Text))
            {
                MostraMensagemTelaUpdatePanel(UpdatePanel, "Atenção\\n\\nE-Mail obrigatório");
                return(false);
            }
            else if (!Util.ValidaEmail(txtEMail.Text))
            {
                MostraMensagemTelaUpdatePanel(UpdatePanel, "Atenção\\n\\nE-Mail inválido");
                return(false);
            }

            ExtratoComponenteBLL ExtUtilBLL = new ExtratoComponenteBLL();
            int iRepresentante = 0;

            int.TryParse(ddlRepresentante.SelectedValue, out iRepresentante);
            epDados         = ExtUtilBLL.Consultar(int.Parse(CodEmpresa), int.Parse(CodMatricula), iRepresentante, 1, 2016);
            epDados.usuario = ddlRepresentante.SelectedItem.Text;

            if (String.IsNullOrEmpty(epDados.empresa) && String.IsNullOrEmpty(epDados.registro))
            {
                MostraMensagemTelaUpdatePanel(UpdatePanel, "Atenção\\n\\nDados não localizados para a matrícula " + CodMatricula);
                return(false);
            }

            ArquivoDownload newAd = new ArquivoDownload();

            // newAd.nome_arquivo = nome_anexo + DatEmissao.Replace("/", "_") + ".pdf";
            newAd.nome_arquivo = nome_anexo + ".pdf";
            newAd.dados        = ReportCrystal.ExportarRelatorioPdf();
            lstAdPdf.Add(newAd);

            return(true);
        }
        protected void imgAprovacao_Click(object sender, ImageClickEventArgs e)
        {
            AberturaFinanceiraDAL dal          = new AberturaFinanceiraDAL();
            ImageButton           imgAprovacao = (ImageButton)sender;
            GridViewRow           row          = (GridViewRow)imgAprovacao.NamingContainer;
            int numRegEmpresa  = 0;
            int numRegAprovado = 0;
            var user           = (ConectaAD)Session["objUser"];

            Resultado res = dal.AprovacaoAberturaFinanceira(Convert.ToInt32((row.FindControl("lblIdReg") as Label).Text), "SYS_FUNCESP");//user.login);

            numRegEmpresa  = dal.GetDataCountEmpresa(Convert.ToInt32((row.FindControl("lblEmpresa") as Label).Text), Convert.ToInt32(txtMes.Text), Convert.ToInt32(txtAno.Text));
            numRegAprovado = dal.GetDataCountAprovados(Convert.ToInt32((row.FindControl("lblEmpresa") as Label).Text), Convert.ToInt32(txtMes.Text), Convert.ToInt32(txtAno.Text));

            if (res.Ok)
            {
                if (numRegAprovado == numRegEmpresa)
                {
                    if (InicializaRelatorioValParticipante(((row.FindControl("lblEmpresa") as Label).Text), txtMes.Text.PadLeft(2, '0'), txtAno.Text))
                    {
                        ArquivoDownload adRelValPartExcel = new ArquivoDownload();
                        adRelValPartExcel.nome_arquivo    = relatorio_nome_part + "_" + (row.FindControl("lblNomEmpresa") as Label).Text.Replace(" ", "_") + "_" + txtMes.Text.PadLeft(2, '0') + txtAno.Text + ".xls";
                        adRelValPartExcel.caminho_arquivo = Server.MapPath(@"UploadFile\") + DateTime.Now.ToFileTime() + "_" + adRelValPartExcel.nome_arquivo;
                        adRelValPartExcel.modo_abertura   = System.Net.Mime.DispositionTypeNames.Inline;
                        ReportCrystal.ExportarRelatorioExcel(adRelValPartExcel.caminho_arquivo);

                        Session[ValidaCaracteres(adRelValPartExcel.nome_arquivo)] = adRelValPartExcel;
                        string fullUrl = "WebFile.aspx?dwFile=" + ValidaCaracteres(adRelValPartExcel.nome_arquivo);
                        AdicionarAcesso(fullUrl);
                        AbrirNovaAba(UpdatePanel, fullUrl, adRelValPartExcel.nome_arquivo);
                    }

                    if (InicializaRelatorioValCredenciado(((row.FindControl("lblEmpresa") as Label).Text), txtMes.Text.PadLeft(2, '0'), txtAno.Text))
                    {
                        ArquivoDownload adRelValCredExcel = new ArquivoDownload();
                        adRelValCredExcel.nome_arquivo    = relatorio_nome_cred + "_" + (row.FindControl("lblNomEmpresa") as Label).Text.Replace(" ", "_") + "_" + txtMes.Text.PadLeft(2, '0') + txtAno.Text + ".xls";
                        adRelValCredExcel.caminho_arquivo = Server.MapPath(@"UploadFile\") + DateTime.Now.ToFileTime() + "_" + adRelValCredExcel.nome_arquivo;
                        adRelValCredExcel.modo_abertura   = System.Net.Mime.DispositionTypeNames.Inline;
                        ReportCrystal.ExportarRelatorioExcel(adRelValCredExcel.caminho_arquivo);

                        Session[ValidaCaracteres(adRelValCredExcel.nome_arquivo)] = adRelValCredExcel;
                        string fullUrl = "WebFile.aspx?dwFile=" + ValidaCaracteres(adRelValCredExcel.nome_arquivo);
                        AdicionarAcesso(fullUrl);
                        AbrirNovaAba(UpdatePanel, fullUrl, adRelValCredExcel.nome_arquivo);
                    }

                    MostraMensagemTelaUpdatePanel(UpdatePanel, "Todos os Movimentos da Empresa: " + (row.FindControl("lblNomEmpresa") as Label).Text + " Aprovados , Relatórios Gerados");
                    grdAberturaFinanceira.DataBind();
                }
                else
                {
                    MostraMensagemTelaUpdatePanel(UpdatePanel, "Aprovado com Sucesso");
                    grdAberturaFinanceira.DataBind();
                }
            }
            else
            {
                MostraMensagemTelaUpdatePanel(UpdatePanel, res.Mensagem);
                grdAberturaFinanceira.DataBind();
            }
        }