public bool BuscaRelatorio() { //BUSCA O CAD REPORT SE NÃO TIVER if ((!string.IsNullOrEmpty(Cad_Report.NM_Classe)) || (!string.IsNullOrEmpty(Cad_Report.ID_RDC))) { TList_Cad_Report lista = TCN_Cad_Report.Buscar(0, string.Empty, Cad_Report.Modulo, Cad_Report.NM_Classe, Cad_Report.Ident, 0, Cad_Report.ID_RDC, false, false, false); if (lista.Count > 0) { Cad_Report = lista[0]; return(true); } return(false); } return(false); }
public bool Gera_DataCube(string Documento, bool St_imprimir, bool St_visualizar, bool St_enviaremail, List <string> Destinatarios, string Titulo, string Mensagem) { bool retorno = false; TFPreviewDataCube fDataCube = new TFPreviewDataCube(); fDataCube.Text = Cad_Report.DS_Report; //AQUI A CLASSE PARA VISUALIZAçÂO DO GRAFICO //BUSCA O CAD REPORT SE NÃO TIVER if ((Cad_Report.ID_Report == 0) && (NM_Classe != "")) { TList_Cad_Report lista = TCN_Cad_Report.Buscar(0, string.Empty, Modulo, NM_Classe, Ident, 0, string.Empty, false, false, false); if (lista.Count > 0) { Cad_Report = lista[0]; } } XmlDocument docXMLRelatorio = new XmlDocument(); fDataCube.bsCubo.DataSource = DTS_CuboDados; if (Cad_Report.Code_DataCube != null) { docXMLRelatorio.LoadXml(System.Text.ASCIIEncoding.UTF8.GetString(Utils.Compact_Data.Descompactar(Cad_Report.Code_DataCube, string.Empty))); fDataCube.dataCube.Layout = docXMLRelatorio.InnerXml; } //ADD O LAYOUT fDataCube.dcGrid.RefreshDataCubeGrid(); try { fDataCube.dataCube.Recalculate(); } catch { } if (Cad_Report.Code_DataCube != null) { if (Altera_CuboDados == false) { fDataCube.dcGrid.ShowOpen = false; fDataCube.dcGrid.ShowSave = false; fDataCube.dcGrid.ShowWizard = true; if (St_imprimir) { fDataCube.dcGrid.PrintPreview(); } else if (St_visualizar) { fDataCube.WindowState = FormWindowState.Maximized; fDataCube.ShowDialog(); retorno = true; } } else { //CHAMA A CLASSE Q DEFINE O MODELO DO RELATORIO string modeloRelatorio = DefineDesigner(fDataCube); if (modeloRelatorio != "") { Cad_Report.Code_DataCube = Utils.Compact_Data.Compactar(System.Text.ASCIIEncoding.UTF8.GetBytes(modeloRelatorio)); } //GRAVA O REPORT if ((Cad_Report.DS_Report) != "" && (!Homologacao)) { TCN_Cad_Report.GravarReport(Cad_Report, null); } } } else { //VERIFICA SE JÁ TEM O ITEM LANÇADO if (Cad_Report.ID_Report == 0) { Cad_Report.Modulo = Modulo; Cad_Report.NM_Classe = NM_Classe; Cad_Report.DS_Report = NM_Classe; Cad_Report.Ident = Ident; Cad_Report.Versao = 1; //CHAMA A CLASSE Q DEFINE O MODELO DO RELATORIO string modeloRelatorio = DefineDesigner(fDataCube); if (modeloRelatorio != "") { Cad_Report.Code_DataCube = Utils.Compact_Data.Compactar(System.Text.ASCIIEncoding.UTF8.GetBytes(modeloRelatorio)); } //GRAVA O REPORT if ((Cad_Report.DS_Report) != "" && (!Homologacao)) { TCN_Cad_Report.GravarReport(Cad_Report, null); } } else { Cad_Report.Code_DataCube = Utils.Compact_Data.Compactar(System.Text.ASCIIEncoding.UTF8.GetBytes(DefineDesigner(fDataCube))); } } return(retorno); }
public bool Gera_Grafico(string Documento, bool St_imprimir, bool St_visualizar, bool St_enviaremail, List <string> Destinatarios, string Titulo, string Mensagem) { bool retorno = false; //AQUI A CLASSE PARA VISUALIZAçÂO DO GRAFICO //BUSCA O CAD REPORT SE NÃO TIVER if ((Cad_Report.ID_Report == 0) && (NM_Classe != "")) { TList_Cad_Report lista = TCN_Cad_Report.Buscar(0, string.Empty, Modulo, NM_Classe, Ident, 0, string.Empty, false, false, false); if (lista.Count > 0) { Cad_Report = lista[0]; } } ChartViewer.DataSources.Add(new ChartDataSource(DTS_Grafico, "DTS")); XmlDocument docXMLRelatorio = new XmlDocument(); if (Cad_Report.Code_Chart != null) { docXMLRelatorio.LoadXml(System.Text.ASCIIEncoding.UTF8.GetString(Utils.Compact_Data.Descompactar(Cad_Report.Code_Chart, string.Empty))); } if (Cad_Report.Code_Chart != null) { if (Altera_Grafico == false) { TFPreviewChart fChart = new TFPreviewChart(); fChart.Text = Cad_Report.DS_Report; fChart.chartViewer.ChartStream = docXMLRelatorio.InnerXml; fChart.chartViewer.DataSources.Add(new ChartDataSource(DTS_Grafico, "DTS")); fChart.chartViewer.ShowNew = false; fChart.chartViewer.ShowSave = false; fChart.chartViewer.ShowDesigner = false; fChart.chartViewer.ResumeLayout(true); if (St_imprimir) { fChart.chartViewer.PrintDialog(); } else if (St_visualizar) { fChart.WindowState = FormWindowState.Maximized; fChart.ShowDialog(); retorno = true; } } else { //ADICIONA O STREAM DO RELATORIO (XML) ChartViewer.ChartStream = docXMLRelatorio.InnerXml; //DEFINE O DESIGNER ChartViewer.RunDesigner(); //BUSCA OS DADOS DO DESIGNER EM XML +E GRAVA EM BINARY if (ChartViewer.ChartStream != "") { docXMLRelatorio.LoadXml(ChartViewer.ChartStream); //INCREMENTA NOVAMENTE OS DADOS Cad_Report.Code_Chart = Utils.Compact_Data.Compactar(System.Text.ASCIIEncoding.UTF8.GetBytes(docXMLRelatorio.InnerXml)); //grava o report if ((Cad_Report.DS_Report) != "" && (!Homologacao)) { TCN_Cad_Report.GravarReport(Cad_Report, null); } } } } else { //VERIFICA SE JÁ TEM O ITEM LANÇADO if (Cad_Report.ID_Report == 0) { Cad_Report.Modulo = Modulo; Cad_Report.NM_Classe = NM_Classe; Cad_Report.DS_Report = NM_Classe; Cad_Report.Ident = Ident; Cad_Report.Versao = 1; //CHAMA A CLASSE Q DEFINE O MODELO DO RELATORIO string modeloRelatorio = DefineDesigner(null); if (modeloRelatorio != "") { Cad_Report.Code_Chart = Utils.Compact_Data.Compactar(System.Text.ASCIIEncoding.UTF8.GetBytes(modeloRelatorio)); } //GRAVA O REPORT if ((Cad_Report.DS_Report) != "" && (!Homologacao)) { TCN_Cad_Report.GravarReport(Cad_Report, null); } } else { Cad_Report.Code_Chart = Utils.Compact_Data.Compactar(System.Text.ASCIIEncoding.UTF8.GetBytes(DefineDesigner(ChartViewer))); } } return(retorno); }