This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
khosb/modules/invoice/views/invoice/user/view.php
Deon George 6d44e7d5b2 Added User email viewing
Improved Table::
2012-01-12 19:53:52 +11:00

172 lines
6.1 KiB
PHP

<!-- @todo NEED to translate this -->
<table class="box-left" border="0">
<tr>
<td style="vertical-align: top">
<table class="company_details" border="0">
<tr>
<td class="logo"><?php echo Config::logo(); ?></td>
<td class="address"><span class="company_name"><?php echo Config::sitename(); ?></span><br/><?php echo Company::address(); ?><br/><?php echo Company::contacts(); ?></td>
</tr>
</table>
</td>
<td>&nbsp;</td>
<td>
<table class="invoice_summary" border="0">
<tr>
<td>TAX INVOICE</td>
<td class="bold-right"><?php echo $io->id(); ?></td>
</tr>
<tr>
<td>Issue Date</td>
<td class="bold-right"><?php echo $io->display('date_orig'); ?></td>
</tr>
<tr>
<td>Due Date</td>
<td class="bold-right"><?php echo $io->display('due_date'); ?></td>
</tr>
<tr>
<td>Current Charges Due</td>
<td class="bold-right"><?php echo $io->display('total_amt'); ?></td>
</tr>
<tr>
<td>Payments Received to Date</td>
<td class="bold-right"><?php echo $io->display('billed_amt'); ?></td>
</tr>
<tr>
<td>Total Charges Due</td>
<td class="bold-right"><?php echo $io->due(TRUE); ?></td>
</tr>
</table>
</td>
</tr>
<tr><td class="spacer" colspan="3">&nbsp;</td></tr>
<tr>
<td colspan="3">
<table class="box-full" border="0">
<tr>
<td class="head" colspan="4">Charges Detail:</td>
</tr>
<?php foreach ($io->sorted_service_items('recur_schedule') as $cat => $catitems) { ?>
<?php if ($cat) { ?>
<tr>
<td><div id="toggle_<?php echo $cat; ?>"><?php echo HTML::image($mediapath->uri(array('file'=>'img/toggle-closed.png')),array('alt'=>'+')); ?></div><script type="text/javascript">$("#toggle_<?php echo $cat; ?>").click(function() {$('#detail_toggle_<?php echo $cat; ?>').toggle();});</script></td>
<td><?php echo StaticList_RecurSchedule::display($cat); ?></td>
<td><?php printf('%s Services',count($catitems['items'])); ?></td>
<td class="bold-right"><?php echo Currency::display($catitems['total']); ?></td>
</tr>
<?php } else { ?>
<tr>
<td colspan="3">Other Items</td>
<td class="bold-right"><?php echo Currency::display($catitems['total']); ?></td>
</tr>
<?php } ?>
<tr>
<td>&nbsp;</td>
<td colspan="2">
<div id="detail_toggle_<?php echo $cat; ?>">
<table class="box-full" border="0">
<?php if ($catitems['items']) { ?>
<?php foreach ($catitems['items'] as $item) { ?>
<!-- Product Information -->
<tr class="head">
<td><?php echo HTML::anchor('/user/service/view/'.$item->service->id,$item->service->id()); ?></td>
<td colspan="3"><?php echo $item->product->product_translate->find()->name; ?> (<?php echo $item->product_id; ?>)</td>
<td class="right"><?php echo Currency::display($io->items_service_total($item->service_id));?></td>
</tr>
<!-- End Product Information -->
<!-- Product Sub Information -->
<tr>
<td>&nbsp;</td>
<td><?php echo $item->trannum();?></td>
<td><?php echo $item->period();?></td>
<td class="right"><?php echo Currency::display($item->subtotal());?></td>
</tr>
<!-- End Product Sub Information -->
<!-- Product Sub Items -->
<?php
foreach ($io->items_sub($item->service_id) as $subitem) {
if (! is_null($subitem->module_id)) {
$m = StaticList_Module::record('module','name','id',$subitem->module_id);
// @todo Need to remove the explicit test for 'charge' and be more dynamic
$mi = ORM::factory($m,$m == 'charge' ? $subitem->charge_id : $subitem->id);
$display = $mi->details('invoice');
} else {
$display = 'Other';
}
?>
<tr>
<td>&nbsp;</td>
<td><?php echo $subitem->trannum(); ?></td>
<td><?php echo $display; ?></td>
<td class="right"><?php echo Currency::display($subitem->subtotal());?></td>
</tr>
<?php } ?>
<!-- Product End Sub Items -->
<!-- Product Sub Items Tax -->
<tr>
<td colspan="2">&nbsp;</td>
<td><?php echo _('Taxes'); ?></td>
<td class="right"><?php echo Currency::display($io->items_service_tax($item->service_id));?></td>
</tr>
<!-- Product End Sub Items Tax -->
<?php } ?>
<?php } else { ?>
<!-- Product Sub Items -->
<?php
foreach ($io->items_sub(NULL) as $subitem) {
if (! is_null($subitem->module_id)) {
$m = StaticList_Module::record('module','name','id',$subitem->module_id);
// @todo Need to remove the explicit test for 'charge' and be more dynamic
$mi = ORM::factory($m,$m == 'charge' ? $subitem->charge_id : $subitem->id);
$display = $mi->details('invoice');
} else {
$display = 'Other';
}
?>
<tr>
<td>&nbsp;</td>
<td><?php echo $subitem->trannum(); ?></td>
<td><?php echo $display; ?></td>
<td class="right"><?php echo Currency::display($subitem->subtotal());?></td>
</tr>
<?php } ?>
<!-- Product End Sub Items -->
<?php } ?>
</table>
</div>
</td>
</tr>
<?php } ?>
<tr>
<td class="head" colspan="2">Sub Total:</td>
<td class="bold-right"><?php echo $io->subtotal(TRUE); ?></td>
</tr>
<tr>
<td class="head" colspan="4">Taxes Included:</td>
</tr>
<?php
foreach ($io->tax_summary() as $tid => $amount) {
$m = ORM::factory('tax',$tid);
?>
<tr>
<td>&nbsp;</td>
<td><?php echo $m->description; ?></td>
<td class="bold-right"><?php echo Currency::display($amount); ?></td>
</tr>
<?php }?>
<!-- @todo Add discounts -->
<tr>
<td class="head" colspan="3">Total:</td>
<td class="bold-right"><?php echo $io->total(TRUE); ?></td>
</tr>
</table>
</td>
</tr>
<tr>
<td><?php echo HTML::anchor('user/invoice/download/'.$io->id,'Download detailed invoice'); ?></td>
</tr>
</table>