dovrei aver fatto.
lato controller:
lato template:codice:$newArr = array(); foreach ($resDd as $key => $item) { $newArr[$item['fornitore']][$key] = $item; } $arrData = array( 'dati' => $newArr ); $viewTpl = 'interr_vendite'; $pdf = PDF::loadView($viewTpl, ['data' => $arrData]); return $pdf->download('vendite.pdf');
si accettano suggerimenti ovviamente!codice:@foreach($data['dati'] as $key => $val) <h3> Fornitore: {{$key}} </h3> <table class="minimalistBlack"> <thead> <tr> <th>Articolo</th> <th>Colore</th> <th>Taglia</th> <th>Qta</th> <th>Prezzo</th> <th>Valore</th> </tr> </thead> <tbody> @php($tot = 0) @php($totValore = 0) @foreach($val as $v) <tr> <td>{{$v['descrizione']}}</td> <td>{{$v['colore']}}</td> <td>{{$v['tg']}}</td> <td>{{$v['qta']}}</td> <td>{{$v['netto']}}</td> <td>{{$v['netto'] * $v['qta']}}</td> </tr> @php($tot += $v['qta']) @php($totValore += ($v['netto'] * $v['qta'])) @endforeach </tbody> <tfoot> <tr> <th>TOTALE</th> <th></th> <th></th> <th>{{$tot}}</th> <th></th> <th>{{$totValore}}</th> </tr> </tfoot> </table> @endforeach

Rispondi quotando