Exemplo n.º 1
0
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            CashSundryManDays rpt = new CashSundryManDays();

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

            if (chkDivision.Checked)
            {
                strAllDivision = "%";
            }
            else
            {
                strAllDivision = cmbDivision.SelectedValue.ToString();
            }
            dataSetReport = myReports.getEmployeeSundryManDaysDetails(Convert.ToDateTime(dtpFromDate.Value.ToShortDateString()), Convert.ToDateTime(dtpToDate.Value.ToShortDateString()), 2, strAllDivision);
            dataSetReport.WriteXml("EmployeeCashSundryManDaysDetail.xml");

            if (dataSetReport.Tables[0].Rows.Count > 0)
            {
                CashSundryManDays rptObj = new CashSundryManDays();
                rptObj.SetDataSource(dataSetReport);

                ReportViewer myReportViewer = new ReportViewer();

                rptObj.SetParameterValue("Company Name", FTSPayRollBL.Company.getCompanyName());
                rptObj.SetParameterValue("Estate", myEstate.ListEstates().Rows[0][0].ToString());
                rptObj.SetParameterValue("Options", "Division : " + cmbDivision.Text.ToString() + " / From:" + dtpFromDate.Value.ToShortDateString() + "   To:" + dtpToDate.Value.ToShortDateString());

                rptObj.SetParameterValue("WorkType", "Work Type : Cash Work");

                myReportViewer.crystalReportViewer1.ReportSource = rptObj;
                myReportViewer.Show();
            }
            else
            {
                MessageBox.Show("No Data to Preview..!");
            }
        }