コード例 #1
0
ファイル: rptDatBao.cs プロジェクト: vanhuudhsp/Demo
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            rptDatBao rpt = new rptDatBao();

            rpt.Site = this.Site;
            return(rpt);
        }
コード例 #2
0
        private void frmInHD_Load(object sender, EventArgs e)
        {
            var query = "SELECT PHIEUDATBAO.SoPhieu, PHIEUDATBAO.NgayDat, KHACHHANG.TenKH," +
                        " KHACHHANG.DiaChi, KHACHHANG.DienThoai, TAPCHI.TenTC, TAPCHI.DonGiaThang," +
                        " CTDATBAO.ThangBD, CTDATBAO.ThangKT, CTDATBAO.SoLuong," +
                        " (CTDATBAO.ThangKT - CTDATBAO.ThangBD + 1)* TAPCHI.DonGiaThang AS ThanhTien" +
                        " FROM CTDATBAO INNER JOIN PHIEUDATBAO ON CTDATBAO.SoPhieu = PHIEUDATBAO.SoPhieu INNER JOIN " +
                        " KHACHHANG ON PHIEUDATBAO.MaKH = KHACHHANG.MaKH INNER JOIN TAPCHI ON CTDATBAO.MaTC = TAPCHI.MaTC" +
                        " Where PHIEUDATBAO.SoPhieu = '" + SoPhieu + "'";
            SqlDataAdapter da = new SqlDataAdapter(query, Modules.cnn);

            try
            {
                DataTable tbDatBao = new DataTable();
                da.Fill(tbDatBao);
                rptDatBao rpt = new rptDatBao();
                rpt.SetDataSource(tbDatBao);
                crvDatBao.ReportSource = rpt;
            }catch (SqlException ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }