-1
I have a foreach
which mounts several tables, but has a td
in my table he is the sum of others td
.
I tried to do with Javascript and put together some PHP, but without success.
The field is the last of the tbody
, what has the total date
@foreach($lancamentos as $lancamento)
@if($lancamento['lojas']['id'] != $id_anterior)
<?php
$id_anterior = $lancamento['lojas']['id'];
?>
<table class="table table-sm table-striped table-bordered" id="{{$lancamento['lojas']['id']}}">
<thead>
<tr>
<td colspan="7" style="text-align: center;"><b>Loja:</b> {{$lancamento['lojas']['nome']}}</td>
</tr>
<tr>
<td>Boleta</td>
<td>Romaneio</td>
<td>Cliente</td>
<td>Data da Compra</td>
<td>Data de Vencimento</td>
<td>Valor</td>
<td>Valor a receber</td>
<td>total</td>
</tr>
</thead>
<tbody>
@endif
<tr>
<td>{{$lancamento['boleta']}}</td>
<td>{{$lancamento['romaneio']}}</td>
<td>{{$lancamento['cliente']}}</td>
<td>{{$lancamento['data_compra']}}</td>
<td>{{$lancamento['data_vencimento']}}</td>
<td data-valor="{{$lancamento['lojas']['id']}}">R$ {{$lancamento['valor']}}</td>
<td>R$ {{$lancamento['valor'] * ($lancamento['lojas']['comissao']/100)}}</td>
<td data-total="{{$lancamento['lojas']['id']}}">{{ $lancamento['valor'] }}</td>
</tr>
@if($lancamento['lojas']['id'] != $id_anterior)
</tbody>
</table>
@endif
@endforeach
Explain better what you want. The total would be the sum of the "value" and the "receivable"?
– Diego Vieira
No, the "total" would be the sum of the "value"
– Danilo Franceschi