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 + @"\Kho.pdf", FileMode.Create));
            PdfWriterEvents writerEvent;

            Image watermarkImage = Image.GetInstance(AppDomain.CurrentDomain.BaseDirectory + @"logo.png");

            watermarkImage.SetAbsolutePosition(doc.PageSize.Width / 2 - 70, 600);
            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("BÁO CÁO KHO VÀ THÀNH PHẨM"));

            doc.Add(FormatConfig.ParaRightBelowHeader("(" + textForPrint + ")"));
            if (modeReport != 1)
            {
                doc.Add(ProductsTable());
            }
            else
            {
                doc.Add(FormatConfig.ParaCommonInfo("Sản phẩm : ", textInfo));
                doc.Add(ProductDetailTable());
            }
            doc.Add(FormatConfig.ParaCommonInfo("Ghi chú : ", String.Concat(Enumerable.Repeat("...", 96))));

            doc.Close();
        }
예제 #2
0
        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();
        }
예제 #3
0
        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 + @"\CongNo.pdf", FileMode.Create));
            PdfWriterEvents writerEvent;

            Image watermarkImage = Image.GetInstance(AppDomain.CurrentDomain.BaseDirectory + @"logo.png");

            watermarkImage.SetAbsolutePosition(doc.PageSize.Width / 2 - 70, 500);
            writerEvent         = new PdfWriterEvents(watermarkImage);
            docWriter.PageEvent = writerEvent;

            doc.Open();
            if (modeReport == 1)
            {
                doc.Add(FormatConfig.ParaRightBeforeHeaderRight(BHConstant.COMPANY_NAME));
                doc.Add(FormatConfig.ParaRightBeforeHeaderRight(BHConstant.COMPANY_ADDRESS));
                doc.Add(FormatConfig.ParaRightBeforeHeaderRight("ĐT: " + BHConstant.COMPANY_PHONE + " Fax: " + BHConstant.COMPANY_FAX));
            }

            doc.Add(FormatConfig.ParaRightBeforeHeader("In ngày : " + BaoHienRepository.GetBaoHienDBDataContext().GetSystemDate().ToString(BHConstant.DATETIME_FORMAT)));
            doc.Add(FormatConfig.ParaHeader("BÁO CÁO CÔNG NỢ"));

            doc.Add(FormatConfig.ParaRightBelowHeader("(" + textForPrint + ")"));
            if (modeReport != 1)
            {
                doc.Add(CustomersTable());
            }
            else
            {
                doc.Add(FormatConfig.ParaCommonInfo("Kính gửi : ", customerPrint.CustomerName));
                doc.Add(FormatConfig.ParaCommonInfo("Địa chỉ : ", customerPrint.Address));
                doc.Add(FormatConfig.ParaCommonInfo("ĐT : ", customerPrint.Phone + " Fax: " + customerPrint.Fax));
                doc.Add(CustomerDetailTable());
            }
            doc.Add(FormatConfig.ParaCommonInfo("", "Quý khách hàng kiểm tra và đối chiếu, nếu có thắc mắc vui lòng liên hệ số điện thoại trên."));
            doc.Add(FormatConfig.ParaCommonInfo("", "Chân thành cảm ơn sự hợp tác của quí khách."));
            doc.Add(FormatConfig.ParaCommonInfo("Ghi chú : ", String.Concat(Enumerable.Repeat("...", 96))));

            doc.Close();
        }