<?php $addressView = 'export/address/salretail1'; ?>
<tr>
<?php
				if ($isLogo == 1 && (!empty($company['logo'])))
				{
					echo '<td class="vat ac" colspan="2" width="100%"><div class="imgDiv fltlt" style="width:100%"><img src="' . $company['logo'] . '" /></div></td>';
				}
?>
			</tr>
<?php
				if($isLogo == 2 )
				{
					echo '<tr><td colspan="2" width="100%"><div class="" ><img style="height: auto; width: 100%;display: inline-block;" src="' . $company['fullHeaderImg'] . '" /></div></td></tr>';
				}

				if($isLogo != 2)
				{
?>			<tr>
				<td class="ac bt bb" colspan="2"><?php
					if(empty($iscompanyaddress) || (!empty($iscompanyaddress) && $iscompanyaddress == 1))
					{
						$company['address1'] = '';
						$company['address2'] = '';
						$company['pan'] = '';	
					}

					if (!empty($company['company']))
					{
						//$company["name"] = "<big>".lang("CompanyName")."</big><br>".$company['company'];
					}else{
						$company['name'] = "<big>".lang("CompanyName")."</big>";
					}
					
					$this->subview($addressView, $company);
					
				?></td>
			</tr><?php if (!empty($titleText)) { ?>
			<tr>
				<td class="ac" colspan="2">
					<b><big><?php echo $titleText; ?><big></b>
				</td>
			</tr>
<?php				}
				}
?>			<tr>
				<td class="al" colspan="2"><?php
					echo mylang("BillNo") . ": " . "<big>" .$tNo ."</big>";
					$this->load->helper("date");
					echo "<br>";
					echo mylang("Date") . ": " . $tDate;
					echo ', ';
					$comp_config = get_company('config');
					echo date(" h:i A", gmt_to_local(strtotime($updatedOn), $comp_config['timeZone']));
					/*if(!empty($isPrint)){
					echo '<br>';
					echo 'Printed on';
					$cur_time = get_timezone_date();
					echo date('d/m/y H:i A',strtotime($cur_time));
					}*/
					if ((!empty($source) && $source == 'P') && !empty($tableType) && !empty($tableName)){
						echo '<br>';
						echo '<span style="white-space: nowrap !important;">'.($tableType == 'D' ? 'Table: ' : 'Take Away: ');
						echo $tableName;
						echo '</span>';						
						if(!empty($kot_no)) {
							// echo '<br>';
							echo '<span style="white-space: nowrap !important;">,  KOT: ';
							echo $kot_no;
							echo '</span>';
							// echo '<br>';
						}
						if(!empty($sRepName)) {
							echo '<br>';
							echo '<span style="white-space: nowrap !important;">'.('Waiter: ');
							echo $sRepName;
							echo '</span>';
						}
						
					}
					$conName = !empty($contact['company']) ? $contact['company'] : (!empty($contact['contactPerson']) ? $contact['contactPerson'] : (!empty($conName) ? $conName : (!empty($contact['name']) ?($contact['name']) : "")));
					if (!empty ($conName) && ((!empty($iscompanyaddress) && $iscompanyaddress == 1)||empty($iscompanyaddress)))
					{
						echo '<br><b>' .$conName.'</b>';
						echo !empty($city) ? ','.$city : '';
						echo '<br>';
					}
					//echo '<br>';
					if(!empty($conAbove))
					{
						$i = 0;
						foreach($conAbove as $row)
						{
							$addcomma = '';
							if($i < count($conAbove)-1)
							{
								$addcomma = ',<br>';
							}
							$row = empty($row) ? "" : ($row.$addcomma);
							$i++;
							echo $row;
						}
						//echo '<br>';
					}
					if((!empty($iscompanyaddress) && $iscompanyaddress == 2)){
						if(!empty($billing)){
							$billing['name'] = !empty($contact['company']) ? $contact['company'] : (!empty($contact['contactPerson']) ? $contact['contactPerson'] : (!empty($contact['name']) ?($contact['name']) : ""));
							echo '<br>';					
							$this->subview($addressView, $billing);
							echo '<br>';	
						}	
					}
					if(!empty($conBelow)) {
						echo '<br>';
						$i = 0;
						foreach($conBelow as $row) {
							$addcomma = '';
							if($i < count($conBelow)-1) {
								$addcomma = ',<br>';
							}
							$row = empty($row) ? "" : ($row.$addcomma);
							$i++;
							echo $row;
						}
					}
					if(!empty($paymentName) && $paymentName != 'Other' && $tType !='PP')
					{
						if(empty ($conName)){
						echo '<br>';
						}
						echo  mylang("PaymentMode").': ';
						echo !empty ($paymentName) ? $paymentName : '';
						
					}
					else if (!empty ($ref)) {
						echo '<br>';
						echo  mylang("Reference").': '; 
						echo $ref;
						// echo !empty ($tType) && $tType == "SR" ? 'Cash' : $paymentName ;
					}
					if (!empty($isprojectname) && !empty($prjName)) {
						echo '<br>';
						echo mylang("ProjectName").': '; 
						echo $prjName;
						
					}
					if ((!empty($sRepMobile)&& !empty($issalesrep)) && (empty($source) || $source != 'P'))
					{
						echo '<br>';
						echo $srep_mobile_text .': '; 
						echo $sRepMobile;
						
					}
					if ((!empty($sRepName)&& !empty($issalesrep) )&& (empty($source) || $source != 'P'))
					{
						echo '<br>';
						echo $srep_text .': '; 
						echo $sRepName;
						
					}
					if (!empty($refName))
					{
						echo '<br>';
						echo mylang("ReferredBy") .': '; 
						echo $refName;
						
					}
					// echo $tDate;
					if (!empty($relNumber))
					{
						echo '<br>';// $rel_tNo_text
						echo $rel_tNo_text .' : ' . $relNumber;
					}
					if (!empty($relDate))
					{
						echo '<br>';// $rel_tDate_text
						echo $rel_tDate_text.':' . $relDate;
					}
					
					echo '<br>';
					
				?></td>
			</tr>
			<?php if (!empty($tType!='PI') && !empty($tType!='PC') && !empty($tType != 'PD') && !empty($company['countryCode'])  && $company['countryCode'] == 'IN')
			{
				$classCodes = array(
					'EXPWOP' => lang('EXPWOP'),
					'EXPWP' => lang('EXPWP'),
					'SEZWP' => lang('SEZWP'),
					'SEZWOP' => lang('SEZWOP')
				);
			if(!empty($classCode) && !empty($classCodes[$classCode])){
				?><tr class="vam">
					<td <?php
						if (!$isQuote && $tType != DELCHALLAN && !empty($classCode) && !empty($classCodes[$classCode]))
						{
							echo 'class="bot ac vam bob" style="padding:5px;border-right: none;"';
						} else if($tType == "SI" && (empty($classCode) || empty($classCodes[$classCode])) && $isComposition) {

							echo 'class="bot ac vam bob" style="padding:5px;border-right: none;"';
						}
					?> colspan="2"><?php
						if (!$isQuote && !empty($classCode) && !empty($classCodes[$classCode]))
						{
							echo $classCodes[$classCode];
						}
						if(($tType == "SI"|| $tType == "SR") && (empty($classCode) || empty($classCodes[$classCode])) && $isComposition) {
							echo "COMPOSITION TAXABLE PERSON, NOT ELIGIBLE TO COLLECT TAX ON SUPPLIES";
						}
					?></td>
				</tr><?php
				}else{
					if (
						($tType == "SH" || $tType == "TD"|| $tType =="GR" || $tType =="TR") &&
						!empty($contact) &&
						!empty($contact['csType']) &&
						($contact['csType'] == 'B' || $contact['csType'] == 'L')
					) {
						$colspan = 3;

						echo '<tr>';
						echo '<td colspan="' . $colspan . '" class="bot ac vam" style="border-bottom:0.5px solid #000000">';
						echo 'Stock Transfer / Branch Transfer - Not for Sale';
						echo '</td>';
						echo '</tr>';
					}
					if(!empty($tType =='PO')){
						echo '<tr>';
						?><td colspan="<?php echo !empty($company['logo']) ? 3 : 2; ?>" class="bot ac vam" style="border-bottom:0.5px solid #000000">';
						<?php echo '</td></tr>';
					}
				}
			}
		?>
