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

            rpt.Site = this.Site;
            return(rpt);
        }
        private void button1_Click(object sender, EventArgs e)
        {
            string strRoute = "%";

            if (chkRoute.Checked)
            {
                strRoute = "%";
            }
            else
            {
                strRoute = cmbRoute.SelectedValue.ToString();
            }
            DataTable dataSetReport = new DataTable();

            dataSetReport.TableName = "SupplierPaymentsSummaryDetail";

            BoughtLeafBusinessLayer.MothlyPaymentSummary myMonthlySummary = new BoughtLeafBusinessLayer.MothlyPaymentSummary();

            string supCode = string.Empty;

            if (chkSupplier.Checked == true)
            {
                supCode = "%";
            }
            else
            {
                supCode = cmbSupplier.SelectedValue.ToString();
            }

            dataSetReport = myMonthlySummary.getSupplierPaymentsDeductionDetail(Convert.ToInt32(cmbYear.Text), Convert.ToInt32(cmbMonth.SelectedValue.ToString()), supCode, strRoute).Tables[0];
            dataSetReport.WriteXml("SupplierPaymentsDeductionDetail.xml");
            SupplierPaymentsDeductionDetailRPT myReport = new SupplierPaymentsDeductionDetailRPT();

            myReport.SetDataSource(dataSetReport);
            ReportViewer rptViewer = new ReportViewer();

            myReport.SetParameterValue("Company", BoughtLeafBusinessLayer.BLUser.getCompanyName());
            myReport.SetParameterValue("Year", cmbYear.Text);
            myReport.SetParameterValue("Month", cmbMonth.SelectedValue.ToString());

            if (chkRoute.Checked == true)
            {
                myReport.SetParameterValue("Route", "All Routes");
            }
            else
            {
                myReport.SetParameterValue("Route", cmbRoute.Text);
            }

            rptViewer.crystalReportViewer1.ReportSource = myReport;
            rptViewer.Show();
        }