<?php defined('BASEPATH') OR exit('No direct script access allowed'); 

$addressTmpl = array();
if (!empty($address1))
{
	$addressTmpl[] = $address1;
}

if (!empty($address2))
{
	$addressTmpl[0] .= ", " . $address2;
}

// if (!empty($addressTmpl))
//{
	$_city = '';
	if(!empty($city))
	{
		$_city .= $city;
		if($zip)
		{
			$_city .= ' - ' . $zip;
		}
		$addressTmpl[] = '<br>' . $_city;
	} else if($zip)
	{
		$_city .= '' . $zip;
		$addressTmpl[] = '<br>' . $_city;
	}		
	
	$state = '';
	if (!empty($stateName))
	{
		$state .= $stateName;
	}
	else if (!empty($pos))
	{
		$state .= $pos;
	}
	/*
	if (!empty($country))
	{
		$state .= ($state ? ', ' : '') . $country;
	}
	*/
	$addressTmpl[] = $state;

	$addressTmpl = implode(", ", $addressTmpl);
/*
} else {
	$addressTmpl = "";
}
*/
?><table class="noborder vat" border="0" cellpadding="0" cellspacing="0">
	<col style="width:33.333%;">
	<col style="width:33.333%;">
	<col style="width:33.333%;">
	<tbody>
		<tr>
			<td class="ac" colspan="3"><strong><?php echo $name; 
			//Branch name/Franchise name  given in Settings>Branches/Warehouse company name input
			if (!empty($company)){
					echo '<br>';
					echo '<b>'.$company.'</b>';
					echo '<br>';
			}
			?></strong></td>
		</tr>
		<tr>
			<td width="33.333%" class="al"><?php
				$txt = '';
				$hasVal = false;
				if(!empty($email))
				{
					$txt .= mylang('Email'). ':'  . $email;
					$hasVal = true;
				}
				if(!empty($phone))
				{
					$txt .= '<br>'.mylang('Phone') . ':' . $phone;
					$hasVal = true;
				}
				if(!empty($mobile))
				{
					$txt .= '<br>'.mylang('Phone') . ':' .$mobile;
					$hasVal = true;
				}
				if ($hasVal) {
					echo $txt;
				}
			?></td>
			<td width="33.333%"  class="ac"><?php echo $addressTmpl; ?></td>
			<td width="33.333%" class="ar"><?php echo empty($gstin) ? '' : mylang("GSTIN").' :' . $gstin; ?>
			<?php  echo empty($pan) ? '' : '<br>'.mylang("PAN").' :'  . $pan; ?>
			<?php echo empty($isRegisteredMSME) ? '' : '<br>'.mylang("MSME").' '. $msmet .' :'  . $msmen;?>
			<br>
			<?php if(!empty($addInfo)){
				echo $addInfo;
			 }?></td>
			
		</tr>
		
	</tbody>
</table>
