public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            UserEfficiencyReport rpt = new UserEfficiencyReport();

            rpt.Site = this.Site;
            return(rpt);
        }
Exemplo n.º 2
0
        private void runquery2(string query)
        {
            MySqlDataReader reader;
            DataTable       table = new DataTable();

            table.Columns.Add("u_name", typeof(string));
            table.Columns.Add("Total_logged_in_hours", typeof(Double));
            table.Columns.Add("Total_work_hours", typeof(Double));
            table.Columns.Add("efficiency", typeof(Double));

            try
            {
                reader = Core.DBConnection.getData(query);

                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        table.Rows.Add(reader["u_name"].ToString(), Double.Parse(reader["diff"].ToString()), Double.Parse(reader["work_hour_sum"].ToString()), 100 * Double.Parse(reader["diff"].ToString()) / Double.Parse(reader["work_hour_sum"].ToString()));
                    }
                }
                reader.Close();

                UserEfficiencyReport sample = new UserEfficiencyReport();

                sample.Database.Tables["AttedanceDSet"].SetDataSource(table);

                crystalReportViewer1.ReportSource = null;
                crystalReportViewer1.ReportSource = sample;
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
            }
        }