public bool CreateReport()
        {
            bool isSuccessful = false;

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

                MultiColumnText columns = new MultiColumnText(document.PageSize.Top - 148, document.PageSize.Height - (170));
                columns.AddSimpleColumn(-51, document.PageSize.Width + 60);

                //set up tables, etc...
                var table = new PdfPTable(21);
                table.WidthPercentage = 85;// document.PageSize.Width;
                var cell = new PdfPCell();
                var gif  = Image.GetInstance(Common.Properties.Resources.logo, BaseColor.WHITE);
                gif.ScalePercent(25);
                runReport = new RunReport();
                document.Open();
                document.SetPageSize(PageSize.LEGAL.Rotate());
                document.SetMargins(-100, -100, 10, 35);
                document.AddTitle(string.Format("{0}: {1}", ReportObject.ReportTitle, DateTime.Now.ToString("MM/dd/yyyy")));

                //here add detail
                WriteDetail(table, 21);
                columns.AddElement(table);
                document.Add(columns);

                string          gunText          = "Total Number of Guns: " + TotalNumberOfGuns;
                MultiColumnText columnBottomPage = new MultiColumnText(document.PageSize.Bottom, 25);
                columnBottomPage.AddSimpleColumn(-51, document.PageSize.Width + 60);
                PdfPTable tableBottom = new PdfPTable(1);
                tableBottom.WidthPercentage = 85;// document.PageSize.Width;
                WriteCell(tableBottom, gunText, ReportFontLargeBold, 1, Element.ALIGN_LEFT, Rectangle.NO_BORDER);
                columnBottomPage.AddElement(tableBottom);
                document.Add(columnBottomPage);

                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;
            }
            return(isSuccessful);
        }
        //create report
        public bool CreateReport()
        {
            bool isSuccessful = false;

            iTextSharp.text.Document document = new iTextSharp.text.Document(PageSize.LEGAL);

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

                //set up tables, etc...
                PdfPTable table = new PdfPTable(23);
                PdfPCell  cell  = new PdfPCell();
                Image     gif   = Image.GetInstance(Resources.logo, BaseColor.WHITE);
                gif.ScalePercent(35);

                _reportFont               = FontFactory.GetFont("Arial", 8, iTextSharp.text.Font.NORMAL);
                _reportFontLargeBold      = FontFactory.GetFont("Arial", 10, iTextSharp.text.Font.BOLD);
                _reportFontLargeUnderline = FontFactory.GetFont("Arial", 10, iTextSharp.text.Font.UNDERLINE);

                runReport = new RunReport();

                document.AddTitle(reportObject.ReportTitle + ": " + DateTime.Now.ToString("MM/dd/yyyy"));
                document.SetPageSize(PageSize.LEGAL.Rotate());
                document.SetMargins(-100, -100, 10, 45);

                ReportHeader(table, gif);
                ColumnHeaders(table);
                ReportDetail(table);
                ReportSummary(table);

                table.HeaderRows = 8;

                document.Open();
                document.Add(table);
                document.Close();

                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);
        }
Ejemplo n.º 3
0
        public bool CreateReport(bool openFile)
        {
            var isSuccessful = false;

            //openFile = true; //comment out
            iTextSharp.text.Document document = new iTextSharp.text.Document(PageSize.HALFLETTER.Rotate());
            try
            {
                //set up RunReport event overrides & create doc
                InventoryChargeOffReport events = this;
                PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(ReportObject.ReportTempFileFullName, FileMode.Create));
                writer.PageEvent = events;

                MultiColumnText columns   = new MultiColumnText(document.PageSize.Top - 80, MultiColumnText.AUTOMATIC);
                float           pageLeft  = document.PageSize.Left;
                float           pageright = document.PageSize.Right;
                columns.AddSimpleColumn(1, document.PageSize.Width + 40);

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

                //here add detail
                WriteDetail(table, 5);
                columns.AddElement(table);
                document.Add(columns);
                document.Close();
                if (openFile)
                {
                    OpenFile(ReportObject.ReportTempFileFullName);
                }

                //CreateReport(true); //comment out
                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);
        }
        public bool CreateReport()
        {
            bool isSuccessful = false;

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

                //set up tables, etc...
                PdfPTable table       = new PdfPTable(11);
                PdfPTable footerTable = new PdfPTable(11);
                PdfPCell  cell        = new PdfPCell();
                Image     gif         = Image.GetInstance(Common.Properties.Resources.logo, BaseColor.WHITE);
                footerTable.HorizontalAlignment = Rectangle.ALIGN_BOTTOM;
                _reportFont           = FontFactory.GetFont("Arial", 8, iTextSharp.text.Font.NORMAL);
                _reportFontLargeBold  = FontFactory.GetFont("Arial", 8, iTextSharp.text.Font.BOLD);
                _reportFontUnderlined = FontFactory.GetFont("Arail", 8, iTextSharp.text.Font.UNDERLINE);

                gif.ScalePercent(20);
                runReport = new RunReport();

                document.SetPageSize(PageSize.HALFLETTER.Rotate());
                document.SetMargins(-40, -40, 5, 23);
                document.AddTitle(string.Empty);

                ReportHeader(table, writer);
                ReportDetail(table);
                ReportSummary(footerTable);

                table.HeaderRows = 11;
                document.Open();
                document.Add(table);
                document.Add(footerTable);
                document.Close();

                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);
        }
Ejemplo n.º 5
0
        public bool CreateReport(ReportObject.PawnTicketAddendum pawnTicketAddendum)
        {
            bool isSuccessful = false;
            var  document     = new iTextSharp.text.Document(PageSize.LETTER);

            try
            {
                //set up RunReport event overrides & create doc
                _pageCount = 1;
                //PawnTicketAddendumDocument events = this;

                PdfWriter        writer = PdfWriter.GetInstance(document, new FileStream(ReportObject.ReportTempFileFullName, FileMode.Create));
                AddndmPageEvents events = new AddndmPageEvents();
                writer.PageEvent = events;



                //MultiColumnText columns = new MultiColumnText(document.PageSize.Top - 100, document.PageSize.Height - (50));
                //columns.AddSimpleColumn(-150, document.PageSize.Width + 76);

                //set up tables, etc...
                PdfPTable table = new PdfPTable(8);
                table.WidthPercentage = 85;// document.PageSize.Width;

                runReport = new RunReport();
                document.Open();
                document.SetPageSize(PageSize.LETTER);
                document.SetMargins(-100, -100, 10, 45);

                ReportHeader(table, 8);
                //here add detail
                WriteDetail(table, pawnTicketAddendum);

                document.Add(table);
                document.Close();
                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);
        }
Ejemplo n.º 6
0
        public static bool DoReport(ReportObject reportObject, IPdfLauncher pdfLauncher)
        {
            bool reportOK = false;

            RunReport runReport = new RunReport();

            runReport.reportObject = reportObject;

            //runReport.reportObject = this;
            if (FileLogger.Instance.IsLogInfo)
            {
                FileLogger.Instance.logMessage(LogLevel.INFO, "ReportProcessing",
                                               "- Report " + reportObject.ReportTitle + " has been requested.");
            }

            if (runReport.CreateReport(pdfLauncher))
            {
                try
                {
                    //SMurphy 4/13/2010 problem when Adobe is already open
                    Process adbProcess = AdobeReaderOpen();
                    if (adbProcess != null)
                    {
                        adbProcess.Kill();
                    }
                }
                catch (Exception eX)
                {
                    if (FileLogger.Instance.IsLogError)
                    {
                        FileLogger.Instance.logMessage(LogLevel.ERROR, "RunReport", "Exception thrown when killing Adobe processes: {0}:{1} {2}",
                                                       eX, eX.Data, eX.StackTrace ?? "NoStackTrace");
                    }
                }

                try
                {
                    pdfLauncher.ShowPDFFile(reportObject.ReportTempFileFullName, false);
                    reportOK = true;
                }
                catch (Exception /*exc*/)
                {
                    reportOK = false;
                }
            }

            return(reportOK);
        }
        //create report
        public bool CreateReport()//ReportObject rptObj)
        {
            bool isSuccessful = false;

            iTextSharp.text.Document document = new iTextSharp.text.Document(PageSize.LEGAL);

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

                //set up tables, etc...
                PdfPTable table = new PdfPTable(21);
                PdfPCell  cell  = new PdfPCell();
                Image     gif   = Image.GetInstance(Resources.logo, BaseColor.WHITE);

                _reportFont               = FontFactory.GetFont("Arial", 8, iTextSharp.text.Font.NORMAL);
                _reportFontLargeBold      = FontFactory.GetFont("Arial", 10, iTextSharp.text.Font.BOLD);
                _reportFontLargeUnderline = FontFactory.GetFont("Arial", 10, iTextSharp.text.Font.UNDERLINE);

                gif.ScalePercent(35);
                runReport = new RunReport();

                if (reportObject.ReportDetail.Equals("Summary"))
                {
                    document.AddTitle(reportObject.ReportTitle + " - Summary: " + DateTime.Now.ToString("MM/dd/yyyy"));

                    document.SetPageSize(PageSize.LETTER);
                    document.SetMargins(-50, -55, 10, 45);

                    SummaryReportHeader(table, gif);
                    Int32[,] gunStatus;
                    gunStatus = new Int32[6, 4];
                    SummaryReportDetail(table, out gunStatus, false);
                    SummaryReportSummary(table, gunStatus, false);

                    table.HeaderRows = 10;
                }
                else//detail version
                {
                    document.AddTitle(reportObject.ReportTitle + " - Detailed: " + DateTime.Now.ToString("MM/dd/yyyy"));

                    document.SetPageSize(PageSize.LEGAL.Rotate());
                    document.SetMargins(-100, -100, 10, 45);

                    DetailReportHeader(table, gif);
                    DetailColumnHeaders(table);
                    DetailReportDetail(table);
                    DetailReportSummary(table);//calls summary methods

                    table.HeaderRows = 7;
                }

                document.Open();
                document.Add(table);
                document.Close();

                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);
        }
Ejemplo n.º 8
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
                //_pageCount = 1;
                RefurbList 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 - (100));
                columns.AddSimpleColumn(-5, document.PageSize.Width - 15);

                //set up tables, etc...
                int colspan = 12;
                var table   = new PdfPTable(colspan);
                table.WidthPercentage = 95;// document.PageSize.Width;
                //table.TotalHeight = 95;

                var cell = new PdfPCell();
                var gif  = Image.GetInstance(Common.Properties.Resources.logo, BaseColor.WHITE);
                gif.ScalePercent(25);
                runReport = new RunReport();
                document.Open();
                document.SetPageSize(PageSize.LETTER);
                document.SetMargins(-100, -20, 10, 35);
                document.AddTitle(string.Format("{0}: {1}", ReportObject.ReportTitle, DateTime.Now.ToString("MM/dd/yyyy")));


                ReportColumns(table, colspan, "Merchandise Expected to be Received from Refurb");
                WriteDetail(table, colspan, ReportObject.ListRefurbItemsExpected);
                WriteTotals(table, colspan, ReportObject.ListRefurbItemsExpected);

                WriteCell(table, string.Empty, ReportFontBold, colspan, Element.ALIGN_LEFT, Rectangle.NO_BORDER);
                WriteCell(table, string.Empty, ReportFontBold, colspan, Element.ALIGN_LEFT, Rectangle.NO_BORDER);
                WriteCell(table, string.Empty, ReportFontBold, colspan, Element.ALIGN_LEFT, Rectangle.NO_BORDER);
                WriteCell(table, string.Empty, ReportFontBold, colspan, Element.ALIGN_LEFT, Rectangle.NO_BORDER);

                ReportColumns(table, colspan, "Merchandise Not Expected to be Received from Refurb");
                WriteDetail(table, colspan, ReportObject.ListRefurbItemsNotExpected);
                WriteTotals(table, colspan, ReportObject.ListRefurbItemsNotExpected);

                WriteCell(table, string.Empty, ReportFont, colspan, Element.ALIGN_LEFT, Element.ALIGN_TOP, Rectangle.NO_BORDER);

                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;
            }
            return(isSuccessful);
        }
Ejemplo n.º 9
0
        public bool CreateReport()
        {
            bool isSuccessful = false;

            iTextSharp.text.Document document = new iTextSharp.text.Document(PageSize.HALFLETTER);
            try
            {
                //ReportTempFileFullName = @"C:\pdfs\PoliceHoldSample.pdf";
                //set up RunReport event overrides & create doc
                PoliceSeizeReport events = new PoliceSeizeReport();
                PdfWriter         writer = PdfWriter.GetInstance(document, new FileStream(ReportTempFileFullName, FileMode.Create));
                writer.PageEvent = events;

                //set up tables, etc...
                PdfPTable headerTableNoBorders   = new PdfPTable(11);
                PdfPTable headerTableWithBorders = new PdfPTable(11);
                PdfPTable detailsTable           = new PdfPTable(11);
                PdfPTable footerTableWithBorders = new PdfPTable(11);
                PdfPTable footerTableNoBorders   = new PdfPTable(11);
                PdfPCell  cell = new PdfPCell();
                Image     gif  = Image.GetInstance(Resources.logo, BaseColor.WHITE);
                _reportFont           = FontFactory.GetFont("Arial", 6, iTextSharp.text.Font.NORMAL);
                _reportFontLargeBold  = FontFactory.GetFont("Arial", 8, iTextSharp.text.Font.BOLD);
                _reportFontUnderlined = FontFactory.GetFont("Arial", 8, iTextSharp.text.Font.UNDERLINE);

                gif.ScalePercent(20);
                runReport = new RunReport();

                document.SetPageSize(PageSize.HALFLETTER.Rotate());
                document.SetMargins(-40, -40, 5, 23);
                document.AddTitle(string.Empty);

                ReportHeaderNoBorder(headerTableNoBorders);
                ReportHeaderWithBorder(headerTableWithBorders);
                ReportDetails(detailsTable);
                ReportFooterNoBorders(footerTableNoBorders);
                ReportFooterWithBorders(footerTableWithBorders);

                //headerTableNoBorders.HeaderRows = 15;

                document.Open();
                document.Add(headerTableNoBorders);
                document.Add(headerTableWithBorders);
                document.Add(detailsTable);
                document.Add(footerTableWithBorders);
                document.Add(footerTableNoBorders);
                document.Close();

                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);
        }