<?php $this->load->view("partial/header"); ?>
<?php
if (isset($error_message))
{
	echo '<h1 style="text-align: center;">'.$error_message.'</h1>';
	exit;
}

?>
<div id="receipt_wrapper">
	
	<div id="receipt_header">
		<div id="company_name" style="display:none"><?php echo $this->config->item('company'); ?></div>
		<div id="company_address" style="display:none"><?php echo nl2br($this->Location->get_info_for_key('address')); ?></div>
		<?php if($this->config->item('company_logo')) {?>
		<div id="company_logo"><?php echo img(array('src' => $this->Appconfig->get_logo_image())); ?></div>
		<?php } ?>
		<div id="sale_receipt"><h3><?php echo $receipt_title; ?></h3></div>
		<div class="pull-right"><button style="display:none" class="btn btn-primary text-white hidden-print" id="new_receiving_button_1" onclick="window.location='<?php echo site_url('receivings'); ?>'" > <?php echo lang('receivings_new_receiving'); ?> </button></div>
	</div>
	<div id="receipt_general_info">
    	<div style="width:50%; float:left">
		
		<div id="sale_id"><?php echo "TRX: ".$expence_id; ?></div>
		<div id="employee"><?php echo 'Reference Voucher # '.": ".$ref_no; ?></div>
		<div id="employee"><?php echo 'Created By'.": ".$employee; ?></div>
		<div id="employee"><?php echo 'Paid To'.": ".$paid_to; ?></div>
		<div id="employee"><?php echo 'Location'.": ".$location; ?></div>
      
        </div>
    	<div style="width:35%; float:right">
        	<table id="receipt_items" >
            	<tr>
                	<td align="left">
					<?php if(isset($supplier)){?>
			<div id="customer"><?php echo lang('suppliers_supplier').": ".$supplier; ?></div>
					<?php } ?>
        			</td>
                </tr>
                <tr>
                	<td align="left">Transaction Date:<?php echo $expence_time ?></td>
                </tr>
                <tr>
                	<td align="left">Phone:<?php echo $this->Location->get_info_for_key('phone'); ?></td>
                </tr>
            </table>
        		

        </div>
        
	</div>

	<table id="receipt_items">
	<tr>
	<th >Title</th>
	<th style="text-align:left;">Description</th>
	<th style="width:16%;text-align:center;">Type</th>
	<th style="width:17%;text-align:right;"><?php echo lang('sales_total'); ?></th>
	</tr>
	
		<tr>
		<td style='text-align:left;'><?php echo $title; ?></td>
		<td style="text-align:left;"><?php echo $comments; ?></td>
		<td style='text-align:center;'><?php echo $expence_type; ?></td>
		<td style='text-align:right;'><?php echo to_currency($total); ?></td>
		</tr>
	
	

	
    <?php if(isset($comments) && $comments){ ?>
    <tr>
		<td colspan="6" style='text-align:left;'><?php echo '<b>Remarks:</b>'; ?> <?php echo $comments; ?></td>
		</tr>
     <?php } ?>
	</table>

	<div id="sale_return_policy">
	<?php echo nl2br($this->config->item('return_policy')); ?>
	</div>
	<div id='barcode'>
	<?php echo "<img src='".site_url('barcode')."?barcode=$expence_id&text=$expence_id' />"; ?>
	</div>
	<button class="btn btn-primary text-white hidden-print" id="print_button" onClick="window.print()" > <?php echo lang('sales_print'); ?> </button>
	<!--<br />-->
	<button style="display:none" class="btn btn-primary text-white hidden-print" id="new_receiving_button_2" onclick="window.location='<?php echo site_url('expences'); ?>'" > <?php echo "New"; ?> </button>
	
</div>
<?php $this->load->view("partial/footer"); ?>

<?php if ($this->config->item('print_after_sale'))
{
?>
<script type="text/javascript">
$(window).load(function()
{
	window.print();
});
</script>
<?php
}
?>