Browse Source

Billing manager - all_bills_resolved filter

Vijayakrishnan 4 năm trước cách đây
mục cha
commit
ff1c7a078b
1 tập tin đã thay đổi với 10 bổ sung0 xóa
  1. 10 0
      app/Http/Controllers/PracticeManagementController.php

+ 10 - 0
app/Http/Controllers/PracticeManagementController.php

@@ -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',