Exemple #1
0
        private void ReportHeader(PdfPTable headingtable, Image gif, TerminatedLayawaysListingReport pageEvent)
        {
            PdfPCell cell = new PdfPCell();

            //  heading - row 1
            cell        = new PdfPCell(gif);
            cell.Border = Rectangle.NO_BORDER;
            cell.HorizontalAlignment = Element.ALIGN_LEFT;
            cell.VerticalAlignment   = Element.ALIGN_TOP;
            cell.Colspan             = 1;
            headingtable.AddCell(cell);

            WriteCell(headingtable, string.Empty, ReportFont, 8, (int)Element.ALIGN_CENTER, (int)Element.ALIGN_TOP, (int)Rectangle.NO_BORDER);

            WriteCell(headingtable, string.Empty, ReportFont, 9, (int)Element.ALIGN_CENTER, (int)Element.ALIGN_TOP, (int)Rectangle.NO_BORDER);

            WriteCell(headingtable, "Date: " + DateTime.Now.ToString(), ReportFont, 9, (int)Element.ALIGN_LEFT, (int)Element.ALIGN_TOP, (int)Rectangle.NO_BORDER);

            WriteCell(headingtable, pageEvent.ReportObject.ReportTitle, ReportFontHeading, 9, (int)Element.ALIGN_CENTER, (int)Rectangle.NO_BORDER);

            //draw line
            DrawLine(headingtable);

            WriteColumns(headingtable);
        }
Exemple #2
0
        public bool CreateReport()
        {
            bool isSuccessful = false;

            iTextSharp.text.Document document = new iTextSharp.text.Document(PageSize.LETTER);
            try
            {
                //set up RunReport event overrides & create doc
                TerminatedLayawaysListingReport events = this;
                PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(ReportObject.ReportTempFileFullName, FileMode.Create));
                writer.PageEvent = events;

                MultiColumnText columns   = new MultiColumnText(document.PageSize.Top - 90, document.PageSize.Height - (90));
                float           pageLeft  = document.PageSize.Left;
                float           pageright = document.PageSize.Right;
                columns.AddSimpleColumn(-22, document.PageSize.Width + 24);

                //set up tables, etc...
                PdfPTable table = new PdfPTable(9);
                table.WidthPercentage = 85;// document.PageSize.Width;
                PdfPCell cell = new PdfPCell();
                Image    gif  = Image.GetInstance(Resources.logo, BaseColor.WHITE);
                gif.ScalePercent(25);
                runReport = new LayawayRunReports();
                document.Open();
                document.SetPageSize(PageSize.LETTER);
                document.SetMargins(-100, -100, 10, 45);
                document.AddTitle(string.Format("{0}: {1}", ReportObject.ReportTitle, DateTime.Now.ToString("MM/dd/yyyy")));
                WriteDetail(table);
                DrawLine(table);
                WriteSummary(table);

                DrawLine(table);
                columns.AddElement(table);
                document.Add(columns);
                document.Close();
                //OpenFile();
                //CreateReport();
                isSuccessful = true;
            }
            catch (DocumentException de)
            {
                ReportObject.ReportError      = de.Message;;
                ReportObject.ReportErrorLevel = (int)LogLevel.ERROR;
            }
            catch (IOException ioe)
            {
                ReportObject.ReportError      = ioe.Message;;
                ReportObject.ReportErrorLevel = (int)LogLevel.ERROR;
            }
            return(isSuccessful);
        }
Exemple #3
0
        //create report
        public bool CreateReport(IPdfLauncher pdfLauncher)
        {
            bool isSuccessful = false;

            try
            {
                //set up fonts
                reportObject.CreateTemporaryFullName();

                switch (reportObject.ReportNumber)
                {
                case (int)LayawayReportIDs.LayawayHistoryAndSchedule:
                    LayawayHistoryAndSchedule layawayHistoryAndSchedule = new LayawayHistoryAndSchedule();
                    layawayHistoryAndSchedule.reportObject = this.reportObject;
                    isSuccessful = layawayHistoryAndSchedule.CreateReport();
                    break;

                case (int)LayawayReportIDs.LayawayContract:
                    LayawayContractReport layawayContractRpt = new LayawayContractReport(pdfLauncher);
                    layawayContractRpt.ReportObject = this.reportObject;
                    isSuccessful = layawayContractRpt.CreateReport();
                    break;

                case (int)LayawayReportIDs.LayawayForfeitPickingSlip:
                    LayawayForefeitPickingSlip layawayForefeitPickingSlip = new LayawayForefeitPickingSlip(pdfLauncher);
                    layawayForefeitPickingSlip.ReportObject = this.reportObject;
                    isSuccessful = layawayForefeitPickingSlip.CreateReport();
                    break;

                case (int)LayawayReportIDs.ForfeitedLayawaysListing:
                    ForfeitedLayawaysListingReport forfeitedLayawaysListingReport = new ForfeitedLayawaysListingReport(pdfLauncher);
                    forfeitedLayawaysListingReport.ReportObject = this.reportObject;
                    isSuccessful = forfeitedLayawaysListingReport.CreateReport();
                    break;

                case (int)LayawayReportIDs.TerminatedLayawaysPickingSlip:
                    TerminatedLayawayPickingSlip terminatedLayawayPickingSlip = new TerminatedLayawayPickingSlip(pdfLauncher);
                    terminatedLayawayPickingSlip.ReportObject = this.reportObject;
                    isSuccessful = terminatedLayawayPickingSlip.CreateReport();
                    break;

                case (int)LayawayReportIDs.TerminatedLayawaysListing:
                    TerminatedLayawaysListingReport terminatedLayawaysListingReport = new TerminatedLayawaysListingReport(pdfLauncher);
                    terminatedLayawaysListingReport.ReportObject = this.reportObject;
                    isSuccessful = terminatedLayawaysListingReport.CreateReport();
                    break;
                }
            }
            catch (DocumentException de)
            {
                reportObject.ReportError      = de.Message;
                reportObject.ReportErrorLevel = (int)LogLevel.WARN;
            }
            catch (IOException ioe)
            {
                reportObject.ReportError      = ioe.Message;
                reportObject.ReportErrorLevel = (int)LogLevel.WARN;
            }

            return(isSuccessful);
        }