//public ActionResult PrintView()
        //{
        //    //ViewBag.myFlag = flag;

        //    return View(ip);
        //}

        public ActionResult PrintAllPrices()
        {
            List <Item> iList = itemService.FindAllActiveItems();
            List <ItemPricesListViewModel> ip      = new List <ItemPricesListViewModel>();
            ItemPricesListViewModel        myModel = new ItemPricesListViewModel();

            foreach (Item i in iList)
            {
                ip.Add(new ItemPricesListViewModel()
                {
                    ItemCode    = i.ItemCode,
                    Description = i.Description,
                    Code1       = itemPriceService.FindOneByItemAndSequence(i, 1).SupplierCode,
                    Code2       = itemPriceService.FindOneByItemAndSequence(i, 2).SupplierCode,
                    Code3       = itemPriceService.FindOneByItemAndSequence(i, 3).SupplierCode,
                    Price1      = itemPriceService.FindOneByItemAndSequence(i, 1).Price,
                    Price2      = itemPriceService.FindOneByItemAndSequence(i, 2).Price,
                    Price3      = itemPriceService.FindOneByItemAndSequence(i, 3).Price
                });
            }
            var a = new ViewAsPdf("PrintView", ip)
            {
                FileName = "ItemPrices.pdf"
            };

            a.Cookies = Request.Cookies.AllKeys.ToDictionary(k => k, k => Request.Cookies[k].Value);
            a.FormsAuthenticationCookieName = System.Web.Security.FormsAuthentication.FormsCookieName;
            a.CustomSwitches = "--load-error-handling ignore";
            return(a);
        }
Example #2
0
        public byte[] ImprimirResultadosKobo(int id)
        {
            try
            {
                ResultadoKobos      kobos = new ResultadoKobos();
                ReporteResultadosBl bl    = new ReporteResultadosBl();
                kobos = bl.GetResultadoKobosId(id, Logueado.idUsuario);
                string paciente       = kobos.apellidoPaterno + " " + kobos.apellidoMaterno + " " + kobos.Nombres;
                string footer         = Server.MapPath("~/Views/ReporteResultados/PrintFooter.html");
                string customSwitches = string.Format("--print-media-type " +
                                                      "--header-spacing \"0\" " +
                                                      "--footer-html \"{0}\" " +
                                                      "--footer-spacing \"10\" " +
                                                      "--footer-line  " +
                                                      "--footer-font-size \"10\" ", footer);

                ViewBag.MensajeObservacion = ConfigurationManager.AppSettings["MensajeObservacionReporteKobos"];
                var pdf = new ViewAsPdf("ReporteKobos", kobos)
                {
                    FileName        = "ReporteKobos-" + paciente + ".pdf",
                    PageSize        = Size.A4,
                    PageOrientation = Orientation.Portrait,
                    PageMargins     = new Margins(10, 10, 30, 10),
                    CustomSwitches  = customSwitches
                };
                return(pdf.BuildPdf(ControllerContext));
            }
            catch (Exception ex)
            {
                new bsPage().LogError(ex, "LogNetLab", "", "ImprimirResultadosKobos");
                throw ex;
            }
        }
Example #3
0
        public async Task <IActionResult> PrintOrder(IFormCollection orderSelect)
        {
            List <Ordering> orderToPrint = new List <Ordering>();

            foreach (var item in orderSelect["OrderingId"])
            {
                int orderingId = Int32.Parse(item);
                var myOrdering = await _context.Orderings.Where(o => o.OrderingId == orderingId)
                                 .Include(o => o.Product)
                                 .Include(o => o.Receiver)
                                 .Include(o => o.Receiver.District)
                                 .Include(o => o.Receiver.Aumphure)
                                 .Include(o => o.Receiver.Province)
                                 .OrderBy(p => p.Time).FirstOrDefaultAsync();

                myOrdering.Status = Status.CompleteSending;     //Set Status Ordering to Complete sending
                _context.Orderings.Update(myOrdering);
                await _context.SaveChangesAsync();

                orderToPrint.Add(myOrdering);
            }

            var DocumentOrder = new ViewAsPdf("OrderPrint", orderToPrint)
            {
                PageSize = Rotativa.AspNetCore.Options.Size.A4,
                FileName = DateTime.Now.ToString("MMddyyyy_HHmmss") + ".pdf"
            };

            return(DocumentOrder);
            //return new ViewAsPdf("OrderPrint", orderToPrint);
            //return View("OrderPrint", orderToPrint);
        }
        //pdf bases militares

        public ActionResult GerarRelatorioBases(int?pagina, Boolean?gerarPDF)
        {
            var GerarRelatorioBases = db.BasesMilitares.OrderBy(n => n.id_BasesMilitares).ToList <BasesMilitares>();

            if (gerarPDF != true)
            {
                //Definindo a paginação
                int paginaQdteRegistros   = 10;
                int paginaNumeroNavegacao = (pagina ?? 1);

                return(View(GerarRelatorioBases.ToPagedList(paginaNumeroNavegacao, paginaQdteRegistros)));
            }
            else
            {
                int paginaNumero = 1;

                var pdf = new ViewAsPdf
                {
                    ViewName    = "GerarRelatorioBases",
                    PageSize    = Size.A4,
                    IsGrayScale = true,
                    Model       = GerarRelatorioBases.ToPagedList(paginaNumero, GerarRelatorioBases.Count)
                };
                return(pdf);
            }
        }
Example #5
0
        public ActionResult Pdf(int?pagina, Boolean?gerarPDF, string Pesquisa)

        {
            ViewBag.Pesquisa = Pesquisa;



            var listagemClientes = db.CELULA.Where(i => i.DISCIPULO.NOME.Equals(Pesquisa) || i.DIA_SEMANA.NOME_DIA.Equals(Pesquisa) || i.LUGAR.Equals(Pesquisa)).OrderBy(n => n.DISCIPULO.NOME).ToList <CELULA>();

            if (gerarPDF != true)
            {
                //Definindo a paginação

                int paginaQdteRegistros   = 100;
                int paginaNumeroNavegacao = (pagina ?? 1);

                return(View(listagemClientes.ToPagedList(paginaNumeroNavegacao, paginaQdteRegistros)));
            }
            else
            {
                int paginaNumero = 1;
                var pdf          = new ViewAsPdf
                {
                    ViewName    = "Pdf",
                    PageSize    = Size.A4,
                    IsGrayScale = true,
                    Model       = listagemClientes.ToPagedList(paginaNumero, listagemClientes.Count)
                };
                return(pdf);
            }
        }
Example #6
0
        public ActionResult ListagemPedido(int?pagina, bool?gerarPDF)
        {
            var listagemPedido = db.Pedidos.OrderBy(n => n.IdPedido).ToList();

            if (gerarPDF != true)
            {
                //Definindo a paginação
                int paginaQdteRegistros   = 10;
                int paginaNumeroNavegacao = (pagina ?? 1);

                return(View(listagemPedido.ToPagedList(paginaNumeroNavegacao, paginaQdteRegistros)));
            }
            else
            {
                int paginaNumero = 1;

                var pdf = new ViewAsPdf
                {
                    ViewName        = "ListagemPedido",
                    PageSize        = Size.A4,
                    PageOrientation = Orientation.Landscape,
                    IsGrayScale     = true,
                    Model           = listagemPedido.ToPagedList(paginaNumero, listagemPedido.Count)
                };
                return(pdf);
            }
        }
Example #7
0
        public ActionResult ListagemClientePorNome(string nome, int?pagina, bool?gerarPDF)
        {
            //var listagemClientes = db.Clientes.OrderBy(n => n.IdCliente).ToList();
            var listagemCliente = db.Clientes.Where(i => i.Nome == nome).OrderBy(i => i.IdCliente).ToList();

            ViewBag.nome = nome;

            if (gerarPDF != true)
            {
                //Definindo a paginação
                int paginaQdteRegistros   = 10;
                int paginaNumeroNavegacao = (pagina ?? 1);

                return(View(listagemCliente.ToPagedList(paginaNumeroNavegacao, paginaQdteRegistros)));
            }
            else
            {
                int paginaNumero = 1;

                var pdf = new ViewAsPdf
                {
                    ViewName        = "ListagemClientePorNome",
                    PageSize        = Size.A4,
                    PageOrientation = Orientation.Landscape,
                    IsGrayScale     = true,
                    Model           = listagemCliente.ToPagedList(paginaNumero, listagemCliente.Count)
                };
                return(pdf);
            }
        }
Example #8
0
        /// <summary>第一種透過 View 產生PDF</summary>
        /// <returns></returns>
        public ActionResult DownloadPDF()
        {
            /*透過View 產生PDF*/
            //透過DB或是MODEL指定PDF內容
            GeneratePDFModel model   = new GeneratePDFModel();
            string           content = "<h2>Rotativa PDF From ViewAsPdf <h2>" +
                                       "<p>Rotativa真的是太方便了!!! <p>";
            string logoFilePath = @"/Images/DotBlogsLogo.gif";

            //指定PDF內容
            model.PDFContent = content;
            //圖片位置
            model.PDFLogo = Server.MapPath(logoFilePath);


            /*產生PDF*/
            ViewAsPdf GenPDF = new ViewAsPdf();

            //指定檔案名稱
            GenPDF.FileName = "ViewPdf.pdf";
            //將GeneratePDFModel 所設定的內容置入
            GenPDF.Model = model;
            //對應View GeneratePDF.cshtml
            GenPDF.ViewName = "GeneratePDF";
            //設定Margin
            GenPDF.PageMargins = new Margins()
            {
                Top = 10, Bottom = 10, Left = 10, Right = 10
            };
            //指定大小預設為A4
            GenPDF.PageSize = Size.A4;
            return(GenPDF);
        }
        public ActionResult BuscaOS(DateTime dt1, DateTime dt2, int?pagina, Boolean?gerarPdf)
        {
            var buscaOS = db.FormularioOrdemServicoes.Where(a => a.Dt >= dt1 && a.Dt <= dt2).ToList();

            ViewBag.dt1 = dt1;
            ViewBag.dt2 = dt2;
            if (gerarPdf == true)
            {
                int pgQtdRegistro = 2;
                int pgNav         = (pagina ?? 1);

                return(View(buscaOS.ToPagedList(pgNav, pgQtdRegistro)));
            }
            else
            {
                int paginaNumero = 1;
                var pdf          = new ViewAsPdf
                {
                    ViewName    = "OsData",
                    PageSize    = Size.A4,
                    IsGrayScale = false,
                    Model       = buscaOS.ToPagedList(paginaNumero, buscaOS.Count)
                };
                return(pdf);
            }
        }
Example #10
0
        public ActionResult BuscaCliente(int?pagina, Boolean?gerarPdf, int ClienteId)
        {
            var kits = db.Especificacaos.Where(o => o.ClienteId == ClienteId).ToList();

            ViewBag.cliente = db.Clientes.Find(ClienteId).NomeCliente;
            if (gerarPdf == true)
            {
                int pgQtdRegistro = 10;
                int pgNav         = (pagina ?? 1);

                return(View(kits.ToPagedList(pgNav, pgQtdRegistro)));
            }
            else
            {
                int paginaNumero = 1;
                var pdf          = new ViewAsPdf
                {
                    ViewName    = "ExibeKit",
                    PageSize    = Size.A4,
                    IsGrayScale = false,
                    Model       = kits.ToPagedList(paginaNumero, kits.Count)
                };
                return(pdf);
            }
        }
Example #11
0
        public ActionResult ExibeOpRefugo(int?pagina, Boolean?gerarPdf, string id)
        {
            OrdemProducaoRefugo ordemProducaoRefugo = db.OrdemProducaoRefugoes.Find(id);
            var busca = db.ParadaRefugoes.Where(o => o.OrdemProducaoRefugoId == id).ToList();

            ordemProducaoRefugo.ParadasRefugo = busca;
            var busca2 = db.EspecificacaoRefugoes.Where(o => o.OrdemProducaoRefugoId == id).Include(o => o.CorPeca).ToList();

            ordemProducaoRefugo.EspecificacoesRefugo = busca2;
            List <OrdemProducaoRefugo> producoes = new List <OrdemProducaoRefugo>();

            producoes.Add(ordemProducaoRefugo);
            if (gerarPdf != true)
            {
                int pgQtdRegistro = 2;
                int pgNav         = (pagina ?? 1);
                return(View(producoes.ToPagedList(pgNav, pgQtdRegistro)));
            }
            else
            {
                int paginaNumero = 1;
                var pdf          = new ViewAsPdf
                {
                    ViewName    = "ExibeOpRefugo",
                    PageSize    = Size.A4,
                    IsGrayScale = false,
                    Model       = producoes.ToPagedList(paginaNumero, producoes.Count)
                };
                return(pdf);
            }
        }
Example #12
0
        public ActionResult ExibeExped(int?pagina, Boolean?gerarPdf, int id)
        {
            ExpedicaoCopo expedicaoCopo = db.ExpedicaoCopoes.Find(id);

            db.Entry(expedicaoCopo).Reference(f => f.Cliente).Load();
            db.Entry(expedicaoCopo).Reference(f => f.Marcanti).Load();
            var busca = from venda in db.Vendas
                        where venda.ExpedicaoCopoId == id
                        select venda;
            List <ExpedicaoCopo> expedicoes = new List <ExpedicaoCopo>();

            expedicaoCopo.Vendas = busca.Include(o => o.EspecificacaoCopo).Include(o => o.EspecificacaoCopo.Cor).ToList();
            expedicoes.Add(expedicaoCopo);
            if (gerarPdf != true)
            {
                int pgQtdRegistro = 2;
                int pgNav         = (pagina ?? 1);
                return(View(expedicoes.ToPagedList(pgNav, pgQtdRegistro)));
            }
            else
            {
                int paginaNumero = 1;
                var pdf          = new ViewAsPdf
                {
                    ViewName    = "ExibeExped",
                    PageSize    = Size.A4,
                    IsGrayScale = false,
                    Model       = expedicoes.ToPagedList(paginaNumero, expedicoes.Count)
                };
                return(pdf);
            }
        }
Example #13
0
        public ActionResult ExibeOpCopo(int?pagina, Boolean?gerarPdf, string id)
        {
            OrdemProducaoCopo ordemProducaoCopo = db.OrdemProducaoCopoes.Find(id);
            var busca  = db.EspecificacaoCopoes.Where(o => o.OrdemProducaoCopoId == id).Include(o => o.Cor).ToArray();
            var busca2 = db.ParadaCopoes.Where(o => o.OrdemProducaoCopoId == id).ToArray();
            var busca3 = db.ControleDeQualidadeCopoes.Where(o => o.OrdemProducaoCopoId == id).Include(o => o.Usuario).ToArray();

            ordemProducaoCopo.EspecificacoesCopo       = busca;
            ordemProducaoCopo.ParadasCopo              = busca2;
            ordemProducaoCopo.ControleDeQualidadeCopos = busca3;
            List <OrdemProducaoCopo> producoes = new List <OrdemProducaoCopo>();

            producoes.Add(ordemProducaoCopo);
            if (gerarPdf != true)
            {
                int pgQtdRegistro = 2;
                int pgNav         = (pagina ?? 1);
                return(View(producoes.ToPagedList(pgNav, pgQtdRegistro)));
            }
            else
            {
                int paginaNumero = 1;
                var pdf          = new ViewAsPdf
                {
                    ViewName    = "ExibeOpCopo",
                    PageSize    = Size.A4,
                    IsGrayScale = false,
                    Model       = producoes.ToPagedList(paginaNumero, producoes.Count)
                };
                return(pdf);
            }
        }
        //public async Task<IActionResult> PrintFuncionarios()
        //{
        //    var relatorioPDF = new ViewAsPdf
        //    {
        //        ViewName = "Index",
        //        Model = Funcionario.ToPagedList
        //    };

        //    return relatorioPDF;
        //    string customSwitches = string.Format("--header-center \"TESTE DE CABEÇALHO\" " +
        //        "--header-spacing \"8\" " +
        //        "--header-font-name \"Open Sans\" " +
        //        "--footer-font-size \"8\" " +
        //        "--footer-font-name \"Open Sans\" " +
        //        "--header-font-size \"10\" " +
        //        "--footer-right \"Pag: [page] de [toPage]\"");

        //    var p = new ViewAsPdf(await _funcionarioService.FindAllAsync());

        //    p = new PartialViewResult
        //    {
        //        ViewName = "PrintFuncionarios",
        //        RotativaOptions = { CustomSwitches = customSwitches },
        //        CustomSwitches = customSwitches,
        //        PageMargins = new Rotativa.AspNetCore.Options.Margins(30, 10, 15, 10)
        //    };

        //    return p;
        //}

        public ActionResult PrintFuncionarios()
        {
            var listaFuncionarios = _context.Funcionarios.ToList();

            int pagNumero = 1;

            string customSwitches = string.Format("--header-left \"LISTA DE FUNCIONARIOS CADASTRADOS\" " +
                                                  "--header-spacing \"8\" " +
                                                  "--header-font-name \"Open Sans\" " +
                                                  "--footer-font-size \"10\" " +
                                                  "--footer-font-name \"Open Sans\" " +
                                                  "--header-font-size \"10\" " +
                                                  "--footer-right \"Pag: [page] de [toPage]\"");


            var relatorioPDF = new ViewAsPdf
            {
                ViewName       = "PrintFuncionarios",
                IsGrayScale    = true,
                Model          = listaFuncionarios.ToPagedList(pagNumero, listaFuncionarios.Count),
                CustomSwitches = customSwitches,
                PageMargins    = new Rotativa.AspNetCore.Options.Margins(30, 10, 15, 10)
            };

            return(relatorioPDF);
        }
Example #15
0
        public ViewAsPdf RelatorioPacientes()
        {
            Carro carro = new Carro();

            carro.placa = 123;
            carro.cor   = "Azul";
            carro.id    = 10;

            //string header = Microsoft.AspNetCore.Server.MapPath("~/Static/NewFolder/PrintHeader.html");
            //string footer = Server.MapPath("~/Static/NewFolder/PrintFooter.html");

            string customSwitches = string.Format("--header-html  \"{0}\" " +
                                                  "--header-spacing \"0\" " +
                                                  "--footer-html \"{1}\" " +
                                                  "--footer-spacing \"10\" " +
                                                  "--footer-font-size \"10\" " +
                                                  "--header-font-size \"10\" " +
                                                  "--footer-right \"Pag: [page] de [toPage]\" ");

            var demoViewLandscape = new ViewAsPdf(carro)
            {
                FileName = "Arquivo_" + DateTime.Now + ".pdf",
                //PageMargins = { Left = 10, Bottom = 0, Right = 10, Top = 5 },
                //PageSize = Rotativa.AspNetCore.Options.Size.A4,
                //PageOrientation = Rotativa.AspNetCore.Options.Orientation.Portrait,
                //PageOrientation = Rotativa.AspNetCore.Options.Orientation.Landscape,
                //CustomSwitches = $"--footer-html \"{Url.Action("Footer", "RelatorioPDF", new { area = "" }, "http")}\" --header-html \"{Url.Action("Footer", "RelatorioPDF", new { area = "" }, "http")}\"",
                CustomSwitches = customSwitches,
            };

            return(demoViewLandscape);
        }
        public ActionResult BuscaTM(DateTime dt1, DateTime dt2, int?pagina, Boolean?gerarPdf, int?id)
        {
            var buscaTM = db.FormularioTrocaMoldes.Where(a => a.DtRetirada >= dt1 && a.DtRetirada <= dt2).ToList();

            ViewBag.dt1 = dt1;
            ViewBag.dt2 = dt2;
            if (gerarPdf == true)
            {
                int pgQtdRegistro = 10;
                int pgNav         = (pagina ?? 1);

                return(View(buscaTM.ToPagedList(pgNav, pgQtdRegistro)));
            }
            else
            {
                int paginaNumero = 1;
                var pdf          = new ViewAsPdf
                {
                    ViewName    = "TmData",
                    PageSize    = Size.A4,
                    IsGrayScale = false,
                    Model       = buscaTM.ToPagedList(paginaNumero, buscaTM.Count)
                };
                return(pdf);
            }
        }
        public ActionResult RelatorioMilitar(int?pagina, Boolean?gerarPDF)
        {
            var RelatorioMilitar = db.Militars.OrderBy(n => n.id_militar).ToList <Militar>();

            if (gerarPDF != true)
            {
                //Definindo a paginação
                int paginaQdteRegistros   = 10;
                int paginaNumeroNavegacao = (pagina ?? 1);

                return(View(RelatorioMilitar.ToPagedList(paginaNumeroNavegacao, paginaQdteRegistros)));
            }
            else
            {
                int paginaNumero = 1;

                var pdf = new ViewAsPdf
                {
                    ViewName    = "RelatorioMilitar",
                    PageSize    = Size.A4,
                    IsGrayScale = true,
                    Model       = RelatorioMilitar.ToPagedList(paginaNumero, RelatorioMilitar.Count)
                };
                return(pdf);
            }
        }
        public ActionResult BuscaOpPeca(DateTime dt1, DateTime dt2, int?pagina, Boolean?gerarPdf, string id)
        {
            var buscaOpPeca = db.OrdemProducaoPecas.Where(a => a.Data >= dt1 && a.Data <= dt2).ToList();

            ViewBag.dt1 = dt1;
            ViewBag.dt2 = dt2;
            if (gerarPdf == true)
            {
                int pgQtdRegistro = 10;
                int pgNav         = (pagina ?? 1);

                return(View(buscaOpPeca.ToPagedList(pgNav, pgQtdRegistro)));
            }
            else
            {
                int paginaNumero = 1;
                var pdf          = new ViewAsPdf
                {
                    ViewName    = "OpPecaData",
                    PageSize    = Size.A4,
                    IsGrayScale = false,
                    Model       = buscaOpPeca.ToPagedList(paginaNumero, buscaOpPeca.Count)
                };
                return(pdf);
            }
        }
Example #19
0
        public ActionResult ListagemClientePorPeriodo(DateTime dataInicial, DateTime dataFinal, int?pagina, bool?gerarPDF)
        {
            //var listagemClientes = db.Clientes.OrderBy(n => n.IdCliente).ToList();
            var listagemCliente = db.Clientes.Where(i => i.DataCadastro >= dataInicial &&
                                                    i.DataCadastro <= dataFinal).OrderBy(i => i.IdCliente).ToList();

            ViewBag.dataInicial = dataInicial;
            ViewBag.dataFinal   = dataFinal;

            if (gerarPDF != true)
            {
                //Definindo a paginação
                int paginaQdteRegistros   = 10;
                int paginaNumeroNavegacao = (pagina ?? 1);

                return(View(listagemCliente.ToPagedList(paginaNumeroNavegacao, paginaQdteRegistros)));
            }
            else
            {
                int paginaNumero = 1;

                var pdf = new ViewAsPdf
                {
                    ViewName        = "ListagemClientePorPeriodo",
                    PageSize        = Size.A4,
                    PageOrientation = Orientation.Landscape,
                    IsGrayScale     = true,
                    Model           = listagemCliente.ToPagedList(paginaNumero, listagemCliente.Count)
                };
                return(pdf);
            }
        }
        public ActionResult PrintView()
        {
            GetEvents();
            var report = new ViewAsPdf("Index", calendarReport);

            return(report);
        }
Example #21
0
        public async Task <ActionResult> Report(string desc, int?deptoId)
        {
            try
            {
                IEnumerable <HorarioConsulta> entities = await _horarioConsultaEndpoint.GetByPartialDescAndDepto(partialDesc : desc, deptoId : deptoId, token : _userSession.BearerToken);

                var horarios = _mapper.Map <IEnumerable <MvcHorarioConsultaModel> >(entities);

                var report = new ViewAsPdf(viewName: "Report", model: horarios)
                {
                    FileName = $"horarios_{DateTime.Now}.pdf"
                };

                report.FormsAuthenticationCookieName = System.Web.Security.FormsAuthentication.FormsCookieName;
                report.CustomSwitches = "--load-error-handling ignore";

                return(report);
            }
            catch (UnauthorizedRequestException)
            {
                return(RedirectToAction("AccessDenied", "Error"));
            }
            catch (Exception ex)
            {
                return(RedirectToAction("SpecificError", "Error", new { error = ex.Message }));
            }
        }
        //NotaFiscal
        public ActionResult NotaFiscal()
        {
            {
                if (TempData["balcao"] != null)
                {
                    Balcao  balc    = TempData["balcao"] as Balcao;
                    Cliente cliente = db.Clientes.Find(balc.ClienteId);
                    ViewBag.NomeCliente = cliente.Nome;
                    ViewBag.CPFCliente  = cliente.CPF;
                    ViewBag.Valortotal  = balc.ValorTotal;


                    List <Balcao> balcaos = new List <Balcao>();
                    balcaos.Add(balc);
                    balcaos.OrderBy(b => b.BalcaoId);

                    var pdf = new ViewAsPdf
                    {
                        ViewName    = "NotaFiscal",
                        IsGrayScale = true,
                        PageSize    = Rotativa.Options.Size.A4,
                        Model       = balcaos.ToPagedList(1, balcaos.Count())
                    };
                    return(pdf);
                }
                return(null);
            }
        }
Example #23
0
        public ActionResult DiscEquipe(string Nome, int?pagina, Boolean?gerarPDF)
        {
            var discipulos = db.DISCIPULO.Where(i => i.DISCIPULO2.NOME.Equals(Nome)).OrderBy(p => p.NOME).ToList <DISCIPULO>();

            ViewBag.Nome = Nome;


            if (gerarPDF != true)
            {
                int paginaQdteRegistros   = 100;
                int paginaNumeroNavegacao = (pagina ?? 1);

                return(View(discipulos.ToPagedList(paginaNumeroNavegacao, paginaQdteRegistros)));
            }
            int paginaNumero = 1;

            var pdf = new ViewAsPdf
            {
                ViewName    = "DiscEquipe",
                PageSize    = Size.A4,
                IsGrayScale = true,
                Model       = discipulos.ToPagedList(paginaNumero, discipulos.Count()),
            };

            return(pdf);
        }
Example #24
0
 public IPDFGeneratorHelper GeneratePDFByteArray()
 {
     _pdf = new List <byte[]>();
     if (_isPartialView)
     {
         foreach (var item in _copiesNames)
         {
             var viewObject = new PartialViewAsPdf(_viewName, item)
             {
                 PageSize        = Size.A3,
                 PageOrientation = Orientation.Landscape,
                 PageMargins     = { Left = 0, Right = 0 },
             };
             _pdf.Add(viewObject.BuildFile(_context));
         }
     }
     else
     {
         foreach (var item in _copiesNames)
         {
             var viewObject = new ViewAsPdf(_viewName, item)
             {
                 PageSize        = Size.A3,
                 PageOrientation = Orientation.Landscape,
                 PageMargins     = { Left = 0, Right = 0 },
             };
             _pdf.Add(viewObject.BuildFile(_context));
         }
     }
     return(this);
 }
Example #25
0
        public ActionResult RelVendasPorPeriodo(DateTime dataInicial, DateTime dataFinal, int?pagina, Boolean?gerarPDF)
        {
            var vendas = db.ENTRADA.Where(i => i.data_entrada >= dataInicial && i.data_entrada <= dataFinal).OrderBy(p => p.cod_tipo_entrada).ToList <ENTRADA>();

            ViewBag.dataInicial = dataInicial;
            ViewBag.dataFinal   = dataFinal;

            if (gerarPDF != true)
            {
                int paginaQdteRegistros   = 100;
                int paginaNumeroNavegacao = (pagina ?? 1);

                return(View(vendas.ToPagedList(paginaNumeroNavegacao, paginaQdteRegistros)));
            }
            else
            {
                int paginaNumero = 1;

                var pdf = new ViewAsPdf
                {
                    ViewName    = "RelVendasPorPeriodo",
                    PageSize    = Size.A4,
                    IsGrayScale = true,
                    Model       = vendas.ToPagedList(paginaNumero, vendas.Count),
                };
                return(pdf);
            }
        }
Example #26
0
        public ActionResult PrintView()
        {
            GetPrez();
            var report = new ViewAsPdf("Index", prez);

            return(report);
        }
Example #27
0
        public ActionResult ExportViewToPdf()
        {
            UserInfo oUser = new UserInfo();

            oUser = UserController.GetUserInfo(User.Identity.Name);

            Params list = (Params)Session["ListParams"];

            if (oUser.ImageContent1 == null)
            {
                return(RedirectToAction("Index", "Login"));
            }
            else
            {
                list.Image2         = oUser.ImageContent2;
                list.Image3         = oUser.ImageContent3;
                list.AttractionName = oUser.AttractionName;
            }


            ActionResult ActionResult = new ViewAsPdf("Index", list)
            {
                FileName        = "Attraction Contribution to Society.pdf",
                PageOrientation = Orientation.Portrait,
                PageWidth       = 210,
                PageHeight      = 300,
                PageMargins     = { Left = 0, Right = 0, Top = 0, Bottom = 0 },
                CustomSwitches  = "--disable-external-links --disable-internal-links --disable-smart-shrinking --viewport-size 1600x900 --load-error-handling ignore"
            };

            return(ActionResult);
        }
Example #28
0
        public ActionResult ListagemClientes(int?pagina, Boolean?gerarPDF)
        {
            var listagemClientes = _db.Clientes.OrderBy(n => n.ClienteId).ToList <Cliente>();

            if (gerarPDF != true)
            {
                //Definindo a paginação
                int paginaQtdeRegistros   = 10;
                int paginaNumeroNavegação = (pagina ?? 1);

                return(View(listagemClientes.ToPagedList(paginaNumeroNavegação, paginaQtdeRegistros)));
            }
            else
            {
                int paginaNumero = 1;

                var pdf = new ViewAsPdf
                {
                    ViewName    = "ListagemClientes",
                    PageSize    = Size.A4,
                    IsGrayScale = true,
                    Model       = listagemClientes.ToPagedList(paginaNumero, listagemClientes.Count)
                };

                return(pdf);
            }
        }
        public FileDownloadViewModel GetReportByte(int id = 1)
        {
            string header = _url + "/reporting/RHeader";

            ViewBag.HeaderText = "This report built with Rotativa";

            string customSwitches = string.Format("--header-html  \"{0}\" " +
                                                  "--header-spacing \"0\" " +
                                                  "--header-font-size \"10\" ", header);

            var pdfResult = new ViewAsPdf("SampleReport")
            {
                FileName       = "SimpleReport.PDF",
                PageSize       = Rotativa.Options.Size.A4,
                CustomSwitches = customSwitches
            };

            byte[] applicationPDFData = pdfResult.BuildPdf(ControllerContext);

            return(new FileDownloadViewModel
            {
                FileName = pdfResult.FileName,
                MainData = applicationPDFData
            });
        }
        public ActionResult PrintStock()
        {
            var       model = db.Demirbas;
            ViewAsPdf pdf   = new ViewAsPdf("Index", model);

            return(pdf);
        }