コード例 #1
0
        private void ReportHeader(PdfPTable headingtable, Image gif, RefurbList pageEvent, int colspan)
        {
            //  row 1
            var cell = new PdfPCell(gif);

            cell.Border = Rectangle.NO_BORDER;
            cell.HorizontalAlignment = Element.ALIGN_LEFT;
            cell.VerticalAlignment   = Element.ALIGN_TOP;
            cell.Colspan             = 6;
            headingtable.AddCell(cell);

            WriteCell(headingtable, ReportObject.ReportStoreDesc, ReportFont, 2, Element.ALIGN_LEFT, Element.ALIGN_TOP, Rectangle.NO_BORDER);
            //row 2

            WriteCell(headingtable, ReportHeaders.OPERATIONAL, ReportFont, 6, Element.ALIGN_LEFT, Element.ALIGN_TOP, Rectangle.NO_BORDER);
            WriteCell(headingtable, "Shop #: " + ReportObject.ReportStore, ReportFont, 2, Element.ALIGN_LEFT, Element.ALIGN_TOP, Rectangle.NO_BORDER);

            WriteCell(headingtable, "Report Date: " + ReportObject.RunDate, ReportFont, 6, Element.ALIGN_LEFT, Element.ALIGN_TOP, Rectangle.NO_BORDER);
            WriteCell(headingtable, "Run Date: " + ReportObject.RunDate, ReportFont, 2, Element.ALIGN_LEFT, Rectangle.NO_BORDER);

            //row 3
            WriteCell(headingtable, string.Empty, ReportFont, 6, Element.ALIGN_LEFT, Element.ALIGN_TOP, Rectangle.NO_BORDER);
            WriteCell(headingtable, "Report #: " + ReportObject.ReportNumber.ToString(), ReportFont, 2, Element.ALIGN_LEFT, Rectangle.NO_BORDER);

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


            //row 7
            WriteCell(headingtable, string.Empty, ReportFontBold, 3, Element.ALIGN_LEFT, Rectangle.NO_BORDER);
            WriteCell(headingtable, ReportObject.ReportTitle, ReportFontBold, 5, Element.ALIGN_LEFT, Rectangle.NO_BORDER);

            //row 8
            WriteCell(headingtable, string.Empty, ReportFont, colspan, Element.ALIGN_LEFT, Element.ALIGN_TOP, Rectangle.NO_BORDER);
            WriteCell(headingtable, string.Empty, ReportFont, colspan, Element.ALIGN_LEFT, Element.ALIGN_TOP, Rectangle.NO_BORDER);
            //Write Columns
            //ReportColumns(headingtable);

            //DrawLine(headingtable);
        }
コード例 #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
                //_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);
        }
コード例 #3
0
        //create report
        public bool CreateReport(IPdfLauncher pdfLauncher)
        {
            bool isSuccessful = false;

            try
            {
                //set up fonts
                reportObject.CreateTemporaryFullName();
                switch (reportObject.ReportNumber)
                {
                //no ticket 3/4/2010 S.Murphy Added Gun Disposition

                case (int)ReportIDs.RefurbList:    //CACC Sales report
                    RefurbList refurbList = new RefurbList(pdfLauncher);
                    reportObject.CreateTemporaryFullName("RefurbList");
                    refurbList.ReportObject = this.reportObject;
                    isSuccessful            = refurbList.CreateReport();

                    break;

                case (int)ReportIDs.RifleDispositionReport:  //Multi Rifle Disposition report
                case (int)ReportIDs.GunDispositionReport:    //Gun Disposition report
                    GunDispositionReport gunDispositionReport = new GunDispositionReport(pdfLauncher);
                    gunDispositionReport.reportObject = this.reportObject;
                    isSuccessful = gunDispositionReport.CreateReport();
                    break;

                case (int)ReportIDs.GunAuditReportATFOpenRecords:    //Gun Disposition report
                    ATFOpenRecordsReport atfOpenRecordsReport = new ATFOpenRecordsReport(pdfLauncher);
                    reportObject.CreateTemporaryFullName("ATFReport");
                    atfOpenRecordsReport.ReportObject = this.reportObject;
                    isSuccessful = atfOpenRecordsReport.CreateReport();
                    break;

                case (int)ReportIDs.LoanAuditReport:    //Loan Audit report
                    LoanAuditReport loanAuditReport = new LoanAuditReport();
                    loanAuditReport.reportObject = this.reportObject;
                    isSuccessful = loanAuditReport.CreateReport();
                    break;

                case (int)ReportIDs.FullLocationsReport:    //Loan Audit report
                    FullLocationsReport fullLocationsReport = new FullLocationsReport();
                    fullLocationsReport.reportObject = this.reportObject;
                    isSuccessful = fullLocationsReport.CreateReport();
                    break;

                case (int)ReportIDs.Snapshot:    //Snapshot report
                    SnapshotReport snapshotReport = new SnapshotReport();
                    snapshotReport.reportObject = this.reportObject;
                    isSuccessful = snapshotReport.CreateReport();
                    break;

                case (int)ReportIDs.InPawnJewelryLocationReport:    //In Pawn Jewelry Locations report
                    InPawnJewelryLocationsReport inPawnJewelryLocationsReport = new InPawnJewelryLocationsReport();
                    inPawnJewelryLocationsReport.reportObject = this.reportObject;
                    isSuccessful = inPawnJewelryLocationsReport.CreateReport();
                    break;

                case (int)ReportIDs.GunAuditReport:    //Gun Audit report
                    GunAuditReport gunAuditReport = new GunAuditReport();
                    gunAuditReport.reportObject = this.reportObject;
                    isSuccessful = gunAuditReport.CreateReport();
                    break;

                case (int)ReportIDs.DetailInventory:    //Gun Disposition report
                    DetailInventoryReport detailInventoryReport = new DetailInventoryReport();
                    detailInventoryReport.reportObject = this.reportObject;
                    isSuccessful = detailInventoryReport.CreateReport();
                    break;

                case (int)ReportIDs.CashDrawerLedgerReport:    //Ledger report
                    CashDrawerLedger ledgerFrm = new CashDrawerLedger();
                    ledgerFrm.RptObject = reportObject;
                    ledgerFrm.Print();
                    isSuccessful = true;
                    break;

                case (int)ReportIDs.CACCSales:    //CACC Sales report
                    CACCSalesReport caccReport = new CACCSalesReport(pdfLauncher);
                    caccReport.reportObject = this.reportObject;
                    isSuccessful            = caccReport.CreateReport(reportObject.CACCSalesData);

                    break;

                case (int)ReportIDs.JewelryCount:
                    if (this.reportObject.ReportDetail.Equals("Detailed"))
                    {
                        JewelryCountDetailReport jewelryCountWorksheet = new JewelryCountDetailReport(pdfLauncher);
                        reportObject.ReportTitle           = "Jewelry Count Worksheet";
                        jewelryCountWorksheet.reportObject = this.reportObject;
                        isSuccessful = jewelryCountWorksheet.CreateReport(reportObject.JewleryCountDetailData);
                    }
                    else
                    {
                        JewelryCountSummaryReport jewelryCountSummary = new JewelryCountSummaryReport(pdfLauncher);
                        reportObject.ReportTitle         = "Jewelry Count Summary";
                        jewelryCountSummary.reportObject = this.reportObject;
                        isSuccessful = jewelryCountSummary.CreateReport(reportObject.JewleryCountSummaryData);
                    }
                    break;

                case (int)ReportIDs.DailySales:
                    if (this.reportObject.ReportDetail.Equals("Detail"))
                    {
                        DailySalesReport dailySalesReport = new DailySalesReport(pdfLauncher);
                        dailySalesReport.reportObject = this.reportObject;
                        isSuccessful = dailySalesReport.CreateReport(reportObject.DailySalesData);
                    }
                    else
                    {
                        DailySalesReport_Summary summary = new DailySalesReport_Summary(pdfLauncher);
                        summary.reportObject = this.reportObject;
                        isSuccessful         = summary.CreateReport(reportObject.DailySalesSummaryData);
                    }
                    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);
        }