Jelajahi Sumber

Billing report - date range filter

Vijayakrishnan 3 tahun lalu
induk
melakukan
66514a9a8d

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

@@ -155,6 +155,8 @@ SELECT effective_date, count(*), sum(number_of_units) as units FROM bill WHERE c
         $zero_deductible = $request->get('zero_deductible');
         $claim_status = $request->get('claim_status');
         $verified = $request->get('verified');
+        $from = $request->get('from');
+        $to = $request->get('to');
 
         if($no_claims){
             $conditions[] = "(clm.id IS NULL)";
@@ -182,6 +184,14 @@ SELECT effective_date, count(*), sum(number_of_units) as units FROM bill WHERE c
             }
         }
 
+        if($from) {
+            $conditions[] = "(n.effective_dateest::date >= '{$from}')";
+        }
+
+        if($to) {
+            $conditions[] = "(n.effective_dateest::date <= '{$to}')";
+        }
+
         $from = "FROM note n
          JOIN (SELECT count(*) AS count,
                       bill.note_id

+ 9 - 3
resources/views/app/practice-management/billing-report.blade.php

@@ -24,12 +24,12 @@
                     <div class="form-group mr-2">
                         <label class="form-check">
                             <input type="checkbox" name="zero_deductible" class="form-check-input" {{request()->input('zero_deductible') ? 'checked' : ''}}>
-                            <span for="" class="form-check-label">Zero Deductible</span>
+                            <span for="" class="form-check-label">Zero Deduc.</span>
                         </label>
                     </div>
 
                     <div class="form-group mr-2">
-                        <label class="control-label  mr-1" for="">Claim Status</label>
+                        <label class="control-label  mr-1" for="">Claim</label>
                         <select name="claim_status" class="form-control">
                             <option value="">All</option>
                             @foreach($claimStatuses as $claimStatus)
@@ -39,13 +39,19 @@
                     </div>
                     
                     <div class="form-group mr-2">
-                        <label class="control-label mr-1" for="">Bill Verification Status</label>
+                        <label class="control-label mr-1" for="">Bill Verif.</label>
                         <select name="verified" class="form-control">
                             <option value="">All</option>
                             <option {{request()->input('verified') === 'VERIFIED' ? 'selected' : ''}} value="VERIFIED">Verified</option>
                             <option {{request()->input('verified') === 'UNVERIFIED' ? 'selected' : ''}} value="UNVERIFIED">Unverified</option>
                         </select>
                     </div>
+                    <div class="form-group mr-2">
+                        <label class="control-label mr-1" for="">From</label>
+                        <input type="date" name="from" class="form-control" value="{{request()->input('from')}}">
+                        <label class="control-label ml-2 mr-1" for="">To</label>
+                        <input type="date" name="to" class="form-control" value="{{request()->input('to')}}">
+                    </div>
                     <div class="form-group mr-2">
                         <button onclick="return fastLoad('{{ route('practice-management.billing-report') }}?' + $('#admin-billing-report-form').serialize())" class="btn btn-primary btn-sm">Filter</button>
                     </div>