private PdfPTable ProductsTable() { PdfPTable table = FormatConfig.Table(9, new float[] { 0.5f, 1.3f, 2.5f, 0.7f, 1f, 1f, 1f, 1f, 1f }); table.AddCell(FormatConfig.TableCellHeader("STT")); table.AddCell(FormatConfig.TableCellHeader("Mã SP")); table.AddCell(FormatConfig.TableCellHeader("Tên và qui cách")); table.AddCell(FormatConfig.TableCellHeader("Jampo")); table.AddCell(FormatConfig.TableCellHeader("ĐVT")); table.AddCell(FormatConfig.TableCellHeader("Đầu kì")); table.AddCell(FormatConfig.TableCellHeader("Nhập")); table.AddCell(FormatConfig.TableCellHeader("Xuất")); table.AddCell(FormatConfig.TableCellHeader("Cuối kì")); foreach (ProductsReport item in productsReports) { if (string.IsNullOrEmpty(item.Index)) { table.AddCell(FormatConfig.TableCellBoldBody(item.ProductName, PdfPCell.ALIGN_LEFT, 9)); } else { table.AddCell(FormatConfig.TableCellBody(item.Index, PdfPCell.ALIGN_CENTER)); table.AddCell(FormatConfig.TableCellBody(item.ProductCode, PdfPCell.ALIGN_CENTER)); table.AddCell(FormatConfig.TableCellBody(item.ProductName, PdfPCell.ALIGN_CENTER)); table.AddCell(FormatConfig.TableCellBody(item.Jampo, PdfPCell.ALIGN_CENTER)); table.AddCell(FormatConfig.TableCellBody(item.UnitName, PdfPCell.ALIGN_CENTER)); table.AddCell(FormatConfig.TableCellBody(item.FirstNumber, PdfPCell.ALIGN_RIGHT)); table.AddCell(FormatConfig.TableCellBody(item.ImportNumber, PdfPCell.ALIGN_RIGHT)); table.AddCell(FormatConfig.TableCellBody(item.ExportNumber, PdfPCell.ALIGN_RIGHT)); table.AddCell(FormatConfig.TableCellBody(item.LastNumber, PdfPCell.ALIGN_RIGHT)); } } return(table); }
private PdfPTable CustomerDetailTable() { PdfPTable table = FormatConfig.Table(7, new float[] { 0.5f, 1.5f, 2f, 2f, 1.2f, 1.3f, 1.5f }); table.AddCell(FormatConfig.TableCellHeader("STT")); table.AddCell(FormatConfig.TableCellHeader("Ngày")); table.AddCell(FormatConfig.TableCellHeader("Mặt hàng")); table.AddCell(FormatConfig.TableCellHeader("Quy cách")); table.AddCell(FormatConfig.TableCellHeader("Số lượng")); table.AddCell(FormatConfig.TableCellHeader("ĐVT")); table.AddCell(FormatConfig.TableCellHeader("Tổng giá")); foreach (CustomerReport item in customerReports) { if (string.IsNullOrEmpty(item.Index)) { table.AddCell(FormatConfig.TableCellBoldBody(item.Date, PdfPCell.ALIGN_LEFT, 7)); } else { table.AddCell(FormatConfig.TableCellBody(item.Index, PdfPCell.ALIGN_CENTER)); table.AddCell(FormatConfig.TableCellBody(item.Date, PdfPCell.ALIGN_CENTER)); table.AddCell(FormatConfig.TableCellBody(item.ProductName, PdfPCell.ALIGN_CENTER)); table.AddCell(FormatConfig.TableCellBody(item.AttrName, PdfPCell.ALIGN_CENTER)); table.AddCell(FormatConfig.TableCellBody(item.Number, PdfPCell.ALIGN_RIGHT)); table.AddCell(FormatConfig.TableCellBody(item.Unit, PdfPCell.ALIGN_CENTER)); table.AddCell(FormatConfig.TableCellBody(item.Cost, PdfPCell.ALIGN_RIGHT)); } } table.AddCell(FormatConfig.TableCellBoldBody("Tổng", PdfPCell.ALIGN_RIGHT, 6)); table.AddCell(FormatConfig.TableCellBody(lbTotal.Text.Split(' ')[2], PdfPCell.ALIGN_RIGHT)); return(table); }
private void ExportFile() { Global.checkDirSaveFile(); var doc = new Document(PageSize.A4, 20, 20, 10, 10); PdfWriter docWriter = PdfWriter.GetInstance(doc, new FileStream(BHConstant.SAVE_IN_DIRECTORY + @"\KHang.pdf", FileMode.Create)); PdfWriterEvents writerEvent; Image watermarkImage = Image.GetInstance(AppDomain.CurrentDomain.BaseDirectory + @"logo.png"); watermarkImage.SetAbsolutePosition(doc.PageSize.Width / 2 - 70, 550); writerEvent = new PdfWriterEvents(watermarkImage); docWriter.PageEvent = writerEvent; doc.Open(); doc.Add(FormatConfig.ParaRightBeforeHeader("In ngày : " + BaoHienRepository.GetBaoHienDBDataContext().GetSystemDate().ToString(BHConstant.DATETIME_FORMAT))); doc.Add(FormatConfig.ParaHeader("DANH SÁCH KHÁCH HÀNG")); PdfPTable table = FormatConfig.Table(7, new float[] { 0.5f, 2f, 1.3f, 1.3f, 2f, 1.6f, 1.3f }); table.AddCell(FormatConfig.TableCellHeader("STT")); table.AddCell(FormatConfig.TableCellHeader("Tên khách hàng")); table.AddCell(FormatConfig.TableCellHeader("Mã KH")); table.AddCell(FormatConfig.TableCellHeader("SĐT Cty")); table.AddCell(FormatConfig.TableCellHeader("Địa chỉ")); table.AddCell(FormatConfig.TableCellHeader("Người liên lạc")); table.AddCell(FormatConfig.TableCellHeader("SĐT")); for (int i = 0; i < customers.Count; i++) { table.AddCell(FormatConfig.TableCellBody((i + 1).ToString(), PdfPCell.ALIGN_CENTER)); table.AddCell(FormatConfig.TableCellBody(customers[i].CustomerName, PdfPCell.ALIGN_LEFT)); table.AddCell(FormatConfig.TableCellBody(customers[i].CustCode, PdfPCell.ALIGN_LEFT)); table.AddCell(FormatConfig.TableCellBody(customers[i].Phone, PdfPCell.ALIGN_LEFT)); table.AddCell(FormatConfig.TableCellBody(customers[i].Address, PdfPCell.ALIGN_LEFT)); table.AddCell(FormatConfig.TableCellBody(customers[i].ContactPerson, PdfPCell.ALIGN_LEFT)); table.AddCell(FormatConfig.TableCellBody(customers[i].ContactPersonPhone, PdfPCell.ALIGN_LEFT)); } doc.Add(table); doc.Add(FormatConfig.ParaCommonInfo("Ghi chú : ", String.Concat(Enumerable.Repeat("...", 96)))); doc.Close(); }
private PdfPTable ProductDetailTable() { PdfPTable table = FormatConfig.Table(4, new float[] { 1f, 2.5f, 3.5f, 3f }); table.AddCell(FormatConfig.TableCellHeader("STT")); table.AddCell(FormatConfig.TableCellHeader("Ngày")); table.AddCell(FormatConfig.TableCellHeader("Mã phiếu")); table.AddCell(FormatConfig.TableCellHeader("Số lượng")); int index = 0; foreach (ProductReport item in productReports) { table.AddCell(FormatConfig.TableCellBody((++index).ToString(), PdfPCell.ALIGN_CENTER)); table.AddCell(FormatConfig.TableCellBody(item.UpdatedDateString, PdfPCell.ALIGN_CENTER)); table.AddCell(FormatConfig.TableCellBody(item.RecordCode, PdfPCell.ALIGN_CENTER)); table.AddCell(FormatConfig.TableCellBody(item.Amount, PdfPCell.ALIGN_RIGHT)); } return(table); }
private PdfPTable EmployeesTable() { PdfPTable table = FormatConfig.Table(5, new float[] { 1f, 2f, 2.5f, 2.5f, 2f }); table.AddCell(FormatConfig.TableCellHeader("STT")); table.AddCell(FormatConfig.TableCellHeader("Ngày")); table.AddCell(FormatConfig.TableCellHeader("Nhân viên")); table.AddCell(FormatConfig.TableCellHeader("Mã phiếu")); table.AddCell(FormatConfig.TableCellHeader("Số tiền")); foreach (EmployeesReport item in employees_reports) { table.AddCell(FormatConfig.TableCellBody(item.Index.ToString(), PdfPCell.ALIGN_CENTER)); table.AddCell(FormatConfig.TableCellBody(item.CreatedDate, PdfPCell.ALIGN_CENTER)); table.AddCell(FormatConfig.TableCellBody(item.EmployeeName, PdfPCell.ALIGN_CENTER)); table.AddCell(FormatConfig.TableCellBody(item.RecordCode, PdfPCell.ALIGN_CENTER)); table.AddCell(FormatConfig.TableCellBody(item.Amount, PdfPCell.ALIGN_RIGHT)); } return(table); }
private PdfPTable CustomersTable() { PdfPTable table = FormatConfig.Table(6, new float[] { 0.5f, 1.5f, 2.5f, 2.5f, 2f, 1f }); table.AddCell(FormatConfig.TableCellHeader("STT")); table.AddCell(FormatConfig.TableCellHeader("Ngày")); table.AddCell(FormatConfig.TableCellHeader("Tên khách hàng")); table.AddCell(FormatConfig.TableCellHeader("Mã khách hàng")); table.AddCell(FormatConfig.TableCellHeader("Mã phiếu")); table.AddCell(FormatConfig.TableCellHeader("Số tiền")); foreach (CustomersReport item in customersReports) { table.AddCell(FormatConfig.TableCellBody(item.Index.ToString(), PdfPCell.ALIGN_CENTER)); table.AddCell(FormatConfig.TableCellBody(item.Date, PdfPCell.ALIGN_CENTER)); table.AddCell(FormatConfig.TableCellBody(item.CustomerName, PdfPCell.ALIGN_CENTER)); table.AddCell(FormatConfig.TableCellBody(item.CustomerCode, PdfPCell.ALIGN_CENTER)); table.AddCell(FormatConfig.TableCellBody(item.RecordCode, PdfPCell.ALIGN_CENTER)); table.AddCell(FormatConfig.TableCellBody(item.Amount, PdfPCell.ALIGN_RIGHT)); } table.AddCell(FormatConfig.TableCellBoldBody("Tổng", PdfPCell.ALIGN_RIGHT, 5)); table.AddCell(FormatConfig.TableCellBody(lbTotal.Text.Split(' ')[2], PdfPCell.ALIGN_RIGHT)); return(table); }
private PdfPTable EmployeeDetailTable() { PdfPTable table = FormatConfig.Table(9, new float[] { 0.5f, 1.3f, 1.5f, 1.3f, 1.4f, 1f, 1f, 1f, 1f }); table.AddCell(FormatConfig.TableCellHeader("STT")); table.AddCell(FormatConfig.TableCellHeader("Ngày")); table.AddCell(FormatConfig.TableCellHeader("Tên khách hàng")); table.AddCell(FormatConfig.TableCellHeader("Mặt hàng")); table.AddCell(FormatConfig.TableCellHeader("Quy cách")); table.AddCell(FormatConfig.TableCellHeader("Số lượng")); table.AddCell(FormatConfig.TableCellHeader("ĐVT")); table.AddCell(FormatConfig.TableCellHeader("Đơn giá")); table.AddCell(FormatConfig.TableCellHeader("Hoa hồng")); foreach (EmployeeReport item in employee_reports) { if (string.IsNullOrEmpty(item.Index)) { table.AddCell(FormatConfig.TableCellBoldBody(item.CustomerName, PdfPCell.ALIGN_LEFT, 9)); } else { table.AddCell(FormatConfig.TableCellBody(item.Index, PdfPCell.ALIGN_CENTER)); table.AddCell(FormatConfig.TableCellBody(item.Date, PdfPCell.ALIGN_CENTER)); table.AddCell(FormatConfig.TableCellBody(item.CustomerName, PdfPCell.ALIGN_CENTER)); table.AddCell(FormatConfig.TableCellBody(item.ProductName, PdfPCell.ALIGN_CENTER)); table.AddCell(FormatConfig.TableCellBody(item.AttrName, PdfPCell.ALIGN_CENTER)); table.AddCell(FormatConfig.TableCellBody(item.Number, PdfPCell.ALIGN_RIGHT)); table.AddCell(FormatConfig.TableCellBody(item.Unit, PdfPCell.ALIGN_CENTER)); table.AddCell(FormatConfig.TableCellBody(item.Price, PdfPCell.ALIGN_RIGHT)); table.AddCell(FormatConfig.TableCellBody(item.Commission, PdfPCell.ALIGN_RIGHT)); } } return(table); }