Esempio n. 1
0
 private void getAll()
 {
     dataGridView1.DataSource = cn.getDataTable("select distinct h.id as 'Mã', h.noigiaohang as 'Nơi giao hàng', h.ngaydat as 'Ngày đặt',h.trangthai as 'Trạng thái' from hoadon h join chitiethoadon ct on h.id = ct.hoadonId " +
                                                "join sanpham s on ct.sanphamid = s.id where h.ngaydat >='" + Ham.GetDate(ngayTu) + "' and h.ngaydat <='" + Ham.GetDate(ngayDen) + "' and ('" + StrangThai + "' = '' or h.trangthai = N'" + StrangThai + "') " +
                                                "and ( " + SIdNV + " = 0 or h.nhanvienId = " + SIdNV + ") group by h.id, s.ten, h.noigiaohang, h.ngaydat, h.trangthai  order by h.trangthai asc");
 }