コード例 #1
0
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            GreenLeafRegisterRPT rpt = new GreenLeafRegisterRPT();

            rpt.Site = this.Site;
            return(rpt);
        }
コード例 #2
0
        private void cmdDisplay_Click(object sender, EventArgs e)
        {
            try
            {
                if (chkAllDivisions.Checked == true)
                {
                    if (chkAllCategory.Checked == true)
                    {
                        dataSetReport = myReports.getGreenLeafRegister(Convert.ToInt32(cmbYear.Text), Convert.ToInt32(cmbMonth.SelectedValue.ToString()));
                        dataSetReport.WriteXml("GreenLeafRegister.xml");

                        if (dataSetReport.Tables[0].Rows.Count > 0)
                        {
                            GreenLeafRegisterRPT myaclist = new GreenLeafRegisterRPT();
                            myaclist.SetDataSource(dataSetReport);
                            ReportViewer myReportViewer = new ReportViewer();

                            myaclist.SetParameterValue("Company Name", FTSPayRollBL.Company.getCompanyName());
                            myaclist.SetParameterValue("Estate", myDivision.ListEstate().Rows[0][1].ToString());
                            myaclist.SetParameterValue("Options", "For All Divisions for the Month of : " + cmbMonth.Text + "/" + cmbYear.Text);
                            myReportViewer.crystalReportViewer1.ReportSource = myaclist;
                            myReportViewer.Show();
                        }
                        else
                        {
                            MessageBox.Show("No data to preview..!");
                        }
                    }
                    else
                    {
                        dataSetReport = myReports.getGreenLeafRegister(Convert.ToInt32(cmbYear.Text), Convert.ToInt32(cmbMonth.SelectedValue.ToString()), cmbEmployeeCategory.SelectedValue.ToString());
                        dataSetReport.WriteXml("GreenLeafRegister.xml");

                        if (dataSetReport.Tables[0].Rows.Count > 0)
                        {
                            GreenLeafRegisterRPT myaclist = new GreenLeafRegisterRPT();
                            myaclist.SetDataSource(dataSetReport);
                            ReportViewer myReportViewer = new ReportViewer();

                            myaclist.SetParameterValue("Company Name", FTSPayRollBL.Company.getCompanyName());
                            myaclist.SetParameterValue("Estate", myDivision.ListEstate().Rows[0][1].ToString());
                            myaclist.SetParameterValue("Options", "For All Divisions and for the Month of : " + cmbMonth.Text + "/" + cmbYear.Text);
                            myReportViewer.crystalReportViewer1.ReportSource = myaclist;
                            myReportViewer.Show();
                        }
                        else
                        {
                            MessageBox.Show("No data to preview..!");
                        }
                    }
                }
                else
                {
                    if (chkAllCategory.Checked == true)
                    {
                        dataSetReport = myReports.getGreenLeafRegister(cmbDivision.SelectedValue.ToString(), Convert.ToInt32(cmbYear.Text), Convert.ToInt32(cmbMonth.SelectedValue.ToString()));
                        dataSetReport.WriteXml("GreenLeafRegister.xml");

                        if (dataSetReport.Tables[0].Rows.Count > 0)
                        {
                            GreenLeafRegisterRPT myaclist = new GreenLeafRegisterRPT();
                            myaclist.SetDataSource(dataSetReport);
                            ReportViewer myReportViewer = new ReportViewer();

                            myaclist.SetParameterValue("Company Name", FTSPayRollBL.Company.getCompanyName());
                            myaclist.SetParameterValue("Estate", myDivision.ListEstate().Rows[0][1].ToString());
                            myaclist.SetParameterValue("Options", "For Division : " + cmbDivision.Text + " for the Month of : " + cmbMonth.Text + "/" + cmbYear.Text);
                            myReportViewer.crystalReportViewer1.ReportSource = myaclist;
                            myReportViewer.Show();
                        }
                        else
                        {
                            MessageBox.Show("No data to preview..!");
                        }
                    }
                    else
                    {
                        dataSetReport = myReports.getGreenLeafRegister(cmbDivision.SelectedValue.ToString(), Convert.ToInt32(cmbYear.Text), Convert.ToInt32(cmbMonth.SelectedValue.ToString()), cmbEmployeeCategory.SelectedValue.ToString());
                        dataSetReport.WriteXml("GreenLeafRegister.xml");

                        if (dataSetReport.Tables[0].Rows.Count > 0)
                        {
                            GreenLeafRegisterRPT myaclist = new GreenLeafRegisterRPT();
                            myaclist.SetDataSource(dataSetReport);
                            ReportViewer myReportViewer = new ReportViewer();

                            myaclist.SetParameterValue("Company Name", FTSPayRollBL.Company.getCompanyName());
                            myaclist.SetParameterValue("Estate", myDivision.ListEstate().Rows[0][1].ToString());
                            myaclist.SetParameterValue("Options", "For Division : " + cmbDivision.Text + "  for the Month of : " + cmbMonth.Text + "/" + cmbYear.Text);
                            myReportViewer.crystalReportViewer1.ReportSource = myaclist;
                            myReportViewer.Show();
                        }
                        else
                        {
                            MessageBox.Show("No data to preview..!");
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }