<?php

if (!empty($export_details) && ($isExport && $currencyCode != $expCurrencyCode))
{
	if (empty($custFieldsCols))
	{
		$custFieldsCols = 3;
	}

	$td = array();
	$i = 0;
	$flag1 = false;
	$custFieldsCols = in_array(count($export_details), array(1, 2, 4)) ? 2 : 3;

	foreach ($export_details as $row)
	{ 
		if ($row['value'])
		{
			$flag1 = true;
			if (empty($td[$i]))
			{
				$td[$i] = "";
			}

			if ($custFieldsCols == 2)
			{
				$td[$i] .= '<p class="nm"><span>' . mylang($row['label']) . ': <b>' . $row['value'] . '</b></span></p>';
			}
			else
			{
				$td[$i] .= '<p class="nm">' .  mylang($row['label']) . ':</p>';
				$td[$i] .= '<p class="nm"><b>' . $row['value'] . '</b></p><br>';
			}

			$i++;
		}

		if ($i == $custFieldsCols)
		{
			$i = 0;
		}
	}

	if ($flag1)
	{
?>
<table border="0" cellspacing="0" cellpadding="0" class="nbv nbb vat <?php echo empty($isThermalPrint) ? "" : "noborder dashed"; ?>" width="50%">
	<tbody>
		<tr class="custFields"><?php
			for ($i=0; $i<$custFieldsCols; $i++)
			{
				echo '<td width="33%">'. (!empty($td[$i]) ? $td[$i] : ' ').'</td>';
			}
		?>
		</tr>
	</tbody>
</table>
<?php
	}
}

/*
?>
<table border="0" cellspacing="0" cellpadding="0" class="nbv nbb vat">
	<col style="width: 33.33%">
	<col style="width: 33.33%">
	<col style="width: 33.33%">
	<tbody>
		<tr><?php
			$td_1 = $td_2 = $td_3 = '';
			$i=0;
			foreach ($export_details as $row)
			{
				if ($row['value'])
				{
					$i++;
					${'td_'.$i} .= '<tr><td>' . $row['label'] . '</td><td>: <b>' . $row['value'] . '</b></td></tr>';
				}

				if ($i==3)
				{
					$i=0;
				}
			}
			?>
			<td class="nbr">
				<table class="noborder nopadding auto"><tbody class="label"><?php echo $td_1;?></tbody></table>
			</td>
			<td class="nbr">
				<table class="noborder nopadding auto"><tbody class="label"><?php echo $td_2;?></tbody></table>
			</td>
			<td class="nbr">
				<table class="noborder nopadding auto"><tbody class="label"><?php echo $td_3;?></tbody></table>
			</td>
		</tr>
	</tbody>
</table><?php
}
*/

