|
@@ -531,6 +531,16 @@ class PracticeManagementController extends Controller
|
|
|
true);
|
|
|
}
|
|
|
|
|
|
+ if($filters['bills_resolved']) {
|
|
|
+ $notes->whereRaw('(SELECT count(id) FROM bill WHERE note_id = note.id) > 0'); // have bills
|
|
|
+ if($filters['bills_resolved'] === 'no') {
|
|
|
+ $notes->whereRaw('(SELECT count(id) FROM bill WHERE note_id = note.id AND is_cancelled = false AND is_verified = false) > 0');
|
|
|
+ }
|
|
|
+ elseif($filters['bills_resolved'] === 'yes') {
|
|
|
+ $notes->whereRaw('(SELECT count(id) FROM bill WHERE note_id = note.id AND (is_cancelled = true OR is_verified = false)) = 0');
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
if($filters['bills_closed']) {
|
|
|
$notes->where(
|
|
|
'is_bill_closed',
|