Exemple #1
0
        private void ReportHeader(PdfPTable headingtable, Image gif, LayawayForefeitPickingSlip 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, 6, (int)Element.ALIGN_CENTER, (int)Element.ALIGN_TOP, (int)Rectangle.NO_BORDER);

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

            WriteCell(headingtable, DateTime.Now.ToString("MM/dd/yyyy"), ReportFont, 6, (int)Element.ALIGN_LEFT, (int)Element.ALIGN_TOP, (int)Rectangle.NO_BORDER);

            WriteCell(headingtable, string.Empty, ReportFont, 1, (int)Element.ALIGN_LEFT, (int)Rectangle.NO_BORDER);

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

            WriteCell(headingtable, "Employee #:" + pageEvent.ReportObject.ReportEmployee, ReportFont, 7, (int)Element.ALIGN_LEFT, (int)Rectangle.NO_BORDER);

            //draw line
            DrawLine(headingtable);
        }
Exemple #2
0
        public bool CreateReport()
        {
            bool isSuccessful = false;
            var  document     = new iTextSharp.text.Document(PageSize.HALFLETTER.Rotate());

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

                MultiColumnText columns   = new MultiColumnText(document.PageSize.Top - 93, document.PageSize.Height - (93));
                float           pageLeft  = document.PageSize.Left;
                float           pageright = document.PageSize.Right;
                columns.AddSimpleColumn(-15, document.PageSize.Width + 13);

                //set up tables, etc...
                PdfPTable table = new PdfPTable(7);
                table.WidthPercentage = 85;// document.PageSize.Width;
                //table.WidthPercentage = 80;// document.PageSize.Width;
                table.TotalWidth = 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.HALFLETTER.Rotate());
                document.SetMargins(-100, -100, 10, 45);
                document.AddTitle(ReportObject.ReportTitle + ": " + DateTime.Now.ToString("MM/dd/yyyy"));

                WritePaymentsDetails(table);
                columns.AddElement(table);
                document.Add(columns);
                document.Close();
                //OpenFile(ReportObject.ReportTempFileFullName);
                //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;
            }
            catch (Exception e)
            {
                ReportObject.ReportError      = e.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);
        }