예제 #1
0
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            ETF6MonthReportAll rpt = new ETF6MonthReportAll();

            rpt.Site = this.Site;
            return(rpt);
        }
        private void button2_Click(object sender, EventArgs e)
        {
            try
            {
                if (String.IsNullOrEmpty(cmbMonth.Text))
                {
                    MessageBox.Show("Select A Time Period.");
                }
                else
                {
                    Int32  intChkAll = 0;
                    Int32  intPeriod = 1;
                    String StrAllDiv = "%";
                    if (cmbMonth.Text.Equals("Jan-Jun"))
                    {
                        intPeriod = 1;
                    }
                    else
                    {
                        intPeriod = 2;
                    }

                    if (chkAll.Checked)
                    {
                        intChkAll = 1;
                    }
                    if (chkAllDiv.Checked)
                    {
                        StrAllDiv = "%";
                    }
                    else
                    {
                        StrAllDiv = cmbDivision.SelectedValue.ToString();
                    }

                    DataSet dataSetReport = new DataSet();

                    dataSetReport = myReports.getETF6Month(Convert.ToInt32(cmbYear.Text), intPeriod, intChkAll, StrAllDiv);
                    dataSetReport.WriteXml("ETF6MonthReport.xml");
                    if (intChkAll == 1)
                    {
                        ETF6MonthReportAll myEPFRep = new ETF6MonthReportAll();
                        myEPFRep.SetDataSource(dataSetReport);
                        ReportViewer myReportViewer = new ReportViewer();
                        myEPFRep.SetParameterValue("Estate", "Employer's Registration No : 269/S ");
                        myEPFRep.SetParameterValue("Period", "Return for the period January to June  2012");
                        myReportViewer.crystalReportViewer1.ReportSource = myEPFRep;
                        myReportViewer.Show();
                    }
                    else
                    {
                        ETF6MonthReport myEPFRep = new ETF6MonthReport();
                        myEPFRep.SetDataSource(dataSetReport);
                        ReportViewer myReportViewer = new ReportViewer();
                        myEPFRep.SetParameterValue("Estate", "Employer's Registration No : 269/S ");
                        myEPFRep.SetParameterValue("Period", "Return for the period January to June  2012");
                        myReportViewer.crystalReportViewer1.ReportSource = myEPFRep;
                        myReportViewer.Show();
                    }
                }
            }
            catch (Exception ex)
            { }
        }