Exemplo n.º 1
0
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            SPR_PQAll rpt = new SPR_PQAll();

            rpt.Site = this.Site;
            return(rpt);
        }
Exemplo n.º 2
0
        private void SPR_PQAll_PrintScreen_Load(object sender, EventArgs e)
        {
            //---MYSQL CONNECTION
            connection = new MySqlConnection(ConnectionStringManager.reicpomsConnection.ConnectionString);
            connection.Open();

            //---SELECT Statements
            reicpomsds = new reicpomsDataSet();

            //Data from PQ Customers
            string selectPQCustomers = string.Format("SELECT DISTINCT customer_t.* " +
                                                     "FROM customer_t, pq_t, po_t " +
                                                     "WHERE pq_t.pq_no = po_t.pq_no " +
                                                     "AND pq_t.customer_id = customer_t.customer_id " +
                                                     "ORDER BY pq_t.pq_no DESC;");

            adapter = new MySqlDataAdapter(selectPQCustomers, connection);
            adapter.Fill(reicpomsds, "customer_t");

            //Data from pq_t
            string selectCompletedPQ = string.Format("SELECT DISTINCT pq_t.* " +
                                                     "FROM pq_t, po_t " +
                                                     "ORDER BY pq_t.pq_no DESC;");

            adapter = new MySqlDataAdapter(selectCompletedPQ, connection);
            adapter.Fill(reicpomsds, "pq_t");

            connection.Close();

            //---INSTANTIATE CRYSTAL REPORT
            SPR_PQAll pqc = new SPR_PQAll();

            pqc.Load();
            pqc.SetDataSource(reicpomsds); //Added a code snippet in app.config file. If else, will result to a System.IOFileNotFoundException error.

            //---EXPORT TO PDF
            string currentDateTime = DateTime.Now.ToString("yyyy-MM-dd hhmmtt");
            string filePath        = "C:\\REIC Files\\Sales Performance Report & Summary\\Price Quotations - All\\All PQ (" + currentDateTime + ").pdf";

            pqc.ExportToDisk(ExportFormatType.PortableDocFormat, filePath);

            MessageBox.Show("A PDF file of this report on completed price quotations can be found in \nC:\\REIC Files\\Sales Performance Report & Summary\\Price Quotations - All.");
            CrystalReportViewer.ReportSource = pqc;
        }