bassman9001

Untitled

Jan 24th, 2024
751
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.87 KB | None | 0 0
  1. <div class="row">
  2.                 <div class="col-md-12">
  3.                     <table class="table table-bordered">
  4.                         <thead>
  5.                             <tr>
  6.                                 <th class="text-center">Product</th>
  7.                                 @php
  8.                                     for($i = 1; $i <= 12; $i++){
  9.                                         $monthNum = $i;
  10.                                         $dateObj = DateTime::createFromFormat('!m', $monthNum);
  11.                                         $monthName = $dateObj->format('F'); // March
  12.                                 @endphp
  13.                                 <th class="text-center">{{ $monthName }} {{ $year_id }}</th>
  14.                                 @php
  15.                                     }
  16.                                 @endphp
  17.                             </tr>
  18.                         </thead>
  19.                         <tbody>
  20.                             @foreach ($products as $p)
  21.                             <tr>
  22.                                 <td>{{ $p->description }}</td>
  23.                                 @php
  24.                                 for($i = 1; $i <= 12; $i++){
  25.                                     $total = \App\Case_check_list::select('qty')->whereYear('date_delivery',$year_id)
  26.                                         ->whereMonth('date_delivery',$i)
  27.                                         ->where('product_id',$p->id)
  28.                                         ->sum('qty');
  29.                                 @endphp
  30.                                 <td>{{ $total }}</td>
  31.                                 @php
  32.                                 }
  33.                                 @endphp
  34.                             </tr>
  35.                             @endforeach
  36.                         </tbody>
  37.                     </table>
  38.                 </div>
  39.             </div>
Advertisement
Add Comment
Please, Sign In to add comment