0
Hello! I’ve got a boring problem I can’t seem to solve. I need to include a foreach in my report using the mPDF library, but I couldn’t find a way to do this in the middle of the HTML code I had inserted. This is my code:
public function gerarpdf() {
$mpdf = new \Mpdf\Mpdf();
$mpdf->WriteHTML(
'<table>
<tr>
<td>'.$this->title.'- Receitas</td>
<td>Filtros:</td>
<td>'.$this->filtros.'</td>
</tr>
<tr>
<td>Rubrica</td>
<td>Descrição</td>
<td>Previsão inicial</td>
<td>Arrec. no Mês</td>
<td>Arrec. no Ano</td>
<td>Por arrecadar</td>
</tr>
<tr>
<td>'.$this->receita->cod_natreceita.'</td>
<td>'.$this->receita->desc_natreceita.'</td>
<td>'.$this->receita->valor_previsto.'</td>
<td>'.$this->receita->valorreceita.'</td>
<td>'.$this->receita->valoracreceita.'</td>
<td>'.($this->receita->valor_previsto - $this->receita- >valoracreceita).'
</td>
</tr>
'.(foreach ($this->receitas as $this->receita) :).'
<tr>
<td></td>
<td></td>
<td><strong>Total previsto</strong></td>
<td><strong>'.$this->totalPrevisto.'</strong></td>
<td><strong>Total arrecadado no mês</strong></td>
<td><strong>'.$this->totalMes.'</strong></td>
<td><strong>Total acumulado no ano</strong></td>
<td><strong>'.$this->totalAcumulado.'</strong></td>
</tr>
'.endforeach.'
</table>');
$mpdf->Output();
}