private function getSomePhieuMuon($txtLoaiUser = null, $txtTK = null) { //Gọi hàm setOnlinePhieuMuon() - setPhieuTreHen() $this->setOnlinePhieuMuon(); $this->setPhieuTreHen(); //--------------------------. $dsPhieuMuon = null; if ($txtLoaiUser != null && $txtTK == null) { $dsPhieuMuon = PhieuMuonSach::join('nguoi_dung', function ($join) { $join->on('phieu_muon_sach.id_nguoi_muon', '=', 'nguoi_dung.id'); })->select('nguoi_dung.id', 'phieu_muon_sach.ma_so_phieu', 'phieu_muon_sach.thoi_gian_lap', 'phieu_muon_sach.thoi_gian_xu_ly', 'phieu_muon_sach.trang_thai_phieu', 'nguoi_dung.ma_so_the', 'phieu_muon_sach.id_nguoi_xu_ly', 'phieu_muon_sach.id')->where('phieu_muon_sach.trang_thai_phieu', $txtLoaiUser)->orderBy('phieu_muon_sach.trang_thai_phieu', 'asc'); } else { if ($txtLoaiUser == null && $txtTK != null) { $dsPhieuMuon = PhieuMuonSach::join('nguoi_dung', function ($join) { $join->on('phieu_muon_sach.id_nguoi_muon', '=', 'nguoi_dung.id'); })->select('nguoi_dung.id', 'phieu_muon_sach.ma_so_phieu', 'phieu_muon_sach.thoi_gian_lap', 'phieu_muon_sach.thoi_gian_xu_ly', 'phieu_muon_sach.trang_thai_phieu', 'nguoi_dung.ma_so_the', 'phieu_muon_sach.id_nguoi_xu_ly', 'phieu_muon_sach.id')->where('nguoi_dung.ma_so_the', $txtTK)->orderBy('phieu_muon_sach.trang_thai_phieu', 'asc'); } else { if ($txtLoaiUser != null && $txtTK != null) { $dsPhieuMuon = PhieuMuonSach::join('nguoi_dung', function ($join) { $join->on('phieu_muon_sach.id_nguoi_muon', '=', 'nguoi_dung.id'); })->select('nguoi_dung.id', 'phieu_muon_sach.ma_so_phieu', 'phieu_muon_sach.thoi_gian_lap', 'phieu_muon_sach.thoi_gian_xu_ly', 'phieu_muon_sach.trang_thai_phieu', 'nguoi_dung.ma_so_the', 'phieu_muon_sach.id_nguoi_xu_ly', 'phieu_muon_sach.id')->where('phieu_muon_sach.trang_thai_phieu', $txtLoaiUser, 'and')->where('nguoi_dung.ma_so_the', $txtTK)->orderBy('phieu_muon_sach.trang_thai_phieu', 'asc'); } else { $dsPhieuMuon = $this->getAllPhieuMuon(); } } } return $dsPhieuMuon; }