/*public string InFavorOf //Different IFO values have slightly different PQs
         * {
         *  set { inFavorOf = value; }
         *  get { return inFavorOf; }
         * }*/

        private void PQ_PrintScreen_IFOSupplier_Load(object sender, EventArgs e)
        { //When screen loads, details of the RFQ Printout should already be displayed.
            //---MYSQL CONNECTION
            connection = new MySqlConnection(ConnectionStringManager.reicpomsConnection.ConnectionString);
            connection.Open();

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

            //Data from supplier_t
            string selectPQSupplier = string.Format("SELECT DISTINCT supplier_t.* " +
                                                    "FROM rfq_order_line_t, item_t, supplier_t " +
                                                    "WHERE rfq_no = '{0}' " +
                                                    "AND rfq_order_line_t.part_number = item_t.part_number " +
                                                    "AND item_t.supplier_id = supplier_t.supplier_id;", PQNo);

            adapter = new MySqlDataAdapter(selectPQSupplier, connection);
            adapter.Fill(reicpomsds, "supplier_t");

            //Data from pq_order_line_t, inserted into item_t
            string selectPQOrderLineItems = string.Format("SELECT item_t.* " +
                                                          "FROM pq_order_line_t, item_t " +
                                                          "WHERE pq_no = '{0}' " +
                                                          "AND pq_order_line_t.part_number = item_t.part_number;", PQNo);

            adapter = new MySqlDataAdapter(selectPQOrderLineItems, connection);
            adapter.Fill(reicpomsds, "item_t"); //Inserted into item_t, since it's where item_name, item_description, and unit_of_measurement can be found

            //Data from pq_t
            string selectPQ = string.Format("SELECT * FROM pq_t WHERE pq_no='{0}';", PQNo);

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

            //Data from pq_order_line_t
            string selectPQOrderLine = string.Format("SELECT * FROM pq_order_line_t WHERE pq_no='{0}';", PQNo);

            adapter = new MySqlDataAdapter(selectPQOrderLine, connection);
            adapter.Fill(reicpomsds, "pq_order_line_t");

            connection.Close();

            //---INSTANTIATE CRYSTAL REPORT
            PQ_Printout_IFOSupplier pq = new PQ_Printout_IFOSupplier();

            pq.Load();
            pq.SetDataSource(reicpomsds);
            string fileName = "C:\\REIC Files\\Price Quotations\\PQ " + PQNo + ".pdf";

            if (FirstTime == true)
            {
                pq.ExportToDisk(ExportFormatType.PortableDocFormat, fileName);
                MessageBox.Show("A PDF file of this Price Quotation can be found in \nC:\\REIC Files\\Price Quotations.");
            }
            CrystalReportViewer.ReportSource = pq;
        }
        private void SPR_RFQCompleted_PrintScreen_Load(object sender, EventArgs e)
        {
            //---MYSQL CONNECTION
            connection = new MySqlConnection(ConnectionStringManager.reicpomsConnection.ConnectionString);
            connection.Open();

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

            //Data from RFQ Suppliers
            string selectAllSuppliers = string.Format("SELECT DISTINCT supplier_t.* " +
                                                      "FROM supplier_t, rfq_t " +
                                                      "WHERE pq_no IS NOT NULL " +
                                                      "AND rfq_t.supplier_id = supplier_t.supplier_id " +
                                                      "ORDER BY rfq_no DESC;");

            adapter = new MySqlDataAdapter(selectAllSuppliers, connection);
            adapter.Fill(reicpomsds, "supplier_t");

            //Data from RFQ Customers
            string selectAllCustomers = string.Format("SELECT DISTINCT customer_t.* " +
                                                      "FROM customer_t, rfq_t " +
                                                      "WHERE pq_no IS NOT NULL " +
                                                      "AND rfq_t.customer_id = customer_t.customer_id " +
                                                      "ORDER BY rfq_no DESC;");

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

            //Data from rfq_t
            string selectPendingRFQ = "SELECT * FROM rfq_t WHERE pq_no IS NOT NULL ORDER BY rfq_no DESC;";

            adapter = new MySqlDataAdapter(selectPendingRFQ, connection);
            adapter.Fill(reicpomsds, "rfq_t");

            connection.Close();

            //---INSTANTIATE CRYSTAL REPORT
            SPR_RFQCompleted rfqc = new SPR_RFQCompleted();

            rfqc.Load();
            rfqc.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\\Requests for Price Quotation - Completed\\Completed RFQ (" + currentDateTime + ").pdf";

            rfqc.ExportToDisk(ExportFormatType.PortableDocFormat, filePath);

            MessageBox.Show("A PDF file of this report on completed requests for price quotation can be found in C:\\REIC Files\\Sales Performance Report & Summary\\\nRequests for Price Quotation - Completed.");
            CrystalReportViewer.ReportSource = rfqc; //Display SPR_RFQPending.rpt in the print preview
        }
Пример #3
0
        private void SPR_POPending_PrintScreen_Load(object sender, EventArgs e)
        {
            //---MYSQL CONNECTION
            connection = new MySqlConnection(ConnectionStringManager.reicpomsConnection.ConnectionString);
            connection.Open();

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

            //Data from PO Suppliers
            string selectPOSuppliers = string.Format("SELECT DISTINCT supplier_t.* " +
                                                     "FROM supplier_t, po_t " +
                                                     "WHERE so_no IS NULL " +
                                                     "AND po_t.supplier_id = supplier_t.supplier_id " +
                                                     "ORDER BY po_no DESC;");

            adapter = new MySqlDataAdapter(selectPOSuppliers, connection);
            adapter.Fill(reicpomsds, "supplier_t");

            //Data from PO Customers
            string selectPOCustomers = string.Format("SELECT DISTINCT customer_t.* " +
                                                     "FROM customer_t, po_t " +
                                                     "WHERE so_no IS NULL " +
                                                     "AND po_t.customer_id = customer_t.customer_id " +
                                                     "ORDER BY po_no DESC;");

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

            //Data from po_t
            string selectPendingPO = "SELECT * FROM po_t WHERE so_no IS NULL ORDER BY po_no DESC;";

            adapter = new MySqlDataAdapter(selectPendingPO, connection);
            adapter.Fill(reicpomsds, "po_t");

            connection.Close();

            //---INSTANTIATE CRYSTAL REPORT
            SPR_POPending pop = new SPR_POPending();

            pop.Load();
            pop.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\\Purchase Orders - Pending\\Pending PO (" + currentDateTime + ").pdf";

            pop.ExportToDisk(ExportFormatType.PortableDocFormat, filePath);

            MessageBox.Show("A PDF file of this report on pending purchase orders can be found in \nC:\\REIC Files\\Sales Performance Report & Summary\\Purchase Orders - Pending.");
            CrystalReportViewer.ReportSource = pop;
        }
Пример #4
0
        private void SPR_PQCompleted_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 (Need the DISTINCT, else will result to ConstraintException)
            string selectPQCustomers = string.Format("SELECT DISTINCT customer_t.* " +
                                                     "FROM customer_t, pq_t, po_t " +
                                                     "WHERE pq_t.pq_no NOT IN (" +
                                                     "SELECT po_t.pq_no " +
                                                     "FROM 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 selectPendingPQ = string.Format("SELECT DISTINCT pq_t.* " +
                                                   "FROM pq_t, po_t " +
                                                   "WHERE pq_t.pq_no NOT IN(" +
                                                   "SELECT po_t.pq_no " +
                                                   "FROM po_t " +
                                                   "WHERE pq_t.pq_no = po_t.pq_no) " +
                                                   "ORDER BY pq_t.pq_no DESC;");

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

            connection.Close();

            //---INSTANTIATE CRYSTAL REPORT
            SPR_PQPending pqp = new SPR_PQPending();

            pqp.Load();
            pqp.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 - Pending\\Pending PQ (" + currentDateTime + ").pdf";

            pqp.ExportToDisk(ExportFormatType.PortableDocFormat, filePath);

            MessageBox.Show("A PDF file of this report on pending price quotations can be found in \nC:\\REIC Files\\Sales Performance Report & Summary\\Price Quotations - Pending.");
            CrystalReportViewer.ReportSource = pqp;
        }
Пример #5
0
        private void PO_PrintScreen_Load(object sender, EventArgs e)
        { //When screen loads, details of the RFQ Printout should already be displayed.
            //---MYSQL CONNECTION
            connection = new MySqlConnection(ConnectionStringManager.reicpomsConnection.ConnectionString);
            connection.Open();

            //DEBUG MESSAGES
            if (connection.State == System.Data.ConnectionState.Open)
            {
                MessageBox.Show("Crystal Report: Connection to SQL successful!");
            }
            else
            {
                MessageBox.Show("Crystal Report: Connection to SQL failed!");
            }

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

            //Data from supplier_t
            string selectRFQSupplier = string.Format("SELECT supplier_t.supplier_id, supplier_name, contact_person, contact_number, email_address, address " +
                                                     "FROM po_t, supplier_t " +
                                                     "WHERE po_t = '{0}' " +
                                                     "AND po_t.supplier_id = supplier_t.supplier_id;", PONo);

            adapter = new MySqlDataAdapter(selectRFQSupplier, connection);
            adapter.Fill(reicpomsds, "supplier_t");

            //Data from po_order_line_t, inserted into item_t
            string selectPOOrderLineItems = string.Format("SELECT item_t.part_number, item_name, item_description, supplier_unit_price, mark_up_percentage, reic_unit_price, minimum_order_quantity, unit_of_measurement, from_date, to_date, supplier_id " +
                                                          "FROM po_order_line_t, item_t " +
                                                          "WHERE po_no = '{0}' " +
                                                          "AND po_order_line_t.part_number = item_t.part_number;", PONo);

            adapter = new MySqlDataAdapter(selectPOOrderLineItems, connection);
            adapter.Fill(reicpomsds, "item_t");

            //Data from po_t
            string selectPO = string.Format("SELECT * FROM po_t WHERE po_no='{0}';", PONo);

            adapter = new MySqlDataAdapter(selectPO, connection);
            adapter.Fill(reicpomsds, "po_t");

            //Data from po_order_line_t
            string selectPOOrderLine = string.Format("SELECT * FROM po_order_line_t WHERE po_no='{0}';", PONo);

            adapter = new MySqlDataAdapter(selectPOOrderLine, connection);
            adapter.Fill(reicpomsds, "po_order_line_t");

            connection.Close();

            //---INSTANTIATE CRYSTAL REPORT
            POPrintout po = new POPrintout();

            po.Load();
            po.SetDataSource(reicpomsds); //Added a code snippet in app.config file. If else, will result to a System.IOFileNotFoundException error.
            string fileName = "C:\\REIC Files\\Purchase Orders\\PO " + PONo + ".pdf";

            if (FirstTime == true)
            {
                po.ExportToDisk(ExportFormatType.PortableDocFormat, fileName);
                MessageBox.Show("A PDF file of this Purchase Order can be found in \nC:\\REIC Files\\Purchase Orders.");
            }
            CrystalReportViewer.ReportSource = po; //Display POPrintout.rpt in the print preview
        }
Пример #6
0
        private void RFQ_PrintScreen_Load(object sender, EventArgs e)
        { //When screen loads, details of the RFQ Printout should already be displayed.
            //---MYSQL CONNECTION
            connection = new MySqlConnection(ConnectionStringManager.reicpomsConnection.ConnectionString);
            connection.Open();

            //---SELECT Statements
            //Why I didn't use MySQLDatabaseDriver: MySqlDataAdapter needs the select statement strings as one of its parameters (MySqlDataAdapter needed to fill the datasets)

            reicpomsds = new reicpomsDataSet();

            //Data from supplier_t (RFQ's Supplier)
            string selectRFQSupplier = string.Format("SELECT supplier_t.* " +
                                                     "FROM rfq_t, supplier_t " +
                                                     "WHERE rfq_no = '{0}' " +
                                                     "AND rfq_t.supplier_id = supplier_t.supplier_id;", rfqNo);

            adapter = new MySqlDataAdapter(selectRFQSupplier, connection);
            adapter.Fill(reicpomsds, "supplier_t_rfq");

            //Further data from supplier_t (Supplier of all the items in the RFQ OrderLine | For some reason, if an item's supplier changes, the item won't appear in the RFQ anymore)
            string selectAllItemSupplier = string.Format("SELECT DISTINCT supplier_t.* " +
                                                         "FROM rfq_order_line_t, item_t, supplier_t " +
                                                         "WHERE rfq_no = '{0}' " +
                                                         "AND rfq_order_line_t.part_number = item_t.part_number " +
                                                         "AND item_t.supplier_id = supplier_t.supplier_id;", rfqNo);

            adapter = new MySqlDataAdapter(selectAllItemSupplier, connection);
            adapter.Fill(reicpomsds, "supplier_t");

            //Data from rfq_order_line_t, inserted into item_t
            string selectRFQOrderLineItems = string.Format(//"SELECT item_t.part_number, item_name, item_description, supplier_unit_price, mark_up_percentage, reic_unit_price, minimum_order_quantity, unit_of_measurement, from_date, to_date, supplier_id " +
                "SELECT item_t.*" +
                "FROM rfq_order_line_t, item_t " +
                "WHERE rfq_no = '{0}' " +
                "AND rfq_order_line_t.part_number = item_t.part_number;", rfqNo);

            //Will use only item_name, item_description, unit_of_measurement
            adapter = new MySqlDataAdapter(selectRFQOrderLineItems, connection);
            adapter.Fill(reicpomsds, "item_t"); //Inserted into item_t, since it's where item_name, item_description, and unit_of_measurement can be found

            //Data from rfq_t
            string selectRFQ = string.Format("SELECT * FROM rfq_t WHERE rfq_no='{0}';", rfqNo);

            adapter = new MySqlDataAdapter(selectRFQ, connection);
            adapter.Fill(reicpomsds, "rfq_t");

            //Data from rfq_order_line_t
            string selectRFQOrderLine = string.Format("SELECT * FROM rfq_order_line_t WHERE rfq_no='{0}';", rfqNo);

            adapter = new MySqlDataAdapter(selectRFQOrderLine, connection);
            adapter.Fill(reicpomsds, "rfq_order_line_t");

            connection.Close();

            //---INSTANTIATE CRYSTAL REPORT
            RFQ_Printout rfq = new RFQ_Printout();

            rfq.Load();
            rfq.SetDataSource(reicpomsds); //Added a code snippet in app.config file. If else, will result to a System.IOFileNotFoundException error.
            string fileName = "C:\\REIC Files\\Requests for Price Quotation\\RFQ " + RFQNo + ".pdf";

            if (FirstTime == true)
            {
                rfq.ExportToDisk(ExportFormatType.PortableDocFormat, fileName);
                MessageBox.Show("A PDF file of this Request for Price Quotation can be found in \nC:\\REIC Files\\Requests for Price Quotation.");
            }
            CrystalReportViewer.ReportSource = rfq; //Display RFQPrintout.rpt in the print preview
        }