コード例 #1
0
        //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);
        }
コード例 #2
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);
        }