1 / 19

Crystal R eport

Crystal R eport. 1. Tạo nguồn dữ liệu. Tạo dữ liệu( Northwind.bak ). Tạo store procedure lấy ra các hóa đơn bán hàng theo khoảng thời gian tùy biến. CREATE procedure [ dbo ].[ spSalebydate ] @ Tungay datetime , @ Denngay datetime as begin

Télécharger la présentation

Crystal R eport

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Crystal Report

  2. 1. Tạo nguồn dữ liệu • Tạo dữ liệu( Northwind.bak)

  3. Tạo storeprocedure lấy ra các hóa đơn bán hàng theo khoảng thời gian tùy biến • CREATE procedure [dbo].[spSalebydate] • @Tungaydatetime, • @Denngaydatetime • as • begin • select * from orders where OrderDate between @Tungay and @Denngay • end

  4. 2. Tạo báo cáo

  5. Xác định nguồn dữ liệu cho báo cáo

  6. Kéo thả các fields vào report(detail)

  7. Section1(ReportHeader Section1(ReportHeader): Chỉ xuất hiện 1 lần duy nhất Thể hiện thông tin chung của báo cáo: Tên báo cáo, điều kiện truy xuất

  8. Section2 (PageHeader: Thể hiện thông tin của trang, lặp lại theo từng trang như Tiêu đề cột, số thứ tự trang…)

  9. Parameter

  10. Các hàm tính toán: Sum, count…

  11. Định dạng

  12. 3. In báo cáo

  13. private void cmdInBaocao_Click(object sender, EventArgs e) • { • frmReportfrm = newfrmReport(); • string s; • s = dtTungay.Value.Day.ToString() + "/" + dtTungay.Value.Month.ToString() +"/"+ dtTungay.Value.Year.ToString()+" 0:0:00"; • frm.tungay =DateTime.Parse(s); • s = dtDenngay.Value.Day.ToString() + "/" + dtDenngay.Value.Month.ToString() + "/" + dtDenngay.Value.Year.ToString() + " 23:59:59"; • frm.denngay = dtDenngay.Value; • frm.ShowDialog(); • }

  14. Tạo form kết quả

  15. Lập trình form Kết quả • Sử dụng NameSpace: • usingCrystalDecisions.CrystalReports.Engine; • usingCrystalDecisions.Shared; • Khai báo paramater: • publicDateTimetungay; • publicDateTimedenngay;

  16. Loadreport • privatevoidfrmReport_Load(objectsender, EventArgs e) • { • ReportDocumentorpt = newReportDocument(); • orpt.Load(@"D:\Giao trinh\C#\CrystalReport\CrystalReport\CrystalReport\CrystalReport1.rpt"); • orpt.SetParameterValue("@Tungay", tungay); • orpt.SetParameterValue("@Denngay", denngay); • orpt.SetDatabaseLogon("","",@"mypc\sqlexpress","No"); • crystalReportViewer1.ReportSource=orpt; • }

More Related