浏览代码

added filter by client

= 2 年之前
父节点
当前提交
cc746b9331

+ 7 - 23
app/Http/Controllers/PracticeManagementController.php

@@ -1033,6 +1033,13 @@ OFFSET {$offset} LIMIT {$perPage}
             $bills = $bills->where('code', '=', $filter);
         }
 
+        $filter = $request->input('clientName');
+        if ($filter) {
+            $bills = $bills->whereHas('client', function($q) use ($filter){
+                return $q->where('name_first', 'ilike', $filter)->orWhere('name_last', 'ilike', $filter);
+            });
+        }
+
         $bills = $bills->orderBy('effective_date', 'desc')->paginate();
 
         $companies = Company::where('is_active', true)->orderBy('name')->get();
@@ -1063,29 +1070,6 @@ OFFSET {$offset} LIMIT {$perPage}
 
         $bills = Bill::where('is_cancelled', false)->whereRaw("(code = 'RM RMM' OR code = 'RM MCP')");
 
-        /*if(!$request->input('t') || $request->input('t') === 'hcp') {
-            $bills = $bills
-                ->where('hcp_expected_payment_amount', '>', 0)
-                ->where('is_signed_by_hcp', true);
-            if ($targetPro) {
-                $bills = $bills->where('hcp_pro_id', $targetPro->id);
-            }
-            if($request->input('c')) {
-                $bills = $bills->whereRaw('(SELECT company_id from company_pro where id = hcp_company_pro_id) = ' . $request->input('c'));
-            }
-        }
-        else if($request->input('t') === 'na') {
-            $bills = $bills
-                ->where('generic_pro_expected_payment_amount', '>', 0)
-                ->where('is_signed_by_generic_pro', true);
-            if ($targetPro) {
-                $bills = $bills->where('generic_pro_id', $targetPro->id);
-            }
-            if($request->input('c')) {
-                $bills = $bills->whereRaw('(SELECT company_id from company_pro where id = generic_company_pro_id) = ' . $request->input('c'));
-            }
-        }*/
-
         $filter = $request->input('f');
         switch ($filter) {
             case 'verified':

+ 4 - 0
resources/views/app/practice-management/processing-bill-matrix2.blade.php

@@ -18,6 +18,10 @@
                         <option value="" {{!@$targetPro ? 'selected' : ''}}>All Pros</option>
                     </select>
                 </div>
+                <div class="max-width-110px">
+                    <label class="text-sm text-secondary mb-1">Client</label>
+                    <input type="text" class="form-control form-control-sm" name="clientName">
+                </div>
                 <div class="max-width-110px ml-2">
                     <label class="text-sm text-secondary mb-1">Verification</label>
                     <select name="filter" class="form-control form-control-sm min-width-unset flex-grow-1" onchange="return billsFilter('f', this.value)">

+ 4 - 1
spec/rpt-queries.sql

@@ -136,4 +136,7 @@ WHERE most_recent_mcp_note_date IS NULL;
 UPDATE bill SET effective_date = (SELECT (date_trunc('month', care_month.start_date) + interval '1 month' - interval '1 day')::DATE FROM care_month WHERE bill.care_month_id = care_month.id)
 WHERE bill.care_month_id IS NOT NULL and bill.effective_date IS NULL;
 
-UPDATE bill SET effective_date = (SELECT effective_dateest FROM note WHERE bill.note_id = note.id) WHERE bill.note_id IS NOT NULL AND bill.effective_date IS NULL;
+UPDATE bill SET effective_date = (SELECT effective_dateest FROM note WHERE bill.note_id = note.id) WHERE bill.note_id IS NOT NULL AND bill.effective_date IS NULL;
+
+SELECT most_recent_mcp_note_date FROM care_month WHERE uid = '6d437394-902e-4899-a2bd-bd1702825461';
+