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); }
public ActionResult PartialPackingSlip(int _orderID) { PartialViewAsPdf result = new PartialViewAsPdf("../PartialViews/PartialPackingSlip", new OrderRepository().GetOrderByID(_orderID)); result.FileName = "Bestelling - " + _orderID + ".pdf"; return(result); }
public ActionResult DailyTimeSheet(int id, string date) { var concernId = Convert.ToInt32(Session["ConcernId"]); var userId = Convert.ToInt32(Session["UserId"]); var userName = Convert.ToString(Session["UserName"]); if (userId > 0 && concernId > 0) { int totalValue = 0; var sheet = _report.DailyTimeSheet(userName, userId, id, date, "en-US"); foreach (var item in sheet) { totalValue = Convert.ToInt32(item.TotalBeforeVat); } WordValue value = new WordValue(); var final = value.NumberToWords(totalValue); //var today = DateTime.Now.ToString("yyyy-MM-dd"); ReportViewModels viewModels = new ReportViewModels { ResponseTimeSheets = sheet }; ViewBag.Value = final; var report = new PartialViewAsPdf("DailyTimeSheet", viewModels); return(report); } return(RedirectToAction("LogIn", "GlobalData", new { Area = "Global" })); }
public ActionResult ShowCVInformation(int personId) { if (personId == 0) { return(RedirectToAction("Index")); } var person = _unitOfWork.PersonRepository.Get(personId); var report = new PartialViewAsPdf("_CVPartial", person); byte[] applicationPDFData = report.BuildPdf(ControllerContext); var file = this._unitOfWork.PersonRepository.ConvertCVToPdf(personId, applicationPDFData); if (!System.IO.File.Exists(file)) { return(HttpNotFound()); } var fileBytes = System.IO.File.ReadAllBytes(file); var response = new FileContentResult(fileBytes, "application/octet-stream") { FileDownloadName = "CV.pdf" }; return(response); }
public ActionResult PrintPartialViewToPdf(ViewModels.PrintReportViewModel form) { if (form.reportFrom.CompareTo(form.reportTo) > 0 || form.reportFrom.CompareTo(DateTime.Now) > 0 || form.reportTo.CompareTo(DateTime.Now) > 0) { return(RedirectToAction("Index")); } var currentUser = Database.Session.Query <Models.User>().FirstOrDefault(u => u.Username == HttpContext.User.Identity.Name); var toDate = form.reportTo; toDate = toDate.AddSeconds(86399); ViewModels.PrintReportViewModel rapor = new ViewModels.PrintReportViewModel(); rapor.allSales = Database.Session.Query <Models.Sales>() .Where(s => s.belongsToUser.Id == currentUser.Id) .Where(s => s.date.CompareTo(form.reportFrom) >= 0) .Where(s => s.date.CompareTo(toDate) <= 0); rapor.currUser = currentUser; rapor.reportFrom = form.reportFrom; rapor.reportTo = form.reportTo; var report = new PartialViewAsPdf("~/Views/Shared/_PrintReport.cshtml", rapor); return(report); }
public ActionResult PrintPartialViewToPdf(string name) { Form f = (new FormDal()).Forms.FirstOrDefault(x => x.NameOfProject == name); var report = new PartialViewAsPdf("~/Views/Developer/PrintPartialViewToPdf.cshtml", f); return(report); }
/// <summary>第三種透過 PartialView 產生PDF</summary> /// <returns></returns> public ActionResult DownloadPartialViewPDF() { GeneratePDFModel model = new GeneratePDFModel(); string content = "<h2>PDF Created<h2>" + "<p>透過partialView產生<p>"; string logoFilePath = @"/Images/DotBlogsLogo.gif"; model.PDFContent = content; model.PDFLogo = Server.MapPath(logoFilePath); /*透過PartialView 產生PDF*/ PartialViewAsPdf PdfPartial = new PartialViewAsPdf(); //指定PDF內容 PdfPartial.Model = model; //指定檔名 PdfPartial.FileName = "partialViewAsPdf.pdf"; //指定對應的partialView~_PartialViewTest.cshtml PdfPartial.ViewName = "_PartialViewTest"; //設定Margin PdfPartial.PageMargins = new Margins() { Top = 10, Bottom = 10, Left = 10, Right = 10 }; //指定大小預設為A4 PdfPartial.PageSize = Size.A4; return(PdfPartial); }
public ActionResult PrintPartialViewToPdf(int id) { Projekti projekt = db.Projekti.FirstOrDefault(c => c.Id == id); var report = new PartialViewAsPdf("~/Views/Projekti/Details.cshtml", projekt); return(report); }
public ActionResult PrintPartialViewToPdf(int id) { using (TheCitiModels db = new TheCitiModels()); var employees = db.Employees.Include(e => e.EmpType); var report = new PartialViewAsPdf("~/Views/Employees/Index.cshtml", employees.ToList()); return(report); }
public ActionResult PdfPartialView(int id) { using (FitAppContext db = new FitAppContext()) { var foods = db.Foods.Where(m => m.MealId == id).ToList(); var report = new PartialViewAsPdf("~/Views/Meal/PdfPartialView.cshtml", foods); return(report); } }
//Imprimir Funciona pero en el index //public ActionResult GetAll() //{ // var recibo = db.Factura.ToList(); // return View(recibo); //} //public ActionResult imprimir() //{ // var pdf = new Rotativa.ActionAsPdf("Details"); // return pdf; //} public ActionResult PrintPartialViewToPdf(int?id) { //using (DbPrintPDFEntities db = new DbPrintPDFEntities()) Factura customer = db.Factura.FirstOrDefault(c => c.Id == id); var report = new PartialViewAsPdf("~/Views/Facturas/Details.cshtml", customer); return(report); }
public ActionResult Details(int id) { using (FileSystemContext db = new FileSystemContext()) { FileData fd = db.FileDatas.FirstOrDefault(c => c.FileDataId == id); var report = new PartialViewAsPdf("~/Views/FileData/Details.cshtml", fd); return(report); } }
public ActionResult PrintPartialViewToPdf(int id) { using (UtakmicaDBEntities db = new UtakmicaDBEntities()) { Natjecanje natj = db.Natjecanjes.FirstOrDefault(n => n.Id == id); var report = new PartialViewAsPdf("~/Views/Natjecanjes/DetaljiPDF.cshtml", natj); return(report); } }
public ActionResult PrintPartialViewToPdf(int id) { using (ModelDB db = new ModelDB()) { Request request = db.Requests.Include(e => e.Educations).Include(c => c.Countries).Include(cr => cr.CountryResidence).Include(p => p.Provinces).Include(m => m.Moneys).FirstOrDefault(c => c.ID == id); var report = new PartialViewAsPdf("~/Views/Shared/DetailsPDF.cshtml", request); return(report); } }
public ActionResult DownloadAsPdf(int id) { using (FUNSAILMEL_Model1Container db = new FUNSAILMEL_Model1Container()) { Booking booking = db.Bookings.FirstOrDefault(c => c.Id == id); var report = new PartialViewAsPdf("~/Views/Shared/DetailBooking.cshtml", booking); return(report); } }
public ActionResult PrintPartialViewToPdf(int id) { using (lear db = new lear()) { Certification customer = db.Certifications.FirstOrDefault(c => c.Id == id); var report = new PartialViewAsPdf("~/Views/Shared/DetailCustomer.cshtml", customer); return(report); } }
public ActionResult PrintPartialViewToPdf(string id) { using (IT_ASSET_MANAGEMENTEntities db = new IT_ASSET_MANAGEMENTEntities()) { View_req_af_follow customer = db.View_req_af_follow.FirstOrDefault(c => c.AF_CODE == id); var report = new PartialViewAsPdf("~/Views/ReqAFRegister/Details_Print.cshtml", customer); return(report); } }
public ActionResult PrintPartialViewToPdf(int id) { using (DbPrintPDFEntities db = new DbPrintPDFEntities()) { Customer customer = db.Customers.FirstOrDefault(c => c.CustomerId == id); var report = new PartialViewAsPdf("~/Views/Shared/DetailCustomer.cshtml", customer); return(report); } }
public ActionResult GenerateInvoice(int id) { using (GerGarageDbEntities db = new GerGarageDbEntities()) { JobDetail jd = db.JobDetails.FirstOrDefault(c => c.JobNumber == id); var report = new PartialViewAsPdf("~/Views/Shared/Invoice.cshtml", jd); return(report); } }
public ActionResult PrintPartialViewToPdf(int id) { if (CheckCookies()) { var courseInDb = _context.Courses.Single(c => c.CourseId == id); var doctorCourseId = _context.DoctorCourses.Single(c => c.CourseId == courseInDb.CourseId).UserId; var stuffIds = _context.StuffCourses.Where(c => c.CourseId == courseInDb.CourseId) .Select(c => new { c.UserId }).ToList(); List <string> stuffNames = new List <string>(); foreach (var stuff in stuffIds) { string temp = ""; temp = _context.Users.Single(c => c.UserId == stuff.UserId).FirstName + " " + _context.Users.Single(c => c.UserId == stuff.UserId).LastName; stuffNames.Add(temp); } var studentIds = _context.Registrations.Where(c => c.CourseId == courseInDb.CourseId) .Select(c => new { c.UserId }).ToList(); List <StudentCourseDetVm> obj = new List <StudentCourseDetVm>(); foreach (var student in studentIds) { StudentCourseDetVm tempObj = new StudentCourseDetVm(); string studentId = _context.Users.Single(c => c.UserId == student.UserId).StudentID; string name = _context.Users.Single(c => c.UserId == student.UserId).FirstName + " " + _context.Users.Single(c => c.UserId == student.UserId).LastName; string email = _context.Users.Single(c => c.UserId == student.UserId).Email; var levelId = _context.Users.Single(c => c.UserId == student.UserId).AspStudentLvlId; string level = _context.StudentLvl.Single(c => c.Id == levelId).lvlName; tempObj.Id = studentId; tempObj.Email = email; tempObj.Name = name; tempObj.Level = level; obj.Add(tempObj); } CourseDetailsVm model = new CourseDetailsVm { CourseId = courseInDb.CourseId, Coursename = courseInDb.CourseName, CourseDepartment = _context.Departments.Single(c => c.DepId == courseInDb.AspDepartmentId).Name, CourseCode = courseInDb.CourseTitle, CourseCredit = "3", CourseTime = _context.CourseTimes.Single(c => c.Id == courseInDb.CourseTimeId).Time, CourseDoctor = _context.Users.Single(c => c.UserId == doctorCourseId).FirstName + " " + _context.Users.Single(c => c.UserId == doctorCourseId).LastName, CourseStuffs = stuffNames, students = obj }; var report = new PartialViewAsPdf("~/Views/Shared/_CourseResult.cshtml", model); return(report); } return(RedirectToAction("Logout", "User")); }
public ActionResult PrintPartialViewToPdf(int pedidoId) { Dac_Usuarios dac_Usuarios = new Dac_Usuarios(); Pedidos resultado = Dac_Pedidos.ConsultarPedido(pedidoId); Usuarios usuario = dac_Usuarios.EncontrarUsuario(resultado.Usuario); ViewData["usuario"] = usuario; var report = new PartialViewAsPdf("~/Views/Pedidos/PrintPartialViewToPdf.cshtml", resultado); return(report); }
public ActionResult PrintAll(string searchString, string searchUser) { var dao = new HocVuDao(); var model = dao.ListHocVu(searchString, searchUser, 1, 10); var q = new ActionAsPdf("Index", model); var b = new ViewAsPdf("Index", model); var a = new PartialViewAsPdf("Index", model); return(q); }
public ActionResult PrintPartialViewToPdf(string id) { using (IT_ASSET_MANAGEMENTEntities db = new IT_ASSET_MANAGEMENTEntities()) { View_Req_AF_Trace customer = db.View_Req_AF_Trace.FirstOrDefault(c => c.Req_AF_CODE == id); var report = new PartialViewAsPdf("~/Views/tbl_Req_AF/Details_Print.cshtml", customer); return(report); } }
public ActionResult PrintAll(string searchYeuCau, string searchTinhTrang, string searchName, string searchTenDanhMuc, string searchTenDonVi, string searchTenLop, string searchEmail, string searchTenVaiTro) { var dao = new HocVuDao(); var model = dao.ListThongKe(searchYeuCau, searchTinhTrang, searchName, searchTenDanhMuc, searchTenDonVi, searchTenLop, searchEmail, searchTenVaiTro, 1, 10); var q = new ActionAsPdf("Index", model); var b = new ViewAsPdf("Index", model); var a = new PartialViewAsPdf("Index", model); return(b); }
private ActionResult GetPDFPackingSlip(Order _order) { try { var report = new PartialViewAsPdf("../PartialViews/PartialPackingSlip", _order) { FileName = "Bestelling:" + _order.ID, }; return(report); } catch (Exception e) { throw new Exception("An Error Occured while creating PDF please try again: " + e.Message); } }
//[AllowAnonymous] public ActionResult Print(int?id) { UnitOfWork uow = new UnitOfWork(); DisbursementList disbursementList = uow.DisbursementListRepository.Get(filter: x => x.ID == id.Value, includeProperties: "CreatedByStaff, ItemTransactions.Item, Department.CollectionPoint").FirstOrDefault(); var fff = new PartialViewAsPdf { ViewName = "Details", Model = disbursementList }; return(fff); }
public ActionResult PrintBill(int tableId) { CounterModel model = new CounterModel(); model.Invoice = entity.Invoices.SingleOrDefault(i => i.Number == tableId && !i.Status); model.TableId = tableId; var currentTable = entity.Tables.SingleOrDefault(table => table.Number == tableId); if (currentTable != null && currentTable.Status) { var currentInvoice = entity.Invoices.SingleOrDefault(invoice => invoice.Number == tableId && !invoice.Status); if (currentInvoice != null) { var list = entity.InvoiceDetails.Where(i => i.ID_Invoice == currentInvoice.ID_Invoice).ToList(); List <OrderDetailModel> listOrder = new List <OrderDetailModel>(); foreach (var element in list) { var currentMenu = entity.Products.SingleOrDefault(menu => menu.ID_Product == element.ID_Product); var orderDetail = new OrderDetailModel() { ID_HOADON = element.ID_Invoice, ID_THUCPHAM = element.ID_Product, SOLUONG = element.Quantity, TONGTIEN = element.TotalPrice, URL = currentMenu.Image, TEN_THUCPHAM = currentMenu.ProductName }; listOrder.Add(orderDetail); } model.OrderList = listOrder; } } payment(tableId); var report = new PartialViewAsPdf("~/Views/Shared/_PrintBill.cshtml", model) { RotativaOptions = new DriverOptions() { PageSize = Size.A6, } }; return(report); }
public ActionResult PrintPostCard(PostCardFrontBack model) { var user = _userManager.GetUserDetailsByUserId(model.UserID); List <string> resultString = new List <string>(); model.cardFront = Utilities.ImagePathToBase64(model.cardFront); var result = new List <string>(); var byteArray = new PartialViewAsPdf("Partials/_pdfPostCard", model) { FileName = string.Format("HyggeMail-PostCard.pdf", LOGGEDIN_USER.FirstName, LOGGEDIN_USER.LastName), //PageMargins = new Rotativa.Options.Margins(7, 0, 0, 0), // PageHeight = 127, // PageWidth = 177.8, // PageOrientation = Rotativa.Options.Orientation.Portrait, // PageSize = Rotativa.Options.Size.A4 PageSize = Rotativa.Options.Size.A3, PageOrientation = Rotativa.Options.Orientation.Landscape, PageMargins = { Left = 0, Right = 0 }, // it's in millimeters PageWidth = 150, // it's in millimeters PageHeight = 200, }.BuildPdf(this.ControllerContext); //var path = HttpContext.Server.MapPath("/Uploads/PostCard-" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".pdf"); var fileName = string.Format("HyggeMail-{0}-{1}.pdf", "PostCard", Utilities.GetTimestamp(DateTime.UtcNow)); var path = Utilities.GetPath(AttacmentsPath.UserProfileImages, fileName); var fileStream = new FileStream(path, FileMode.Create, FileAccess.Write); fileStream.Write(byteArray, 0, byteArray.Length); fileStream.Close(); result.Add(AttacmentsPath.UserProfileImages.Replace("~/", "../../../") + fileName); _userManager.AddHistory(new UserHistoryModel() { UserFK = model.UserID, Type = "Order", Status = "Order Placed", TokenChange = "", AddedOn = DateTime.UtcNow, TokenAvailable = user.Object.CardsCount }); return(Json(new ActionOutput() { Results = result, Status = ActionStatus.Successfull })); }
public ActionResult TimeSheetSummary(int id) { var concernId = Convert.ToInt32(Session["ConcernId"]); var userId = Convert.ToInt32(Session["UserId"]); var userName = Convert.ToString(Session["UserName"]); if (userId > 0 && concernId > 0) { //var today = DateTime.Now.ToString("yyyy-MM-dd"); //var today = DateTime.Now.ToString("yyyy-MM-dd"); var sheet = _report.TimeSheetSummary(userName, userId, id, "en-US"); ReportViewModels viewModels = new ReportViewModels { ResponseTimeSheets = sheet }; var report = new PartialViewAsPdf("TimeSheetSummary", viewModels); return(report); } return(RedirectToAction("LogIn", "GlobalData", new { Area = "Global" })); }
public ActionResult PrintPartialViewToPdf(ViewModels.PrintReportViewModel form) { if (form.reportFrom.CompareTo(form.reportTo) > 0 || form.reportFrom.CompareTo(DateTime.Now) > 0 || form.reportTo.CompareTo(DateTime.Now) > 0) { return(RedirectToAction("Index")); // Rapor aralığının kontrollerini yapıyoruz ki geçersiz aralıklar için rapor hazırlanamasın. } var currentUser = Database.Session.Query <Models.User>().FirstOrDefault(u => u.Username == HttpContext.User.Identity.Name); ViewModels.PrintReportViewModel customer = new ViewModels.PrintReportViewModel(); customer.allIncomings = Database.Session.Query <Models.Incomings>() .Where(i => i.Users.Id == currentUser.Id && i.Date.CompareTo(form.reportFrom) >= 0 && i.Date.CompareTo(form.reportTo) <= 0); customer.allOutGoings = Database.Session.Query <Models.Outgoings>() .Where(i => i.Users.Id == currentUser.Id && i.Date.CompareTo(form.reportFrom) >= 0 && i.Date.CompareTo(form.reportTo) <= 0); customer.currUser = currentUser; customer.reportFrom = form.reportFrom; customer.reportTo = form.reportTo; var report = new PartialViewAsPdf("~/Views/Shared/_PrintReport.cshtml", customer); return(report); }