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);
                }
            }
        }
Exemple #2
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);
            }
        }
Exemple #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");
                }
            }
        }
        void pic_Click(object sender, EventArgs e)
        {
            if (ADS.ActiveAudit.AuditId > 0)
            {
                //Instantiate docinfo which will return info we need to be able to
                //call reprint ticket.
                CouchDbUtils.PawnDocInfo docInfo = new CouchDbUtils.PawnDocInfo();
                docInfo.DocumentType = Document.DocTypeNames.PDF;

                /*docInfo.SetDocumentSearchType(CouchDbUtils.DocSearchType.STORAGE);
                 * docInfo.StoreNumber = ADS.ActiveAudit.StoreNumber;
                 * docInfo.TicketNumber = ADS.ActiveAudit.AuditId;
                 * int receiptNumber = 0;*/

                string storageID = ((PictureBox)sender).Name.ToString();

                if (!string.IsNullOrEmpty(storageID))
                {
                    //Get the accessors
                    SecuredCouchConnector cC = GlobalDataAccessor.Instance.CouchDBConnector;

                    //Retrieve the document data
                    var pLoadMesg = new ProcessingMessage("* Loading Document *");

                    //Connect to couch and retrieve document
                    Document doc;
                    string   errText;
                    if (!CouchDbUtils.GetDocument(
                            storageID,
                            cC, out doc, out errText))
                    {
                        pLoadMesg.Close();
                        pLoadMesg.Dispose();
                        this.showErrorMessage("view", errText, storageID);
                        this.Close();
                    }
                    else if (doc != null)
                    {
                        pLoadMesg.Message = "* Document Loaded...Displaying *";
                        //Fetch data
                        string tmpFileName;
                        byte[] fileData;
                        if (!doc.GetSourceData(out fileData))
                        {
                            this.showErrorMessage("view", "Cannot retrieve file data to show file", storageID);
                            pLoadMesg.Close();
                            pLoadMesg.Dispose();
                            this.Close();
                            return;
                        }

                        //Create temporary file
                        if (!this.createTempFile(fileData, out tmpFileName))
                        {
                            this.showErrorMessage("view", "Cannot generate file data to show file", storageID);
                            pLoadMesg.Close();
                            pLoadMesg.Dispose();
                            this.Close();
                            return;
                        }
                        pLoadMesg.Close();
                        pLoadMesg.Dispose();
                        switch (docInfo.DocumentType)
                        {
                        case Document.DocTypeNames.PDF:
                            AuditDesktopSession.ShowPDFFile(tmpFileName, true);
                            break;
                        }
                    }
                }
            }
        }