예제 #1
0
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            CashNamePluckingRegisterRPT rpt = new CashNamePluckingRegisterRPT();

            rpt.Site = this.Site;
            return(rpt);
        }
예제 #2
0
        private void btnDisplay_Click(object sender, EventArgs e)
        {
            DataSet ds = new DataSet();

            try
            {
                if (chkEmpRange.Checked)
                {
                    ds = myReports.getHarvestNamePlkRegister(cmbDivision.SelectedValue.ToString(), Convert.ToDateTime(dtpFrom.Value.Date.ToShortDateString()), Convert.ToDateTime(dtpTo.Value.Date.ToShortDateString()), txtEmpNoFrom.Text, txtEmpNoTo.Text);
                }
                else
                {
                    ds = myReports.getHarvestNamePlkRegister(cmbDivision.SelectedValue.ToString(), Convert.ToDateTime(dtpFrom.Value.Date.ToShortDateString()), Convert.ToDateTime(dtpTo.Value.Date.ToShortDateString()));
                }

                ds.WriteXml("CashNamePlkRegister.xml");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    CashNamePluckingRegisterRPT myDailyRep = new CashNamePluckingRegisterRPT();
                    myDailyRep.SetDataSource(ds);
                    ReportViewer myReportViewer = new ReportViewer();
                    myDailyRep.SetParameterValue("Company Name", FTSPayRollBL.Company.getCompanyName());
                    myDailyRep.SetParameterValue("Date", "From:" + dtpFrom.Value.Date.ToShortDateString() + " To:" + dtpTo.Value.Date.ToShortDateString());
                    myDailyRep.SetParameterValue("Division", "Division : " + cmbDivision.Text);
                    myReportViewer.crystalReportViewer1.ReportSource = myDailyRep;
                    myReportViewer.Show();
                }
                else
                {
                    MessageBox.Show("No Data To Preview", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }