Exemplo n.º 1
0
        public Stream generateReportPrintAll(int TuyenID, int month, int year)
        {
            var source = printCtl.GetDanhSachHoaDons(TuyenID, month, year).ToList();

            //cập nhật trạng thái in cho tất cả các hóa đơn
            foreach (var item in source)
            {
                int hoaDonID = item.HoaDonID;
                printCtl.CapNhatTrangThaiIn(hoaDonID);
            }
            //đặt datasource để đẩy vào crystal report
            report.SetDataSource(source);
            try
            {
                Stream str = report.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
                str.Seek(0, SeekOrigin.Begin);
                return(str);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.ToString());
            }
        }