示例#1
0
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            MusterChitSummaryRPT rpt = new MusterChitSummaryRPT();

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

            if (chkDivision.Checked)
            {
                strAllDivision = "%";
            }
            else
            {
                strAllDivision = cmbDivision.SelectedValue.ToString();
            }
            dataSetReport = objMuster.GetMusterSummary(dtpFromDate.Value.Date, dtpToDate.Value.Date, strAllDivision);
            dataSetReport.WriteXml("MusterSummary.xml");

            if (dataSetReport.Tables[0].Rows.Count > 0)
            {
                MusterChitSummaryRPT rptObj = new MusterChitSummaryRPT();
                rptObj.SetDataSource(dataSetReport);
                ReportViewer myReportViewer = new ReportViewer();
                rptObj.SetParameterValue("Estate", myEstate.ListEstates().Rows[0][0].ToString());
                rptObj.SetParameterValue("Period", "From:" + dtpFromDate.Value.Date.ToShortDateString() + " To: " + dtpToDate.Value.Date.ToShortDateString());
                rptObj.SetParameterValue("Company Name", FTSPayRollBL.Company.getCompanyName());
                rptObj.SetParameterValue("Division", "Division : " + cmbDivision.Text.ToString());


                //if (intworktyp == 1)
                //{
                //    myaclist.SetParameterValue("WorkType", "Work Type : Normal Work");

                //}
                //else
                //{
                //    myaclist.SetParameterValue("WorkType", "Work Type : Cash Work");
                //}
                myReportViewer.crystalReportViewer1.ReportSource = rptObj;
                myReportViewer.Show();
            }
            else
            {
                MessageBox.Show("No Data to Preview..!");
            }
        }