Пример #1
0
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            DeductionSearchReportRPT rpt = new DeductionSearchReportRPT();

            rpt.Site = this.Site;
            return(rpt);
        }
        private void btnView_Click(object sender, EventArgs e)
        {
            String       strAllDiv        = "%";
            String       strAllEmp        = "%";
            String       strAllDeductCode = "%";
            String       ReportName       = "";
            ReportViewer myReportViewer   = new ReportViewer();

            if (!chkAll.Checked)
            {
                strAllDiv  = cmbDivision.SelectedValue.ToString();
                ReportName = cmbDivision.SelectedValue.ToString() + " Division -";
            }
            else
            {
                ReportName = "All Division - ";
            }
            if (!chkAllEmp.Checked)
            {
                strAllEmp   = cmbEmpNo.SelectedValue.ToString();
                ReportName += cmbEmpNo.SelectedValue.ToString() + " Employee - ";
            }
            else
            {
                ReportName += " All Employees - ";
            }

            if (!chkAllDeduction.Checked)
            {
                strAllDeductCode = cmbDeductCode.SelectedValue.ToString();
                ReportName      += cmbDeductCode.SelectedValue.ToString() + " Deduction  ";
            }
            else
            {
                ReportName += " All Deductions  ";
            }
            DataSet DsDeductSearch = new DataSet();

            DsDeductSearch = myDeducSearch.GetDeductionSearchData(strAllDiv, strAllDeductCode, strAllEmp, cmbYear.SelectedValue.ToString(), cmbMonth.SelectedValue.ToString());

            if (DsDeductSearch.Tables[0].Rows.Count > 0)
            {
                DsDeductSearch.WriteXml("DeductionSearchData.xml");

                DeductionSearchReportRPT myAllDeducAllEmp = new DeductionSearchReportRPT();
                myAllDeducAllEmp.SetDataSource(DsDeductSearch);

                myAllDeducAllEmp.SetParameterValue("CompanyName", FTSPayRollBL.Company.getCompanyName());
                myAllDeducAllEmp.SetParameterValue("Estate", "Estate :" + myEstateDiv.ListEstates().Rows[0][0].ToString());
                myAllDeducAllEmp.SetParameterValue("Division", "Division :" + cmbDivision.Text);
                myAllDeducAllEmp.SetParameterValue("Period", "For the Month of :" + cmbMonth.Text + "  /  " + cmbYear.Text);
                myAllDeducAllEmp.SetParameterValue("RepName", ReportName);
                myReportViewer.crystalReportViewer1.ReportSource = myAllDeducAllEmp;
                myReportViewer.Show();
            }
            else
            {
                MessageBox.Show("No Data to Preview..!");
            }
        }