コード例 #1
0
        private void btnPrintShortList_Click(object sender, EventArgs e)
        {
            var     reportObject = new ReportObject(SecurityAccessor.Instance.EncryptConfig.ClientConfig.GlobalConfiguration.BaseLogPath);
            DataSet outputDataSet;

            //reportObject.ReportTempFile = "c:\\Program Files\\Audit\\logs\\";
            reportObject.CreateTemporaryFullName("MissingItemsReport_");
            string _storeName = ADS.ActiveAudit.StoreName;

            reportObject.ReportStore = ADS.ActiveAudit.StoreNumber;
            //reportObject.ReportParms.Add(DateTime.Now);

            bool hasData = AuditReportsProcedures.GetMissingItemsData(ADS.ActiveAudit.StoreNumber, ADS.ActiveAudit.AuditId, out outputDataSet);

            if (hasData)
            {
                // Create Report
                reportObject.ReportTitle     = "Missing Items Short List";
                reportObject.ReportStoreDesc = string.Format("{0} \n #{1}", _storeName, ADS.ActiveAudit.StoreNumber);

                var MsgItemsReport = new MissingItemsReport("Missing Items Short List");

                MsgItemsReport.reportObject = reportObject;

                if (MsgItemsReport.CreateReport(outputDataSet.Tables[AuditReportsProcedures.MISSING_ITEMS]))
                {
                    AuditDesktopSession.ShowPDFFile(System.IO.Path.GetFullPath(MsgItemsReport.reportObject.ReportTempFileFullName)
                                                    , false);
                }
            }
        }
コード例 #2
0
        private void PrintPDFReport(CustomerVO currentCustomer, List <HoldData> policeHolds)
        {
            // 03082012 TG - Add printing using iText#
            //var rtcReport = new Reports.ReleaseToClaimantReport();
            var phReport     = new Reports.PoliceHoldReport();
            var reportObject = new ReportObject();

            reportObject.ReportTempFile = SecurityAccessor.Instance.EncryptConfig.ClientConfig.GlobalConfiguration.BaseLogPath;
            reportObject.CreateTemporaryFullName();

            phReport.reportObject           = reportObject;
            phReport.ReportTempFileFullName = reportObject.ReportTempFileFullName;
            // set store information
            phReport.STORE_NAME    = ProcessTenderController.STORE_NAME;
            phReport.STORE_ADDRESS = ProcessTenderController.STORE_ADDRESS;
            phReport.STORE_CITY    = ProcessTenderController.STORE_CITY;
            phReport.STORE_STATE   = ProcessTenderController.STORE_STATE;
            phReport.STORE_ZIP     = ProcessTenderController.STORE_ZIP;

            phReport.CurrentCust = currentCustomer;
            // Pass hold data
            phReport.HoldData = policeHolds[0];


            if (phReport.CreateReport())
            {
                DesktopSession.ShowPDFFile(phReport.reportObject.ReportTempFileFullName, false);
                this.TopMost = false;
            }
        }
コード例 #3
0
        public void GetPreAuditReport(bool store, bool display)
        {
            var     reportObject = new ReportObject();
            DataSet outputDataSet;

            reportObject.ReportTempFile = SecurityAccessor.Instance.EncryptConfig.ClientConfig.GlobalConfiguration.BaseLogPath;
            //reportObject.ReportTempFileFullName = "PreAuditReport_" + DateTime.Now.Ticks + ".pdf";
            reportObject.CreateTemporaryFullName("PreAuditReport_");
            string _storeName = ADS.ActiveAudit.StoreName;

            reportObject.ReportStore = ADS.ActiveAudit.StoreNumber;
            //reportObject.ReportParms.Add(DateTime.Now);

            bool hasData = (ADS.ActiveAudit.PreAuditData != null && ADS.ActiveAudit.PreAuditData.Tables.Count == 3);

            if (hasData)
            {
                outputDataSet = ADS.ActiveAudit.PreAuditData;
            }
            else
            {
                AuditReportsProcedures.GetPreAuditData(ADS.ActiveAudit.StoreNumber, ADS.ActiveAudit.AuditId, out outputDataSet, ref _storeName);
            }

            if (hasData)
            {
                // Create Report
                reportObject.ReportTitle     = "Full Pre-Audit";
                reportObject.ReportStoreDesc = string.Format("{0} \n #{1}", _storeName, ADS.ActiveAudit.StoreNumber);
                var preReport = new PreAuditReport("Full Pre-Audit");
                preReport.reportObject = reportObject;
                if (preReport.CreateReport(outputDataSet))
                {
                    //string fullPath = System.IO.Path.GetFullPath(preReport.reportObject.ReportTempFileFullName);
                    if (display)
                    {
                        AuditDesktopSession.ShowPDFFile(reportObject.ReportTempFileFullName, false);
                    }
                }
                if (store)
                {
                    PrintAndStoreReport(reportObject, "Pre-Audit");
                }
            }
        }
コード例 #4
0
        public bool CreateReport()
        {
            bool isSuccessful = false;

            _document = new iTextSharp.text.Document(PageSize.LETTER);

            try
            {
                string reportTitle = "Pending Shop Transfer Summary";

                _ReportObject = new ReportObject();
                _ReportObject.CreateTemporaryFullName();

                if (!Directory.Exists(_logPath))
                {
                    Directory.CreateDirectory(_logPath);
                }

                reportFileName = _logPath + "\\" + _ReportObject.ReportTempFileFullName;

                PdfWriter writer = PdfWriter.GetInstance(_document, new FileStream(reportFileName, FileMode.Create));
                writer.PageEvent = this;
                Image gif = Image.GetInstance(Common.Properties.Resources.logo, BaseColor.WHITE);
                _reportFont          = FontFactory.GetFont("Arial", 8, iTextSharp.text.Font.NORMAL);
                _reportFontBold      = FontFactory.GetFont("Arial", 8, iTextSharp.text.Font.BOLD);
                _reportFontLargeBold = FontFactory.GetFont("Arial", 12, iTextSharp.text.Font.BOLD);
                gif.ScalePercent(35);
                _document.AddTitle(reportTitle);
                _document.SetMargins(-50, -55, 10, 45);
                _document.Open();
                createPendingSummaryHeader(gif, reportTitle);
                PrintReportDetail();
                addTotalRow(_transferList.Count);
                _document.Close();
                isSuccessful = true;
            }
            catch (Exception e)
            {
                Console.WriteLine("Error generating report :" + e);
                isSuccessful = false;
            }
            return(isSuccessful);
        }
コード例 #5
0
        protected void Print_btn_Click(object sender, EventArgs e)
        {
            string rptDir = SecurityAccessor.Instance.EncryptConfig.ClientConfig.GlobalConfiguration.BaseLogPath;

            var ro = new ReportObject();

            //var report = new Reports.Inquiry.PartialPaymentListingReport(ro.ReportTitle, ro.ReportStore, ro.ReportStoreDesc, ro.ReportTitle, string.Empty, string.Empty);
            var report = new Reports.Inquiry.PartialPaymentListingReport(PdfLauncher.Instance);

            ro.CreateTemporaryFullName();
            ro.ReportTempFileFullName = rptDir + ro.ReportTempFileFullName;
            ro.ReportTitle            = "Partial Payment Listing";
            ro.ReportStore            = GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber;
            ro.ReportStoreDesc        = GlobalDataAccessor.Instance.CurrentSiteId.StoreName;
            ro.ReportSort             = "USERID";
            report.reportObject       = ro;

            var dv           = _theData.DefaultViewManager.CreateDataView(_theData.Tables[0]);
            var isSuccessful = report.CreateReport(_theData.Tables[0]);

            DesktopSession.ShowPDFFile(report.reportObject.ReportTempFileFullName, false);
            this.TopMost = false;
        }
コード例 #6
0
        public bool CreateReport()
        {
            bool isSuccessful = false;
            var  document     = new iTextSharp.text.Document(PageSize.LETTER);

            try
            {
                //set up RunReport event overrides & create doc
                //ReportObject.BuildChargeOffsList();
                ReportObject.ReportTempFile = "c:\\Program Files\\Phase2App\\logs\\AuditReportsTemp\\";
                ReportObject.CreateTemporaryFullName("InventorySummaryResponseReport");
                _pageCount = 1;
                var events = this;
                var 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...

                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, -100, 10, 45);
                document.AddTitle(ReportObject.ReportTitle + ": " + DateTime.Now.ToString("MM/dd/yyyy"));


                var additionalCommentsSectionTable = new PdfPTable(1);
                additionalCommentsSectionTable.WidthPercentage = 100;// document.PageSize.Width;
                WriteAdditionalCommentsSection(additionalCommentsSectionTable);
                columns.AddElement(additionalCommentsSectionTable);

                var deficiencesSectionTable = new PdfPTable(4);
                deficiencesSectionTable.WidthPercentage = 100;// document.PageSize.Width;
                WriteDeficiencesSection(deficiencesSectionTable);
                columns.AddElement(deficiencesSectionTable);

                var inventoryHistorySectionTable = new PdfPTable(9);
                inventoryHistorySectionTable.WidthPercentage = 100;// document.PageSize.Width;
                WriteInventoryHistorySection(inventoryHistorySectionTable);
                columns.AddElement(inventoryHistorySectionTable);

                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);
        }
コード例 #7
0
        public void Print(string totalCost, string totalTags, bool showMsg = true)
        {
            if (ReportData == null || ReportData.Rows.Count == 0)
            {
                if (showMsg)
                {
                    MessageBox.Show("No records available to print", ReportTitle, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                return;
            }

            ControllerForm.Cursor = Cursors.WaitCursor;

            ProcessingMessage processingForm = new ProcessingMessage("Please wait while we generate report.");

            processingForm.Show();

            ReportObject reportObject = new ReportObject();

            reportObject.ReportTitle    = ReportTitle;
            reportObject.ReportStore    = GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber;
            reportObject.ReportTempFile = SecurityAccessor.Instance.EncryptConfig.ClientConfig.GlobalConfiguration.BaseLogPath;
            reportObject.CreateTemporaryFullName();
            PfiPostReport report = new PfiPostReport(ReportData, totalCost, totalTags, ShopDateTime.Instance.ShopDate.ToShortDateString(), Convert.ToDateTime(ShopDateTime.Instance.ShopTime.ToString()), reportObject, PdfLauncher.Instance);

            if (!report.CreateReport())
            {
                processingForm.Close();
                processingForm.Dispose();
                ControllerForm.Cursor = Cursors.Default;
                MessageBox.Show("Failed to generate report", "PFI POST", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            //Dictionary<string, string> eDeviceData = GetPrintDeviceData();
            if (SecurityAccessor.Instance.EncryptConfig.ClientConfig.ClientConfiguration.PrintEnabled &&
                GlobalDataAccessor.Instance.DesktopSession.LaserPrinter.IsValid)
            {
                if (FileLogger.Instance.IsLogInfo)
                {
                    FileLogger.Instance.logMessage(LogLevel.INFO, "PrintPFIUtilities", "Printing {0} on {1}", ReportTitle,
                                                   GlobalDataAccessor.Instance.DesktopSession.LaserPrinter);
                }
                string strReturnMessage =
                    PrintingUtilities.printDocument(
                        reportObject.ReportTempFileFullName,
                        GlobalDataAccessor.Instance.DesktopSession.LaserPrinter.IPAddress,
                        GlobalDataAccessor.Instance.DesktopSession.LaserPrinter.Port,
                        1);
                if (strReturnMessage.IndexOf("SUCCESS", StringComparison.OrdinalIgnoreCase) == -1)
                {
                    if (FileLogger.Instance.IsLogError)
                    {
                        FileLogger.Instance.logMessage(LogLevel.ERROR, this, "Cannot print " + ReportTitle + " report " + strReturnMessage);
                    }
                }
            }

            processingForm.Close();
            processingForm.Dispose();
            ControllerForm.Cursor = Cursors.Default;

            if (showMsg)
            {
                MessageBox.Show("Printing Complete", ReportTitle, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
コード例 #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
                //ReportObject.ReportTempFile = "c:\\Program Files\\Phase2App\\logs\\";
                ReportObject.CreateTemporaryFullName("PostAuditReport");
                _pageCount = 1;
                PostAuditReport 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"));

                PdfPTable tableInventoryTotalsCountedByStatus = new PdfPTable(6);
                tableInventoryTotalsCountedByStatus.WidthPercentage = 100;// document.PageSize.Width;
                SectionInventoryTotalsCountedByStatus(tableInventoryTotalsCountedByStatus, 6);
                columns.AddElement(tableInventoryTotalsCountedByStatus);

                PdfPTable tableChargeOff = new PdfPTable(9);
                tableChargeOff.WidthPercentage = 100;// document.PageSize.Width;
                WriteSections(tableChargeOff, 9, "Charge Off", (int)EnumPostAuditReportCategories.ChargeOff);
                columns.AddElement(tableChargeOff);

                PdfPTable tableReactivation = new PdfPTable(8);
                tableReactivation.WidthPercentage = 100;// document.PageSize.Width;
                WriteSections(tableReactivation, 8, "Reactivation", (int)EnumPostAuditReportCategories.Reactivation);
                columns.AddElement(tableReactivation);

                PdfPTable tableChargeOn = new PdfPTable(8);
                tableChargeOn.WidthPercentage = 100;// document.PageSize.Width;
                WriteSections(tableChargeOn, 8, "Charge On", (int)EnumPostAuditReportCategories.ChargeOn);
                columns.AddElement(tableChargeOn);

                PdfPTable tabletempRecon = new PdfPTable(4);
                tabletempRecon.WidthPercentage = 100;// document.PageSize.Width;
                WriteTempRecociliationSection(tabletempRecon, 4);
                columns.AddElement(tabletempRecon);

                PdfPTable tableFooter = new PdfPTable(3);
                tableFooter.WidthPercentage = 100;// document.PageSize.Width;
                WriteFooter(tableFooter, 3);
                columns.AddElement(tableFooter);

                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);
        }
コード例 #9
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);
        }
コード例 #10
0
        public bool CreateReport()
        {
            bool isSuccessful = false;

            iTextSharp.text.Document document = new iTextSharp.text.Document(PageSize.LETTER);
            try
            {
                ReportObject.CreateTemporaryFullName("InventorySummaryReport");
                _pageCount = 1;
                InventorySummaryReport 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"));


                PdfPTable employeeSectionTable = new PdfPTable(12);
                employeeSectionTable.WidthPercentage = 100;// document.PageSize.Width;
                WriteEmployeeSection(employeeSectionTable);
                columns.AddElement(employeeSectionTable);

                PdfPTable chargeOffsSectionTable = new PdfPTable(12);
                chargeOffsSectionTable.WidthPercentage = 100;// document.PageSize.Width;
                WriteChargeOffHeaders(chargeOffsSectionTable, 12);
                WriteChargeOffsSection(chargeOffsSectionTable, 12, ReportObject.ListInventorySummaryChargeOffsField, true);
                WriteCell(chargeOffsSectionTable, string.Empty, ReportFontBold, 12, Element.ALIGN_LEFT, Rectangle.NO_BORDER, false);
                WriteCell(chargeOffsSectionTable, string.Empty, ReportFontBold, 12, Element.ALIGN_LEFT, Rectangle.NO_BORDER, false);
                WriteChargeOffsSection(chargeOffsSectionTable, 12, ReportObject.ListInventorySummaryChargeOffsFieldCACC, false);

                PdfPTable currentInventorySectionTable = new PdfPTable(12);
                currentInventorySectionTable.WidthPercentage = 100;// document.PageSize.Width;
                WriteCurrentInventorySection(currentInventorySectionTable, 12);

                columns.AddElement(currentInventorySectionTable);
                columns.AddElement(chargeOffsSectionTable);

                //PdfPTable chargeOffsCACCSectionTable = new PdfPTable(12);
                //chargeOffsCACCSectionTable.WidthPercentage = 100;// document.PageSize.Width;
                //WriteChargeOffsSection(chargeOffsCACCSectionTable, 12, ReportObject.ListInventorySummaryChargeOffsFieldCACC);
                //columns.AddElement(chargeOffsCACCSectionTable);

                document.Add(columns);
                NewPage = true;
                document.NewPage();
                MultiColumnText columns2 = new MultiColumnText(document.PageSize.Top - 120, document.PageSize.Height);
                columns2.AddSimpleColumn(20, document.PageSize.Width - 20);

                PdfPTable additionalCommentsSectionTable = new PdfPTable(1);
                additionalCommentsSectionTable.WidthPercentage = 100;// document.PageSize.Width;
                WriteAdditionalCommentsSection(additionalCommentsSectionTable, 1);
                columns2.AddElement(additionalCommentsSectionTable);

                PdfPTable deficiencesSectionTable = new PdfPTable(5);
                deficiencesSectionTable.WidthPercentage = 100;// document.PageSize.Width;
                WriteDeficiencesSection(deficiencesSectionTable, 5);
                columns2.AddElement(deficiencesSectionTable);

                PdfPTable inventoryHistorySectionTable = new PdfPTable(9);
                inventoryHistorySectionTable.WidthPercentage = 100;// document.PageSize.Width;
                WriteInventoryHistorySection(inventoryHistorySectionTable, 9);
                columns2.AddElement(inventoryHistorySectionTable);

                document.Add(columns2);

                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);
        }
コード例 #11
0
        private void Print_btn_Click(object sender, EventArgs e)
        {
            string rptDir =
                SecurityAccessor.Instance.EncryptConfig.ClientConfig.GlobalConfiguration.BaseLogPath;

            var ro = new ReportObject();

            ro.CreateTemporaryFullName();
            ro.ReportTempFileFullName = rptDir + ro.ReportTempFileFullName;
            ro.ReportStore            = GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber;
            ro.ReportStoreDesc        = GlobalDataAccessor.Instance.CurrentSiteId.StoreName;
            ro.ReportSort             = "USERID";
            ro.RunDate = DateTime.Now.ToShortDateString();

            switch (_transferTypeEnum)
            {
            case (TransferTypeEnum.BANK):
            {
                var report = new CashTransferBankTransferReport();
                report.reportObject = ro;

                var isSuccessful = report.CreateReport(_theData.Tables[0]);

                if (isSuccessful)
                {
                    DesktopSession.ShowPDFFile(report.reportObject.ReportTempFileFullName, false);
                    this.TopMost = false;
                }
            }
            break;

            case (TransferTypeEnum.INTERNAL):
            {
                var report = new CashTransferInternalTransferReport();
                report.reportObject = ro;

                var isSuccessful = report.CreateReport(_theData.Tables[0]);

                if (isSuccessful)
                {
                    DesktopSession.ShowPDFFile(report.reportObject.ReportTempFileFullName, false);
                    this.TopMost = false;
                }
            }
            break;

            case (TransferTypeEnum.SHOP):
            {
                var report = new CashTransferShopToShopTransferReport();
                report.reportObject = ro;

                var isSuccessful = report.CreateReport(_theData.Tables[0]);

                if (isSuccessful)
                {
                    DesktopSession.ShowPDFFile(report.reportObject.ReportTempFileFullName, false);
                    this.TopMost = false;
                }
            }
            break;

            default:
                System.Diagnostics.Debug.Assert(false, "Unhandled Condition. Forget to add handler?");
                break;
            }
        }
コード例 #12
0
        private void printButton_Click(object sender, EventArgs e)
        {
            // Have extra enumeration to go ProKnow with only ONE call
            List <CustomerProductDataVO> productObjects = new List <CustomerProductDataVO>();
            List <String> customerNames = new List <String>();

            List <int> tickets = new List <int>(gvLoans.Rows.Count);

            Cursor = Cursors.WaitCursor;
            try
            {
                // improve efficiency -- only return new numbers if these have been previously loaded
                foreach (DataGridViewRow myRow in gvLoans.Rows)
                {
                    if (Convert.ToBoolean(myRow.Cells[colSelect.Name].Value) &&
                        !myRow.Cells[colSelect.Name].ReadOnly)
                    {
                        int iTktNumber =
                            Utilities.GetIntegerValue(myRow.Cells[colNumber.Name].Value, 0);

                        if (iTktNumber != 0)
                        {
                            tickets.Add(iTktNumber);
                        }
                    }
                }

                string   errorCode;
                string   errorTxt;
                DateTime dt = Convert.ToDateTime(dateCalendarSearchDate.SelectedDate);

                StoreLoans.Get_PFI_Details(CashlinxDesktopSession.Instance.CurrentSiteId.StoreNumber, dt,
                                           tickets, out _PawnLoans, out _PawnApplications, out _CustomerVOs,
                                           out _Purchases, out errorCode, out errorTxt);

                foreach (DataGridViewRow myRow in gvLoans.Rows)
                {
                    if (Convert.ToBoolean(myRow.Cells[colSelect.Name].Value) &&
                        !myRow.Cells[colSelect.Name].ReadOnly)
                    {
                        int iTktNumber =
                            Utilities.GetIntegerValue(myRow.Cells[colNumber.Name].Value, 0);

                        string   customer = (string)myRow.Cells[4].Value;
                        PawnLoan pawnLoan = null;

                        if (myRow.Cells[colType.Name].Value.Equals("LOAN"))
                        {
                            if (_PawnLoans != null)
                            {
                                pawnLoan = (from ploan in _PawnLoans
                                            where
                                            ploan.TicketNumber == iTktNumber &&
                                            ploan.ProductType == ProductType.PAWN.ToString()
                                            select ploan).FirstOrDefault();
                            }

                            if (pawnLoan != null)
                            {
                                LoanPrinted loanPrinted =
                                    _PrintedLoans.Find(
                                        l => l.LoanNumber == iTktNumber && l.RefType == 1);
                                loanPrinted.bPrinted = true;
                                _PrintedLoans.RemoveAll(
                                    l => l.LoanNumber == iTktNumber && l.RefType == 1);
                                _PrintedLoans.Add(loanPrinted);
                                productObjects.Add(pawnLoan);
                                customerNames.Add(customer);
                            }
                        }
                        else
                        {
                            PurchaseVO purchaseObj = null;
                            if (_Purchases != null)
                            {
                                purchaseObj = (from purchase in _Purchases where purchase.TicketNumber == iTktNumber select purchase).FirstOrDefault();
                            }
                            if (purchaseObj != null)
                            {
                                LoanPrinted loanPrinted =
                                    _PrintedLoans.Find(l => l.LoanNumber == iTktNumber && l.RefType == 2);
                                loanPrinted.bPrinted = true;
                                _PrintedLoans.RemoveAll(l => l.LoanNumber == iTktNumber && l.RefType == 2);
                                _PrintedLoans.Add(loanPrinted);
                                productObjects.Add(purchaseObj);
                                customerNames.Add(customer);
                            }
                        }
                    }
                }
                if (productObjects.Count() > 0)
                {
                    ProcessingMessage processingForm = new ProcessingMessage("Please wait while we generate report.");
                    try
                    {
                        processingForm.Show();

                        this.Cursor = Cursors.WaitCursor;

                        //----- Tracy 12/15/2010
                        List <int>    lstTicketNumbers = new List <int>();
                        List <string> lstRefTypes      = new List <string>();
                        string        sErrorCode;
                        string        sErrorText;

                        foreach (CustomerProductDataVO o in productObjects)
                        {
                            lstTicketNumbers.Add(o.TicketNumber);
                            lstRefTypes.Add(o.ProductType == "PAWN" ? "1" : "2");
                        }

                        if (lstTicketNumbers.Count > 0 && !StoreLoans.UpdateTempStatus(
                                lstTicketNumbers,
                                StateStatus.PFIW,
                                CashlinxDesktopSession.Instance.CurrentSiteId.StoreNumber,
                                true,
                                lstRefTypes,
                                out sErrorCode,
                                out sErrorText))
                        {
                            MessageBox.Show("Error updating PFI Verify.  " + sErrorText, "PFI Verification Update", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }
                        //------- Tracy 12/15/2010

                        var context      = new PickingSlipHelper().GetPickingSlipReportContext(productObjects, customerNames, true);
                        var reportObject = new ReportObject();
                        reportObject.ReportTempFile = SecurityAccessor.Instance.EncryptConfig.ClientConfig.GlobalConfiguration.BaseLogPath;
                        reportObject.CreateTemporaryFullName();
                        context.ReportObject = reportObject;
                        var pickingSlip = new PickingSlip(context);

                        if (!pickingSlip.CreateReport())
                        {
                            processingForm.Close();
                            processingForm.Dispose();
                            this.Cursor = Cursors.Default;
                            MessageBox.Show("Failed to generate report", "Picking Slip", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            return;
                        }

                        //Dictionary<string, string> eDeviceData = new PrintUtilities().GetPrintDeviceData("pfipickslip");
                        if (SecurityAccessor.Instance.EncryptConfig.ClientConfig.ClientConfiguration.PrintEnabled &&
                            GlobalDataAccessor.Instance.DesktopSession.LaserPrinter.IsValid)
                        {
                            if (FileLogger.Instance.IsLogInfo)
                            {
                                FileLogger.Instance.logMessage(LogLevel.INFO, "PFI_SelectLoan", "Printing PFI picking slip on {0}",
                                                               GlobalDataAccessor.Instance.DesktopSession.LaserPrinter);
                            }
                            string strReturnMessage =
                                PrintingUtilities.printDocument(reportObject.ReportTempFileFullName,
                                                                GlobalDataAccessor.Instance.DesktopSession.LaserPrinter.IPAddress,
                                                                GlobalDataAccessor.Instance.DesktopSession.LaserPrinter.Port, 1);
                            if (!strReturnMessage.Contains("SUCCESS"))
                            {
                                FileLogger.Instance.logMessage(LogLevel.ERROR, this, "Cannot print picking slip : " + strReturnMessage);
                            }
                        }

                        processingForm.Close();
                        processingForm.Dispose();
                        this.Cursor = Cursors.Default;

                        MessageBox.Show("Printing Complete", "Picking Slip", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    catch (Exception exc)
                    {
                        FileLogger.Instance.logMessage(LogLevel.ERROR, this, exc.Message);
                        processingForm.Close();
                        processingForm.Dispose();
                        this.Cursor = Cursors.Default;
                        MessageBox.Show(exc.Message);
                    }
                }
                //else
                //{
                //    continueButton.Enabled = false;
                //}
                continueButton.Enabled = true;
            }
            catch (Exception exp)
            {
                MessageBox.Show("Error in printing.  Retry. (" + exp.Message + ")", "PFI Printing");
            }

            Cursor = Cursors.Default;
        }