<div class="row">
	<div class="span5">
		<table>
			<tr>
				<td style="vertical-align: top"><?php echo HTML::image('http://www.gth.bgo.co/logo-blue'); ?></td>
				<td style="text-align: right; font-weight: bold">
					<?php echo Company::instance()->name(); ?><br/>
					<?php echo Company::instance()->taxid(); ?><br/>
					<br/>
					<?php echo Company::instance()->address(); ?><br/>
					<br/>
					<?php echo Company::instance()->contacts(); ?>
				</td>
			</tr>
		</table>
	</div> <!-- /span -->

	<div class="span5">
		<div class="dl-horizontal pull-right">
			<dt>Tax Invoice</dt>
			<dd><?php echo $o->id(); ?></dd>

			<dt>Issue Date</dt>
			<dd><?php echo $o->display('date_orig'); ?></dd>

			<dt>Due Date</dt>
			<dd><?php echo $o->display('due_date'); ?></dd>

			<dt>Current Charges</dt>
			<dd><?php echo $o->total_charges(TRUE); ?></dd>

			<dt>Payments Received</dt>
			<dd><?php echo $o->payments_total(TRUE); ?></dd>

			<dt>Credits Applied</dt>
			<dd><?php echo $o->total_credits(TRUE); ?></dd>

			<dt>Still Due</dt>
			<dd><?php echo $o->due(TRUE); ?></dd>
		</div>
	</div> <!-- /span -->
</div>

<div class="row">
	<div class="span11">
		<h4>Charge Details</h4>

		<?php echo Invoice::instance($o)->render('html','body'); ?>
	</div> <!-- /span -->
</div>

<div class="row">
	<div class="span5">
		<h5>Reminder Details</h5>

		<div class="dl-horizontal pull-left">
			<?php foreach ($o->reminders() as $eto) : ?>
				<dt><?php echo $o->reminders($eto->name,TRUE); ?></dt>
				<dd><?php echo $eto->name(); ?></dd>
			<?php endforeach ?>
		</div>
	</div> <!-- /span -->

	<div class="span5">
		<div class="dl-horizontal pull-right">
			<!-- Sub Total -->
			<dt>Sub Total</dt>
			<dd><?php echo $o->subtotal(TRUE); ?></dd>
			<!-- END Invoice Sub Total -->

			<!-- Invoice Credits -->
			<?php if ($o->total_credits()) : ?>
				<dt>Credits</dt>
				<dd><?php echo $o->total_credits(TRUE); ?></dd>
			<?php endif ?>
			<!-- END Invoice Credits -->

			<!-- Invoice Discounts Total -->
			<?php if ($o->total_discounts()) : ?>
				<dt>Discounts</dt>
				<dd><?php echo $o->total_discounts(TRUE); ?></dd>
			<?php endif ?>
			<!-- END Invoice Discounts Total -->

			<!-- Invoice Taxes Total -->
			<dt>Taxes Included:</dt>
			<?php foreach ($o->tax_summary() as $tid => $amount) :
				$m = ORM::factory('Tax',$tid); ?>
				<dd><?php printf('%s (%s)',Currency::display($amount),$m->description); ?><dd>
			<?php endforeach ?>
			<!-- END Invoice Taxes Total -->

			<!-- Invoice Total -->
			<dt>Total Invoice:</dt>
			<dd><?php echo $o->total(TRUE); ?></dd>
			<!-- END Invoice Total -->

			<!-- Account Total Due -->
			<dt>Account Due:</dt>
			<dd><?php echo $o->account->invoices_due_total(NULL,TRUE); ?></dd>
			<!-- END Account Total Due -->
		</div>
	</div> <!-- /span -->
</div>
