コード例 #1
0
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            crRevenue rpt = new crRevenue();

            rpt.Site = this.Site;
            return(rpt);
        }
コード例 #2
0
        private void btnFilter_Click(object sender, EventArgs e)
        {
            SqlConnection sqlConnection = new SqlConnection(Properties.Settings.Default.QLSieuThiMiniConnectionString);

            string query = "select * from tbl_DetailedBill, tbl_Product, tbl_Bill where tbl_Bill.BillID = tbl_DetailedBill.IDBill and tbl_DetailedBill.IDProduct = tbl_Product.ProductID";

            if (txtYear.Text.Trim().Length > 0)
            {
                query += " and tbl_Bill.BilledDate/10000 = " + txtYear.Text;
            }
            if (txtMonth.Text.Trim().Length > 0)
            {
                query += " and (tbl_Bill.BilledDate/100)%100 = " + txtMonth.Text;
            }
            if (txtMonth.Text.Trim().Length > 0)
            {
                query += " and tbl_Bill.BilledDate%100 = " + txtDay.Text;
            }

            SqlDataAdapter da = new SqlDataAdapter(query, sqlConnection);
            DataTable      dt = new DataTable();

            da.Fill(dt);

            crRevenue rpt = new crRevenue();

            rpt.SetDataSource(dt.DefaultView);
            crystalReportViewer1.ReportSource = rpt;
        }