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); SummaryReport oRpt1 = new SummaryReport(); 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 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(); * Customer oCustomer = new Customer(); * Brochure oBrochure = new Brochure(Global.CurrrentCompany); * foreach (DataRow row in ds1.Tables["Summary"].Rows) * { * if (oCustomer.Find(row["CustomerID"].ToString())) * { * if (oBrochure.Find(oCustomer.BrochureID)) * { * row["BrochureID"] = oCustomer.BrochureID; * row["Description"] = oBrochure.Description; * } * if (oBrochure.Find(oCustomer.BrochureID_2)) * { * row["BrochureID_2"] = oCustomer.BrochureID_2; * row["Description_2"] = oBrochure.Description; * } * } * } * * 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 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(); }