public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { EmployeeWorkAttendanceRPT rpt = new EmployeeWorkAttendanceRPT(); rpt.Site = this.Site; return(rpt); }
private void btnDisplay_Click(object sender, EventArgs e) { DataSet ds = new DataSet(); Int32 IntWorkType; if (ChkAll.Checked) { if (rbtNormal.Checked) { IntWorkType = 1; ds = myReports.GetEmpWorkAttandance(Convert.ToInt32(cmbYear.Text), Convert.ToInt32(cmbMonth.SelectedValue.ToString()), Convert.ToInt32(IntWorkType)); } else { IntWorkType = 2; ds = myReports.GetEmpWorkAttandance(Convert.ToInt32(cmbYear.Text), Convert.ToInt32(cmbMonth.SelectedValue.ToString()), Convert.ToInt32(IntWorkType)); } } else { if (rbtNormal.Checked) { IntWorkType = 1; ds = myReports.GetEmpWorkAttandance(cmbDivision.SelectedValue.ToString(), Convert.ToInt32(cmbYear.Text), Convert.ToInt32(cmbMonth.SelectedValue.ToString()), Convert.ToInt32(IntWorkType)); } else { IntWorkType = 2; ds = myReports.GetEmpWorkAttandance(cmbDivision.SelectedValue.ToString(), Convert.ToInt32(cmbYear.Text), Convert.ToInt32(cmbMonth.SelectedValue.ToString()), Convert.ToInt32(IntWorkType)); } } if (ds.Tables[0].Rows.Count > 0) { ds.WriteXml("EmployeeWorkAttendance.xml"); EmployeeWorkAttendanceRPT myWorkAtt = new EmployeeWorkAttendanceRPT(); myWorkAtt.SetDataSource(ds); myWorkAtt.SetParameterValue("Company Name", FTSPayRollBL.Company.getCompanyName()); myWorkAtt.SetParameterValue("Estate", myEstate.ListEstates().Rows[0][0].ToString()); if (ChkAll.Checked) { myWorkAtt.SetParameterValue("Options", "Division : ALL / Month:" + cmbMonth.Text + "/" + cmbYear.Text); } else { myWorkAtt.SetParameterValue("Options", "Division : " + cmbDivision.Text + " Month: " + cmbMonth.Text + "/" + cmbYear.Text); } if (IntWorkType == 1) { myWorkAtt.SetParameterValue("WorkType", "Work Type : Normal Work"); } else { myWorkAtt.SetParameterValue("WorkType", "Work Type : Cash Work"); } ReportViewer myReportViewer = new ReportViewer(); myReportViewer.crystalReportViewer1.ReportSource = myWorkAtt; myReportViewer.Show(); } else { MessageBox.Show("No Data to Preview..!"); } }