0
My need is to group the notes in a single row where the OE are repeated for example:
My code below:
<?php
foreach($class->Lista($empresa,$fatura) as $dados) {
$CdFatura = $dados->getFatura();
$NrNFSe = $dados->getNrNFSe();
$CdOE = $dados->getCdOe();
$NrNotaFiscal = $dados->getNrNotafiscal();
echo '
<div class="large-12 columns">
<table>
<thead>
<tr>
<th>NrNFSe</th>
<th>OE</th>
<th>NotaFiscal</th>
</tr>
</thead>
<tbody>
<tr>
<td>'.$NrNFSe.'</td>
<td>'.$CdOE.'</td>
<td>'.$NrNotaFiscal.'</td>
</tr>
</tbody>
</table>
</div>
';
}
?>
It worked but it made this mistake
Call to a member function getCdOe() on boolean in
in thewhile ($nextDados->getCdOe() == $CdOE) {
– KevinF
@Kevin. F probably at some point the value of "$data" is coming as null, in this case I believe that validating the element before calling Function should solve. I updated the response with an extra validation in the second while.
– ThiagoYou
I understood, but now the notes that come each OE are the same numbers but comes the right amount. For example on OE 36 is coming 4 times the note 1127437.
– KevinF
This is because it was calling the 4 times the same main variable ($data), instead of the new variable ($nestDados). Fixed issue.
– ThiagoYou