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

            rpt.Site = this.Site;
            return(rpt);
        }
コード例 #2
0
        private void LoadReportSource(string _MaKho)
        {
            crtTrangThaiThietBiKho cry = new crtTrangThaiThietBiKho();
            var model = (from m in db.ChiTietKhoVatTus
                         join n in db.KhoVatTus on
                         m.MaKhoVT equals n.MaKhoVT
                         join vt in db.VatTus on m.MaVT equals vt.MaVT
                         where m.MaKhoVT == _MaKho
                         select new
            {
                m.MaKhoVT,
                m.SerialNumber,
                m.SoLuong,
                m.TinhTrangVT,
                m.TrangThai,
                n.TenKhoVT,
                MaVT = vt.TenVT
            }).ToList();
            var totalsum = db.ChiTietKhoVatTus.Where(m => m.MaKhoVT == _MaKho).GroupBy(a => new { a.MaVT, a.TinhTrangVT }).Select(p => new { MaVT = p.Key.MaVT, p.Key.TinhTrangVT, SoLuong = p.Sum(q => q.SoLuong) });
            var modelSub = (from m in totalsum
                            join n in db.VatTus on m.MaVT equals n.MaVT
                            select(new { MaVT = n.TenVT, m.TinhTrangVT, m.SoLuong })).ToList();

            cry.SetDataSource(model);
            cry.Subreports[0].SetDataSource(modelSub);;

            cryView1.ReportSource = cry;
            cryView1.RefreshReport();
        }