public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { SummaryRpt rpt = new SummaryRpt(); rpt.Site = this.Site; return(rpt); }
private void glassButton1_Click(object sender, EventArgs e) { _cmd = new SqlCommand(); _cmd.Connection = frmMainForm._MasterCon; _cmd.CommandType = CommandType.StoredProcedure; _cmd.CommandText = "GET_NUM_HOURS"; _cmd.CommandTimeout = 2000; _cmd.Parameters.Add("@FROMDATE", SqlDbType.VarChar).Value = dtpDateFrom.Value.ToString("yyyy/MM/dd"); _cmd.Parameters.Add("@TODATE", SqlDbType.VarChar).Value = dtpDateTo.Value.ToString("yyyy/MM/dd"); //Str = "select CARD,NAME,JOB,Department,DATE,[Enter Time],[Exit Time],[WORK HOURS] from VTransaction_IN_OUT_FINAL " + FilterString; _da = new SqlDataAdapter(_cmd); _Dt = new DataTable(); _Dt.Reset(); _da.Fill(_Dt); ////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// frmReportViewer2 Viewer = new frmReportViewer2(); //if (_Dt.Rows.Count == 0) //{ // MessageBox.Show("Message_No_Records", "", MessageBoxButtons.OK, MessageBoxIcon.Information); // return; //} SummaryRpt Rpt = new SummaryRpt(); Rpt.Database.Tables["GET_NUM_HOURS;1"].SetDataSource(_Dt); Rpt.SetParameterValue(Rpt.Parameter_From.ParameterFieldName, dtpDateFrom.Text); Rpt.SetParameterValue(Rpt.Parameter_To.ParameterFieldName, dtpDateTo.Text); Rpt.SetParameterValue(Rpt.Parameter_FROMDATE.ParameterFieldName, dtpDateFrom.Value.ToString("yyyy/MM/dd")); Rpt.SetParameterValue(Rpt.Parameter_TODATE.ParameterFieldName, dtpDateFrom.Value.ToString("yyyy/MM/dd")); Viewer.crystalReportViewer1.ReportSource = Rpt; Viewer.ShowDialog(); }