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

            rpt.Site = this.Site;
            return(rpt);
        }
        private void btnOilPalmEntries_Click(object sender, EventArgs e)
        {
            DataSet ds          = new DataSet();
            String  strDivision = cmbDivision.SelectedValue.ToString();
            Int32   intWorkType = 1;

            if (rbGeneral.Checked)
            {
                intWorkType = 1;
            }
            else
            {
                intWorkType = 2;
            }
            if (chkDivision.Checked)
            {
                strDivision = "%";
            }
            else
            {
                strDivision = cmbDivision.SelectedValue.ToString();
            }
            DateTime Fromdate = Convert.ToDateTime(dtpFromDate.Value.Date);
            DateTime Todate   = Convert.ToDateTime(dtpToDate.Value.Date);

            ds = myReports.GetOilParmEntries(Fromdate, Todate, strDivision, intWorkType);
            if (ds.Tables[0].Rows.Count > 0)
            {
                ds.WriteXml("DailyEntriesOilPalm.xml");
                DailyDataEntryOilPalmRPT myReportViewe = new DailyDataEntryOilPalmRPT();
                myReportViewe.SetDataSource(ds);
                myReportViewe.SetParameterValue("Estate", "Estate:" + myEstate.ListEstates().Rows[0][0].ToString() + " / DivisionID:" + cmbDivision.SelectedValue.ToString());
                myReportViewe.SetParameterValue("Date", "From: " + Fromdate.ToShortDateString() + "  To: " + Todate.ToShortDateString());
                myReportViewe.SetParameterValue("Company Name", FTSPayRollBL.Company.getCompanyName());
                ReportViewer myReportViewer = new ReportViewer();
                myReportViewer.crystalReportViewer1.ReportSource = myReportViewe;
                myReportViewer.Show();
            }
            else
            {
                MessageBox.Show("No Data To Print", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }