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

	$addressView = 'export/address/salinv';
	$detailsView = !empty($detailsView) ? $detailsView : 'export/details/salinv';
	$letterPadHeader = 'export/letterpadHeader';
	//Label declaration
	//**********************
	$tNo_text = (!empty($label) && !empty($label['No'])) ? $label['No'] :lang("PaymentNo");
	$tDate_text =  (!empty($label) && !empty($label['Date'])) ? $label['Date'] :lang("PaymentDate");
	$Payment_Mode =  (!empty($label) && !empty($label['PaymentMode'])) ? $label['PaymentMode'] : lang("PaymentMode"); 
	$Reference = (!empty($label) && !empty($label['Reference'])) ? $label['Reference'] : lang("Reference");
	//*****************
	$arr = array(
		'SE' => 'Quote',
		'SC' => 'Sales Credit note',
		'SD' => 'Sales Debit note',
		'SR' => 'Cash invoice',
		'SI' => 'Tax Invoice'
	);
	$transUrl = array(
		'PQ' => 'quotes',
		'PO' => 'estimate',
		'PI' => 'bills',
		'PE' => 'expenses',
		"GR" => 'receiptnote',
		'PC' => 'creditnote',
		'PD' => 'debitnote',
		'PP' => 'payments',
	);
	$totAmount = formatAmount($totAmount, $currencyCode, "-", true,$currFraction);

	if($tType == 'SI' && in_array($classCode, array('EXPWP', 'EXPWOP', 'DEEM', 'EXPBO')))
	{
		$arr['SI'] = 'Export Invoice';
	}
	$transType = !empty($arr[$tType]) ? $arr[$tType] : lang($tType);

	$fontname = (!empty($fontname) && $fontname != 'null' )  ? $fontname : ""; 
	$this->view('export/css', array(
		"fontname" => $fontname
	));
	
?><div>
<?php 
	if (isset($download) && $download==-1){
		echo '<bookmark title="'.$tNo.'" level="0" ></bookmark>';
	} ?>
	<div>
		<div class="ac"><?php
			$this->subview($letterPadHeader);
		?>
			<h2 class="highlght margin"><?php echo empty($titleText) ? 'PAYMENT VOUCHER' : $titleText; ?></h2>
		</div>
	</div>
	<table class="noborder vat nopadding" cellspacing="0" cellpadding="0" style="width:100%;padding-bottom:10px;" align="right">
		<tbody>
			<tr>
				<td  style="text-align:left"  width="78%"><?php
					if(!empty($billing)) {
						echo 'Paid To : ';
						$this->subview($addressView, $billing);
					}
				?></td>
				<td style="text-align:left" width="22%">
					<span><?php echo $tNo_text;?> <span style="margin-left:7px;">: <b><?php echo $tNo; ?></b></span></span><br>
					<?php if(!empty($tDate)) { ?><?php echo $tDate_text;?> <b><?php echo $tDate; ?></b><?php } ?>
					<?php if(!empty($paymentName)) { ?><br><span><?php echo $Payment_Mode;?> : <?php echo $paymentName; ?></span><?php } ?>
					<?php if(!empty($ref)) { ?><br><span><?php echo $Reference;?> : <?php echo $ref; ?></span><?php } ?>
					<?php if(!empty($isprojectname) && !empty($prjName)) { ?><br><span><?php echo mylang("ProjectName");?> : <?php echo $prjName; ?></span><?php } ?>
					<?php if(!empty($relNumber)) {?><br><?php echo 'Sup Inv.No : '.' <b> '. $relNumber .'</b>';}?>
					<?php if(!empty($relDate)) { ?><br><?php echo 'Sup Inv.Date : '.' <b>'. $relDate .'</b>';}?>
				</td>
			</tr>
		</tbody>
	</table>
	<?php 
	$this->view($detailsView, array(
		"useSimpleTaxCol" => isset($useSimpleTaxCol) ? $useSimpleTaxCol : 1,
		'showVerticalLine' => 1,
		'isShowFor' => '1',
		'isTaxDetailCol' => 0,
		
	));
	?>
	
</div>
<style>
	td {
		white-space: nowrap;
	}
	.highlght {
		background-color: <?php echo $bgColor; ?>;
		color: <?php echo $foreColor; ?>;
    		padding: 6px;
		padding-top:<?php echo !empty($isPrint) ? '3px' : ''; ?>;
	    	font-weight: bold;
	    	font-size: 19px;
	}
	.margin {
		margin-top: 0px;
   		margin-bottom: 6px;
	}
</style>
