Пример #1
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);
        }
        public bool CreateReport()
        {
            bool isSuccessful = false;

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

                //set up tables, etc...
                PdfPTable table = new PdfPTable(8);
                Image     gif   = Image.GetInstance(Common.Properties.Resources.logo, BaseColor.WHITE);

                _reportFont          = FontFactory.GetFont("Arial", 7, iTextSharp.text.Font.NORMAL);
                _reportFontLargeBold = FontFactory.GetFont("Arial", 8, iTextSharp.text.Font.BOLD);
                _reportFontSmallBold = FontFactory.GetFont("Arial", 6, iTextSharp.text.Font.BOLD);
                gif.ScalePercent(25);
                runReport = new LayawayRunReports();

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

                ReportHeader(table, gif);
                AddLines(1, table);
                ReportTitleAndOtherInfo(table);
                AddLines(1, table);
                ColumnHeaders(table);
                DrawLine(table, _reportFontLargeBold);
                //ReportDetail(table);
                //ReportSummary(table);
                WriteSchedule(table);
                table.HeaderRows = 11;
                document.Open();
                document.Add(table);
                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);
        }
Пример #3
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);
        }
        public bool CreateReport()
        {
            bool isSuccessful = false;

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

                MultiColumnText columns = new MultiColumnText(document.PageSize.Top - 125, MultiColumnText.AUTOMATIC);
                columns.AddSimpleColumn(-30, document.PageSize.Width + 20);

                //set up tables, etc...
                PdfPTable table = new PdfPTable(7);
                table.WidthPercentage = 85;// document.PageSize.Width;
                var 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(string.Format("{0}: {1}", ReportObject.ReportTitle, DateTime.Now.ToString("MM/dd/yyyy")));

                ReportDetail(table);

                columns.AddElement(table);
                document.Add(columns);
                document.Close();
                //nnaeme
                //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);
        }
Пример #5
0
        public static bool DoReport(LayawayReportObject reportObject, bool open, IPdfLauncher pdfLauncher)
        {
            bool reportOK = false;
            LayawayRunReports runReport = new LayawayRunReports();

            runReport.reportObject = reportObject;

            //runReport.reportObject = this;

            FileLogger.Instance.logMessage(LogLevel.INFO, "ReportProcessing", "- Report " + reportObject.ReportTitle + " has been requested.");

            if (runReport.CreateReport(pdfLauncher))
            {
                if (open)
                {
                    pdfLauncher.ShowPDFFile(reportObject.ReportTempFileFullName, false);
                }
            }

            return(reportOK);
        }
Пример #6
0
        public bool CreateReport()
        {
            bool isSuccessful = false;

            iTextSharp.text.Document document = new iTextSharp.text.Document(PageSize.HALFLETTER.Rotate());
            try
            {
                //set up RunReport event overrides & create doc
                TerminatedLayawayPickingSlip 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(-27, document.PageSize.Width + 29);

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

                //int layawayCount = ReportObject.TerminatedLayawayPickingSlipList.Count;
                //int counter = 1;
                //foreach (LayawayVO layaway in ReportObject.TerminatedLayawayPickingSlipList)
                //{
                WriteCell(table, "Ticket #: " + ReportObject.TerminatedLayaway.TicketNumber.ToString(), ReportFontBold, 9, Rectangle.ALIGN_CENTER, Rectangle.NO_BORDER);

                WriteInfo(table, ReportObject.TerminatedLayaway);

                DrawLine(table);

                WritePaymentList(table, ReportObject.TerminatedLayaway);

                DrawLine(table);

                WriteDetail(table, ReportObject.TerminatedLayaway);

                /*while (counter < layawayCount)
                 * {
                 *  WriteCell(table, string.Empty, ReportFont, 7, Rectangle.ALIGN_CENTER, Rectangle.NO_BORDER);
                 *  WriteCell(table, string.Empty, ReportFont, 7, Rectangle.ALIGN_CENTER, Rectangle.NO_BORDER);
                 *  WriteCell(table, string.Empty, ReportFont, 7, Rectangle.ALIGN_CENTER, Rectangle.NO_BORDER);
                 *  WriteCell(table, string.Empty, ReportFont, 7, Rectangle.ALIGN_CENTER, Rectangle.NO_BORDER);
                 *  WriteCell(table, string.Empty, ReportFont, 7, Rectangle.ALIGN_CENTER, Rectangle.NO_BORDER);
                 *  WriteCell(table, string.Empty, ReportFont, 7, Rectangle.ALIGN_CENTER, Rectangle.NO_BORDER);
                 *  WriteCell(table, string.Empty, ReportFont, 7, Rectangle.ALIGN_CENTER, Rectangle.NO_BORDER);
                 *  WriteCell(table, string.Empty, ReportFont, 7, Rectangle.ALIGN_CENTER, Rectangle.NO_BORDER);
                 *  WriteCell(table, string.Empty, ReportFont, 7, Rectangle.ALIGN_CENTER, Rectangle.NO_BORDER);
                 *  WriteCell(table, string.Empty, ReportFont, 7, Rectangle.ALIGN_CENTER, Rectangle.NO_BORDER);
                 *  break;
                 * }
                 * counter++;
                 * }*/
                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);
        }
Пример #7
0
        public bool CreateReport()
        {
            bool isSuccessful = false;

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

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

                //set up tables, etc...
                PdfPTable table = new PdfPTable(7);
                table.WidthPercentage = 80;// document.PageSize.Width;
                table.TotalWidth      = document.PageSize.Width;
                Image gif = Image.GetInstance(Resources.logo, BaseColor.WHITE);
                gif.ScalePercent(35);

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

                document.AddTitle(ReportObject.ReportTitle + ": " + DateTime.Now.ToString("MM/dd/yyyy"));

                ReportDetail(table);
                AddLines(1, table, false, " ", false, ReportFont);
                ReportSummary(table);
                AddLines(1, table, false, " ", false, ReportFont);
                WriteSingleLine(table, 150);
                AddLines(1, table, false, " ", false, ReportFont);
                //WriteAgreement(table, (LayawayContractReport)writer.PageEvent);
                //AddLines(5, table, false, " ", false, ReportFont);
                //WriteFooter(table, (LayawayContractReport)writer.PageEvent);
                document.Open();
                //CallWriteAgreement(writer, document);
                columns.AddElement(table);
                float tableHeight = table.TotalHeight;
                //agreement stuff

                MultiColumnText agreementColumns;
                //table.WriteSelectedRows(0, -1, 10, (document.PageSize.Height - 166), writer.DirectContent);


                //add objects to document
                document.Add(columns);

                float agreementTableHeight = 155f;
                float pageSpan             = (int)tableHeight / 542;
                float remainingHeight      = 625f - (tableHeight - ((pageSpan * 542) - 50));;//document.PageSize.Top - 150 - tableHeight - 75;
                float newPageTop           = document.PageSize.Top - 150;
                if (remainingHeight > agreementTableHeight)
                {
                    agreementColumns = new MultiColumnText(remainingHeight + 75, agreementTableHeight);
                }
                else
                {
                    document.NewPage();
                    //agreementColumns = new MultiColumnText(document.PageSize.Bottom + 550, document.PageSize.Height - (166));
                    agreementColumns = new MultiColumnText(document.PageSize.Top - 150, agreementTableHeight);
                }
                agreementColumns.AddSimpleColumn(-63, document.PageSize.Width + 63);
                PdfPTable agreementTable = new PdfPTable(7);
                agreementTable.WidthPercentage = 80;// document.PageSize.Width;
                agreementTable.TotalWidth      = document.PageSize.Width;
                WriteAgreement(agreementTable, (LayawayContractReport)writer.PageEvent);
                AddLines(5, table, false, " ", false, ReportFont);
                WriteFooter(agreementTable, (LayawayContractReport)writer.PageEvent);
                agreementColumns.AddElement(agreementTable);

                float agtableHeight = agreementTable.TotalHeight;
                document.Add(agreementColumns);
                document.Close();
                //nnaeme
                //return true;
                //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);
        }