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

            rpt.Site = this.Site;
            return(rpt);
        }
        private void btnDisplay_Click(object sender, EventArgs e)
        {
            String AllCat = "%";

            if (chkAllCat.Checked)
            {
                AllCat = "%";
            }
            else
            {
                AllCat = cmbEmpCat.SelectedValue.ToString();
            }
            DataSet dataSetReport = new DataSet();

            myRepotrs.StrDivisionID = cmbDivision.SelectedValue.ToString();
            myRepotrs.IntMonth      = Convert.ToInt32(cmbMonth.SelectedValue.ToString());
            myRepotrs.IntYear       = Convert.ToInt32(cmbYear.SelectedValue.ToString());

            dataSetReport = myRepotrs.EmployeeNetPay(AllCat);
            dataSetReport.WriteXml("EmployeeNetpayRPT.xml");

            if (dataSetReport.Tables[0].Rows.Count > 0)
            {
                if (ChkSettings.IsNetPayWithGrossEarnings())
                {
                    EmployeeNetPayWithGrossPayRPT myEmployeeNetpayRPT = new EmployeeNetPayWithGrossPayRPT();
                    myEmployeeNetpayRPT.SetDataSource(dataSetReport);
                    myEmployeeNetpayRPT.SetParameterValue("Estate", "Estate :" + EstDivBlock.GetClusterName(mydiv.ListEstate().Rows[0][0].ToString(), cmbDivision.SelectedValue.ToString()));
                    ReportViewer myReportViewer = new ReportViewer();
                    myReportViewer.crystalReportViewer1.ReportSource = myEmployeeNetpayRPT;
                    myReportViewer.Show();
                }
                else
                {
                    EmployeeNetpayRPT myEmployeeNetpayRPT = new EmployeeNetpayRPT();
                    myEmployeeNetpayRPT.SetDataSource(dataSetReport);
                    myEmployeeNetpayRPT.SetParameterValue("Estate", "Estate :" + EstDivBlock.GetClusterName(mydiv.ListEstate().Rows[0][0].ToString(), cmbDivision.SelectedValue.ToString()));
                    ReportViewer myReportViewer = new ReportViewer();
                    myReportViewer.crystalReportViewer1.ReportSource = myEmployeeNetpayRPT;
                    myReportViewer.Show();
                }
            }
            else
            {
                MessageBox.Show("No Data to Preview..!");
            }
        }