I have a small invoice web tool.
So I would like to find out the total amount of all positions of items and if it reached a maximum level it should print the following positions on the second page of the invoice.
I use the sample code to "design" my invoices:
http://codepen.io/rafaelcastrocouto/pen/LFAes/
My idea is: first count all characters of the foreach loop.
But I don't know how I should continue?
Please give me some hints. Thanks
EDIT: here is my foreach loop code:
<?php foreach( $items as $it): ?>
<tr class="even">
<td style="width:8%;"><?php echo $pos; ?></td>
<td style="width:47%;"><?php
$string = $it->invoice_item_text;
if (strlen($string) > 350) $string = substr($string,0,350).'...';
echo $string;
?></td>
<td style="width:15%;">
<?php if ($it->invoice_item_type == 3) {$date = date('M Y', strtotime($it->invoice_item_date)); } else { $date = date('d.m.Y', strtotime($it->invoice_item_date)); } ?>
<?php echo $date; ?>
</td>
<td style="width:20%;"><?php if ($it->invoice_item_time != '0') { if ($it->invoice_item_type == 1 or $it->invoice_item_type == 2) echo gmdate('H:i', $it->invoice_item_time);}; ?></td>
<td style="width:10%;"><?php echo number_format($it->invoice_item_sum, 2, ',', ' '); ?> €</td>
</tr>
<?php $pos++; ?
<?php endforeach; ?>