Download - Lab6_3
![Page 1: Lab6_3](https://reader034.vdocuments.pub/reader034/viewer/2022051819/552298a94a7959775e8b4995/html5/thumbnails/1.jpg)
Lab6_3 Using Crystal Report
Trang 1
I. Báo cáo danh mục đối tượng: Viết Store procedure BC_DMDT lấy dữ liệu cho báo cáo như mẫu sau.
Dùng Crystal Report 8.5 thiết kế báo cáo giống như mẫu trên.
![Page 2: Lab6_3](https://reader034.vdocuments.pub/reader034/viewer/2022051819/552298a94a7959775e8b4995/html5/thumbnails/2.jpg)
Lab6_3 Using Crystal Report
Trang 2
Sau khi thiết kế mẫu báo cáo xong ta tiến hành gán dữ liệu nguồn cho báo cáo.
Dữ liệu nguồn của báo cáo được lấy từ Store Procedure đã được viết ở bước trước đây.
Chọn dữ liệu nguồn cho báo cáo là Microsoft SQL Server, chọn OLE DB.
Chọn tạo mới connection đến dữ liệu nguồn báo cáo là Microsoft SQL Server.
![Page 3: Lab6_3](https://reader034.vdocuments.pub/reader034/viewer/2022051819/552298a94a7959775e8b4995/html5/thumbnails/3.jpg)
Lab6_3 Using Crystal Report
Trang 3
Chọn options. Chọn Stored Procedures.
Chọn Provider for Microsoft SQL Server.
![Page 4: Lab6_3](https://reader034.vdocuments.pub/reader034/viewer/2022051819/552298a94a7959775e8b4995/html5/thumbnails/4.jpg)
Lab6_3 Using Crystal Report
Trang 4
Chọn thông tin cấu hình cơ sở dữ liệu vào database Microsoft SQL Server.
Chọn test connection.
![Page 5: Lab6_3](https://reader034.vdocuments.pub/reader034/viewer/2022051819/552298a94a7959775e8b4995/html5/thumbnails/5.jpg)
Lab6_3 Using Crystal Report
Trang 5
Chọn Stored Procedure là dữ liệu nguồn cho báo cáo.
Chọn Add.
Chọn các field cần thiết đưa vào báo cáo.
![Page 6: Lab6_3](https://reader034.vdocuments.pub/reader034/viewer/2022051819/552298a94a7959775e8b4995/html5/thumbnails/6.jpg)
Lab6_3 Using Crystal Report
Trang 6
Khai báo các parameter cho báo cáo.
![Page 7: Lab6_3](https://reader034.vdocuments.pub/reader034/viewer/2022051819/552298a94a7959775e8b4995/html5/thumbnails/7.jpg)
Lab6_3 Using Crystal Report
Trang 7
Chèn thông tin số trang cho báo cáo.
Chọn preview để xem lại báo cáo.
![Page 8: Lab6_3](https://reader034.vdocuments.pub/reader034/viewer/2022051819/552298a94a7959775e8b4995/html5/thumbnails/8.jpg)
Lab6_3 Using Crystal Report
Trang 8
Gắn báo cáo lên ứng dụng, các bước đã mô tả như ở bài tập trước.
![Page 9: Lab6_3](https://reader034.vdocuments.pub/reader034/viewer/2022051819/552298a94a7959775e8b4995/html5/thumbnails/9.jpg)
Lab6_3 Using Crystal Report
Trang 9
II. Báo cáo phiếu tiền mặt: Viết Store procedure BC_TM_THUCHI lấy dữ liệu cho báo cáo theo mẫu sau.
Dùng Crystal Report 8.5 thiết kế báo cáo giống như mẫu trên.
![Page 10: Lab6_3](https://reader034.vdocuments.pub/reader034/viewer/2022051819/552298a94a7959775e8b4995/html5/thumbnails/10.jpg)
Lab6_3 Using Crystal Report
Trang 10
Trong báo cáo trên có các tham số: sCompanyName, sUnitName, @pIDKEY thể hiện
thông tin của tên công ty, địa chỉ công ty và mã phiếu sẽ được thể hiện ở phần tiêu đề của báo cáo.
Khai báo các Formula cho báo cáo:
![Page 11: Lab6_3](https://reader034.vdocuments.pub/reader034/viewer/2022051819/552298a94a7959775e8b4995/html5/thumbnails/11.jpg)
Lab6_3 Using Crystal Report
Trang 11
Formula @LOAIPHIEU - Tên loại phiếu, ví dụ: Phiếu thu, phiếu chi,…
Formula @NHANNOP - Người nhận hay người nộp tùy theo loại phiếu:
![Page 12: Lab6_3](https://reader034.vdocuments.pub/reader034/viewer/2022051819/552298a94a7959775e8b4995/html5/thumbnails/12.jpg)
Lab6_3 Using Crystal Report
Trang 12
Formula @LYDO – Lý do thu hay chi.
Formula @NGAY – Ngày tháng năm của phiếu.
![Page 13: Lab6_3](https://reader034.vdocuments.pub/reader034/viewer/2022051819/552298a94a7959775e8b4995/html5/thumbnails/13.jpg)
Lab6_3 Using Crystal Report
Trang 13
Formula @KYTEN1 – Người ký tên.
Formula @KYTEN2 – Người ký tên.
![Page 14: Lab6_3](https://reader034.vdocuments.pub/reader034/viewer/2022051819/552298a94a7959775e8b4995/html5/thumbnails/14.jpg)
Lab6_3 Using Crystal Report
Trang 14
Khai báo các parameter cho báo cáo.
Sau khi thiết kế mẫu báo cáo xong ta tiến hành gán dữ liệu nguồn cho báo cáo. Dữ liệu nguồn của báo cáo được lấy từ Store Procedure đã được viết ở bước trước đây.
Chọn dữ liệu nguồn cho báo cáo là Microsoft SQL Server, chọn OLE DB. Chọn tạo mới connection đến dữ liệu nguồn báo cáo là Microsoft SQL Server. Chọn Provider for Microsoft SQL Server. Chọn thông tin cấu hình cơ sở dữ liệu vào database Microsoft SQL Server. Chọn test connection. Chọn Stored Procedure là dữ liệu nguồn cho báo cáo. Chọn Add. Chọn các field cần thiết đưa vào báo cáo. Chọn preview để xem lại báo cáo.
![Page 15: Lab6_3](https://reader034.vdocuments.pub/reader034/viewer/2022051819/552298a94a7959775e8b4995/html5/thumbnails/15.jpg)
Lab6_3 Using Crystal Report
Trang 15
Gắn báo cáo lên ứng dụng, các bước đã mô tả như ở bài tập trước.
![Page 16: Lab6_3](https://reader034.vdocuments.pub/reader034/viewer/2022051819/552298a94a7959775e8b4995/html5/thumbnails/16.jpg)
Lab6_3 Using Crystal Report
Trang 16
III. Báo cáo phiếu giao hàng: Viết Store procedure BC_VT_XUAT lấy dữ liệu cho báo cáo như mẫu sau.
Dùng Crystal Report 8.5 thiết kế báo cáo giống như mẫu trên.
Trong báo cáo trên có các tham số: sCompanyName, sUnitName, @pIDKEY thể hiện
thông tin của tên công ty, địa chỉ công ty sẽ được thể hiện ở phần tiêu đề của báo cáo.
![Page 17: Lab6_3](https://reader034.vdocuments.pub/reader034/viewer/2022051819/552298a94a7959775e8b4995/html5/thumbnails/17.jpg)
Lab6_3 Using Crystal Report
Trang 17
Khai báo các Formula cho báo cáo:
Formula @LOAISO - Số chứng từ/Loại chứng từ.
Formula @NGAY – Ngày tháng năm của phiếu.
![Page 18: Lab6_3](https://reader034.vdocuments.pub/reader034/viewer/2022051819/552298a94a7959775e8b4995/html5/thumbnails/18.jpg)
Lab6_3 Using Crystal Report
Trang 18
Formula @TEN – Tên của phiếu.
Formula @THANHTIEN – Số lượng * Đơn giá.
![Page 19: Lab6_3](https://reader034.vdocuments.pub/reader034/viewer/2022051819/552298a94a7959775e8b4995/html5/thumbnails/19.jpg)
Lab6_3 Using Crystal Report
Trang 19
Formula @TONGTIEN – Tổng thành tiền.
Khai báo các biến cho số thứ tự.
![Page 20: Lab6_3](https://reader034.vdocuments.pub/reader034/viewer/2022051819/552298a94a7959775e8b4995/html5/thumbnails/20.jpg)
Lab6_3 Using Crystal Report
Trang 20
Chèn thông tin số trang cho báo cáo.
Sau khi thiết kế mẫu báo cáo xong ta tiến hành gán dữ liệu nguồn cho báo cáo. Dữ liệu nguồn của báo cáo được lấy từ Store Procedure đã được viết ở bước trước đây.
Chọn dữ liệu nguồn cho báo cáo là Microsoft SQL Server, chọn OLE DB. Chọn tạo mới connection đến dữ liệu nguồn báo cáo là Microsoft SQL Server. Chọn Provider for Microsoft SQL Server. Chọn thông tin cấu hình cơ sở dữ liệu vào database Microsoft SQL Server. Chọn test connection. Chọn Stored Procedure là dữ liệu nguồn cho báo cáo. Chọn Add.
![Page 21: Lab6_3](https://reader034.vdocuments.pub/reader034/viewer/2022051819/552298a94a7959775e8b4995/html5/thumbnails/21.jpg)
Lab6_3 Using Crystal Report
Trang 21
Chọn các field cần thiết đưa vào báo cáo. Chọn preview để xem lại báo cáo.
Gắn báo cáo lên ứng dụng, các bước đã mô tả như ở bài tập trước.
![Page 22: Lab6_3](https://reader034.vdocuments.pub/reader034/viewer/2022051819/552298a94a7959775e8b4995/html5/thumbnails/22.jpg)
Lab6_3 Using Crystal Report
Trang 22
IV. Báo cáo liệt kê chứng từ: Viết Store procedure BC_TH_LIETKECT lấy dữ liệu cho báo cáo.
Dùng Crystal Report 8.5 thiết kế báo cáo giống như mẫu trên.
Trong báo cáo trên có các tham số: vNgaythang, vTongCongTy, vTenCTy, @Tungay,
@Denngay, @DSDonvi, @LoaiBC.
![Page 23: Lab6_3](https://reader034.vdocuments.pub/reader034/viewer/2022051819/552298a94a7959775e8b4995/html5/thumbnails/23.jpg)
Lab6_3 Using Crystal Report
23
Khai báo các Formula:
Formula Nam - Lấy năm của ngày tháng.
Formula Ngay - Lấy ngày của ngày tháng.
Trang
![Page 24: Lab6_3](https://reader034.vdocuments.pub/reader034/viewer/2022051819/552298a94a7959775e8b4995/html5/thumbnails/24.jpg)
Lab6_3 Using Crystal Report
Trang 24
Formula Thang - Lấy tháng của ngày tháng.
Formula Tieude - Thể hiện tiêu đề của báo cáo.
Khai báo nhóm theo mã đơn vị.
![Page 25: Lab6_3](https://reader034.vdocuments.pub/reader034/viewer/2022051819/552298a94a7959775e8b4995/html5/thumbnails/25.jpg)
Lab6_3 Using Crystal Report
Trang 25
Sau khi thiết kế mẫu báo cáo xong ta tiến hành gán dữ liệu nguồn cho báo cáo. Dữ liệu nguồn của báo cáo được lấy từ Store Procedure đã được viết ở bước trước đây.
Chọn dữ liệu nguồn cho báo cáo là Microsoft SQL Server, chọn OLE DB. Chọn tạo mới connection đến dữ liệu nguồn báo cáo là Microsoft SQL Server. Chọn Provider for Microsoft SQL Server. Chọn thông tin cấu hình cơ sở dữ liệu vào database Microsoft SQL Server. Chọn test connection. Chọn Stored Procedure là dữ liệu nguồn cho báo cáo. Chọn Add. Chọn các field cần thiết đưa vào báo cáo. Chèn thông tin số trang cho báo cáo. Chọn preview để xem lại báo cáo. Gắn báo cáo lên ứng dụng, các bước đã mô tả như ở bài tập trước.