Exemple #1
0
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            rptSalaryList rpt = new rptSalaryList();

            rpt.Site = this.Site;
            return(rpt);
        }
Exemple #2
0
        private void btnGenerate_Click(object sender, EventArgs e)
        {
            if (rdbAttendance.Checked)
            {
                try
                {
                    rptAttendance AttendanceReport = new rptAttendance();
                    dsReport      ds = new dsReport();
                    dsReportTableAdapters.vAttendanceListTableAdapter taEmployee = new dsReportTableAdapters.vAttendanceListTableAdapter();
                    if (cmbEmployee.SelectedIndex == -1)
                    {
                        taEmployee.Fill(ds.vAttendanceList, 0, dtpStart.Text, dtpEnd.Text);
                    }
                    else
                    {
                        taEmployee.Fill(ds.vAttendanceList, Convert.ToInt32(cmbEmployee.SelectedValue), dtpStart.Text, dtpEnd.Text);
                    }

                    AttendanceReport.SetDataSource(ds);
                    Cursor = Cursors.WaitCursor;
                    this.crystalReportViewer1.ReportSource = AttendanceReport;
                    this.crystalReportViewer1.RefreshReport();
                    Cursor = Cursors.Default;
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
            else
            {
                try
                {
                    rptSalaryList SalaryReport = new rptSalaryList();
                    dsReport      ds           = new dsReport();
                    dsReportTableAdapters.rSalaryListTableAdapter taSalary = new dsReportTableAdapters.rSalaryListTableAdapter();
                    if (cmbEmployee.SelectedIndex == -1)
                    {
                        taSalary.Fill(ds.rSalaryList, dtpStart.Text, dtpEnd.Text, 0);
                    }
                    else
                    {
                        taSalary.Fill(ds.rSalaryList, dtpStart.Text, dtpEnd.Text, Convert.ToInt32(cmbEmployee.SelectedValue));
                    }
                    SalaryReport.SetDataSource(ds);
                    Cursor = Cursors.WaitCursor;
                    this.crystalReportViewer1.ReportSource = SalaryReport;
                    this.crystalReportViewer1.RefreshReport();
                    Cursor = Cursors.Default;
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
        }