It is very strange, i know i am a noob.. but i was thinking that an $variable should output the content of that variable when i put it in the $html part. So, in the case of above post, i expected
Code:
$html = '<!DOCTYPE html><html><body>' . $pdfoutputdemand . '</body></html>';
to virtually print the table code <table><td> etc with the content between the body tags. But, what it does is just printing the content into the pdf as a text.
So i tried to extract the variable with different print commando's like print_f and print_r with no luck.
Code:
$html = print_r($pdfoutputdemand, TRUE);
This resulted in an empty pdf.
I tried to use $formModel->getElementData to get the data from the calc element what is making the table.
Code:
$jaja = $formModel->getElementData('g4e_orakel_uitbet_maak___tabel_raw');
$html = '<!DOCTYPE html><html><body>' . $jaja . '</body></html>';
With the _raw part it crashes the site on a 404 page, and without the raw part it is sending the table as a text to the pdf file, just like in the pdf in an earlier reply. The pdf is showing the table styling and content.
Then I did read a topic about the $formModel->getElementData to get the data from the calc element. There they said that sometimes it returned an array. So I tried to solve it with:
Code:
$jaja = $formModel->getElementData('g4e_orakel_uitbet_maak___tabel_raw', true);
$jaja = is_array($jaja) ? $jaja[0] : $jaja;
$html = '<!DOCTYPE html><html><body>' . $jaja . '</body></html>';
This resulted in sending an empty pdf.
Finally i came into $data so i tried that.
Code:
$jaja = $data['g4e_orakel_uitbet_maak___tabel'];
$html = '<!DOCTYPE html><html><body>' . $jaja . '</body></html>';
But this is returning a 404 page.
So, How can i get the outcome of {g4e_orakel_uitbet_maak___tabel_raw} printed as html code between <html><body>' . $jaja . '</body></html>. So it looks like:
Code:
$html = '<!DOCTYPE html>
<html>
<body>
<table class="uitbet-tabel">
<thead>
<tr> <th class="naam">Naam</th>
<th class="maand">Maand</th>
<th class="uren">Uren</th>
<th class="dagen">Dagen</th>
<th class="salaris">Uursalaris</th>
<th class="fee">Fee</th>
<th class="totaal">Uitbetalen</th>
<th class="bedrijf_id">Bedrijf_id</th>
</tr>
</thead>
<tbody>
<tr class="">
<td class="naam">joep, Meloen van</td>
<td class="maand">December2020</td>
<td class="uren">37,00</td>
<td class="dagen">4</td>
<td class="salaris">€ 25,00</td>
<td class="fee">€ 0,00</td>
<td class="totaal">€ 925,00</td>
<td class="bedrijf_id">22061978</td>
</tr>
<tr class="">
<td class="naam">Nuijs, Jap van</td>
<td class="maand">December 2020</td>
<td class="uren">37,00</td>
<td class="dagen">0</td>
<td class="salaris">€ 40,00</td>
<td class="fee">€ 0,00</td>
<td class="totaal">€ 1.480,00</td>
<td class="bedrijf_id">22061978</td>
</tr>
<tr class="">
<td class="naam">Nuijs, Japs van</td>
<td class="maand">December 2020</td>
<td class="uren">37,00</td>
<td class="dagen">18</td>
<td class="salaris">€ 36,00</td>
<td class="fee">€ 0,00</td>
<td class="totaal">€ 1.332,00</td>
<td class="bedrijf_id">22061978</td>
</tr>
</tbody>
<tfoot>
<tr class="pdf-niet">
<td>3 medewerkers</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td>€ 3.737,00</td>
<td></td>
</tr> <tr class="pdf-wel">
<td>3 medewerkers</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td>€ 3.737,00</td>
<td></td>
</tr>
</tfoot>
</table>
</body>
</html>';
And then, renders this to a pdf when using:
Code:
$dompdf = new DOMPDF();
$dompdf->load_html($html);
$dompdf->render();
$pdfoutput = $dompdf->output();
Sorry for the long post.. but i want to show i do a lot of work to achieve what i want, but i cannot find the sollution. I hope someone can help me and guide me in the right direction.
thanks