예제 #1
0
        public void GetTrakkerUploadReport(bool store, bool display)
        {
            CommonDatabaseContext dataContext = CreateCommonDatabaseContext();
            List <AuditReportsObject.TrakkerUploadReportSinceLastInventory> fields = new List <AuditReportsObject.TrakkerUploadReportSinceLastInventory>();

            AuditReportsProcedures.GetTrakkerUploadReportFields(ref fields, ADS.ActiveAudit.StoreNumber, ADS.ActiveAudit.AuditId, dataContext);
            AuditReportsObject ro = new AuditReportsObject();

            ro.ReportNumber                 = 22;
            ro.ReportStore                  = ADS.ActiveAudit.StoreName;
            ro.ReportTitle                  = "Trakker Upload Report";
            ro.StoreNumber                  = ADS.ActiveAudit.StoreNumber;
            ro.InventoryAuditDate           = DateTime.Today;
            ro.ListTrakkerUploadReportField = fields;
            ro.ActiveAudit                  = ADS.ActiveAudit;
            ro.ReportTempFile               = ReportDirectoryPath;
            TrakkerUploadReport trpt = new TrakkerUploadReport();

            trpt.ReportObject = ro;
            trpt.CreateReport();
            if (store)
            {
                PrintAndStoreReport(ro, ro.ReportTitle);
            }
            if (display)
            {
                AuditDesktopSession.ShowPDFFile(ro.ReportTempFileFullName, false);
            }
        }
예제 #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
                //ReportObject.BuildTrakkerUploadFieldsList();
                //ReportObject.ReportTempFile = "c:\\Program Files\\Phase2App\\logs\\";
                ReportObject.CreateTemporaryFullName("TrakkerUploadReport");
                _pageCount = 1;
                TrakkerUploadReport events = this;
                PdfWriter           writer = PdfWriter.GetInstance(document, new FileStream(ReportObject.ReportTempFileFullName, FileMode.Create));
                writer.PageEvent = events;

                MultiColumnText columns   = new MultiColumnText(document.PageSize.Top - 120, document.PageSize.Height);
                float           pageLeft  = document.PageSize.Left;
                float           pageright = document.PageSize.Right;
                columns.AddSimpleColumn(20, document.PageSize.Width - 20);

                //set up tables, etc...

                PdfPCell cell = new PdfPCell();
                Image    gif  = Image.GetInstance(Common.Properties.Resources.logo, BaseColor.WHITE);
                gif.ScalePercent(25);
                document.Open();
                document.SetPageSize(PageSize.LETTER);
                document.SetMargins(-100, -100, 10, 45);
                document.AddTitle(ReportObject.ReportTitle + ": " + DateTime.Now.ToString("MM/dd/yyyy"));

                //here get the List with all the data, if list
                PdfPTable tableIcnsSinceLastInventory = new PdfPTable(9);
                tableIcnsSinceLastInventory.WidthPercentage = 100;// document.PageSize.Width;
                SectionICNsSinceLastInventory(tableIcnsSinceLastInventory, 9);
                columns.AddElement(tableIcnsSinceLastInventory);

                PdfPTable tableMissingitems = new PdfPTable(10);
                tableMissingitems.WidthPercentage = 100;// document.PageSize.Width;
                SectionMissingItems(tableMissingitems, 10);
                columns.AddElement(tableMissingitems);

                PdfPTable tableNXTsSinceLast = new PdfPTable(8);
                tableNXTsSinceLast.WidthPercentage = 100;// document.PageSize.Width;
                SectionNXTsSinceLastInventory(tableNXTsSinceLast, 8);
                columns.AddElement(tableNXTsSinceLast);

                PdfPTable tableUnexpectedItems = new PdfPTable(11);
                tableUnexpectedItems.WidthPercentage = 100;// document.PageSize.Width;
                SectionUnexpectedItems(tableUnexpectedItems, 11);
                columns.AddElement(tableUnexpectedItems);

                PdfPTable tableDuplicateScans = new PdfPTable(12);
                tableDuplicateScans.WidthPercentage = 100;// document.PageSize.Width;
                SectionDuplicateScans(tableDuplicateScans, 12);
                columns.AddElement(tableDuplicateScans);

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