Samson Mutunga 3 роки тому
батько
коміт
336b3a4a5a

+ 5 - 1
app/Http/Controllers/DnaController.php

@@ -21,6 +21,7 @@ use App\Models\Pro;
 use App\Models\Product;
 use App\Models\ProProAccess;
 use App\Models\ProTeam;
+use App\Models\ProTransaction;
 use App\Models\SectionTemplate;
 use App\Models\Shipment;
 use App\Models\SupplyOrder;
@@ -113,7 +114,10 @@ class DnaController extends Controller
 
     public function financialTransactions(Request $request){
         $filters = $request->all();
-        $financialTransactions = Bill::paginate(20);
+        $financialTransactions = ProTransaction::select('pro_transaction.*')
+                                ->join('bill', 'bill.id', '=', 'pro_transaction.bill_id')
+                                ->where('bill.na_pro_id', $this->performer->pro->id);
+        $financialTransactions = $financialTransactions->orderBy('created_at', 'DESC')->paginate(20);
         return view('app.dna.financial-transactions', compact('financialTransactions', 'filters'));
     }
     public function myBills(Request $request){

+ 19 - 8
resources/views/app/dna/financial-transactions.blade.php

@@ -18,24 +18,35 @@
             <table class="table table-condensed p-0 m-0">
                 <thead class="bg-light">
                     <tr>
-                    <th class="px-3 border-0">Date</th>
-                    <th class="px-3 border-0">Type</th>
-                    <th class="px-3 border-0">Chart</th>
-                    <th class="px-3 border-0">Context</th>
-                    <th class="px-3 border-0">Amount</th>
-                    <th class="px-3 border-0">Balance</th>
+                        <th class="px-3 border-0">Date</th>
+                        <th class="px-3 border-0">Type</th>
+                        <th class="px-3 border-0">Chart</th>
+                        <th class="px-3 border-0">Context</th>
+                        <th class="px-3 border-0">Amount</th>
+                        <th class="px-3 border-0">Balance</th>
                     </tr>
                 </thead>
                 <tbody>
                     @foreach($financialTransactions as $financialTransaction)
                     <tr>
-                        
+                        <td>{{ friendlier_date($financialTransaction->created_at) }}</td>
+                        <td>{{ $financialTransaction->type }}</td>
+                        <td>
+                            @if($financialTransaction->client)
+                            <a native target="_blank" href="{{route('patients.view.dashboard', $financialTransaction->client)}}">
+                                {{$financialTransaction->client->chart_number}}
+                            </a>
+                            @endif
+                        </td>
+                        <td>{{ $financialTransaction->reason_type }}</td>
+                        <td>${{ $financialTransaction->amount }}</td>
+                        <td></td>
                     </tr>
                     @endforeach
 
                     @if(count($financialTransactions) === 0)
                     <tr>
-                        <td colspan="9">No records found!</td>
+                        <td colspan="6">No records found!</td>
                     </tr>
                     @endif
                 </tbody>