Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <div class="row">
- <div class="col-md-12">
- <table class="table table-bordered">
- <thead>
- <tr>
- <th class="text-center">Product</th>
- @php
- for($i = 1; $i <= 12; $i++){
- $monthNum = $i;
- $dateObj = DateTime::createFromFormat('!m', $monthNum);
- $monthName = $dateObj->format('F'); // March
- @endphp
- <th class="text-center">{{ $monthName }} {{ $year_id }}</th>
- @php
- }
- @endphp
- </tr>
- </thead>
- <tbody>
- @foreach ($products as $p)
- <tr>
- <td>{{ $p->description }}</td>
- @php
- for($i = 1; $i <= 12; $i++){
- $total = \App\Case_check_list::select('qty')->whereYear('date_delivery',$year_id)
- ->whereMonth('date_delivery',$i)
- ->where('product_id',$p->id)
- ->sum('qty');
- @endphp
- <td>{{ $total }}</td>
- @php
- }
- @endphp
- </tr>
- @endforeach
- </tbody>
- </table>
- </div>
- </div>
Advertisement
Add Comment
Please, Sign In to add comment