public ActionResult Report(Department department) { DeptReport deptreport = new DeptReport(); byte[] abytes = deptreport.PrepareReport(exportToPdf()); return(File(abytes, "application/pdf")); }
public async Task <ActionResult> exportPDF() { DeptReport dept = new DeptReport(); var readTask = await GetDept(); byte[] abytes = dept.PrepareReport(readTask); return(File(abytes, "application/pdf", $"Department Report ({DateTime.Now.ToString("hh:mm:ss dd/MM/yyyy")}).pdf")); }
public async Task <ActionResult <BaseResponse> > Get() { List <DeptReport> list = new List <DeptReport>(); var customers = await _context.CUSTOMERS.ToListAsync(); for (int i = 0; i < customers.Count; i++) { var receipt = await _context.RECEIPTS.Where(re => re.customerId == customers[i].id).FirstOrDefaultAsync(); double res = Math.Abs(receipt.customerPaid - receipt.total); DeptReport report = new DeptReport(); report.name = customers[i].lastName + " " + customers[i].firstName; report.nowDept = customers[i].nowDept; report.additionalDept = res; report.oldDept = customers[i].oldDept; list.Add(report); } return(new BaseResponse { ErrorCode = Roles.Success, Message = "Completed create report!", Data = list }); }