Example #1
0
        private void DrawReportSummary(PagingSetup pagingSetup, PdfDocument document,
                                       SampleSpecInfo sampleSpecInfo)
        {
            ReportUtils.IncreaseLineHeight(pagingSetup, document, pagingSetup.RegularLineHeight);

            ReportUtils.DrawParagraphLine(pagingSetup, document, PagingSetup.CreateDefaultPDFRegularFont(),
                                          XParagraphAlignment.Left, pagingSetup.RegularLineHeight,
                                          string.Format("Mã bệnh phẩm: {0}", sampleSpecInfo.SampleSpecId));

            ReportUtils.DrawParagraphLine(pagingSetup, document, PagingSetup.CreateDefaultPDFRegularFont(),
                                          XParagraphAlignment.Left, pagingSetup.RegularLineHeight,
                                          string.Format("Tên bệnh nhân: {0}", sampleSpecInfo.PatientName));

            ReportUtils.DrawParagraphLine(pagingSetup, document, PagingSetup.CreateDefaultPDFRegularFont(),
                                          XParagraphAlignment.Left, pagingSetup.RegularLineHeight,
                                          string.Format("Giới tính: {0}", sampleSpecInfo.SexDisplay));

            ReportUtils.DrawParagraphLine(pagingSetup, document, PagingSetup.CreateDefaultPDFRegularFont(),
                                          XParagraphAlignment.Left, pagingSetup.RegularLineHeight,
                                          string.Format("Năm sinh: {0}", sampleSpecInfo.YearOfBirth));

            ReportUtils.DrawParagraphLine(pagingSetup, document, PagingSetup.CreateDefaultPDFRegularFont(),
                                          XParagraphAlignment.Left, pagingSetup.RegularLineHeight,
                                          string.Format("Nguồn: {0}", sampleSpecInfo.LocationId));

            ReportUtils.DrawParagraphLine(pagingSetup, document, PagingSetup.CreateDefaultPDFRegularFont(),
                                          XParagraphAlignment.Left, pagingSetup.RegularLineHeight,
                                          string.Format("Thời gian nhập: {0}", sampleSpecInfo.DateInputDisplay));

            ReportUtils.DrawParagraphLine(pagingSetup, document, PagingSetup.CreateDefaultPDFRegularFont(),
                                          XParagraphAlignment.Left, pagingSetup.RegularLineHeight,
                                          string.Format("Danh sách nhập"));
        }
        private void ExportHistoryDrawReportSummary(PagingSetup pagingSetup, PdfDocument document,
                                                    DateTime startDate, DateTime endDate)
        {
            var options = new XPdfFontOptions(PdfFontEncoding.Unicode, PdfFontEmbedding.Always);

            ReportUtils.DrawParagraphLine(pagingSetup, document, new XFont("Tahoma", 12, XFontStyle.Bold, options),
                                          XParagraphAlignment.Center, pagingSetup.RegularLineHeight,
                                          string.Format("Từ ngày: {0} - Đến ngày: {1}",
                                                        startDate.ToString(CommonConstant.DateFormatDisplay),
                                                        endDate.ToString(CommonConstant.DateFormatDisplay)));

            ReportUtils.IncreaseLineHeight(pagingSetup, document, pagingSetup.RegularLineHeight);
        }
Example #3
0
        private void DrawReportSummary(PagingSetup pagingSetup, PdfDocument document,
                                       RemovalNote removalNote)
        {
            var options = new XPdfFontOptions(PdfFontEncoding.Unicode, PdfFontEmbedding.Always);

            ReportUtils.DrawParagraphLine(pagingSetup, document, new XFont("Tahoma", 12, XFontStyle.Bold, options),
                                          XParagraphAlignment.Center, pagingSetup.RegularLineHeight,
                                          string.Format("Mã hủy: {0}", removalNote.RemovalId));

            ReportUtils.IncreaseLineHeight(pagingSetup, document, pagingSetup.RegularLineHeight);

            ReportUtils.DrawParagraphLine(pagingSetup, document, PagingSetup.CreateDefaultPDFRegularFont(),
                                          XParagraphAlignment.Left, pagingSetup.RegularLineHeight,
                                          "Danh sách hủy: ");
        }
        public FileContentResult Print(string id)
        {
            MemoryStream stream = new MemoryStream();

            try
            {
                var exportInfo        = _tubeSampleService.GetExportInfo(id);
                var exportUserInfo    = _userService.GetLoginUserInfo(exportInfo.ExportUserId);
                var exportForUserInfo = _userService.GetLoginUserInfo(exportInfo.ExportForUserId);

                PagingSetup pagingSetup = ReportUtils.CreateDefaultPagingSetup();
                PdfDocument document    = ReportUtils.CreateDefaultPdfDocument(pagingSetup);
                ReportUtils.DrawReportHeader(pagingSetup, document, "PHIẾU XUẤT MẪU", labID);
                DrawReportHeaderSummary(pagingSetup, document, exportInfo);

                var gridTable = new ReportGridTable <ExportNoteDetail>()
                {
                    Columns = ExportGridColumns(),
                    Datas   = exportInfo.ExportNoteDetails
                };

                ReportUtils.DrawGrid(gridTable, pagingSetup, document);

                ReportUtils.IncreaseLineHeight(pagingSetup, document, pagingSetup.RegularLineHeight);

                DrawReportFooterSummary(pagingSetup, document, exportInfo);

                DrawReportFooter(pagingSetup, document,
                                 exportUserInfo == null ? exportInfo.ExportUserId : exportUserInfo.FullName,
                                 exportForUserInfo == null ? exportInfo.ExportForUserId : exportForUserInfo.FullName);

                ReportUtils.DrawReportFooter(pagingSetup, document, labID);
                document.Save(stream);
            }
            catch (BusinessException exception)
            {
                _logger.DebugFormat("BusinessException: {0}-{1}", exception.ErrorCode, exception.Message);
            }
            catch (Exception exception)
            {
                _logger.Error(string.Format("Iternal error {0}", exception));
            }
            stream.Flush();
            return(File(stream.ToArray(), "application/pdf"));
        }
        public FileContentResult SampleStatistics()
        {
            MemoryStream stream = new MemoryStream();

            try
            {
                var reportDetailList = _reportService.GetSampleStatistics();

                PagingSetup pagingSetup = ReportUtils.CreateDefaultPagingSetup();
                pagingSetup.PageOrientation = PageOrientation.Landscape;
                pagingSetup.PageSize        = PageSize.A4;
                PdfDocument document = ReportUtils.CreateDefaultPdfDocument(pagingSetup);
                PdfPage     page     = document.Pages[0];
                ReportUtils.DrawReportHeader(pagingSetup, document, "Thống kê tổng hợp", labID);
                ReportUtils.IncreaseLineHeight(pagingSetup, document, pagingSetup.RegularLineHeight);

                var gridTable = new ReportGridTable <ReportSampleStatisticInfo>()
                {
                    Columns = SampleStatisticsImportGridColumns(),
                    Datas   = reportDetailList
                };

                ReportUtils.DrawGrid(gridTable, pagingSetup, document);
                ReportUtils.DrawReportFooter(pagingSetup, document, labID);
                document.Save(stream);
            }
            catch (BusinessException exception)
            {
                _logger.DebugFormat("BusinessException: {0}-{1}", exception.ErrorCode, exception.Message);
            }
            catch (Exception exception)
            {
                _logger.Error(string.Format("Iternal error {0}", exception));
            }
            stream.Flush();
            return(File(stream.ToArray(), "application/pdf"));
        }