public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { SalbyEmp rpt = new SalbyEmp(); rpt.Site = this.Site; return(rpt); }
//salary employee private void DataSet4(string qry) { DataTable table = new DataTable(); MySqlDataReader reader; table.Columns.Add("first_name", typeof(string)); table.Columns.Add("basic_sal_amount", typeof(double)); table.Columns.Add("allowance", typeof(double)); table.Columns.Add("etf_epf_amount", typeof(double)); table.Columns.Add("rate", typeof(int)); table.Columns.Add("hours", typeof(int)); table.Columns.Add("sal_date", typeof(DateTime)); table.Columns.Add("gross_sal", typeof(double)); table.Columns.Add("net_sal", typeof(double)); try { reader = DBConnection.getData(qry); if (reader.HasRows) { while (reader.Read()) { table.Rows.Add(reader.GetString("first_name"), reader.GetDouble("basic_sal_amount"), reader.GetDouble("allowance"), reader.GetDouble("etf_epf_amount"), reader.GetInt32("rate"), reader.GetInt32("hours"), reader.GetDateTime("sal_date"), reader.GetDouble("gross_sal"), reader.GetDouble("net_sal")); } } reader.Close(); OfficeExpensesForm.Reports.SalbyEmp report = new Reports.SalbyEmp(); report.Database.Tables["Sal"].SetDataSource(table); crystalReportViewer1.ReportSource = null; crystalReportViewer1.ReportSource = report; } catch (Exception exc) { MessageBox.Show(exc.ToString()); } }