private void frmViewTeacher_Load(object sender, System.EventArgs e)
        {
            Signature.Data.MySQL oMySql = Global.oMySql;

            //MessageBox.Show("Select distinct(BatchID), NumberImages, StartDate, EndDate, StartImage, EndImage, Processed  from scanned_images Where CompanyID='" + sCompanyID + "' And CustomerID='" + this.sCustomerID + "' And CustomerID='" + this._Teacher + "' Group by BatchID");

            dt = oMySql.GetDataView("Select distinct(BatchID), Teacher, NumberImages, StartDate, EndDate, StartImage, EndImage, Processed  from scanned_images Where CompanyID='" + sCompanyID + "' And CustomerID='" + this.sCustomerID + "'  Group by BatchID", "Batches");


            //cboTraineeFields.Items.Insert(0, "Teacher");
            //cboTraineeFields.Items.Insert(1, "Students");

            //cboTraineeFields.SelectedIndex = 0;

            //
            DataGridTableStyle TbStyle = new DataGridTableStyle();

            TbStyle.MappingName          = "Bactches";
            TbStyle.RowHeadersVisible    = false;
            TbStyle.GridLineColor        = System.Drawing.Color.Black;
            TbStyle.AllowSorting         = false;
            TbStyle.AlternatingBackColor = System.Drawing.Color.AliceBlue;

            DataGridTextBoxColumn Col_01 = new DataGridTextBoxColumn();

            Col_01.HeaderText  = "Batch Number";
            Col_01.MappingName = "BatchID";
            Col_01.Width       = 150;
            Col_01.NullText    = "";
            Col_01.ReadOnly    = true;

            DataGridTextBoxColumn Col_02 = new DataGridTextBoxColumn();

            Col_02.HeaderText  = "Number of Images";
            Col_02.MappingName = "NumberImages";
            Col_02.Width       = 80;
            Col_02.NullText    = "";
            Col_02.ReadOnly    = true;

            TbStyle.GridColumnStyles.AddRange(new DataGridColumnStyle[] { Col_01, Col_02 });
            DataGrid.TableStyles.Add(TbStyle);

            DataGrid.DataSource = dt;
            DataGrid.Focus();
//			oMySql.Close();
        }
        private void view_report(int nReport, String sCompany, String sCustomerID, bool nView)
        {
            DataSet ds1;

            Signature.Data.MySQL oMySql = new Signature.Data.MySQL();              // Sql Open

            switch (nReport)
            {
            case 1:
                ds1 = oMySql.get_summary_by_classes(sCompany, sCustomerID);
                summary_by_classes oRpt2 = new summary_by_classes();
                oRpt2.SetDataSource(ds1);
                if (nView)
                {
                    cReport.ReportSource = oRpt2;
                    this.Text            = "Summary by Classes";
                    this.Show();
                }
                else
                {
                    oRpt2.PrintToPrinter(1, true, 1, 100);
                }

                break;

            case 2:

                ds1 = oMySql.get_ranking_by_student(sCompany, sCustomerID, this.Selection);
                ranking_by_student oRpt1 = new ranking_by_student();
                oRpt1.SetDataSource(ds1);
                if (nView)
                {
                    cReport.ReportSource = oRpt1;
                    this.Text            = "Ranking by Student";
                    this.Show();
                }
                else
                {
                    oRpt1.PrintToPrinter(1, true, 1, 100);
                }

                break;

            case 3:
                ds1 = oMySql.get_summary_of_products_by_brochure(sCompany, sCustomerID);
                summary_of_products_by_brochure oRpt3 = new summary_of_products_by_brochure();
                oRpt3.SetDataSource(ds1);
                if (nView)
                {
                    cReport.ReportSource = oRpt3;
                    this.Text            = "Summary of Products by Brochure";
                    this.Show();
                }
                else
                {
                    oRpt3.PrintToPrinter(1, true, 1, 100);
                }
                break;

            case 4:
                ds1 = oMySql.get_detail_by_student_by_class(sCompany, sCustomerID);
                detail_by_student_by_class oRpt4 = new detail_by_student_by_class();
                oRpt4.SetDataSource(ds1);
                if (nView)
                {
                    cReport.ReportSource = oRpt4;
                    this.Text            = "Detail by Student by Class";
                    this.Show();
                }
                else
                {
                    oRpt4.PrintToPrinter(1, true, 1, 100);
                }
                break;

            case 5:
                ds1 = oMySql.get_detail_by_student(sCompany, sCustomerID);
                detail_by_student oRpt5 = new detail_by_student();
                oRpt5.SetDataSource(ds1);
                if (nView)
                {
                    cReport.ReportSource = oRpt5;
                    this.Text            = "Order Detail by Student";
                    this.Show();
                }
                else
                {
                    oRpt5.PrintToPrinter(1, true, 1, 100);
                }
                break;

            case 6:
                ds1 = oMySql.get_prize_summary_by_student_by_class(sCompany, sCustomerID);
                prize_summary_by_student_by_class oRpt6 = new prize_summary_by_student_by_class();
                oRpt6.SetDataSource(ds1);
                if (nView)
                {
                    cReport.ReportSource = oRpt6;
                    this.Text            = "Prize Summary by Student by Class";
                    this.Show();
                }
                else
                {
                    oRpt6.PrintToPrinter(1, true, 1, 100);
                }
                break;

            case 7:
                ds1 = oMySql.get_summary_reps_sales(sCompany);
                if (ds1 == null)
                {
                    MessageBox.Show("BAD");
                }
                summary_reps_sales oRpt7 = new summary_reps_sales();
                oRpt7.SetDataSource(ds1);
                //ds1.WriteXml("..\\Reports\\dataset14.xml", XmlWriteMode.WriteSchema);
                if (nView)
                {
                    this.Text            = "Summary Rep Sales";
                    cReport.ReportSource = oRpt7;
                    this.Show();
                }
                else
                {
                    oRpt7.PrintToPrinter(1, true, 1, 100);
                }
                break;

            case 8:
            {
                ds1 = oMySql.GetDataSetGAProducByBox(sCompany, sCustomerID);
                if (ds1 == null)
                {
                    MessageBox.Show("Please check the database");
                }
                GAInventoryBox oRpt = new GAInventoryBox();
                oRpt.SetDataSource(ds1);
                ds1.WriteXml("dataset00.xml", XmlWriteMode.WriteSchema);
                if (nView)
                {
                    this.Text            = "Box Inventory";
                    cReport.ReportSource = oRpt;
                    this.Show();
                }
                else
                {
                    oRpt.PrintToPrinter(1, true, 1, 100);
                }
            }
            break;

            case 9:
            {
                ds1 = oMySql.GetDataSetGAByBox(sCompany, sCustomerID);
                if (ds1 == null)
                {
                    MessageBox.Show("Please check the database");
                }
                FinalBillTally oRpt = new FinalBillTally();
                oRpt.SetDataSource(ds1);
                ds1.WriteXml("dataset19.xml", XmlWriteMode.WriteSchema);
                if (nView)
                {
                    this.Text            = "Final Bill Tally Sheet";
                    cReport.ReportSource = oRpt;
                    this.Show();
                }
                else
                {
                    oRpt.PrintToPrinter(1, true, 1, 100);
                }
            }
            break;

            case 10:
            {
                ds1 = oMySql.GetDiscrepancyLetters(sCompany, sCustomerID);
                if (ds1 == null)
                {
                    MessageBox.Show("Please check the database");
                }
                DiscrepancyList oRpt = new DiscrepancyList();
                //ds1.WriteXml("dataset22.xml", XmlWriteMode.WriteSchema);
                oRpt.SetDataSource(ds1);

                if (nView)
                {
                    this.Text            = "Discrepancy List";
                    cReport.ReportSource = oRpt;
                    this.Show();
                }
                else
                {
                    oRpt.PrintToPrinter(1, true, 1, 100);
                }
            }
            break;

            case 11:
            {
                ds1 = oMySql.GetCustomerPallets(sCompany, sCustomerID, Parameter_1);
                if (ds1 == null)
                {
                    MessageBox.Show("Please check the database");
                }
                PalletLabels oRpt = new PalletLabels();

                //ds1.WriteXml("dataset25.xml", XmlWriteMode.WriteSchema);

                /*ParameterField ParamField = new ParameterField();
                 * ParameterDiscreteValue DiscreteVal = new ParameterDiscreteValue();
                 *
                 * DiscreteVal.Value = "5";
                 * ParamField.CurrentValues.Add(DiscreteVal);
                 *
                 * //' Add the parameter to the parameter fields collection.
                 * oRpt.ParameterFields.Add(ParamField);*/

                /* ParameterFieldDefinitions crParameterFieldDefinitions;
                 * ParameterFieldDefinition crParameterFieldDefinition;
                 * ParameterDiscreteValue crParameterDiscreteValue;
                 * ParameterValues crParameterValues;
                 *
                 * crParameterFieldDefinitions = oRpt.DataDefinition.ParameterFields;
                 * //Access the specified parameter from the collection
                 *
                 *
                 *
                 * crParameterFieldDefinition = crParameterFieldDefinitions["BoxNumber"];
                 * crParameterValues = crParameterFieldDefinition.CurrentValues;
                 * crParameterDiscreteValue = null;
                 *
                 * crParameterDiscreteValue = new ParameterDiscreteValue();
                 * crParameterDiscreteValue.Value = "3"; //2nd current value
                 *
                 * //Add the second current value for the parameter field
                 * crParameterValues.Add(crParameterDiscreteValue);
                 *
                 * //All current parameter values must be applied for the parameter field.
                 * crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);
                 *
                 *
                 * oRpt.SetParameterValue(0,Parameter_1);
                 *
                 */


                oRpt.SetDataSource(ds1);

                if (nView)
                {
                    this.Text            = "Pallet Labels";
                    cReport.ReportSource = oRpt;
                    this.Show();
                }
                else
                {
                    oRpt.PrintToPrinter(1, true, 1, 100);
                }
            }
            break;

            case 12:
            {
                ds1 = oMySql.GetCustomerStatement(sCompany, sCustomerID);
                if (ds1 == null)
                {
                    MessageBox.Show("Please check the database");
                }
                Statement oRpt = new Statement();
                ds1.WriteXml("dataset26.xml", XmlWriteMode.WriteSchema);
                oRpt.SetDataSource(ds1);

                if (nView)
                {
                    this.Text            = "Statement";
                    cReport.ReportSource = oRpt;
                    this.Show();
                }
                else
                {
                    oRpt.PrintToPrinter(1, true, 1, 100);
                }
            }
            break;

            case 13:
            {
                ds1 = oMySql.GetDiscrepancyLetters(sCompany, sCustomerID);
                if (ds1 == null)
                {
                    MessageBox.Show("Please check the database");
                }
                DiscrepancyLetters oRpt = new DiscrepancyLetters();
                //ds1.WriteXml("dataset27.xml", XmlWriteMode.WriteSchema);
                oRpt.SetDataSource(ds1);

                if (nView)
                {
                    this.Text            = "Discrepancy Letters";
                    cReport.ReportSource = oRpt;
                    this.Show();
                }
                else
                {
                    oRpt.PrintToPrinter(1, true, 1, 100);
                }
            }
            break;

            case 14:
            {
                ds1 = oMySql.GetPOReceive(sCompany, sParameter_1);
                if (ds1 == null)
                {
                    MessageBox.Show("Please check the database");
                }
                ds1.WriteXml("dataset29.xml", XmlWriteMode.WriteSchema);
                POReceive oRpt = new POReceive();

                oRpt.SetDataSource(ds1);

                if (nView)
                {
                    this.Text            = "PO Receive";
                    cReport.ReportSource = oRpt;
                    this.Show();
                }
                else
                {
                    oRpt.PrintToPrinter(1, true, 1, 100);
                }
            }
            break;

            case 15:
            {
                ds1 = oMySql.GetPOReceive(sCompany, sParameter_1);
                if (ds1 == null)
                {
                    MessageBox.Show("Please check the database");
                }
                ds1.WriteXml("dataset29.xml", XmlWriteMode.WriteSchema);
                POReceive oRpt = new POReceive();

                oRpt.SetDataSource(ds1);

                if (nView)
                {
                    this.Text            = "PO Receive";
                    cReport.ReportSource = oRpt;
                    this.Show();
                }
                else
                {
                    oRpt.PrintToPrinter(1, true, 1, 100);
                }
            }
            break;

            default:
                break;
            }
            //oMySql.Close();
        }