<?php
	$i = 0;
	$t_amount = 0;
	$t_dpt = 0;
	$t_total = 0;
	$t_pcs = 0;
	$t_out = 0;
	$t_pcs_out = 0;
	foreach ($data as $key => $value) {
		$i++;
		$t_amount += az_remove_separator(azarr($value, 'total_amount'));
		$t_dpt += floor(azarr($value, 'total_dpt'));
		$t_total += azarr($value, 'total');
		$t_pcs += azarr($value, 'total_pcs');
		$t_out += azarr($value, 'total_out');
		$t_pcs_out += azarr($value, 'total_pcs_out');
?>
	<tr>
		<td align="center"><?php echo $i;?></td>
		<td><?php echo $value['name'];?></td>
		<td align="right"><?php echo azarr($value, 'total_amount');?></td>
		<td align="right"><?php echo az_thousand_separator(floor(azarr($value, 'total_dpt')));?></td>
		<td align="center"><?php echo az_thousand_separator(azarr($value, 'total'));?></td>
		<td align="center"><?php echo az_thousand_separator(azarr($value, 'total_pcs'));?></td>
		<td align="center"><?php echo az_thousand_separator(azarr($value, 'total_out'));?></td>
		<td align="center"><?php echo az_thousand_separator(azarr($value, 'total_pcs_out'));?></td>
	</tr>
<?php
	}
?>
<tr>
	<td colspan="2" align="right">Total</td>
	<td align="right"><?php echo az_thousand_separator($t_amount);?></td>
	<td align="right"><?php echo az_thousand_separator($t_dpt);?></td>
	<td align="center"><?php echo az_thousand_separator($t_total);?></td>
	<td align="center"><?php echo az_thousand_separator($t_pcs);?></td>
	<td align="center"><?php echo az_thousand_separator($t_out);?></td>
	<td align="center"><?php echo az_thousand_separator($t_pcs_out);?></td>
</tr>