private void btnTimKiem_Click(object sender, EventArgs e) { if (cbTimKiem.Text == "Mã Phiếu") { dgvHoaDonXuat.DataSource = Bus.TimKiemHDX("select * from HoaDonXuat where MaHoaDon like '%" + txtTimKiem.Text.Trim() + "%'and TRANGTHAI=N'Chưa thanh toán'"); } if (cbTimKiem.Text == "Khách Hàng") { dgvHoaDonXuat.DataSource = Bus.TimKiemHDX("select * from HoaDonXuat where MaKH like '%" + txtTimKiem.Text.Trim() + "%' and TRANGTHAI=N'Chưa thanh toán'"); } if (cbTimKiem.Text == "Nhân Viên") { dgvHoaDonXuat.DataSource = Bus.TimKiemHDX("select * from HoaDonXuat where MaNVXuat Like '%" + txtTimKiem.Text.Trim() + "%' and TRANGTHAI=N'Chưa thanh toán'"); } if (cbTimKiem.Text == "Ngày Nhập(năm-tháng-ngày)") { dgvHoaDonXuat.DataSource = Bus.TimKiemHDX("select * from HoaDonXuat where NgayXuat like '%" + txtTimKiem.Text.Trim() + "%' and TRANGTHAI=N'Chưa thanh toán'"); } }
private void btnTimKiem_Click(object sender, EventArgs e) { if (cbTimKiem.Text == "Mã HĐ") { dgvHoaDon.DataSource = Bus.TimKiemHDX("select * from HoaDonXuat where MaHoaDon like '%" + txtTimKiem.Text.Trim() + "%' and TRANGTHAI=N'Đã thanh toán'"); } if (cbTimKiem.Text == "Mã KH") { dgvHoaDon.DataSource = Bus.TimKiemHDX("select * from HoaDonXuat where MaKH like '%" + txtTimKiem.Text.Trim() + "%' and TRANGTHAI=N'Đã thanh toán'"); } if (cbTimKiem.Text == "Ngày Xuất") { dgvHoaDon.DataSource = Bus.TimKiemHDX("select * from HoaDonXuat where NgayXuat like '%" + txtTimKiem.Text.Trim() + "%' and TRANGTHAI=N'Đã thanh toán'"); } if (cbTimKiem.Text == "Mã NVX") { dgvHoaDon.DataSource = Bus.TimKiemHDX("select * from HoaDonXuat where MaNVXuat Like '%" + txtTimKiem.Text.Trim() + "%' and TRANGTHAI=N'Đã thanh toán'"); } }
private void btnTimKiem_Click(object sender, EventArgs e) { dgvDTNgay.DataSource = Bus.TimKiemHDX("SELECT NgayXuat, SUM(ThanhTien) AS DTNgay FROM dbo.ChiTietHoaDonXuat INNER JOIN dbo.HoaDonXuat ON HoaDonXuat.MaHoaDon = ChiTietHoaDonXuat.MaHDX WHERE NgayXuat like '%" + txtTimKiem.Text + "%' GROUP BY NgayXuat"); }
private void btnTimKiem_Click(object sender, EventArgs e) { dgvDTThang.DataSource = Bus.TimKiemHDX("SELECT MONTH(NgayXuat) AS THANG ,YEAR(NgayXuat) AS NAM,SUM(ThanhTien) AS DOANHTHU FROM dbo.HoaDonXuat INNER JOIN dbo.ChiTietHoaDonXuat ON ChiTietHoaDonXuat.MaHDX = HoaDonXuat.MaHoaDon WHERE TrangThai=N'Đã thanh toán' AND MONTH(NgayXuat)='" + txtTimKiem.Text + "' GROUP BY MONTH(NgayXuat),YEAR(NgayXuat)"); }