Beispiel #1
0
        public override void Imprimir()
        {
            using (internalReport = new Report())
            {
                PrepararImpressao();

                internalReport.RegisterData(Parent.NotasServico.ToArray(), "NotaServico");
                internalReport.Prepare();

                if (isDesign)
                {
                    //internalReport.Design();
                }
                else
                {
                    switch (Filtro)
                    {
                    case FiltroDFeReport.Nenhum:
                        throw new NotImplementedException("ok");

                    case FiltroDFeReport.PDF:
                        var evtPdf = new DANFSeExportEventArgs();
                        evtPdf.Export = new PDFSimpleExport
                        {
                            ShowProgress    = MostrarSetup,
                            OpenAfterExport = MostrarPreview
                        };

                        OnExport.Raise(this, evtPdf);
                        internalReport.Export(evtPdf.Export, NomeArquivo);
                        break;

                    case FiltroDFeReport.HTML:
                        var evtHtml = new DANFSeExportEventArgs();
                        evtHtml.Export = new HTMLExport()
                        {
                            Format        = HTMLExportFormat.MessageHTML,
                            EmbedPictures = true,
                            Preview       = MostrarPreview,
                            ShowProgress  = MostrarSetup
                        };

                        OnExport.Raise(this, evtHtml);
                        internalReport.Export(evtHtml.Export, NomeArquivo);
                        break;

                    default:
                        throw new ArgumentOutOfRangeException();
                    }
                }

                internalReport.Dispose();
            }

            internalReport = null;
        }
Beispiel #2
0
        public PartyListElementViewModel(UserParty party, Action <UserParty, bool> onSelect)
        {
            Id          = party.Id;
            Party.Value = party;

            PartyUnits = new ReactiveCollection <UserUnitViewModel>();
            Tags       = new ReactiveCollection <TagViewModel>();

            IsExpandComment.Subscribe(x =>
            {
                if (x)
                {
                    Comment.Value = party.Comment;
                }
                else
                {
                    Comment.Value = party.Comment?.GetFirstLine() ?? string.Empty;
                }
            });

            EditParty.Subscribe(x =>
            {
                var editWindow = new EditParty((UserParty)x);
                editWindow.ShowDialog();
            });
            OnDelete.Subscribe(() => DeleteParty(party));

            OnExport.Subscribe(() => ExportParty(party));

            OnDuplicate.Subscribe(() => DuplicateParty(party));

            OnSelect.Subscribe(() =>
            {
                IsSelectedRoute.Value = !IsSelectedRoute.Value;
                onSelect?.Invoke(party, IsSelectedRoute.Value);
            });

            UpdateParty(party);
        }
Beispiel #3
0
        public Stream ExportToStream()
        {
            using (internalReport = new Report())
            {
                PrepararImpressao();

                internalReport.RegisterData(Parent.NotasServico.ToArray(), "NotaServico");
                internalReport.Prepare();
                var evtPdf = new DANFSeExportEventArgs
                {
                    Export = new PDFSimpleExport
                    {
                        ShowProgress    = MostrarSetup,
                        OpenAfterExport = MostrarPreview
                    }
                };

                OnExport.Raise(this, evtPdf);
                var stream = new MemoryStream();
                internalReport.Export(evtPdf.Export, stream);
                return(stream);
            }
        }
        private void Imprimir(Stream stream)
        {
            using (internalReport = new Report())
            {
                PrepararImpressao();

                internalReport.RegisterData(Parent.NotasServico.ToArray(), "NotaServico");
                internalReport.Prepare();

                if (isDesign)
                {
                    internalReport.Design();
                }
                else
                {
                    switch (Filtro)
                    {
                    case FiltroDFeReport.Nenhum:
                        if (MostrarPreview)
                        {
                            internalReport.Show();
                        }
                        else
                        {
                            internalReport.Print();
                        }
                        break;

                    case FiltroDFeReport.PDF:
                        var evtPdf = new DANFSeExportEventArgs();
                        evtPdf.Export = new PDFExport
                        {
                            PdfCompliance   = PDFExport.PdfStandard.PdfA_1a,
                            ShowProgress    = MostrarSetup,
                            OpenAfterExport = MostrarPreview
                        };

                        OnExport.Raise(this, evtPdf);
                        if (stream.IsNull())
                        {
                            internalReport.Export(evtPdf.Export, NomeArquivo);
                        }
                        else
                        {
                            internalReport.Export(evtPdf.Export, stream);
                        }
                        break;

                    case FiltroDFeReport.HTML:
                        var evtHtml = new DANFSeExportEventArgs();
                        evtHtml.Export = new HTMLExport()
                        {
                            Format        = HTMLExportFormat.HTML,
                            EmbedPictures = true,
                            Preview       = MostrarPreview,
                            ShowProgress  = MostrarSetup
                        };

                        OnExport.Raise(this, evtHtml);
                        if (stream.IsNull())
                        {
                            internalReport.Export(evtHtml.Export, NomeArquivo);
                        }
                        else
                        {
                            internalReport.Export(evtHtml.Export, stream);
                        }
                        break;

                    default:
                        throw new ArgumentOutOfRangeException();
                    }
                }

                internalReport.Dispose();
            }

            internalReport = null;
        }
Beispiel #5
0
 private void button1_Click_1(object sender, EventArgs e)
 {
     OnExport?.Invoke();
 }
Beispiel #6
0
        private void Imprimir(Stream stream)
        {
            try
            {
                this.Log().Debug("Iniciando impressão.");

                using (internalReport = new Report())
                {
                    PrepararImpressao();

                    this.Log().Debug("Passando dados para impressão.");

                    internalReport.RegisterData(Parent.NotasServico.ToArray(), "NotaServico");
                    internalReport.Prepare();

                    switch (Filtro)
                    {
                    case FiltroDFeReport.Nenhum:
                        if (MostrarPreview)
                        {
                            internalReport.Show();
                        }
                        else if (MostrarSetup)
                        {
                            internalReport.PrintWithDialog();
                        }
                        else
                        {
                            internalReport.Print(settings);
                        }
                        break;

                    case FiltroDFeReport.PDF:
                        this.Log().Debug("Exportando para PDF.");

                        var evtPdf = new DANFSeExportEventArgs();
                        evtPdf.Filtro = Filtro;
                        evtPdf.Export = new PDFSimpleExport()
                        {
                            ImageDpi        = 600,
                            ShowProgress    = MostrarSetup,
                            OpenAfterExport = MostrarPreview
                        };

                        OnExport.Raise(this, evtPdf);
                        if (stream.IsNull())
                        {
                            internalReport.Export(evtPdf.Export, NomeArquivo);
                        }
                        else
                        {
                            internalReport.Export(evtPdf.Export, stream);
                        }

                        this.Log().Debug("Exportação concluida.");
                        break;

                    case FiltroDFeReport.HTML:
                        this.Log().Debug("Exportando para HTML.");

                        var evtHtml = new DANFSeExportEventArgs();
                        evtHtml.Filtro = Filtro;
                        evtHtml.Export = new HTMLExport()
                        {
                            Format        = HTMLExportFormat.HTML,
                            EmbedPictures = true,
                            Preview       = MostrarPreview,
                            ShowProgress  = MostrarSetup
                        };

                        OnExport.Raise(this, evtHtml);
                        if (stream.IsNull())
                        {
                            internalReport.Export(evtHtml.Export, NomeArquivo);
                        }
                        else
                        {
                            internalReport.Export(evtHtml.Export, stream);
                        }

                        this.Log().Debug("Exportação concluida.");
                        break;

                    default:
                        throw new ArgumentOutOfRangeException();
                    }

                    this.Log().Debug("Impressão Concluida.");
                }
            }
            finally
            {
                internalReport = null;
                settings       = null;
            }
        }
Beispiel #7
0
 private void btnExport_Click(object sender, EventArgs e)
 {
     OnExport?.Invoke();
 }