public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            DivisionAmalgamationRPT rpt = new DivisionAmalgamationRPT();

            rpt.Site = this.Site;
            return(rpt);
        }
예제 #2
0
        private void cmdDisplay_Click(object sender, EventArgs e)
        {
            try
            {
                String strDivision = "";

                if (chkActiveDiv.Checked)
                {
                    strDivision   = cmbDivision.SelectedValue.ToString();
                    dataSetReport = myReports.getDivisionAmalgamation(Convert.ToInt32(cmbYear.Text), Convert.ToInt32(cmbMonth.SelectedValue.ToString()), strDivision.ToString());
                    dataSetReport.WriteXml("DivisionAmalgamation.xml");
                }
                else
                {
                    strDivision   = "";
                    dataSetReport = myReports.getDivisionAmalgamation(Convert.ToInt32(cmbYear.Text), Convert.ToInt32(cmbMonth.SelectedValue.ToString()));
                    dataSetReport.WriteXml("DivisionAmalgamation.xml");
                }

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

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

                //    if (dataSetReport.Tables[0].Rows.Count > 0)
                //    {
                //        DivisionAmalgamationRPT myaclist = new DivisionAmalgamationRPT();
                //        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 Category of : " + cmbEmployeeCategory.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);
            }


            //}
            //else
            //{
            //    if (chkAllCategory.Checked == true)
            //    {
            //        dataSetReport = myReports.getDivisionAmalgamation(cmbDivision.SelectedValue.ToString(), Convert.ToInt32(cmbYear.Text), Convert.ToInt32(cmbMonth.SelectedValue.ToString()));
            //        dataSetReport.WriteXml("DivisionAmalgamation.xml");
            //        DivisionAmalgamationRPT myaclist = new DivisionAmalgamationRPT();
            //        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 Categories and Division : " + cmbDivision.Text + " for the Month of : " + cmbMonth.Text + "/" + cmbYear.Text);
            //        myReportViewer.crystalReportViewer1.ReportSource = myaclist;
            //        myReportViewer.Show();
            //    }
            //    else
            //    {
            //        dataSetReport = myReports.getDivisionAmalgamation(cmbDivision.SelectedValue.ToString(), Convert.ToInt32(cmbYear.Text), Convert.ToInt32(cmbMonth.SelectedValue.ToString()), cmbEmployeeCategory.SelectedValue.ToString());
            //        dataSetReport.WriteXml("DivisionAmalgamation.xml");
            //        DivisionAmalgamationRPT myaclist = new DivisionAmalgamationRPT();
            //        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 + " and Category : " + cmbEmployeeCategory.Text + " for the Month of : " + cmbMonth.Text + "/" + cmbYear.Text);
            //        myReportViewer.crystalReportViewer1.ReportSource = myaclist;
            //        myReportViewer.Show();
            //    }
            //}
        }