<table class="table table-striped table-condensed table-hover" id="list-table">
	<thead><tr>
		<th>Service</th>
		<th>ID</th>
		<th>Supplier Plan</th>
		<th>Contract Start</th>
		<th>Contract End</th>
		<th>Supplier Cost</th>
		<th>Invoiced</th>
		<th>Extras</th>
		<th>Total</th>
		<th>Charging</th>
		<th>Profit</th>
	</tr></thead>

	<tbody>
		<?php foreach ($aso->services(TRUE) as $so) : ?>
			<?php $p = $so->plugin(); $po = $p->admin_plan(); $service_number = $p->service_number; ?>
			<?php $cost = $o->charge($service_number); $excess = $o->excess($service_number); $charge = Period::multiple($so->recur_schedule)*$so->price(TRUE)/12; ?>

			<?php if ($cost != $po->supplier_plan->display('base_cost')) : ?>
				<tr class="error">
			<?php elseif ($charge-$cost-$excess < 0) : ?>
				<tr class="warning">
			<?php else : ?>
				<tr>
			<?php endif ?>

				<td><?php echo $service_number; ?></td>
				<td><?php echo HTML::anchor(URL::link('user','service/view/'.$so->id),$so->id); ?></td>
				<td><?php echo $po->supplier_plan->name().($p->provided_adsl_plan_id ? '*' : ''); ?></td>
				<td><?php echo $p->contract_date_start(TRUE); ?></td>
				<td><?php echo $p->contract_date_end(TRUE); ?></td>
				<td><?php echo $po->supplier_plan->display('base_cost'); ?></td>
				<td><?php echo Currency::display($cost); ?></td>
				<td><?php echo Currency::display($excess); ?></td>
				<td><?php echo Currency::display($cost+$excess); ?>
				<td><?php echo Currency::display($charge); ?>
				<td><?php echo Currency::display($charge-$cost-$excess); ?>

			</tr>
		<?php endforeach ?>

		<tr class="info">
			<td colspan="6">&nbsp;</td>
			<td><?php echo $o->totalcharge(TRUE); ?></td>
			<td><?php echo $o->totalexcess(TRUE); ?></td>
			<td><?php echo Currency::display($o->totalcharge()+$o->totalexcess()); ?></td>
			<td colspan="2">&nbsp;</td>
		</tr>
	</tbody>
</table>
