1. Trang chủ
  2. » Luận Văn - Báo Cáo

XÂY DỰNG CHƯƠNG TRÌNH QUẢN LÝ TÀI SẢN CÔNG TY

89 101 0
Tài liệu đã được kiểm tra trùng lặp

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Tiêu đề Xây Dựng Chương Trình Quản Lý Tài Sản Công Ty
Tác giả Lý Thị Hiền
Trường học Trường Đại Học Mỏ - Địa Chất
Chuyên ngành Lập Trình .NET
Thể loại bài tập lớn
Năm xuất bản 2021
Thành phố Hà Nội
Định dạng
Số trang 89
Dung lượng 1,77 MB

Cấu trúc

  • BỘ GIÁO DỤC VÀ ĐÀO TẠO TRƯỜNG ĐẠI HỌC MỎ - ĐỊA CHẤT

  • BÀI TẬP LỚN

  • Hà Nội, Năm 2021

  • PHẦN 1: THIẾT KẾ CƠ SỞ DỮ LIỆU

  • 1. Cấu trúc Bảng Tài Sản

  • 2. Cấu trúc Bảng Đơn Vị

  • 3. Cấu trúc Bảng Phân Loại

  • 4. Cấu trúc Bảng Nước

  • 5. Cấu trúc Bảng Nhà Cung Cấp

  • 6. Cấu trúc Bảng Nhân Viên

  • 7. Cấu trúc Bảng Tài Khoản

  • 8. Cấu trúc Bảng Chuyển Tài Sản

  • 9. Cấu trúc Bảng Kiểm Kê Tài Sản

  • 10. Cấu trúc Bảng Sửa Chữa

  • 11. Cấu trúc Bảng Thanh Lý Tài Sản

  • 12. Cấu trúc Bảng Giá Trị Tài Sản

  • 13. Lược đồ quan hệ

  • PHẦN 2: SƠ ĐỒ PHÂN RÃ CHỨC NĂNG

  • PHẦN 3: GIAO DIỆN CỦA CÁC CHỨC NĂNG

  • 1. Giao diện chương trình chính

  • 2. Giao diện đăng nhập

  • 3. Giao diện Đổi mật khẩu

  • 4. Giao diện Đăng xuất

  • 5. Giao diện Thông Tin Tài Khoản

  • 6. Giao diện Nhân viên

  • 7. Giao diện Đơn Vị

  • 8. Giao diện Phân Loại

  • 9. Giao diện Nước

  • 10. Giao diện Tài Sản

  • 11. Giao diện Nhà Cung Cấp

  • 12. Giao diện Điều Chuyển Tài Sản

  • Lưu ý:

  • 13. Giao diện Kiểm Kê Tài Sản

  • Lưu ý:

  • 14. Giao diện Sửa Chữa Tài Sản

  • Lưu ý:

  • 15. Giao diện Thanh Lý Tài Sản

  • Lưu ý:

  • 16. Giao diện Khấu Hao Tài Sản

  • Lưu ý:

  • 17. Giao diện Thống Kê Tất Cả Tài Sản Theo Đơn Vị

  • Lưu ý:

  • 18. Giao diện Thống Kê Tài Sản Theo Loại Tài Sản

  • Lưu ý:

  • PHẦN 4: MÃ NGUỒN (SOURCE CODE)

  • 1. Giao diện chức năng Form Main (Giao diện chương trình chính)

  • 2. Mã nguồn chức năng Form Function (Kết nối tất cả các form lại với SQL SERVER)

  • 3. Mã nguồn chức năng Form Tài Khoản

  • 4. Mã nguồn chức năng Form Login

  • 5. Mã nguồn chức năng Form Đổi Mật Khẩu

  • 6. Mã nguồn chức năng Form Nhân Viên

  • 7. Mã nguồn chức năng Form Đơn Vị

  • 8. Mã nguồn chức năng Form Phân Loại

  • 9. Mã nguồn chức năng Form Nước

  • 10. Mã nguồn chức năng Form Tài Sản

    • }

  • 11. Mã nguồn chức năng Form Nhà Cung Cấp

  • 12. Mã nguồn chức năng Form Điều Chuyển Tài Sản

    • }

  • 13. Mã nguồn chức năng Form Kiểm Kê Tài Sản

    • }

  • 14. Mã nguồn chức năng Form Cấp Sửa Chữa Tài Sản

  • 15. Mã nguồn chức năng Form Thanh Lý tài Sản

    • }

  • 16. Mã nguồn chức năng Form Tính Khấu Hao Tài Sản

  • 17. Mã nguồn chức năng Form Thống Kê Tất Cả Tài Sản Theo Đơn Vị

  • 18. Mã nguồn chức năng Form Thống Kê Tài Sản Hiện Có Theo Loại Tài Sản

Nội dung

TÊN ĐỀ TÀI: XÂY DỰNG CHƯƠNG TRÌNH QUẢN LÝ TÀI SẢN CÔNG TY BÀI TẬP LỚN MÔN: LẬP TRÌNH .NET 1 + BTL Hà Nội, Năm 2021 MỤC LỤC PHẦN 1: THIẾT KẾ CƠ SỞ DỮ LIỆU 3 1. Cấu trúc Bảng Tài Sản 3 2. Cấu trúc Bảng Đơn Vị 3 3. Cấu trúc Bảng Phân Loại 4 4. Cấu trúc Bảng Nước 4 5. Cấu trúc Bảng Nhà Cung Cấp 4 6. Cấu trúc Bảng Nhân Viên 4 7. Cấu trúc Bảng Tài Khoản 5 8. Cấu trúc Bảng Chuyển Tài Sản 5 9. Cấu trúc Bảng Kiểm Kê Tài Sản 6 10. Cấu trúc Bảng Sửa Chữa 7 11. Cấu trúc Bảng Thanh Lý Tài Sản 7 12. Cấu trúc Bảng Giá Trị Tài Sản 8 13. Lược đồ quan hệ 9 PHẦN 2: SƠ ĐỒ PHÂN RÃ CHỨC NĂNG 10 PHẦN 3: GIAO DIỆN CỦA CÁC CHỨC NĂNG 11 1. Giao diện chương trình chính 11 2. Giao diện đăng nhập 11 3. Giao diện Đổi mật khẩu 12 4. Giao diện Đăng xuất 13 5. Giao diện Thông Tin Tài Khoản 13 6. Giao diện Nhân viên 14 7. Giao diện Đơn Vị 15 8. Giao diện Phân Loại 16 9. Giao diện Nước 17 10. Giao diện Tài Sản 18 11. Giao diện Nhà Cung Cấp 19 12. Giao diện Điều Chuyển Tài Sản 20 13. Giao diện Kiểm Kê Tài Sản 21 14. Giao diện Sửa Chữa Tài Sản 22 15. Giao diện Thanh Lý Tài Sản 23 16. Giao diện Khấu Hao Tài Sản 24 17. Giao diện Thống Kê Tất Cả Tài Sản Theo Đơn Vị 25 18. Giao diện Thống Kê Tài Sản Theo Loại Tài Sản 26 PHẦN 4: MÃ NGUỒN (SOURCE CODE) 27 1. Giao diện chức năng Form Main (Giao diện chương trình chính) 27 2. Mã nguồn chức năng Form Function (Kết nối tất cả các form lại với SQL SERVER) 30 3. Mã nguồn chức năng Form Tài Khoản 31 4. Mã nguồn chức năng Form Login 35 5. Mã nguồn chức năng Form Đổi Mật Khẩu 36 6. Mã nguồn chức năng Form Nhân Viên 37 7. Mã nguồn chức năng Form Đơn Vị 40 8. Mã nguồn chức năng Form Phân Loại 44 9. Mã nguồn chức năng Form Nước 47 10. Mã nguồn chức năng Form Tài Sản 50 11. Mã nguồn chức năng Form Nhà Cung Cấp 54 12. Mã nguồn chức năng Form Điều Chuyển Tài Sản 58 13. Mã nguồn chức năng Form Kiểm Kê Tài Sản 63 14. Mã nguồn chức năng Form Cấp Sửa Chữa Tài Sản 67 15. Mã nguồn chức năng Form Thanh Lý tài Sản 71 16. Mã nguồn chức năng Form Tính Khấu Hao Tài Sản 75 17. Mã nguồn chức năng Form Thống Kê Tất Cả Tài Sản Theo Đơn Vị 78 18. Mã nguồn chức năng Form Thống Kê Tài Sản Hiện Có Theo Loại Tài Sản 79

THIẾT KẾ CƠ SỞ DỮ LIỆU

Cấu trúc Bảng Tài Sản

Bảng TAISAN thể hiện thông tin tài sản của công ty Mỗi tài sản được phân biệt với nhau bởi mã tài sản.

Cấu trúc Bảng Đơn Vị

Bảng DONVI cung cấp thông tin chi tiết về tài sản của công ty, bao gồm đơn vị sở hữu và các thông tin liên quan Mỗi đơn vị được nhận diện bằng mã đơn vị riêng biệt, giúp phân biệt rõ ràng giữa các tài sản.

Cấu trúc Bảng Phân Loại

Bảng PHANLOAI thể hiện sự phân loại tài sản công ty Mỗi loại tài sản được phân biệt với nhau bởi mã loại

Cấu trúc Bảng Nước

Bảng NUOC thể hiện tài sản được nhập khẩu tại quốc gia nào Mỗi quốc gia nhập khẩu tài sản được phân biệt với nhau bởi mã nước

Cấu trúc Bảng Nhà Cung Cấp

Bảng NHACUNGCAP ghi nhận thông tin về tài sản được cung cấp, bao gồm tên công ty, địa chỉ và mã phân biệt của tài sản từ nhà cung cấp Mỗi nhà cung cấp được nhận diện qua mã riêng biệt, giúp phân loại và quản lý tài sản hiệu quả.

Cấu trúc Bảng Nhân Viên

Bảng NHANVIEN thể hiện thông tin nhân viên của công ty Nhân viên được phân biệt với nhau bởi mã nhân viên

Cấu trúc Bảng Tài Khoản

Bảng TAIKHOAN thể hiện thông tin tài khoản của nhân viên công ty Mỗi tài khoản được phân biệt với nhau bởi tên đăng nhập

Cấu trúc Bảng Chuyển Tài Sản

Bảng CHUYENTAISAN ghi nhận tài sản hiện tại của từng đơn vị và nhân viên thực hiện việc điều chuyển Các tài sản trong từng đơn vị được phân biệt thông qua mã tài sản riêng biệt.

Cấu trúc Bảng Kiểm Kê Tài Sản

Bảng KIEMKETS giúp kiểm kê tình trạng hiện tại của tài sản, phân loại chúng thành các trạng thái như Tốt, Bình Thường và Hỏng Dựa trên kết quả kiểm kê, người quản lý có thể yêu cầu sửa chữa, nâng cấp hoặc thanh lý tài sản khi cần thiết Mỗi tài sản được kiểm kê sẽ được xác định bằng số biên bản kiểm kê riêng biệt.

Cấu trúc Bảng Sửa Chữa

Bảng SUACHUA ghi nhận yêu cầu sửa chữa tài sản từ bảng KIEMKETS, trong đó số lượng tài sản hỏng sẽ được tiến hành sửa chữa Mỗi tài sản sửa chữa được xác định bằng mã cấp sửa chữa riêng biệt.

Cấu trúc Bảng Thanh Lý Tài Sản

Bảng THANHLY_TS thể hiện yêu cầu thanh lý tài sản từ bảng KIEMKETS, bao gồm số lượng tài sản cần thanh lý Mỗi tài sản được phân biệt rõ ràng bằng mã tài sản riêng.

Cấu trúc Bảng Giá Trị Tài Sản

Bảng GIATRITAISAN phản ánh mức độ khấu hao của tài sản sau khi thanh lý theo bảng THANHLY_TS, đồng thời thể hiện thời gian khấu hao của từng tài sản Việc khấu hao tài sản được phân biệt thông qua mã tài sản cụ thể.

GIAO DIỆN CỦA CÁC CHỨC NĂNG

Giao diện đăng nhập

Chức năng này cho phép người dùng đăng nhập vào hệ thống với tên đăng nhập và mật khẩu.

+ Hệ thống hiển thị form đăng nhập yêu cầu người dùng nhập “Tên đăng nhập” và “Mật khẩu”.

+ Hệ thống sẽ kiểm tra tên đăng nhập và mật khẩu được nhập và cho phép người dùng đăng nhập vào hệ thống.

Giao diện Đổi mật khẩu

Giao diện đổi mật khẩu cho phép người dùng nhập thông tin mật khẩu cũ, mật khẩu mới và xác nhận mật khẩu mới Nếu thông tin không chính xác hoặc mật khẩu mới không khớp với xác nhận, hệ thống sẽ báo lỗi Để hoàn tất quá trình, người dùng nhấn “Lưu” để thay đổi mật khẩu hoặc “Hủy” để xóa các trường đã nhập, ngoại trừ tên đăng nhập.

Giao diện Đăng xuất

Giao diện này cho phép người dùng dễ dàng đăng xuất khỏi tài khoản hiện tại để có thể đăng nhập lại bằng tài khoản đó hoặc một tài khoản khác Chức năng của hệ thống tương tự như quá trình đăng nhập.

Giao diện Thông Tin Tài Khoản

Giao diện thông tin tài khoản cho phép người dùng dễ dàng cập nhật, sửa đổi và xóa thông tin cá nhân Tại đây, người dùng có thể xem chi tiết về tên đăng nhập, quyền hạn và trạng thái hoạt động của tài khoản.

Các chức năng trên giao diện:

Tên đăng nhập hiện đang ở trạng thái Enabled, cho phép người dùng thực hiện thao tác thêm mới Hệ thống hỗ trợ người dùng trong việc tạo tên đăng nhập kèm theo mật khẩu, quyền truy cập và trạng thái tương ứng.

Để sửa thông tin, hãy nhấp vào mục cần chỉnh sửa trong datagridview bên dưới Thông tin sẽ hiển thị trên các ô textbox, combobox, v.v Sau đó, thực hiện thao tác nhấn nút sửa để lưu lại các thay đổi.

• Lưu: lưu thay đổi sau khi thao tác nút thêm.

• Xóa: xóa user trong danh sách Nếu tài khoản đó có các ràng buộc liên quan thì không thể xóa.

Giao diện Nhân viên

Giao diện này cho phép người dùng cập nhật, sửa đổi và xóa thông tin nhân viên Tại đây, người dùng có thể xem chi tiết mã nhân viên, tên, ngày sinh, giới tính, địa chỉ, số điện thoại và chức vụ của nhân viên.

Các chức năng trên giao diện:

Người dùng có thể thêm mới mã nhân viên với trạng thái Enabled, bao gồm thông tin như tên, ngày sinh, giới tính, địa chỉ, điện thoại và chức vụ của nhân viên.

Để sửa thông tin, hãy nhấp vào mục cần chỉnh sửa trong datagridview phía dưới, sau đó thông tin sẽ được hiển thị trên các ô textbox, combobox, v.v Tiếp theo, thực hiện thao tác nhấn nút sửa để lưu lại các thay đổi.

• Lưu: lưu thay đổi sau khi thao tác nút thêm.

• Xóa: xóa user trong danh sách Nếu mã nhân viên đó có các ràng buộc liên quan thì không thể xóa.

Lưu ý: Form Nhân viên chỉ có tài khoản admin mới có thể thấy, còn ngoài ra các tài khoản khác sẽ không thấy được form này.

Giao diện Đơn Vị

Giao diện này cho phép người dùng cập nhật, sửa đổi và xóa thông tin về đơn vị tài sản Tại đây, người dùng có thể xem chi tiết các thông tin như mã đơn vị, tên đơn vị, số lượng người, địa chỉ và số điện thoại.

Các chức năng trên giao diện:

Mã đơn vị hiện đang ở trạng thái Enabled, cho phép người dùng thực hiện thao tác thêm mới Người dùng có thể nhập mã đơn vị, tên đơn vị, số lượng người, địa chỉ và số điện thoại.

Để sửa thông tin, bạn hãy nhấp vào dữ liệu cần chỉnh sửa trong datagridview ở phía dưới Thông tin sẽ được hiển thị trên các ô textbox, combobox, v.v Sau đó, thực hiện thao tác nhấn nút sửa để lưu lại thông tin đã chỉnh sửa.

• Lưu: lưu thay đổi sau khi thao tác nút thêm.

• Xóa: xóa user trong danh sách Nếu mã tài sản đó có các ràng buộc liên quan thì không thể xóa.

Giao diện Phân Loại

Giao diện này cho phép người dùng có thể cập nhật thêm, sửa, xóa thông tin phân loại tài sản.

Tại Giao diện Phân Loại, chúng ta có thể xem chi tiết về mã loại tài sản, tên loại tài sản của tài sản

Các chức năng trên giao diện:

• Thêm: Mã loại đang ở trạng thái Enabled Thao tác nút thêm, hệ thống cho phép người dùng thêm mới mã loại, tên loại của tài sản

Để chỉnh sửa thông tin, hãy nhấp vào mục cần sửa trong datagridview phía dưới Thông tin sẽ hiển thị trên các ô textbox, combobox, v.v Sau đó, thực hiện thao tác nhấn nút sửa để lưu lại thông tin đã chỉnh sửa.

• Lưu: lưu thay đổi sau khi thao tác nút thêm.

• Xóa: xóa user trong danh sách Nếu mã tài sản đó có các ràng buộc liên quan thì không thể xóa.

Giao diện Nước

Giao diện này cho phép người dùng có thể cập nhật thêm, sửa, xóa thông tin nguồn gốc của tài sản.

Tại Giao diện Nước, chúng ta có thể xem chi tiết về mã nước, tên nước của tài sản

• Thêm: Mã nước đang ở trạng thái Enabled Thao tác nút thêm, hệ thống cho phép người dùng thêm mới mã nước, tên nước của tài sản

Để chỉnh sửa thông tin, hãy nhấp vào mục cần sửa trong datagridview phía dưới Thông tin sẽ hiển thị trên các ô textbox, combobox, v.v Sau đó, thực hiện thao tác nhấn nút sửa để lưu lại thông tin đã chỉnh sửa.

• Lưu: lưu thay đổi sau khi thao tác nút thêm.

• Xóa: xóa user trong danh sách Nếu mã tài sản đó có các ràng buộc liên quan thì không thể xóa.

Giao diện Tài Sản

Giao diện này cho phép người dùng có thể cập nhật thêm, sửa, xóa thông tin tài sản.

Tại Giao diện Tài Sản, người dùng có thể xem thông tin chi tiết về mã tài sản, tên tài sản, mã loại, mã nước, đơn vị tính, năm sản xuất, năm sử dụng, số lượng và mã đơn vị của tài sản.

Các chức năng trên giao diện:

Người dùng có thể thêm mới mã tài sản khi mã tài sản đang ở trạng thái Enabled Hệ thống cho phép nhập các thông tin bao gồm tên tài sản, mã loại, mã nước, đơn vị tính, năm sản xuất, năm sử dụng, số lượng và mã đơn vị của tài sản.

Để sửa thông tin, hãy nhấp vào mục cần chỉnh sửa trong datagridview phía dưới Thông tin sẽ được hiển thị trên các ô textbox, combobox, v.v Sau đó, thực hiện thao tác nhấn nút sửa để lưu lại các thay đổi.

• Lưu: lưu thay đổi sau khi thao tác nút thêm.

• Xóa: xóa user trong danh sách Nếu mã tài sản đó có các ràng buộc liên quan thì không thể xóa.

Giao diện Nhà Cung Cấp

Giao diện Nhà Cung Cấp cho phép người dùng dễ dàng cập nhật, sửa đổi và xóa thông tin liên quan đến nhà cung cấp Tại đây, người dùng có thể xem chi tiết mã nhà cung cấp, tên, địa chỉ, số điện thoại, mã tài sản và Pax của tài sản.

Các chức năng trên giao diện:

Người dùng có thể thêm mới mã nhà cung cấp khi mã này đang ở trạng thái Enabled Hệ thống cho phép nhập các thông tin như tên nhà cung cấp, địa chỉ, số điện thoại, mã tài sản và Pax.

Để sửa thông tin, hãy nhấp vào mục cần chỉnh sửa trong datagridview bên dưới Thông tin sẽ được hiển thị trên các ô textbox, combobox, v.v Sau đó, thực hiện chỉnh sửa và nhấn nút sửa để lưu lại thông tin đã thay đổi.

• Lưu: lưu thay đổi sau khi thao tác nút thêm.

• Xóa: xóa user trong danh sách Nếu mã tài sản đó có các ràng buộc liên quan thì không thể xóa.

Giao diện Điều Chuyển Tài Sản

Giao diện này cho phép người dùng có thể cập nhật thêm, sửa, xóa thông tin điều chuyển tài sản.

Tại Giao diện Điều Chuyển Tài Sản, người dùng có thể xem thông tin chi tiết về mã tài sản, mã đơn vị bàn giao, tên đơn vị bàn giao, mã đơn vị nhận, tên đơn vị nhận, số lượng tài sản, ngày chuyển giao, và mã nhân viên thực hiện điều chuyển.

Các chức năng trên giao diện:

Mã tài sản hiện đang ở trạng thái Enabled, cho phép người dùng thực hiện thao tác thêm mới Hệ thống hỗ trợ thêm các thông tin như mã tài sản, mã đơn vị nhận, tên đơn nhận, ngày chuyển tài sản và mã nhân viên.

Để sửa thông tin, hãy nhấp vào mục cần chỉnh sửa trong datagridview bên dưới Thông tin sẽ hiển thị trên các ô textbox, combobox, v.v Sau đó, thực hiện chỉnh sửa và nhấn nút sửa để lưu lại thông tin đã thay đổi.

• Lưu: lưu thay đổi sau khi thao tác nút thêm.

• Xóa: xóa user trong danh sách Nếu mã tài sản đó có các ràng buộc liên quan thì không thể xóa.

Mã đơn vị bàn giao, tên đơn vị bàn giao và số lượng được tự động chọn từ mã tài sản, do đó người dùng không thể thêm hoặc sửa đổi thông tin này Khi mã tài sản được chọn, các thông tin liên quan sẽ tự động hiển thị.

• Ngày điều chuyển tài sản không thể nhỏ hơn ngày bắt đầu mua sử dụng tài sản.

Giao diện Kiểm Kê Tài Sản

Giao diện này cho phép người dùng có thể cập nhật thêm, sửa, xóa thông tin kiểm kê tình trạng tài sản.

Tại Giao diện Kiểm Kê Tài Sản, người dùng có thể truy cập thông tin chi tiết về mã số biên bản kiểm kê, mã tài sản, mã đơn vị, mã nhân viên, số lượng kiểm kê, ngày kiểm kê, tình trạng tài sản, số lượng hỏng, số lượng thanh lý và ghi chú về tình trạng của tài sản.

Các chức năng trên giao diện:

Mã số biên bản kiểm kê hiện đang ở trạng thái Enabled, cho phép người dùng thực hiện thao tác thêm mới Hệ thống hỗ trợ người dùng nhập mã số biên bản kiểm kê, mã tài sản, mã nhân viên, ngày kiểm kê, tình trạng, số lượng hỏng, số lượng thanh lý và ghi chú về tình trạng.

Để sửa thông tin, bạn chỉ cần nhấp vào dữ liệu cần chỉnh sửa trong datagridview bên dưới Thông tin sẽ được hiển thị trên các ô textbox, combobox,… Sau đó, hãy thực hiện thao tác nhấn nút sửa để lưu lại các thay đổi.

• Lưu: lưu thay đổi sau khi thao tác nút thêm.

• Xóa: xóa user trong danh sách Nếu mã tài sản đó có các ràng buộc liên quan thì không thể xóa.

Khi chọn mã tài sản, số lượng kiểm kê và mã đơn vị sẽ tự động được hiển thị, do đó không thể thêm hoặc sửa đổi số lượng kiểm kê và mã đơn vị từ mã tài sản đã được chọn.

• Ngày kiểm kê tài sản không thể nhỏ hơn ngày bắt đầu mua và sử dụng tài sản.

Giao diện Sửa Chữa Tài Sản

Giao diện này cho phép người dùng có thể cập nhật thêm, sửa, xóa thông tin sửa chữa tài sản.

Tại Giao diện Sửa Chữa Tài Sản, người dùng có thể xem thông tin chi tiết bao gồm mã cấp sửa chữa, tên cấp sửa chữa, mã tài sản, ngày cấp sửa chữa, ngày hoàn thành sửa chữa, số lượng sửa chữa và chi phí sửa chữa của tài sản.

Các chức năng trên giao diện:

Mã cấp sửa chữa hiện đang ở trạng thái Enabled, cho phép người dùng thực hiện thao tác thêm mới Hệ thống hỗ trợ người dùng nhập các thông tin cần thiết như mã cấp sửa chữa, tên cấp sửa chữa, mã tài sản, ngày cấp sửa chữa, ngày sửa chữa xong và chi phí.

Để sửa thông tin, hãy nhấp vào mục cần chỉnh sửa trong datagridview bên dưới Thông tin sẽ hiển thị trên các ô textbox, combobox, và bạn có thể thực hiện chỉnh sửa Sau khi hoàn tất, hãy nhấn nút sửa để lưu lại thông tin đã chỉnh sửa.

• Lưu: lưu thay đổi sau khi thao tác nút thêm.

• Xóa: xóa user trong danh sách Nếu mã tài sản đó có các ràng buộc liên quan thì không thể xóa.

Số lượng sửa chữa được tự động xác định từ mã tài sản, vì vậy không thể thêm hoặc chỉnh sửa Khi bạn chọn mã tài sản, số lượng sửa chữa sẽ tự động hiển thị.

• Cấp sửa chữa tài sản phải được đưa đi sửa chữa trong vòng 5 ngày không kể từ ngày kiểm kê.

Giao diện Thanh Lý Tài Sản

Giao diện Thanh Lý Tài Sản cho phép người dùng dễ dàng cập nhật, sửa đổi và xóa thông tin liên quan đến tài sản thanh lý Tại đây, người dùng có thể xem chi tiết các thông tin như mã tài sản, tên tài sản, mã đơn vị, mã nhân viên, số lượng, giá tiền, ngày thanh lý và lý do thanh lý tài sản.

Các chức năng trên giao diện:

Người dùng có thể thêm mới mã tài sản đang ở trạng thái Enabled thông qua thao tác nút thêm Hệ thống cho phép nhập mã nhân viên, giá tiền, ngày thanh lý và lý do liên quan.

Để sửa thông tin, bạn hãy nhấp vào mục cần chỉnh sửa trong datagridview bên dưới Thông tin sẽ hiển thị trên các ô textbox, combobox, v.v Sau đó, thực hiện chỉnh sửa và nhấn nút lưu để cập nhật thông tin.

• Lưu: lưu thay đổi sau khi thao tác nút thêm.

• Xóa: xóa user trong danh sách Nếu mã tài sản đó có các ràng buộc liên quan thì không thể xóa.

Tên tài sản, mã đơn vị và số lượng thanh lý được tự động lấy từ mã tài sản đã chọn, vì vậy không thể thực hiện việc thêm hoặc sửa đổi thông tin này Khi mã tài sản được chọn, các thông tin liên quan sẽ tự động hiển thị.

• Thanh lý tài sản phải được thực hiện và hoàn thành trong vòng 10 ngày không kể ngày kiểm kê tài sản.

Giao diện Khấu Hao Tài Sản

Giao diện này cho phép người dùng có thể cập nhật thêm, sửa, xóa thông tin khấu hao tài sản

Tại giao diện Khấu Hao Tài Sản, người dùng có thể xem thông tin chi tiết về mã tài sản, nguyên giá, số lượng, ngày sử dụng, ngày thanh lý, giá trị còn lại và thời gian khấu hao.

Các chức năng trên giao diện:

• Thêm: Mã tài sản đang ở trạng thái Enabled Thao tác nút thêm, hệ thống cho phép người dùng thêm mới mã tài sản, nguyên giá

Để sửa thông tin, hãy nhấp vào mục cần chỉnh sửa trong datagridview phía dưới Thông tin sẽ được hiển thị trên các ô textbox, combobox, v.v Sau đó, thực hiện thao tác nhấn nút sửa để lưu lại thông tin đã chỉnh sửa.

• Lưu: lưu thay đổi sau khi thao tác nút thêm.

• Xóa: xóa user trong danh sách Nếu mã tài sản đó có các ràng buộc liên quan thì không thể xóa.

Số lượng thanh lý, ngày sử dụng, ngày thanh lý, giá trị còn lại và thời gian khấu hao được tự động chọn từ mã tài sản, do đó không thể thêm hoặc sửa đổi thông tin này Khi bạn chọn mã tài sản, các thông tin như số lượng thanh lý, ngày sử dụng, ngày thanh lý và giá trị còn lại (giá tiền thanh lý) sẽ hiển thị tự động.

• Thời gian khấu hao được tính bằng Month(ngày thanh lý) – Month(ngày sử dụng).

Giao diện Thống Kê Tất Cả Tài Sản Theo Đơn Vị

Giao diện này cho phép người dùng có thể tạo báo cáo thống kê tất cả tài sản theo đơn vị

Tại Giao diện Thống Kê Tài Sản Theo Đơn Vị, người dùng có thể xem thông tin chi tiết về mã tài sản, tên tài sản, mã loại, tên loại, đơn vị tính, năm sản xuất, năm sử dụng và số lượng tài sản.

Các chức năng trên giao diện:

• Tạo báo cáo: tạo báo cáo sau mới chứa các thông tin trên

• Đóng: Đóng giao diện đang hiển thị form Main

• Khi chọn mã đơn vị thì tên đơn vị tự động xuất hiện được select theo mã đơn vị

• Để tạo báo cáo thì trước đó phải có một DataSet(DatasetTaiSan.xsd) và Crystall

Giao diện Thống Kê Tài Sản Theo Loại Tài Sản

Giao diện này cho phép người dùng có thể tạo báo cáo thống kê tất cả tài sản theo loại tài sản

Tại Giao diện Thống Kê Tài Sản Theo Loại Tài Sản, người dùng có thể xem thông tin chi tiết bao gồm mã đơn vị, mã tài sản, tên tài sản, số lượng, đơn vị tính và mã nước.

Các chức năng trên giao diện:

• Tạo báo cáo: tạo báo cáo sau mới chứa các thông tin trên

• Đóng: Đóng giao diện đang hiển thị form Main

• Khi chọn mã đơn vị thì tên đơn vị tự động xuất hiện được select theo mã đơn vị

• Để tạo báo cáo thì trước đó phải có một DataSet(DatasetTaiSan.xsd) và CrystalReport (rpThongKeTheoLoaiTS.rpt)

MÃ NGUỒN (SOURCE CODE)

Giao diện chức năng Form Main (Giao diện chương trình chính)

The provided code snippet includes essential namespaces for a C# application, such as System, System.Collections.Generic, System.Data, and System.Windows.Forms, which facilitate various functionalities like data handling and user interface development Additionally, it references the BTTHUHOACH.Class namespace, indicating the presence of custom classes within the project This structure is typical for applications that require database interaction and graphical user interface components.

{ public partial class frmMain : Form

{ public string tendangnhap = "", matkhau = "", quyen = ""; public frmMain()

}public frmMain(string tendangnhap, string matkhau, string quyen) { InitializeComponent(); this.tendangnhap tendangnhap; this.matkhau matkhau; this.quyen = quyen;

} private void Form1_Load(object sender, EventArgs e)

{ this.IsMdiContainer = true; this.WindowState = FormWindowState.Maximized;

}private void AddForm(Form frm)

{ frm.MdiParent = this; frm.TopMost = true; frm.WindowState = FormWindowState.Normal; frm.StartPosition = FormStartPosition.CenterScreen; frm.FormBorderStyle = FormBorderStyle.None; frm.Show();

} private void mnuthongtinTS_Click(object sender, EventArgs e) { frmtaisan frm = new frmtaisan();

} private void mnukhauhao_Click(object sender, EventArgs e) { frmkhauhao frm = new frmkhauhao(); AddForm(frm);

} private void mnudieuchuyen_Click(object sender, EventArgs e) { frmdieuchuyenTS frm = new frmdieuchuyenTS(); AddForm(frm);

} private void mnudonvi_Click(object sender, EventArgs e)

} private void mnuTShienco_Click(object sender, EventArgs e) { frmThongKeTheoPhanLoai frm = new frmThongKeTheoPhanLoai(); AddForm(frm);

} private void mnutatcaTS_Click(object sender, EventArgs e) { frmThongKeTheoDV frm = new frmThongKeTheoDV(); AddForm(frm);

} private void mnuthanhlyTS_Click(object sender, EventArgs e) { frmthanhlyTS frm = new frmthanhlyTS();

} private void mnuThoat_Click_1(object sender, EventArgs e) {

} private void mnuCapsuachua_Click(object sender, EventArgs e) { frmCapsuachuaTS frm = new frmCapsuachuaTS(); AddForm(frm);

} private void mnukiemkeTS_Click(object sender, EventArgs e) { frmkiemkeTS frm = new frmkiemkeTS(); AddForm(frm);

} private void mnuphanloai_Click(object sender, EventArgs e) { frmPhanloai frm = new frmPhanloai();

} private void mnunuoc_Click(object sender, EventArgs e)

{ frmNuoc frm = new frmNuoc(); AddForm(frm);

} private void mnuNCC_Click(object sender, EventArgs e)

{ frmnhacungcap frm = new frmnhacungcap(); AddForm(frm);

} private void mnuDoiMK_Click(object sender, EventArgs e) { frmDoiMatKhau frm = new frmDoiMatKhau(tendangnhap); AddForm(frm);

} private void mnuDangXuat_Click(object sender, EventArgs e) { frmLogin frm = new frmLogin(tendangnhap);

} private void mnuQuanlyNV_Click_1(object sender, EventArgs e) { if (quyen == "admin")

{ frmNhanVien frm = new frmNhanVien(); AddForm(frm);

MessageBox.Show("Thông tin này chỉ ADMIN mới có quyền thấy", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);

} } private void mnuTaiKhoan_Click(object sender, EventArgs e)

Mã nguồn chức năng Form Function (Kết nối tất cả các form lại với SQL SERVER)

Create a folder named "Class" that contains the Function class, utilizing essential namespaces such as System, System.Collections.Generic, System.Linq, System.Text, System.Threading.Tasks, System.Data.SqlClient, System.Data, and System.Windows.Forms, within the BTTHUHOACH namespace.

{ public static SqlConnection Con = new SqlConnection(@"Data SourceKTOP- DG89C7T\SQLEXPRESS;Initial Catalog=Quanlytaisancongty;Integrated Security=True; "); public static void myconnect()

{ if (Con.State == ConnectionState.Open) Con.Close();

// Phương thức thực thi câu lệnh Select public static DataTable Taobang(string sql)

SqlDataAdapter ds = new SqlDataAdapter(sql, Con); ds.Fill(dt); return dt;

}// Phương thức thực thi câu lệnh Insert, Update, Delete public static void RunSqlDel(string sql)

SqlCommand(); cmd.Connection Function.Con; cmd.CommandText sql; try{ cmd.ExecuteNonQuery();

}//Hàm kiểm tra khoá trùng public static bool KiemtraMa(string sql)

{ SqlDataAdapter dap = new SqlDataAdapter(sql, Con);

DataTable table = new DataTable(); dap.Fill(table); if (table.Rows.Count > 0) return true; else return false;

} public static string GetFieldValues(string sql)

SqlCommand cmd = new SqlCommand(sql,

Con); SqlDataReader reader; reader = cmd.ExecuteReader(); while (reader.Read()) ma = reader.GetValue(0).ToString(); reader.Close(); return ma;

} public static void FillCombo(string sql, ComboBox cbo, string ma, string ten)

SqlDataAdapter dap = new SqlDataAdapter(sql, Con);

DataTable table = new DataTable(); dap.Fill(table); cbo.DataSource = table; cbo.ValueMember = ma; cbo.DisplayMember } ten;

Mã nguồn chức năng Form Tài Khoản

The article discusses the use of various namespaces in a C# application, including System, System.Collections.Generic, System.ComponentModel, System.Data, System.Drawing, System.Linq, System.Text, System.Threading.Tasks, System.Windows.Forms, and System.Data.SqlClient It highlights the integration of these namespaces within the BTTHUHOACH project, showcasing their roles in enhancing functionality and data management in Windows Forms applications.

{ public partial class frmTaiKhoan : Form

}private void frmTaiKhoan_Load(object sender, EventArgs e)

Function.FillCombo("SELECT manv, tennv FROM NHANVIEN", cmbmanv, "manv",

"manv"); cmbmanv.SelectedIndex = -1; txttendangnhap.Enabled = false;

{ string sql; sql = "SELECT tendangnhap, quyen, trangthai, manv FROM

The code snippet initializes a DataTable named "tblTaiKhoan" using a SQL query and sets it as the data source for a DataGridView called "dgvTaiKhoan." It configures the column headers to display "Username," "Role," "Status," and "Employee ID," while also specifying the width for each column The DataGridView is set to prevent users from adding new rows and is configured to allow programmatic editing only A method named "ResetValue" is defined but not fully implemented in the provided code.

{ txttendangnhap.Text = ""; txtmatkhau1.Text = ""; txtmatkhau2.Text = ""; cmbquyen.Text = ""; ckbtrangthai.Checked = false; cmbmanv.Text = "";

}private void btnThem_Click(object sender, EventArgs e)

{ if (btnThem.Text.Equals("Thêm"))

} else{ btnSua.Enabled = false; btnXoa.Enabled = false; btnDong.Enabled = true;

ResetValue(); txttendangnhap.Enabled = true; txttendangnhap.Focus(); btnThem.Text = "Lưu"; string sql; if (txttendangnhap.Text.Trim().Length == 0) {

MessageBox.Show("Bạn phải nhập tên đăng nhập", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); txttendangnhap.Focus(); return;

} if (txtmatkhau1.Text.Trim().Length == 0) {

MessageBox.Show("Bạn phải nhập mật khẩu", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); txtmatkhau1.Focus(); return;

} if (txtmatkhau2.Text.Trim().Length == 0)

MessageBox.Show("Bạn phải nhập lại mật khẩu", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); txtmatkhau2.Focus(); return;

} if (txtmatkhau2.Text != txtmatkhau1.Text) {

MessageBox.Show("Mật khẩu không trùng khớp", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); txtmatkhau2.Text = ""; txtmatkhau2.Focus(); return;

} if (cmbmanv.Text.Trim().Length == 0) {

MessageBox.Show("Bạn phải chọn mã nhân viên", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); cmbmanv.Focus()

} if (ckbtrangthai.Checked == true) { ckbtrangthai.Text = "Đang hoạt động";

The SQL query checks if a username already exists in the TAIKHOAN table by selecting the username that matches the input from the user If the username is found, a warning message is displayed, prompting the user to choose a different username, and the input field is focused for correction.

}sql = "INSERT INTO TAIKHOAN VALUES(N'" + txttendangnhap.Text + "',N'" + txtmatkhau1.Text + "', N'" + cmbquyen.Text + "', N'" + ckbtrangthai.Text + "', N'" + cmbmanv.SelectedValue + "')";

ResetValue(); btnXoa.Enabled = true; btnSua.Enabled = true; btnDong.Enabled = false; txttendangnhap.Enabled = false; btnThem.Text = "Thêm";

} private void btnsua_Click(object sender, EventArgs e)

{ string sql; if (tblTaiKhoan.Rows.Count == 0)

MessageBox.Show("Không còn dữ liệu", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return;

MessageBox.Show("Bạn chưa chọn bản ghi nào", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return;

} sql = "UPDATE TAIKHOAN SET matkhau = N'" + txtmatkhau1.Text.ToString() + "', quyen = N'" + cmbquyen.Text + "', trangthai = N'" + ckbtrangthai.Text + "', manv = N'" + cmbmanv.SelectedValue + "' WHERE tendangnhap =N'" + txttendangnhap.Text + "'";

} private void btnXoa_Click(object sender, EventArgs e)

{ string sql; if (tblTaiKhoan.Rows.Count == 0)

{ MessageBox.Show("Không còn dữ liệu", "Thông báo",

MessageBoxButtons.OK, MessageBoxIcon.Information); return;

MessageBox.Show("Bạn chưa chọn bản ghi nào", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return;

} if (MessageBox.Show("Bạn có muốn xoá không?", "Thông báo",

MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)

{ sql = "DELETE TAIKHOAN WHERE tendangnhap=N'" + txttendangnhap.Text + "'

}private void btnDong_Click(object sender, EventArgs e)

} private void dgvTaiKhoan_Click(object sender, EventArgs e)

MessageBox.Show("Đang ở chế độ thêm mới!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); txttendangnhap.Focus(); return;

If there is no data available, a message box will display the notification "No data!" with an information icon The function will then return, preventing further execution If data is present, the username, role, and status from the selected row in the account data grid will be retrieved and displayed in their respective fields Specifically, if the status is "Active," additional actions may be triggered based on this condition.

= true; ckbtrangthai.Checked = false; cmbmanv.Text = dgvTaiKhoan.CurrentRow.Cells["manv"].Value.ToString(); btnSua.Enabled = true; btnXoa.Enabled = true; btnDong.Enabled = true;

Mã nguồn chức năng Form Login

The code snippet is a C# program that utilizes various namespaces such as System, System.Collections.Generic, System.ComponentModel, System.Data, System.Drawing, System.Linq, System.Text, System.Threading.Tasks, System.Windows.Forms, and System.Data.SqlClient It is part of the BTTHUHOACH namespace, indicating its association with a specific project or application.

{ public partial class frmLogin : Form

{ public string tendangnhap; public frmLogin()

}private void frmLogin_Load(object sender, EventArgs e)

} private void btnlogin_Click(object sender, EventArgs e)

SqlDataAdapter da = new SqlDataAdapter("SELECT * FROM TAIKHOAN WHERE tendangnhap

= N'" + txttendangnhap.Text + "' AND matkhau = N'" + txtmatkhau.Text + "' ", Function.Con);

DataTable d = new DataTable(); da.Fill(d); if (d.Rows.Count > 0)

{ MessageBox.Show("Đăng nhập thành công", "Thông báo",

MessageBoxButtons.OK, MessageBoxIcon.Information); this.Hide(); frmMain frm = new frmMain(d.Rows[0][0].ToString(), d.Rows[0][1].ToString(), d.Rows[0] [2].ToString()); frm.Show();

MessageBox.Show("Đăng nhập thất bại"); private void btncancel_Click(object sender, EventArgs e)

Mã nguồn chức năng Form Đổi Mật Khẩu

The provided code snippet demonstrates the use of various namespaces in a C# application, including System, System.Collections.Generic, System.ComponentModel, System.Data, System.Drawing, System.Linq, System.Text, System.Threading.Tasks, and System.Windows.Forms It also incorporates a custom class from the BTTHUHOACH namespace and establishes a connection to a SQL Server database using System.Data.SqlClient.

{ public partial class frmDoiMatKhau : Form

{ public string user; public frmDoiMatKhau()

}private void frmDoiMatKhau_Load(object sender, EventArgs e)

{ txtuser.Text = user; txtuser.Enabled = false;

}private void btnXacnhan_Click(object sender, EventArgs e)

DataTable d; da = new SqlDataAdapter("SELECT * FROM TAIKHOAN WHERE tendangnhap N'" + txtuser.Text + "' AND matkhau = N'" + txtmatkhaucu.Text + "' ", Function.Con); d = new DataTable(); da.Fill(d); if (d.Rows.Count > 0)

{ if (txtmatkhaumoi.Text == txtmatkhaumoi2.Text) { da = new SqlDataAdapter("UPDATE TAIKHOAN SET matkhau = N'" + txtmatkhaumoi.Text + "' WHERE tendangnhap = N'" + txtuser.Text + "'", Function.Con); da.Fill(d);

MessageBox.Show("Đổi mật khẩu thành công !", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close();

} else{ errorProvider1.SetError(txtmatkhaumoi, "Bạn chưa điền mật khẩu !");

} else{ errorProvider1.SetError(txtmatkhaumoi2, "Nhập lại mật khẩu chưa đúng errorProvider1.SetError(txtmatkhaucu, "Mật khẩu cũ không đúng

} } private void btnhuy_Click(object sender, EventArgs e) { this.Close();

Mã nguồn chức năng Form Nhân Viên

using System; using System.Coll ections.Gen eric; using System.Co mponentMo del; using System.Dat a; us i ng

S ys te m D ra w in g; u s in g

Syst em.Data.S qlCli ent; namespa ce

ACH{ public partial class frmNhanVien : Form {

Da t aT ab l e tb ln ha n vi en

} private void frmQuanlynhanvien_Load(object sender, EventArgs e) { txt m anv.

.Taoban g(sql); dgvnhan vien.Dat aSource tblnhanv ien;dgvnhan vien.Col umns[0]

.HeaderT ext "Mã nhân viên" dgvnhan vien.Col umns[1]

.HeaderT ext "Tên nhân viên" dgvnhan vien.Col umns[2]

.HeaderT ext "Ngày sinh" dgvnhan vien.Col umns[3]

.HeaderT ext "Giới tính" dgvnhan vien.Col umns[4 ].Heade rText "Địa chỉ" dgvnha nvien.C olumns[ 5].Head erText điện thoại" dgvnha nvien.C olumns[ 6].Head erText

The "Chức vụ" (Position) data grid view has specific column widths set for optimal display: the first column is 100 pixels, the second is 200 pixels, the third is 120 pixels, the fourth is 100 pixels, the fifth is 120 pixels, the sixth is 100 pixels, and the seventh is 150 pixels Additionally, the data grid view does not allow users to add new rows and is configured to be edited programmatically.

{ txtmanv.Text = ""; txttennv.Text = ""; txtsdt.Text = ""; txtdiachi.Text = ""; cmbgioitinh.Text = ""; cmbchucvu.Text = "";

Trong ứng dụng, người dùng có thể chọn giới tính từ các tùy chọn: "Nam", "Nữ" và "Khác" Bên cạnh đó, danh sách chức vụ bao gồm các lựa chọn như "Nhân viên", "Quản lý", "Giám đốc" và "Phó giám đốc".

} private void dgvnhanvien_Click(object sender, EventArgs e)

{ MessageBox.Show("Đang ở chế độ thêm mới!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); txtmanv.Focus(); return;

MessageBox.Show("Không có dữ liệu!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return;

The code retrieves and displays employee information from a data grid view, assigning the employee ID, name, birth date, gender, address, and phone number to respective text fields and controls.

= dgvnhanvien.CurrentRow.Cells["sdt"].Value.ToString(); cmbchucvu.Text dgvnhanvien.CurrentRow.Cells["chucvu"].Value.ToString(); btnSua.Enabled = true; btnXoa.Enabled = true; btnDong.Enabled = true;

}private void btnThem_Click(object sender, EventArgs e)

{ if (btnThem.Text.Equals("Thêm"))

{ btnSua.Enabled = false; btnXoa.Enabled = false; btnDong.Enabled = true;

To enable the employee ID input field, set `txtmanv.Enabled` to true and focus on it Change the button text to "Save" If the employee ID (`txtmanv.Text`) is empty after trimming, display a message box prompting the user to enter the employee ID and return focus to the input field.

} if (txttennv.Text.Trim().Length == 0) { MessageBox.Show("Bạn phải nhập tên nhân viên", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); txttennv.Focus(); return;

} if (txtdiachi.Text.Trim().Length == 0) { MessageBox.Show("Bạn phải nhập địa chỉ", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); txtdiachi.Focus(); return;

} if (txtsdt.Text.Trim().Length == 0) { MessageBox.Show("Bạn phải nhập số điện thoại", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); txtsdt.Focus(); return;

"'"; sql = "Select manv From NHANVIEN where manv= N'" + txtmanv.Text.Trim() + if (Function.KiemtraMa(sql)) {

MessageBox.Show("Mã đơn vị này đã có, bạn phải nhập mã khác", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); txtmanv.Focus(); return;

} sql = "INSERT INTO NHANVIEN VALUES(N'" + txtmanv.Text + "',N'" + txttennv.Text + "', N'" + dateTimePicker1.Value.Date + "', N'" + cmbgioitinh.Text + "', N'" + txtdiachi.Text + "', N'" + txtsdt.Text + "', N'" + cmbchucvu.Text + "' )";

ResetValue(); btnXoa.Enabled = true; btnSua.Enabled = true; btnDong.Enabled = false; txtmanv.Enabled = false; btnThem.Text = "Thêm";

} private void btnSua_Click(object sender, EventArgs e)

{ string sql; if (tblnhanvien.Rows.Count == 0)

MessageBox.Show("Không còn dữ liệu", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return;

MessageBox.Show("Bạn chưa chọn bản ghi nào", "Thông báo",MessageBoxButtons.OK, MessageBoxIcon.Information); return;

} if (txttennv.Text.Trim().Length == 0)

{ MessageBox.Show("Bạn chưa nhập tên nhân viên", "Thông báo",

MessageBoxButtons.OK, MessageBoxIcon.Information); return;

} if (txtdiachi.Text.Trim().Length == 0)

{ MessageBox.Show("Bạn chưa nhập địa chỉ", "Thông báo",

MessageBoxButtons.OK, MessageBoxIcon.Information); return;

}if (txtsdt.Text.Trim().Length == 0)

MessageBox.Show("Bạn chưa nhập số điện thoại", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return;

} sql = "UPDATE NHANVIEN SET tennv = N'" + txttennv.Text.ToString() + "', ngaysinh

= N'" + dateTimePicker1.Value.Date + "', gioitinh = N'" + cmbgioitinh.Text + "', diachi = N'" + txtdiachi.Text + "', sdt = N'" + txtsdt.Text + "', chucvu = N'" + cmbchucvu.Text + "' WHERE manv=N'" + txtmanv.Text + "'";

} private void btnXoa_Click(object sender, EventArgs e)

{ string sql; if (tblnhanvien.Rows.Count == 0)

MessageBox.Show("Không còn dữ liệu", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return;

{ MessageBox.Show("Bạn chưa chọn bản ghi nào", "Thông báo",

MessageBoxButtons.OK, MessageBoxIcon.Information); return;

} if (MessageBox.Show("Bạn có muốn xoá không?", "Thông báo",

MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)

{ sql = "DELETE NHANVIEN WHERE manv=N'" + txtmanv.Text +

}private void btnDong_Click(object sender, EventArgs e)

Mã nguồn chức năng Form Đơn Vị

The provided code snippet demonstrates the use of various namespaces in a C# application, including System, System.Collections.Generic, System.ComponentModel, System.Data, System.Drawing, System.Linq, System.Text, System.Threading.Tasks, System.Windows.Forms, and System.Data.SqlClient It is part of the BTTHUHOACH namespace, which likely relates to a specific project or application functionality.

{ public partial class frmDonVi : Form

}private void Form2_Load(object sender, EventArgs e)

The SQL query "SELECT * FROM DONVI" retrieves all records from the DONVI table, which are then displayed in a DataGridView named dgvDonVi The columns are customized with headers such as "Mã đơn vị" for the unit code, "Tên đơn vị" for the unit name, "Số người" for the number of people, "Địa chỉ" for the address, and "Số điện thoại" for the phone number Each column is assigned a specific width to enhance readability, with widths set at 100, 200, 100, 250, and 150 pixels respectively Additionally, users are restricted from adding new rows, and the DataGridView is set to allow programmatic editing only.

} private void dgvDonVi_Click(object sender, EventArgs e)

MessageBox.Show("Đang ở chế độ thêm mới!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); txtmadv.Focus(); return;

MessageBox.Show("Không có dữ liệu!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return;

The current row of the data grid view (dgvDonVi) is used to populate various text fields: the code (madv) is assigned to txtmadv, the name (tendv) to txttendv, the number of people (songuoi) to txtsonguoi, the address (diachi) to txtdiachi, and the phone number (sdt) to txtsdt Additionally, the buttons for editing (btnsua), deleting (btnXoa), and closing (btnDong) are enabled, allowing for further actions on the selected entry.

} private void btnThem_Click(object sender, EventArgs e)

{ if (btnThem.Text.Equals("Thêm"))

{ btnsua.Enabled = false; btnXoa.Enabled = false; btnDong.Enabled = true;

ResetValue(); txtmadv.Enabled = true; txtmadv.Focus(); btnThem.Text = "Lưu"; string sql; if (txtmadv.Text.Trim().Length == 0) {

MessageBox.Show("Bạn phải nhập mã đơn vị", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); txtmadv.Focus(); return;

}if (txttendv.Text.Trim().Length == 0) {

MessageBox.Show("Bạn phải nhập tên đơn vị", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); txttendv.Focus(); return;

}if (txtsonguoi.Text.Trim().Length == 0) { MessageBox.Show("Bạn phải nhập số người", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); txtsonguoi.Focus(); return;

} if (txtdiachi.Text.Trim().Length == 0) {

MessageBox.Show("Bạn phải nhập địa chỉ", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); txtdiachi.Focus(); return;

}if (txtsdt.Text.Trim().Length == 0) {

MessageBox.Show("Bạn phải nhập số điện thoại", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); txtsdt.Focus(); return;

} sql = "Select madv From DONVI where madv= N'" + txtmadv.Text.Trim() + "'"; if (Function.KiemtraMa(sql))

{ MessageBox.Show("Mã đơn vị này đã có, bạn phải nhập mã khác", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); txtmadv.Focus(); return;

} sql = "INSERT INTO DONVI VALUES(N'" + txtmadv.Text + "',N'" + txttendv.Text + "', N'" + txtsonguoi.Text + "', N'" + txtdiachi.Text + "', N'" + txtsdt.Text + "' )";

ResetValue(); btnXoa.Enabled = true; btnsua.Enabled = true; btnDong.Enabled = false; txtmadv.Enabled = false; btnThem.Text = "Thêm";

{ txtmadv.Text = ""; txttendv.Text = ""; txtsonguoi.Text = ""; txtdiachi.Text = ""; txtsdt.Text = "";

} private void btnXoa_Click(object sender, EventArgs e)

{ string sql; if (tbldonvi.Rows.Count == 0)

MessageBox.Show("Không còn dữ liệu", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return;

MessageBox.Show("Bạn chưa chọn bản ghi nào", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return;

} if (MessageBox.Show("Bạn có muốn xoá không?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)

{ sql = "DELETE DONVI WHERE madv=N'" + txtmadv.Text +

} private void btnsua_Click(object sender, EventArgs e)

{ string sql; if (tbldonvi.Rows.Count == 0)

MessageBox.Show("Không còn dữ liệu", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return;

{ MessageBox.Show("Bạn chưa chọn bản ghi nào", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return;

} if (txttendv.Text.Trim().Length == 0)

{ MessageBox.Show("Bạn chưa nhập tên đơn vị", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return;

} if (txtsonguoi.Text.Trim().Length == 0)

{ MessageBox.Show("Bạn chưa nhập số người", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return;

} if (txtdiachi.Text.Trim().Length == 0)

MessageBox.Show("Bạn chưa nhập địa chỉ", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return;

} if (txtsdt.Text.Trim().Length == 0)

{ MessageBox.Show("Bạn chưa nhập số điện thoại", "Thông báo",

MessageBoxButtons.OK, MessageBoxIcon.Information); return;

} sql = "UPDATE DONVI SET tendv = N'" + txttendv.Text.ToString() + "', songuoi = N'" + txtsonguoi.Text + "', diachi = N'" + txtdiachi.Text + "', sdt = N'" + txtsdt.Text + "' WHERE madv=N'" + txtmadv.Text + "'";

} private void btnDong_Click(object sender, EventArgs e)

Mã nguồn chức năng Form Phân Loại

The provided code snippet is a C# program that utilizes various namespaces, including System, System.Collections.Generic, System.ComponentModel, System.Data, System.Drawing, System.Linq, System.Text, System.Threading.Tasks, System.Windows.Forms, and System.Data.SqlClient It is part of the BTTHUHOACH namespace, indicating its function within a specific application context.

{ public partial class frmPhanloai : Form

} private void frmPhanloai_Load(object sender, EventArgs e)

The SQL query "SELECT * FROM LOAITAISAN" is executed to retrieve data, which is then used to create a data table for displaying asset classifications The data source for the DataGridView, dgvPhanloaiTS, is set to the retrieved table The column headers are defined as "Mã loại tài sản" for the first column and "Tên loại tài sản" for the second, with respective widths of 200 and 300 pixels User additions to the rows are disabled, and the DataGridView is set to allow programmatic editing only.

} private void dgvPhanloaiTS_Click(object sender, EventArgs e)

{ MessageBox.Show("Đang ở chế độ thêm mới!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); txtmaloai.Focus(); return;

MessageBox.Show("Không có dữ liệu!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return;

}txtmaloai.Text = dgvPhanloaiTS.CurrentRow.Cells["maloai"].Value.ToString(); txttenloai.Text = dgvPhanloaiTS.CurrentRow.Cells["tenloai"].Value.ToString(); btnSua.Enabled = true; btnXoa.Enabled = true; btnDong.Enabled = true;

} private void btnThem_Click(object sender, EventArgs e)

{ if (btnThem.Text.Equals("Thêm"))

} else{ btnSua.Enabled = false; btnXoa.Enabled = false; btnDong.Enabled = true;

To ensure proper functionality, reset the value of the input field and enable it for user interaction Set focus on the 'txtmaloai' field and change the button text to "Save." If the input field is empty, display a message box prompting the user to enter the asset type code, then redirect focus back to the input field for correction.

} if (txttenloai.Text.Trim().Length == 0) { MessageBox.Show("Bạn phải nhập tên loại tài sản", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); txttenloai.Focus(); return;

} sql = "Select maloai From LOAITAISAN where maloai= N'" + txtmaloai.Text.Trim() + "'"; if (Function.KiemtraMa(sql)){

MessageBox.Show("Mã đơn vị này đã có, bạn phải nhập mã khác", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); txtmaloai.Focus(); return;

} sql = "INSERT INTO LOAITAISAN VALUES(N'" + txtmaloai.Text + "',N'" + txttenloai.Text + "')";

ResetValue(); btnThem.Text = "Thêm"; btnXoa.Enabled = true; btnSua.Enabled = true; btnDong.Enabled = false; txtmaloai.Enabled = false;

} } private void btnSua_Click(object sender, EventArgs e)

{ string sql; if (tblPhanloai.Rows.Count == 0)

MessageBox.Show("Không còn dữ liệu", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return;

{ MessageBox.Show("Bạn chưa chọn bản ghi nào", "Thông báo",

MessageBoxButtons.OK, MessageBoxIcon.Information); return;

} if (txttenloai.Text.Trim().Length == 0)

{ MessageBox.Show("Bạn chưa nhập tên loại", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return; sql = "UPDATE LOAITAISAN SET tenloai = N'" + txttenloai.Text.ToString() + "' }

} private void btnXoa_Click(object sender, EventArgs e)

{ string sql; if (tblPhanloai.Rows.Count == 0)

MessageBox.Show("Không còn dữ liệu", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return;

{ MessageBox.Show("Bạn chưa chọn bản ghi nào", "Thông báo",

MessageBoxButtons.OK, MessageBoxIcon.Information); return; if (MessageBox.Show("Bạn có muốn xoá không?", "Thông báo",}

MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)

{ sql = "DELETE LOAITAISAN WHERE maloai=N'" + txtmaloai.Text + "'";

} private void btnDong_Click(object sender, EventArgs e)

Mã nguồn chức năng Form Nước

The article discusses the use of various namespaces in a C# application, specifically focusing on System, System.Collections.Generic, System.ComponentModel, System.Data, System.Drawing, System.Linq, System.Text, System.Threading.Tasks, System.Windows.Forms, and System.Data.SqlClient It is part of the BTTHUHOACH namespace, which likely indicates a project related to data management or user interface development The inclusion of these namespaces suggests a comprehensive approach to handling data operations and graphical elements within the application.

{ public partial class frmNuoc : Form

} private void frmNuoc_Load(object sender, EventArgs e)

In the provided code snippet, a SQL query is executed to select all records from the "NUOC" table, which is then assigned to a data table named `tblNuoc` This data table serves as the data source for a DataGridView control called `dgvNuoc` The column headers are customized to display "Mã nước" for the first column and "Tên nước" for the second column, with specified widths of 100 and 200 pixels, respectively User interaction is restricted by disabling the ability to add new rows, and the DataGridView is set to allow programmatic editing only Additionally, a method named `ResetValue` is defined, although its implementation is not provided.

} private void dgvNuoc_Click(object sender, EventArgs e)

{ MessageBox.Show("Đang ở chế độ thêm mới!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); txtmanuoc.Focus(); return;

MessageBox.Show("Không có dữ liệu!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return;

} txtmanuoc.Text = dgvNuoc.CurrentRow.Cells["manuoc"].Value.ToString(); txttennuoc.Text = dgvNuoc.CurrentRow.Cells["tennuoc"].Value.ToString(); btnSua.Enabled = true; btnXoa.Enabled = true; btnDong.Enabled = true;

} private void btnThem_Click(object sender, EventArgs e)

{ if (btnThem.Text.Equals("Thêm"))

{ btnSua.Enabled = false; btnXoa.Enabled = false; btnDong.Enabled = true;

ResetValue(); txtmanuoc.Enabled = true; txtmanuoc.Focus(); btnThem.Text = "Lưu"; string sql; //Lưu lệnh sql if (txtmanuoc.Text.Trim().Length == 0) {

MessageBox.Show("Bạn phải nhập mã nước", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); txtmanuoc.Focus(); return;

} if (txttennuoc.Text.Trim().Length == 0) { MessageBox.Show("Bạn phải nhập tên nước", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); txttennuoc.Focus(); return;

"'"; sql = "Select manuoc From NUOC where manuoc= N'" + txtmanuoc.Text.Trim()

+ if (Function.KiemtraMa(sql)) { MessageBox.Show("Mã đơn vị này đã có, bạn phải nhập mã khác", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); txtmanuoc.Focus(); return;

} sql = "INSERT INTO NUOC VALUES(N'" + txtmanuoc.Text + "',N'" + txttennuoc.Text + "')";

ResetValue(); btnThem.Text = "Thêm"; btnXoa.Enabled = true; btnSua.Enabled = true; btnDong.Enabled = false; txtmanuoc.Enabled = false;

} } private void btnSua_Click(object sender, EventArgs e)

{ string sql; //Lưu câu lệnh sql if

MessageBox.Show("Không còn dữ liệu", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return;

MessageBox.Show("Bạn chưa chọn bản ghi nào", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return;

}if (txttennuoc.Text.Trim().Length == 0)

MessageBox.Show("Bạn chưa nhập tên nước", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return;

} sql = "UPDATE NUOC SET tennuoc = N'" + txttennuoc.Text.ToString() + "' WHERE manuoc =N'" + txtmanuoc.Text + "'";

} private void btnXoa_Click(object sender, EventArgs e)

{ string sql; if (tblNuoc.Rows.Count == 0)

MessageBox.Show("Không còn dữ liệu", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return;

MessageBox.Show("Bạn chưa chọn bản ghi nào", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return; if (MessageBox.Show("Bạn có muốn xoá không?", "Thông báo",}

MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)

{ sql = "DELETE NUOC WHERE manuoc=N'" + txtmanuoc.Text +

} } private void btnDong_Click(object sender, EventArgs e)

Mã nguồn chức năng Form Tài Sản

The code snippet provided includes essential namespaces for a C# application, such as System, System.Collections.Generic, and System.Windows.Forms, which are crucial for building Windows Forms applications It also references System.Data and System.Data.SqlClient for database operations, indicating that the application may involve data handling and SQL database interactions The use of BTTHUHOACH.Class suggests a custom class structure within the application, likely designed for specific functionality related to the project's goals.

{ public partial class frmtaisan : Form

} private void Form5_Load(object sender, EventArgs e)

{ Function.FillCombo("SELECT maloai, tenloai FROM LOAITAISAN", cmbmaloai,

Function.FillCombo("SELECT manuoc, tennuoc FROM NUOC", cmbmanuoc, "manuoc",

Function.FillCombo("SELECT madv, tendv FROM DONVI", cmbmadv, "madv",

"madv"); cmbmadv.SelectedIndex = -1; txtmaTS.Enabled = false;

The SQL query "SELECT * FROM TAISAN" retrieves all records from the TAISAN table, which is then displayed in the dgvThongtinTS data grid view The columns are labeled with headers such as "Mã tài sản" (Asset ID), "Tên tài sản" (Asset Name), "Mã loại" (Type ID), "Mã nước" (Country Code), "Đơn vị tính" (Unit of Measure), "Năm sản xuất" (Year of Manufacture), "Năm sử dụng" (Year of Use), "Số lượng" (Quantity), and "Mã đơn vị" (Unit Code) Each column is assigned a specific width to enhance readability, and the data grid view is configured to prevent users from adding new rows while allowing programmatic editing.

} private void dgvThongtinTS_Click(object sender, EventArgs e)

{ MessageBox.Show("Đang ở chế độ thêm mới!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); txtmaTS.Focus(); return;

MessageBox.Show("Không có dữ liệu!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return;

The current row's data from the dgvThongtinTS grid is used to populate various fields, including the asset code (maTS), asset name (tenTS), asset type (maloai), country of origin (manuoc), unit of measurement (donvitinh), manufacturing year (namsx), expiration year (namsd), quantity (soluong), and vendor (madv) Additionally, the edit (btnSua), delete (btnXoa), and close (btnDong) buttons are enabled for user interaction.

{ txtmaTS.Text = ""; txttenTS.Text = ""; txtdvtinh.Text = ""; txtsoluong.Text = ""; cmbmaloai.Text = ""; cmbmanuoc.Text = "";

}private void btnThem_Click(object sender, EventArgs e)

{ if (btnThem.Text.Equals("Thêm"))

} else{ btnSua.Enabled = false; btnXoa.Enabled = false; btnDong.Enabled = true;

ResetValue(); txtmaTS.Enabled = true; txtmaTS.Focus(); btnThem.Text = "Lưu"; string sql; if (txtmaTS.Text.Trim().Length == 0) {

MessageBox.Show("Bạn phải nhập mã đơn vị", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); txtmaTS.Focus(); return;

} if (txttenTS.Text.Trim().Length == 0) { MessageBox.Show("Bạn phải nhập tên tài sản", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); txttenTS.Focus(); return;

58 if (cmbmaloai.Text.Trim().Length == 0) {

MessageBox.Show("Bạn phải chọn mã loại", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); cmbmaloai.Focus(); return;

} if (cmbmanuoc.Text.Trim().Length == 0) {

MessageBox.Show("Bạn phải chọn mã nước", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); cmbmanuoc.Focus(); return;

} if (txtdvtinh.Text.Trim().Length == 0) { MessageBox.Show("Bạn phải nhập đơn vị tính", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); txtdvtinh.Focus(); return;

}if (dateTimePicker1.Text.Trim().Length == 0) {

MessageBox.Show("Bạn phải nhập đơn vị tính", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); dateTimePicker1.Focus(); return;

} if (dateTimePicker2.Text.Trim().Length == 0) {

MessageBox.Show("Bạn phải nhập đơn vị tính", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); dateTimePicker2.Focus(); return;

} if (txtsoluong.Text.Trim().Length == 0) {

MessageBox.Show("Bạn phải nhập số lượng", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); txtsoluong.Focus(); return;

} if (cmbmadv.Text.Trim().Length == 0) {

MessageBox.Show("Bạn phải nhập mã đơn vị", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); txtsoluong.Focus(); return;

} if (dateTimePicker1.Value.Date > dateTimePicker2.Value.Date) {

MessageBox.Show("Ngày mua sử dụng không thể nhỏ hơn ngày sản xuất" + dateTimePicker1.Value.Date, "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); dateTimePicker2.Text = ""; dateTimePicker2.Focus(); return;

} sql = "Select maTS From TAISAN where maTS= N'" + txtmaTS.Text.Trim() + "'"; if (Function.KiemtraMa(sql))

The system displays a warning message stating, "This unit code already exists; please enter a different code," prompting the user to focus on the input field The SQL command is structured to insert a new asset into the TAISAN table, capturing essential details such as the asset code, asset name, type code, country code, unit of measurement, and relevant date values.

ResetValue(); btnThem.Text = "Thêm"; btnXoa.Enabled = true; btnSua.Enabled = true; btnDong.Enabled = false; txtmaTS.Enabled = false;

} private void btnXoa_Click(object sender, EventArgs e)

{ string sql; if (tbltaisan.Rows.Count == 0)

MessageBox.Show("Không còn dữ liệu", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return;

{ MessageBox.Show("Bạn chưa chọn bản ghi nào", "Thông báo",

MessageBoxButtons.OK, MessageBoxIcon.Information); return;

} if (MessageBox.Show("Bạn có muốn xoá không?", "Thông báo",

MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)

{ sql = "DELETE TAISAN WHERE maTS=N'" + txtmaTS.Text + "'";

}private void btnSua_Click(object sender, EventArgs e)

{ string sql; if (tbltaisan.Rows.Count == 0)

MessageBox.Show("Không còn dữ liệu", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return;

{ MessageBox.Show("Bạn chưa chọn bản ghi nào", "Thông báo",

MessageBoxButtons.OK, MessageBoxIcon.Information); return;

} if (txttenTS.Text.Trim().Length == 0)

MessageBox.Show("Bạn chưa nhập tên tài sản", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return;

} if (cmbmaloai.Text.Trim().Length == 0)

MessageBox.Show("Bạn chưa nhập mã loại", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return;

}if (cmbmanuoc.Text.Trim().Length == 0)

{ MessageBox.Show("Bạn chưa nhập mã nước", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return;

} if (txtsoluong.Text.Trim().Length == 0)

{ MessageBox.Show("Bạn chưa nhập số lượng", "Thông báo",

MessageBoxButtons.OK, MessageBoxIcon.Information); return;

} if (cmbmadv.Text.Trim().Length == 0)

MessageBox.Show("Bạn chưa nhập mã đơn vị", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return;

}if (dateTimePicker1.Text.Trim().Length == 0)

{ MessageBox.Show("Bạn chưa chọn năm sản xuất", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return;

} if (dateTimePicker2.Text.Trim().Length == 0)

{ MessageBox.Show("Bạn chưa chọn năm sử dụng", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return;

} if (dateTimePicker1.Value.Date > dateTimePicker2.Value.Date)

MessageBox.Show("Ngày mua sử dụng không thể nhỏ hơn ngày sản xuất" + dateTimePicker1.Value.Date, "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); dateTimePicker2.Text = ""; dateTimePicker2.Focus(); return;

The SQL query updates the "TAISAN" table by setting various fields such as "tenTS," "maloai," "manuoc," "donvitinh," "namsx," "namsd," "soluong," and "madv" with values from user inputs It specifically targets the record where "maTS" matches the provided identifier, ensuring accurate data modification based on user selections and entries.

}private void btnDong_Click(object sender, EventArgs e)

Mã nguồn chức năng Form Nhà Cung Cấp

The code snippet provided is a C# program that utilizes various namespaces, including System, System.Collections.Generic, System.ComponentModel, System.Data, System.Drawing, System.Linq, System.Text, System.Threading.Tasks, System.Windows.Forms, and System.Data.SqlClient It also references a class from the BTTHUHOACH namespace, indicating its role in a larger application context.

{ public partial class frmnhacungcap : Form

} private void frmnhacungcap_Load(object sender, EventArgs e)

Function.FillCombo("SELECT maTS FROM TAISAN", cmbmaTS, "maTS",

"maTS"); cmbmaTS.SelectedIndex = -1; txtmaNCC.Enabled = false;

The code snippet initializes a SQL query to select all records from the "NHACUNGCAP" table, populating a DataGridView with supplier information The columns are labeled as "Supplier ID," "Supplier Name," "Address," "Phone Number," "Asset ID," and "Pax," with specified widths for each column to ensure clarity User modifications are restricted by disabling the ability to add new rows and setting the edit mode to programmatic only Additionally, a method named "ResetValue" is defined, presumably to reset the DataGridView or its values, although its implementation is not provided in the snippet.

{ txtmaNCC.Text = ""; txttenNCC.Text = ""; txtPax.Text = ""; txtsdt.Text = ""; cmbmaTS.Text = "";

} private void dgvThongtinNCC_Click(object sender, EventArgs e)

MessageBox.Show("Đang ở chế độ thêm mới!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); txtmaNCC.Focus(); return;

{ MessageBox.Show("Không có dữ liệu!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return;

The code retrieves and displays the current supplier's information from the data grid view, populating fields such as the supplier ID, name, address, phone number, asset ID, and Pax Additionally, it enables the edit, delete, and close buttons for further actions.

} private void btnThem_Click(object sender, EventArgs e)

{ if (btnThem.Text.Equals("Thêm"))

{ btnSua.Enabled = false; btnXoa.Enabled = false; btnDong.Enabled = true;

To ensure proper functionality, the ResetValue() method is called, enabling the txtmaNCC field and setting focus on it, while updating the btnThem button text to "Save." A SQL string is initialized, and if the txtmaNCC field is empty, a message box prompts the user to enter a supplier code, directing focus back to txtmaNCC before exiting the method.

} if (txttenNCC.Text.Trim().Length == 0) { MessageBox.Show("Bạn phải nhập tên nhà cung cấp", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); txttenNCC.Focus(); return;

} if (txtdiachi.Text.Trim().Length == 0) { MessageBox.Show("Bạn phải nhập địa chỉ", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); txtdiachi.Focus(); return;

} if (txtsdt.Text.Trim().Length == 0) {

MessageBox.Show("Bạn phải nhập số điện thoại", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); txtsdt.Focus(); return;

} if (cmbmaTS.Text.Trim().Length == 0) { MessageBox.Show("Bạn phải chọn mã tài sản", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); cmbmaTS.Focus(); return;

}if (txtPax.Text.Trim().Length == 0) { MessageBox.Show("Bạn phải nhập Pax", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); txtPax.Focus(); return;

+ "'"; sql = "Select maNCC From NHACUNGCAP where maNCC= N'" + txtmaNCC.Text.Trim() if (Function.KiemtraMa(sql)) {

MessageBox.Show("Mã đơn vị này đã có, bạn phải nhập mã khác", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); txtmaN CC.Foc us(); return;

} sql = "INSERT INTO NHACUNGCAP VALUES(N'" + txtmaNCC.Text + "',N'" + txttenNCC.Text + "', N'" + txtdiachi.Text + "', N'" + txtsdt.Text + "', N'" + cmbmaTS.SelectedValue + "', N'" + txtPax.Text + "')";

Text "Thêm"; btnXoa.E nabled true; btnSua.E nabled true; btnDong.

} }private void btnSua_Click(object sender, EventArgs e) { string sql; if (tblNCC.Rows.Count == 0) {

MessageBox.Show("Không còn dữ liệu", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return;

MessageBox.Show("Bạn chưa chọn bản ghi nào", "Thông báo", MessageBoxButtons.OK,

}if (txttenNCC.Text.Trim().Length == 0) {

MessageBox.Show("Bạn chưa nhập tên nhà cung cấp", "Thông báo", MessageBoxButtons.OK,

} if (txtdiachi.Text.Trim().Length == 0){

B ạn ch ưa nhập địa chỉ", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return;

} if (txtsdt.Text.Trim().Length == 0) { MessageBox.Show("Bạn chưa nhập số điện thoại", "Thông báo", MessageBoxButtons.OK,

}if (cmbmaTS.Text.Trim().Length == 0) {

MessageBox.Show("Bạn chưa chọn mã tài sản", "Thông báo", MessageBoxButtons.OK,

} if (txtPax.Text.Trim().Length == 0) {

MessageBox.Show("Bạn chưa nhập pax", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return;

} sql = "UPDATE NHACUNGCAP SET tenNCC = N'" + txttenNCC.Text.ToString() + "', diachi = N'" + txtdiachi.Text + "', sdt = N'" + txtsdt.Text + "', maTS = N'" + cmbmaTS.SelectedValue + "', Pax = N'" + txtPax.Text + "' WHERE maNCC=N'" + txtmaNCC.Text + "'";

}private void btnXoa_Click(object sender, EventArgs e)

{ string sql; if (tblNCC.Rows.Count == 0)

MessageBox.Show("Không còn dữ liệu", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return;

{ MessageBox.Show("Bạn chưa chọn bản ghi nào", "Thông báo",

MessageBoxButtons.OK, MessageBoxIcon.Information); return;

} if (MessageBox.Show("Bạn có muốn xoá không?", "Thông báo",

MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)

{ sql = "DELETE NHACUNGCAP WHERE maNCC=N'" + txtmaNCC.Text + "'"; Function.RunSqlDel(sql);

} private void btnDong_Click(object sender, EventArgs e)

Mã nguồn chức năng Form Điều Chuyển Tài Sản

The article discusses the use of various namespaces in a C# application, including System, System.Collections.Generic, and System.Data, among others It emphasizes the importance of these namespaces for functionalities such as data manipulation and user interface design Additionally, the code snippet indicates the inclusion of the BTTHUHOACH.Class namespace, suggesting a focus on specific class implementations within the application Overall, the content highlights the foundational elements necessary for developing a Windows Forms application that interacts with a SQL database.

{ public partial class frmdieuchuyenTS : Form

}private void Form3_Load(object sender, EventArgs e)

Function.FillCombo("SELECT maTS, tenTS FROM TAISAN", cmbmaTS, "maTS",

Function.FillCombo("SELECT madv, tendv FROM DONVI", cmbMadvden, "madv",

Function.FillCombo("SELECT manv, tennv FROM NHANVIEN", cmbmanv, "manv",

"manv"); cmbmanv.SelectedIndex = -1; cmbmaTS.Enabled = false; txtsoluong.Enabled = false; txtMadvdi.Enabled = false; txtTendvdi.Enabled = false; txtTendvden.Enabled = false;

The code snippet demonstrates how to retrieve and display data from the "CHUYENTS" table in a DataGridView It initializes an SQL query to select all records and populates the DataGridView with the resulting data source Each column is configured with specific header text, such as "Asset Code," "Unit Code for Transfer," and "Quantity," alongside their respective widths Additionally, user modifications are restricted by disabling row addition and setting the edit mode to programmatic The function also includes a placeholder for resetting values within the DataGridView.

{ cmbmaTS.Text = ""; txtMadvdi.Text = ""; cmbMadvden.Text = ""; cmbmanv.Text = ""; dateTimePicker1.Text = ""; txtsoluong.Text = ""; txtTendvden.Text = ""; txtTendvdi.Text = "";

}private void btnDong_Click(object sender, EventArgs e)

} private void btndieuchuyen_Click(object sender, EventArgs e)

{ if (btndieuchuyen.Text.Equals("Điều chuyển"))

{ btnSua.Enabled = false; btnXoa.Enabled = false; btnDong.Enabled = true;ResetValue();

{ cmbmaTS.Enabled = true; cmbmaTS.Focus(); btndieuchuyen.Text = "Lưu"; string sql, sql1, a; if (cmbmaTS.Text.Trim().Length == 0)

{ MessageBox.Show("Bạn phải chọn mã tài sản", "Thông báo", MessageBoxButtons.OK,

; }if (cmbmanv.Text.Trim().Length == 0) { MessageBox.Show("Bạn phải chọn mã nhân viên", "Thông báo", MessageBoxButtons.OK,

MessageBoxIcon.Information); c mb ma nv

Fo cu s (); re tu rn

; }if (cmbMadvden.Text.Trim().Length == 0) { MessageBox.Show("Bạn phải chọn đơn vị đến", "Thông báo", MessageBoxButtons.OK,

);retur n} if (txtsoluong.Text.Trim().Length == 0) {

MessageBox.Show("Bạn phải nhập số lượng", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); txts oluo ng Foc us(); retu rn; }

DateTime dt Convert.ToDateTime(Function.GetFieldValues("SELECT namsd FROM TAISAN WHERE maTS = N'" + cmbmaTS.SelectedValue + "'")).Date; if (dt > Convert.ToDateTime(dateTimePicker1.Value.Date)) {

MessageBox.Show("Ngày điều chuyển không thể nhỏ hơn ngày mua sử dụng" + dt, "Thông báo", MessageBoxButtons.OK,

MessageBoxIcon.Information); dateT imePi cker1 Text

= ""; dateT imePi cker1 Focu s(); retur n;

To check for existing unit codes in the database, the SQL query retrieves the unit code from the CHUYENTS table based on user input If the unit code already exists, a message box alerts the user to enter a different code, ensuring uniqueness in the system.

F un ct io n R un S ql

//Cập nhật lại mã đơn vị a = Convert.ToString(Function.GetFieldValues("SELECT madvden FROM CHUYENTS WHERE maTS = N'" + cmbmaTS.SelectedValue + "'")); sql1 = "UPDATE TAISAN SET madv =" + a + " WHERE maTS= N'" + cmbmaTS.SelectedValue + "'";

Function.RunSqlDel(sql1); btnXoa.Enabled = true; btnSua.Enabled = true; btnDong.Enabled = true; cmbmaTS.Enabled = false; btndieuchuyen.Text = "Điều chuyển";

} private void btnXoa_Click(object sender, EventArgs e)

{ string sql, a; if (tblDieuChuyenTS.Rows.Count == 0)

MessageBox.Show("Không còn dữ liệu", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return;

{ MessageBox.Show("Bạn chưa chọn bản ghi nào", "Thông báo",

MessageBoxButtons.OK, MessageBoxIcon.Information); return;

} if (MessageBox.Show("Bạn có muốn xoá không?", "Thông báo",

MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)

{ a = Convert.ToString(Function.GetFieldValues("SELECT madvdi FROM CHUYENTS WHERE maTS = N'" + cmbmaTS.SelectedValue + "'")); sql = "UPDATE TAISAN SET madv =" + a + " WHERE maTS= N'" + cmbmaTS.SelectedValue + "'";

Function.RunSqlDel(sql); sql = "DELETE CHUYENTS WHERE maTS=N'" + cmbmaTS.Text + "'";

}private void dgvdieuchuyenTS_Click(object sender, EventArgs e)

MessageBox.Show("Không có dữ liệu!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return;

The selected asset's code is retrieved and displayed in the cmbmaTS dropdown, while the corresponding destination unit code and name are populated in the txtMadvdi and txtTendvdi fields Additionally, the destination unit code and name are set in the cmbMadvden and txtTendvden fields, respectively The quantity of the asset is shown in the txtsoluong field, and the transfer date is reflected in the dateTimePicker1 Finally, the employee code is assigned to the cmbmanv dropdown, ensuring all relevant data is accurately represented.

}private void cmbmaTS_TextChanged(object sender, EventArgs e)

{ string str; if (cmbmaTS.Text == "")

{ txtMadvdi.Text = ""; txtTendvdi.Text = ""; txtsoluong.Text = "";

}// Khi chọn mã hàng thì các thông tin về hàng hiện ra str = "SELECT madv FROM TAISAN WHERE maTS =N'" + cmbmaTS.SelectedValue +

The code retrieves the values of the selected asset's details from a database It first fetches the unit name associated with the asset by joining the "DONVI" and "TAISAN" tables based on the asset's ID Then, it retrieves the quantity of the asset from the "TAISAN" table using the same asset ID.

"'"; txtsoluong.Text = Function.GetFieldValues(str);

} private void cmbMadvden_TextChanged(object sender, EventArgs e)

{ string str; if (cmbMadvden.Text == "")

// Khi chọn mã hàng thì các thông tin về hàng hiện ra str = "SELECT tendv FROM DONVI WHERE madv =N'" + cmbMadvden.SelectedValue +

"'"; txtTendvden.Text = Function.GetFieldValues(str);

} private void btnSua_Click(object sender, EventArgs e)

{ string sql; if (tblDieuChuyenTS.Rows.Count == 0)

{ MessageBox.Show("Không còn dữ liệu", "Thông báo",

MessageBoxButtons.OK, MessageBoxIcon.Information); return;

MessageBox.Show("Bạn chưa chọn bản ghi nào", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return;

} if (cmbMadvden.Text.Trim().Length == 0)

MessageBox.Show("Bạn chưa nhập mã đơn vị đến", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return;

}if (txtTendvden.Text.Trim().Length == 0)

MessageBox.Show("Bạn chưa nhập tên đơn vị đến", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return;

} if (txtsoluong.Text.Trim().Length == 0)

MessageBox.Show("Bạn chưa nhập số lượng", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return;

} if (cmbmanv.Text.Trim().Length == 0)

{ MessageBox.Show("Bạn chưa nhập mã nhân viên", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return;

} if (dateTimePicker1.Text.Trim().Length == 0)

MessageBox.Show("Bạn chưa chọn năm sản xuất", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return;

The SQL command updates the "CHUYENTS" table by setting various fields such as "madvdi," "tendvdi," "madvden," "tendvden," "soluong," "ngaychuyen," and "manv" with values from user inputs The update is applied to the record identified by "maTS," ensuring the data reflects the latest changes made through the user interface.

Mã nguồn chức năng Form Kiểm Kê Tài Sản

The provided code snippet imports essential namespaces for a C# application, including System, System.Collections.Generic, System.ComponentModel, System.Data, System.Drawing, System.Linq, System.Text, System.Threading.Tasks, System.Windows.Forms, and System.Data.SqlClient It also references a custom class from the BTTHUHOACH namespace, indicating its use in developing a Windows Forms application that likely interacts with a SQL database.

{ public partial class frmkiemkeTS : Form

} private void frmtinhtrangTS_Load(object sender, EventArgs e)

Function.FillCombo("SELECT maTS, tenTS FROM TAISAN", cmbmaTS, "maTS",

Function.FillCombo("SELECT manv, tennv FROM NHANVIEN", cmbmanv, "manv",

"manv"); cmbmaTS.SelectedIndex = -1; txtsoluongkk.Enabled = false; txtsobbkk.Enabled = false;

The SQL query "SELECT * FROM KIEMKETS" retrieves all records from the KIEMKETS table, which are then displayed in a DataGridView (dgvkiemkeTS) The columns are labeled with appropriate headers, including "Mã số biên bản" for the report number, "Mã tài sản" for asset ID, "Mã đơn vị" for unit ID, "Mã nhân viên" for employee ID, "Số lượng kiểm kê" for inventory quantity, "Ngày kiểm kê" for inventory date, "Tình trạng" for status, "Số lượng hỏng" for damaged quantity, "Số lượng thanh lý" for disposed quantity, and "Ghi chú" for notes Each column is set to a width of 80 pixels, except for the notes column, which is 200 pixels wide The DataGridView does not allow users to add new rows and is set to allow programmatic editing only.

{ txtsoluongkk.Text = ""; txtghichu.Text = ""; txtsobbkk.Text = ""; txtmadv.Text = ""; txtsoluonghong.Text = ""; txtsoluongTL.Text = "";

{ cmbtinhtrang.Items.Add("Hỏng"); cmbtinhtrang.Items.Add("Tốt"); cmbtinhtrang.Items.Add("Bình thường");

}private void btnThem_Click(object sender, EventArgs e)

{ if (btnThem.Text.Equals("Thêm"))

} else{ btnSua.Enabled = false; btnXoa.Enabled = false; btnDong.Enabled = true;

To ensure proper functionality, the code enables the txtsobbkk input field and sets focus on it while changing the button text to "Save." If the txtsobbkk field is empty, a message box alerts the user to select an inventory record number, prompting them to focus back on the input field.

}sql = "Select sobbkk From KIEMKETS where sobbkk= N'" + txtsobbkk.Text.Trim() if (Function.KiemtraMa(sql)) {

MessageBox.Show("Mã đơn vị này đã có, bạn phải nhập mã khác", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); txtsobbkk.Focus(); return;

} DateTime dt1 = Convert.ToDateTime(Function.GetFieldValues("SELECT namsd FROM TAISAN WHERE maTS = N'" + cmbmaTS.SelectedValue + "'")).Date;

//Ngày kiểm kê tài sản if (dt1 >= Convert.ToDateTime(dateTimePicker1.Value.Date)) {

MessageBox.Show("Ngày kiểm kê tài sản không thể bé hơn ngày sử dụng " + dt1, "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); dateTimePicker1.Text = ""; dateTimePicker1.Focus(); return;

} sql = "INSERT INTO KIEMKETS VALUES(N'" + txtsobbkk.Text + "', N'" + cmbmaTS.SelectedValue + "', N'" + txtmadv.Text + "', N'" + cmbmanv.SelectedValue + "', N'" + txtsoluongkk.Text + "', N'" + dateTimePicker1.Value.Date + "', N'" + cmbtinhtrang.Text + "', N'" + txtsoluonghong.Text + "', N'" + txtsoluongTL.Text + "', N'" + txtghichu.Text + "')";

ResetValue(); txtsobbkk.Enabled = false; btnSua.Enabled = true; btnXoa.Enabled = true; btnThem.Text = "Thêm";

} private void btnXoa_Click(object sender, EventArgs e)

{ string sql; if (tblkiemkeTS.Rows.Count == 0)

MessageBox.Show("Không còn dữ liệu", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return;

MessageBox.Show("Bạn chưa chọn bản ghi nào", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return;

} if (MessageBox.Show("Bạn có muốn xoá không?", "Thông báo",

MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)

{ sql = "DELETE KIEMKETS WHERE sobbkk=N'" + txtsobbkk.Text + "'";

} } private void btnDong_Click(object sender, EventArgs e)

}private void cmbmaTS_TextChanged(object sender, EventArgs e)

{ string str; if (cmbmaTS.Text == "")

}// Khi chọn mã hàng thì các thông tin về hàng hiện ra str = "SELECT madv FROM TAISAN WHERE maTS =N'" + cmbmaTS.SelectedValue +

"'"; txtmadv.Text = Function.GetFieldValues(str); str = "SELECT soluong FROM TAISAN WHERE maTS =N'" + cmbmaTS.SelectedValue +

"'"; txtsoluongkk.Text = Function.GetFieldValues(str);

} private void btnSua_Click(object sender, EventArgs e)

{ string sql; if (tblkiemkeTS.Rows.Count == 0)

{ MessageBox.Show("Không còn dữ liệu", "Thông báo",

MessageBoxButtons.OK, MessageBoxIcon.Information); return;

{ MessageBox.Show("Bạn chưa chọn bản ghi nào", "Thông báo",

MessageBoxButtons.OK, MessageBoxIcon.Information); return;

}if (cmbmaTS.Text.Trim().Length == 0)

MessageBox.Show("Bạn chưa chọn mã tài sản", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return;

}if (cmbmanv.Text.Trim().Length == 0)

{ MessageBox.Show("Bạn chưa chọn mã nhân viên", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return;

} if (dateTimePicker1.Text.Trim().Length == 0)

{ MessageBox.Show("Bạn chưa chọn ngày kiểm kê", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return;

The SQL query updates the "KIEMKETS" table by setting various fields such as "maTS," "madv," "manV," "soluongkk," "ngaykk," "tinhtrang," "soluonghong," "soluongthanhly," and "ghichu" with the values from the corresponding input fields The update is applied to the record identified by "sobbkk," ensuring that the specified data is accurately modified in the database.

}private void dgvkiemkeTS_Click(object sender, EventArgs e)

MessageBox.Show("Không có dữ liệu!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return;

The code retrieves and assigns values from the current row of the data grid view (dgvkiemkeTS) to various text fields and combo boxes It extracts the serial number (sobbkk), asset code (maTS), department code (madv), employee code (manv), quantity checked (soluongkk), check date (ngaykk), condition status (tinhtrang), quantity damaged (soluonghong), and quantity for liquidation (soluongthanhly) Additionally, it populates a notes field (ghichu) with relevant information from the selected row.

Mã nguồn chức năng Form Cấp Sửa Chữa Tài Sản

The article discusses a C# program that utilizes various namespaces such as System, System.Collections.Generic, and System.Data, among others It highlights the importance of these namespaces in managing data and user interfaces within Windows Forms applications Additionally, it emphasizes the use of the BTTHUHOACH.Class and System.Data.SqlClient for database interactions, showcasing how these components work together to create efficient software solutions.

{ public partial class frmCapsuachuaTS : Form

} private void frmCapsuachuaTS_Load(object sender, EventArgs e)

Function.FillCombo("SELECT maTS FROM KIEMKETS WHERE tinhtrang = N'Hỏng'

", cmbmaTS, "maTS", "maTS"); cmbmaTS.SelectedIndex -1; txtsoluong.Enabled false; txtmacapSC.Enabled false; LoadDataGridView();

The SQL query retrieves all records from the "SUACHUA" table, which is then assigned to the data source of the data grid view (dgvsuachuaTS) The columns of the data grid view are configured to display relevant headers, including "Repair Level Code," "Repair Level Name," "Asset Code," "Repair Date," "Completion Date," "Repair Quantity," and "Cost."

(VNĐ)"; dgvsuachuaTS.Columns[0].Width = 100; dgvsuachuaTS.Columns[1].Width = 100; dgvsuachuaTS.Columns[2].Width = 100; dgvsuachuaTS.Columns[3].Width = 120; dgvsuachuaTS.Columns[4].Width = 120; dgvsuachuaTS.Columns[5].Width = 100; dgvsuachuaTS.Columns[6].Width = 100; dgvsuachuaTS.AllowUserToAddRows = false; dgvsuachuaTS.EditMode = DataGridViewEditMode.EditProgrammatically;

{ cmbmaTS.Text = ""; txtmacapSC.Text = ""; txttencapSC.Text = ""; txtsoluong.Text = ""; txtchiphi.Text = "";

} private void dgvsuachuaTS_Click(object sender, EventArgs e)

{ MessageBox.Show("Đang ở chế độ thêm mới!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); cmbmaTS.Focus(); return;

MessageBox.Show("Không có dữ liệu!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return;

The code snippet retrieves and displays data from the current row of the `dgvsuachuaTS` DataGridView It assigns the values of various cells, such as "macapSC," "tencapSC," "maTS," "ngaycapSC," "ngaysua," "soluong," and "chiphi," to their respective text boxes and date pickers Additionally, it enables the "Edit," "Delete," and "Close" buttons, allowing users to interact with the data effectively.

} private void btnThem_Click(object sender, EventArgs e)

{ if (btnThem.Text.Equals("Thêm"))

{ btnSua.Enabled = false; btnXoa.Enabled = false; btnDong.Enabled = true;

ResetValue(); txtmacapSC.Enabled = true; txtmacapSC.Focus(); btnThem.Text = "Lưu"; string sql; if (txtmacapSC.Text.Trim().Length == 0) {

MessageBox.Show("Bạn phải nhập mã cấp sửa chữa", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); txtmacapSC.Focus(); return;

} if (txttencapSC.Text.Trim().Length == 0) {

MessageBox.Show("Bạn phải nhập tên cấp sửa chữa", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); txttencapSC.Focus(); return;

} if (cmbmaTS.Text.Trim().Length == 0) {

MessageBox.Show("Bạn phải chọn mã tài sản", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); cmbmaTS.Focus(); return;

} if (txtchiphi.Text.Trim().Length == 0) //Nếu chưa nhập số lượng{

MessageBox.Show("Bạn nhập chi phí", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); txtchiphi.Focus(); return;

}sql = "Select macapSC From SUACHUA where macapSCN'" + txtmacapSC.Text.Trim() + "'"; if (Function.KiemtraMa(sql)) {

MessageBox.Show("Mã đơn vị này đã có, bạn phải nhập mã khác", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); txtmacapSC.Focus(); return;

} //Ngày cấp sửa chữa không thể nhỏ ngày kiểm kê và trong vòng 5 ngày tiếp theo phải được mang đi sửa chữa

DateTime a = Convert.ToDateTime(Function.GetFieldValues("SELECT ngaykk FROM KIEMKETS WHERE maTS = N'" + cmbmaTS.Text + "'")).Date;

DateTime b = a.AddDays(+5); if (a >= Convert.ToDateTime(dateTimePicker1.Value.Date) || b <

Convert.ToDateTime(dateTimePicker1.Value.Date))

{ MessageBox.Show("Ngày cấp sửa chữa không thể nhỏ hơn ngày kiểm kê hoặc mang đi sửa không đúng thời gian cho phép" + a, "Thông báo", MessageBoxButtons.OK,

MessageBoxIcon.Information); dateTimePicker1.Text = ""; dateTimePicker1.Focus(); return;

If the completion date selected in dateTimePicker1 is earlier than the issue date in dateTimePicker2, a message box will alert the user that the completion date cannot be earlier than the issue date The text in dateTimePicker2 will be cleared, and the focus will return to it for correction.

To calculate the total cost based on the quantity, the code parses the input values for quantity and cost, multiplying them by 1000 to update the cost field Subsequently, it constructs an SQL insert statement to add a new record into the "SUACHUA" table, including fields for the repair code, repair name, asset code, start date, end date, quantity, and total cost.

ResetValue(); btnXoa.Enabled = true; btnSua.Enabled = true; btnDong.Enabled = false; txtmacapSC.Enabled = false; btnThem.Text = "Thêm";

} private void btnSua_Click(object sender, EventArgs e)

{ string sql; if (tblsuachua.Rows.Count == 0)

MessageBox.Show("Không còn dữ liệu", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return;

{ MessageBox.Show("Bạn chưa chọn bản ghi nào", "Thông báo",

MessageBoxButtons.OK, MessageBoxIcon.Information); return;

} if (txttencapSC.Text.Trim().Length == 0)

{ MessageBox.Show("Bạn chưa nhập tên cấp sửa chữa", "Thông báo",

MessageBoxButtons.OK, MessageBoxIcon.Information); return;

} if (cmbmaTS.Text.Trim().Length == 0)

MessageBox.Show("Bạn chưa chọn mã tài sản", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return;

} if (txtchiphi.Text.Trim().Length == 0) //nếu chưa nhập mã đơn vị

{ MessageBox.Show("Bạn chưa nhập chi phí", "Thông báo",

MessageBoxButtons.OK, MessageBoxIcon.Information); return;

} sql = "UPDATE SUACHUA SET tencapSC = N'" + txttencapSC.Text.ToString() + "', maTS = N'" + cmbmaTS.SelectedValue + "', ngaycapSC = N'" + dateTimePicker1.Value.Date + "', ngaysua = N'" + dateTimePicker2.Value.Date + "', soluong = N'" + txtsoluong.Text + "', chiphi N'" + txtchiphi.Text + "' WHERE macapSC=N'" + txtmacapSC.Text + "'";

}private void btnXoa_Click(object sender, EventArgs e)

{ string sql; if (tblsuachua.Rows.Count == 0)

MessageBox.Show("Không còn dữ liệu", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return;

MessageBox.Show("Bạn chưa chọn bản ghi nào", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return;

} if (MessageBox.Show("Bạn có muốn xoá không?", "Thông báo",

MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)

{ sql = "DELETE SUACHUA WHERE macapSC=N'" + txtmacapSC.Text +

}private void btnDong_Click(object sender, EventArgs e)

} private void cmbmaTS_TextChanged(object sender, EventArgs e)

{ string str; if (cmbmaTS.Text == "")

// Khi chọn mã hàng thì các thông tin về hàng hiện ra str = "SELECT soluonghong FROM KIEMKETS WHERE maTS =N'" + cmbmaTS.SelectedValue txtsoluong.Text = Function.GetFieldValues(str);

Mã nguồn chức năng Form Thanh Lý tài Sản

The provided code snippet is a C# program that includes essential namespaces for building Windows Forms applications, handling data collections, and connecting to SQL databases It utilizes the System, System.Collections.Generic, System.ComponentModel, System.Data, System.Drawing, System.Linq, System.Text, System.Threading.Tasks, and System.Windows.Forms namespaces, as well as a custom class from BTTHUHOACH.Class The program is organized under the BTTHUHOACH namespace, indicating its functionality within a specific project context.

{ public partial class frmthanhlyTS : Form

} private void frmthanhlyTS_Load(object sender, EventArgs e)

Function.FillCombo("SELECT maTS FROM KIEMKETS WHERE ghichu = N'Yêu cầu thanh lý' ", cmbmaTS, "maTS", "maTS"); cmbmaTS.SelectedIndex = -1;

Function.FillCombo("SELECT manv, tennv FROM NHANVIEN", cmbmanv, "manv",

"manv"); cmbmanv.SelectedIndex = -1; cmbmaTS.Enabled = false; txttenTS.Enabled = false; txtmadv.Enabled = false; txtsoluong.Enabled = false; txtsoluong.Enabled = false;

{ txttenTS.Text = ""; txtgiatien.Text = ""; txtlydothanhly.Text = ""; txtsoluong.Text = ""; txtmadv.Text = "";

The SQL query "SELECT * FROM THANHLY_TS" retrieves all records from the THANHLY_TS table, which is then displayed in the dgvThanhLyTS data grid The columns are customized with specific headers such as "Mã tài sản" (Asset Code), "Tên tài sản" (Asset Name), "Mã đơn vị" (Unit Code), "Mã nhân viên" (Employee Code), "Số lượng" (Quantity), "Giá tiền (VNĐ)" (Price in VND), "Ngày thanh lý" (Liquidation Date), and "Lý do" (Reason) Column widths are adjusted for clarity, with allowances for user interaction restricted as the grid is set to read-only mode, enhancing data integrity during programmatic edits.

} private void cmbmaTS_TextChanged(object sender, EventArgs e)

{ string str; if (cmbmaTS.Text == "")

{ txttenTS.Text = ""; txtmadv.Text = ""; txtsoluong.Text = "";

}// Khi chọn mã hàng thì các thông tin về hàng hiện ra str = "SELECT madv FROM TAISAN WHERE maTS =N'" + cmbmaTS.SelectedValue +

"'"; txtmadv.Text = Function.GetFieldValues(str); str = "SELECT tenTS FROM TAISAN WHERE maTS =N'" + cmbmaTS.SelectedValue +

"'"; txttenTS.Text = Function.GetFieldValues(str); str = "SELECT soluongthanhly FROM KIEMKETS WHERE maTS

=N'" + cmbmaTS.SelectedValue + "'"; txtsoluong.Text = Function.GetFieldValues(str);

} private void btnThem_Click(object sender, EventArgs e)

{ if (btnThem.Text.Equals("Thêm"))

{ btnSua.Enabled = false; btnXoa.Enabled = false; btnDong.Enabled = true;

ResetValue(); cmbmaTS.Enabled true; cmbmaTS.Focus(); btnThem.Text = "Lưu"; string sql, sql1; float soluong, giatien; if (cmbmaTS.Text.Trim().Length == 0) {

MessageBox.Show("Bạn phải chọn mã tài sản", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); cmbmaTS.Focus(); return;

} if (txtgiatien.Text.Trim().Length == 0) {

MessageBox.Show("Bạn phải chọn giá tiền", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); txtgiatien.Focus(); return;

} soluong = float.Parse(txtsoluong.Text); giatien = float.Parse(txtgiatien.Text); txtgiatien.Text = (soluong * giatien * 1000).ToString();

//Ngày thanh lý tài sản không thể nhỏ ngày kiểm kê và trong vòng 10 ngày tiếp theo phải được mang đi sửa chữa

DateTime a = Convert.ToDateTime(Function.GetFieldValues("SELECT ngaykk FROM KIEMKETS WHERE maTS = N'" + cmbmaTS.Text + "'")).Date;

DateTime b = a.AddDays(+10); if (a >= Convert.ToDateTime(dateTimePicker1.Value.Date) || b <

Convert.ToDateTime(dateTimePicker1.Value.Date))

{ MessageBox.Show("Ngày thanh lý không thể nhỏ hơn ngày kiểm kê" + a,

"Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); dateTimePicker1.Text = ""; dateTimePicker1.Focus(); return;

}sql = "INSERT INTO THANHLY_TS VALUES(N'" + cmbmaTS.SelectedValue + "',N'" + txttenTS.Text + "', N'" + txtmadv.Text + "', N'" + cmbmanv.SelectedValue + "', N'" + txtsoluong.Text + "', N'" + txtgiatien.Text + "', N'" + dateTimePicker1.Value.Date + "', N'"

ResetValue(); btnXoa.Enabled = true; btnSua.Enabled = true; btnDong.Enabled = false; cmbmaTS.Enabled false; btnThem.Text "Thêm";

To update the inventory quantity of an asset, first retrieve the sold quantity from the THANHLY_TS table using the asset ID selected in the combo box Next, obtain the total quantity from the KIEMKETS table for the same asset ID Subtract the sold quantity from the total quantity to calculate the remaining stock Finally, execute an SQL update command to set the new quantity in the TAISAN table for the specified asset ID.

} private void btnSua_Click(object sender, EventArgs e)

{ string sql; if (tblthanhlyTS.Rows.Count == 0)

{ MessageBox.Show("Không còn dữ liệu", "Thông báo",

MessageBoxButtons.OK, MessageBoxIcon.Information); return;

MessageBox.Show("Bạn chưa chọn bản ghi nào", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return;

}if (txtlydothanhly.Text.Trim().Length == 0)

{ MessageBox.Show("Bạn chưa nhập lý do thanh lý", "Thông báo",

MessageBoxButtons.OK, MessageBoxIcon.Information); return;

To update the asset record in the database, first, the quantity and price are parsed from the input fields The total price is calculated by multiplying the quantity by the price and converting it to a string The SQL command then updates the asset details, including the asset name, unit code, employee ID, quantity, total price, disposal date, and reason for disposal, based on the specified asset ID.

}private void btnXoa_Click(object sender, EventArgs e)

{ string sql; if (tblthanhlyTS.Rows.Count == 0)

{ MessageBox.Show("Không còn dữ liệu", "Thông báo",

MessageBoxButtons.OK, MessageBoxIcon.Information); return;

{ MessageBox.Show("Bạn chưa chọn bản ghi nào", "Thông báo",

MessageBoxButtons.OK, MessageBoxIcon.Information); return;

} if (MessageBox.Show("Bạn có muốn xoá không?", "Thông báo",

MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)

+ "'"; double sl, slcon, slxoa; sql = "SELECT maTS, soluong FROM THANHLY_TS WHERE maTS = N'" + cmbmaTS.Text

The code snippet retrieves data from a database using SQL and updates the quantity of items It iterates through each row of the DataTable, fetching the current quantity of each item based on its identifier The current quantity is obtained from the "TAISAN" table, while the quantity to be removed is sourced from the DataTable This process ensures accurate inventory management by updating item quantities as needed.

= sl + slxoa; sql = "UPDATE TAISAN SET soluong =" + slcon + " WHERE maTS= N'"

} sql = "DELETE THANHLY_TS WHERE maTS=N'" + cmbmaTS.Text + "'";

} } private void btnDong_Click(object sender, EventArgs e)

} private void dgvThanhLyTS_Click(object sender, EventArgs e)

MessageBox.Show("Đang ở chế độ thêm mới!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); cmbmaTS.Focus(); return;

{ MessageBox.Show("Không có dữ liệu!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return;

The code snippet retrieves and displays asset details from the current row of the data grid view, including asset code, name, unit code, employee code, quantity, price, disposal date, and reason for disposal It assigns these values to corresponding text fields and enables the edit, delete, and close buttons for user interaction.

Mã nguồn chức năng Form Tính Khấu Hao Tài Sản

The article discusses the use of various namespaces in a C# application, including System, System.Collections.Generic, and System.Data, which are essential for handling data and user interface elements It highlights the importance of using System.Windows.Forms for creating Windows applications and System.Data.SqlClient for database connectivity The namespace BTTHUHOACH.Class suggests a structured approach to organizing code within the application.

{ public partial class frmkhauhao : Form

}private void Form4_Load(object sender, EventArgs e)

To populate the combo box with data from the THANHLY_TS table, use the function FillCombo with the SQL query "SELECT maTS, tenTS" Ensure that the selected index of cmbmaTS is set to -1, and disable the input fields for depreciation (txtkhauhao), remaining value (txtconlai), asset code (cmbmaTS), depreciation duration (txtthoigianKH), year of use (txtnamsd), liquidation date (txtngayTL), and quantity (txtsoluong) to prevent user input errors.

The code snippet retrieves data from the "GIATRITAISAN" table using SQL and populates a DataGridView named "dgvkhauhaoTS" The columns are labeled for asset identification, original value, quantity, depreciation, remaining value, and depreciation period, with specified widths for each column User interaction is limited, as new rows cannot be added, and editing is restricted to programmatic changes.

} private void dgvkhauhaoTS_Click(object sender, EventArgs e)

MessageBox.Show("Không có dữ liệu!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return;

The current row of the asset depreciation data grid (dgvkhauhaoTS) populates various text fields with relevant values: the asset code (maTS), original value (nguyengia), quantity (soluong), depreciation amount (khauhao), remaining value (giatriconlai), and depreciation period (thoigiankhauhao) Additionally, the edit (btnsua), delete (btnXoa), and close (btnDong) buttons are enabled for user interaction.

} private void btnThem_Click(object sender, EventArgs e)

{ if (btnThem.Text.Equals("Thêm"))

{ btnsua.Enabled = false; btnXoa.Enabled = false; btnDong.Enabled = true;

To reset the form and enable the combo box, use ResetValue() and set cmbmaTS.Enabled to true, followed by setting focus on cmbmaTS Change the button text to "Save." If the original price field (txtnguyengia) is empty, display a message box prompting the user to enter the original price, set focus back to the original price field, and exit the function.

} float soluong = float.Parse(txtsoluong.Text); float nguyengia = float.Parse(txtnguyengia.Text); float giatriconlai = float.Parse(txtconlai.Text); txtkhauhao.Text = (nguyengia * soluong * 1000 - giatriconlai).ToString(); txtnguyengia.Text = (nguyengia * 1000).ToString();

// Thời gian khấu hao DateTime a = Convert.ToDateTime(txtnamsd.Text).Date;

DateTime b = Convert.ToDateTime(txtngayTL.Text).Date;

TimeSpan c = b - a; int ThoigianKH = c.Days; txtthoigianKH.Text = Convert.ToString(ThoigianKH/28) + " Tháng"; sql = "INSERT INTO GIATRITAISAN VALUES(N'" + cmbmaTS.SelectedValue + "', N'" + txtnguyengia.Text + "', N'" + txtsoluong.Text + "', N'" + txtkhauhao.Text + "', N'" + txtconlai.Text + "', N'" + txtthoigianKH.Text + "')";

ResetValue(); btnXoa.Enabled = true; btnsua.Enabled = true; btnDong.Enabled = false; cmbmaTS.Enabled false; btnThem.Text "Thêm";

{ txtnguyengia.Text = ""; txtkhauhao.Text = ""; txtconlai.Text = ""; txtsoluong.Text = ""; txtthoigianKH.Text = "";

}private void btnXoa_Click(object sender, EventArgs e)

{ string sql; if (tblKhauhao.Rows.Count == 0)

{ MessageBox.Show("Không còn dữ liệu", "Thông báo",

MessageBoxButtons.OK, MessageBoxIcon.Information); return;

{ MessageBox.Show("Bạn chưa chọn bản ghi nào", "Thông báo",

MessageBoxButtons.OK, MessageBoxIcon.Information); return;

} if (MessageBox.Show("Bạn có muốn xoá không?", "Thông báo",

MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)

{ sql = "DELETE GIATRITAISAN WHERE maTS=N'" + cmbmaTS.Text + "'";

}private void btnsua_Click(object sender, EventArgs e)

{ string sql; if (tblKhauhao.Rows.Count == 0)

{ MessageBox.Show("Không còn dữ liệu", "Thông báo",

MessageBoxButtons.OK, MessageBoxIcon.Information); return;

MessageBox.Show("Bạn chưa chọn bản ghi nào", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return;

} if (txtnguyengia.Text.Trim().Length == 0)

{ MessageBox.Show("Bạn chưa nhập nguyên giá", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return;

To calculate the depreciation of an asset, first, parse the quantity and original value from the input fields Then, compute the remaining value and update the depreciation value accordingly Finally, update the asset value in the database with the new original value and quantity.

= N'" + txtsoluong.Text + "', khauhao = N'" + txtkhauhao.Text + "', giatriconlai = N'" + txtconlai.Text + "', thoigiankhauhao = N'" + txtthoigianKH.Text + "' WHERE maTS=N'" + cmbmaTS.SelectedValue + "'";

} private void btnDong_Click(object sender, EventArgs e)

} private void cmbmaTS_TextChanged(object sender, EventArgs e)

{ string str; if (cmbmaTS.Text == "")

{ txtsoluong.Text = ""; txtconlai.Text = ""; txtthoigianKH.Text = ""; txtnamsd.Text = ""; txtngayTL.Text = "";

To retrieve the quantity of an asset, the SQL query "SELECT soluong FROM THANHLY_TS WHERE maTS = N'" + cmbmaTS.SelectedValue + "' is executed Additionally, to obtain the price of the asset, the query "SELECT giatien FROM THANHLY_TS WHERE maTS = N'" + cmbmaTS.SelectedValue + "' is used Lastly, to find the year of use for the asset, the query "SELECT namsd FROM TAISAN WHERE maTS = N'" + cmbmaTS.SelectedValue + "' is executed.

"'"; txtnamsd.Text = Function.GetFieldValues(str); str = "SELECT ngaythanhly FROM THANHLY_TS WHERE maTS = N'" + cmbmaTS.SelectedValue + "'"; txtngayTL.Text = Function.GetFieldValues(str);

Mã nguồn chức năng Form Thống Kê Tất Cả Tài Sản Theo Đơn Vị

Before generating a report with CrystalReportView, it is essential to create a DatasetTaiSan.xsd and a rpThongKeTheoLoaiTaiSan.rpt This process involves using various namespaces such as System, System.Collections.Generic, System.ComponentModel, System.Data, System.Drawing, System.Linq, System.Text, System.Threading.Tasks, and System.Windows.Forms, along with the BTTHUHOACH.Class and System.Data.SqlClient namespaces in the BTTHUHOACH application.

{ public partial class frmThongKeTheoDV : Form

} private void frmThongKeTheoDV_Load(object sender, EventArgs e)

{ string sql = "SELECT madv FROM DONVI "; cmbmadv.DataSource = Function.Taobang(sql); cmbmadv.DisplayMember = "madv";

} private void btnDong_Click(object sender, EventArgs e)

}private void btnTaobaocao_Click(object sender, EventArgs e)

{ Function.myconnect(); rpThongKeTheoDV rpt = new rpThongKeTheoDV();

SqlDataAdapter dap = new SqlDataAdapter("Select maTS, tenTS, maloai, manuoc, donvitinh, namsx, namsd, soluong FROM TAISAN WHERE madv = N'" + cmbmadv.Text + "'",

DataSet ds = new DataSet(); dap.Fill(ds); rpt.SetDataSource(ds.Tables[0]); crvThongKeTS.ReportSource = rpt;

} private void cmbmadv_SelectedIndexChanged(object sender, EventArgs e)

{ string sql = "SELECT * FROM DONVI WHERE madv = N'" + cmbmadv.Text +

"'"; DataTable dt = Function.Taobang(sql); foreach (DataRow hang in dt.Rows) txttendv.Text

Mã nguồn chức năng Form Thống Kê Tài Sản Hiện Có Theo Loại Tài Sản

Before generating a report with CrystalReportView, it is essential to create a DatasetTaiSan.xsd and a rpThongKeTheoLoaiTaiSan.rpt This process involves using various namespaces such as System, System.Collections.Generic, System.ComponentModel, System.Data, System.Drawing, System.Linq, System.Text, System.Threading.Tasks, System.Windows.Forms, and BTTHUHOACH.Class, along with System.Data.SqlClient for database connectivity.

Ngày đăng: 14/11/2021, 10:32

TỪ KHÓA LIÊN QUAN

TÀI LIỆU CÙNG NGƯỜI DÙNG

TÀI LIỆU LIÊN QUAN

w