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.
2013-03-20 23:04:44 +11:00

219 lines
7.7 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 Company::instance()->logo(); ?></td>
<td class="address">
<span class="company_name"><?php echo Company::instance()->name(); ?></span><br/>
<?php echo Company::instance()->taxid(); ?><br/>
<br/>
<?php echo Company::instance()->address(); ?><br/>
<br/>
<?php echo Company::instance()->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</td>
<td class="bold-right"><?php echo $io->total_charges(TRUE); ?></td>
</tr>
<tr>
<td>Payments Received to Date</td>
<td class="bold-right"><?php echo $io->payments_total(TRUE); ?></td>
</tr>
<tr>
<td>Credits Applied to Date</td>
<td class="bold-right"><?php echo $io->total_credits(TRUE); ?></td>
</tr>
<tr>
<td>Total Charges Due This Invoice</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 border="0">
<tr>
<td class="head" colspan="4">Charges Detail:</td>
</tr>
<?php foreach ($io->items_index('period') as $rs => $items) { ?>
<tr>
<td><div id="toggle_<?php echo $rs; ?>"><?php echo HTML::image($mediapath->uri(array('file'=>'img/toggle-closed.png')),array('alt'=>'+')); ?></div><script type="text/javascript">$("#toggle_<?php echo $rs; ?>").click(function() {$('#detail_toggle_<?php echo $rs; ?>').toggle();});</script></td>
<?php if ($rs) { ?>
<td><?php echo StaticList_RecurSchedule::display($rs); ?></td>
<td><?php printf('%s Service(s)',count($items)); ?></td>
<td>&nbsp;</td>
<?php } else { ?>
<td colspan="3">Other Items</td>
<?php } ?>
</tr>
<tr>
<td>&nbsp;</td>
<td colspan="2">
<div id="detail_toggle_<?php echo $rs; ?>">
<table class="box-full" border="0">
<?php if ($items) {
foreach ($items as $k=>$service_id) {
$i = 0;
$lp = NULL;
$ito_tax = NULL;
foreach ($io->items_service($service_id) as $ito) {
$ito_tax = $ito;
// Our first line we show the Service Details
if ($ito->item_type == 0 AND $ito->product_id != $lp) {
$lp = $ito->product_id; ?>
<!-- Service Information -->
<tr class="head">
<td><?php echo HTML::anchor(URL::link('user','service/view/'.$ito->service_id),$ito->service->id()); ?></td>
<td colspan="5"><?php printf('%s - %s',$ito->product->name(),$ito->service->name()); ?> (<?php echo $ito->product_id; ?>)</td>
<td class="right"><?php echo ($i++==0 ? Currency::display($io->items_service_total($ito->service_id)) : '&nbsp;');?></td>
</tr>
<!-- END Product Information -->
<?php } ?>
<!-- Product Sub Information -->
<tr>
<td>&nbsp;</td>
<td><?php echo $ito->trannum();?></td>
<td><?php echo $ito->name();?></td>
<td><?php echo $ito->detail();?></td>
<td><?php echo $ito->period();?></td>
<td class="right"><?php echo Currency::display($ito->subtotal());?>&nbsp;</td>
</tr>
<!-- END Product Sub Information -->
<!-- Service Discount Information -->
<?php if ($ito->discount_amt) { ?>
<tr>
<td colspan="4">&nbsp;</td>
<td><?php echo _('Discounts'); ?></td>
<td class="right">(<?php echo Currency::display($io->items_service_discount($ito->service_id));?>)</td>
</tr>
<?php } ?>
<!-- END Service Discount Information -->
<?php } ?>
<?php if ($ito_tax) { ?>
<!-- Product Sub Items Tax -->
<tr>
<td colspan="4">&nbsp;</td>
<td><?php echo _('Taxes'); ?></td>
<td class="right"><?php echo Currency::display($io->items_service_tax($ito->service_id));?>&nbsp;</td>
</tr>
<!-- END Product Sub Items Tax -->
<?php } ?>
<?php } ?>
<?php } ?>
</table>
</div>
</td>
<td>&nbsp;</td>
</tr>
<?php } ?>
<?php if ($io->items_index('account')) { ?>
<tr>
<td><?php echo HTML::image($mediapath->uri(array('file'=>'img/toggle-closed.png')),array('alt'=>'+')); ?></td>
<td colspan="2">Other Invoice Items</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td colspan="2">
<div id="detail_toggle_other">
<table class="box-full" border="0">
<?php foreach ($io->items_index('account') as $id => $ito) { ?>
<tr>
<td>&nbsp;</td>
<td><?php echo $ito->trannum();?></td>
<td><?php echo $ito->name();?></td>
<td><?php echo $ito->detail();?></td>
<td><?php echo $ito->period();?></td>
<td class="right"><?php echo Currency::display($ito->subtotal());?>&nbsp;</td>
</tr>
<!-- Product Sub Items Tax -->
<tr>
<td colspan="4">&nbsp;</td>
<td><?php echo _('Taxes'); ?></td>
<td class="right"><?php echo Currency::display($io->items_service_tax($ito->service_id));?>&nbsp;</td>
</tr>
<!-- Product End Sub Items Tax -->
<?php } ?>
</table>
</div>
</td>
<td>&nbsp;</td>
</tr>
<?php } ?>
<!-- Invoice Sub Total -->
<tr>
<td class="head" colspan="2">Sub Total of Items:</td>
<td class="bold-right" colspan="2"><?php echo $io->subtotal(TRUE); ?></td>
</tr>
<!-- END Invoice Sub Total -->
<?php if ($io->total_credits()) { ?>
<!-- Invoice Credits -->
<tr>
<td class="head" colspan="2">Credits Received:</td>
<td class="bold-right" colspan="2"><?php echo $io->total_credits(TRUE); ?></td>
</tr>
<!-- END Invoice Credits -->
<?php } ?>
<?php if ($io->total_discounts()) { ?>
<!-- Invoice Discounts Total -->
<tr>
<td class="head" colspan="2">Discounts:</td>
<td class="bold-right" colspan="2">(<?php echo $io->total_discounts(TRUE); ?>)</td>
</tr>
<!-- END Invoice Discounts Total -->
<?php } ?>
<!-- Invoice Taxes Total -->
<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" colspan="2"><?php echo Currency::display($amount); ?></td>
</tr>
<?php }?>
<!-- END Invoice Taxes Total -->
<!-- Invoice Total -->
<tr>
<td class="head" colspan="2">Total This Invoice:</td>
<td class="bold-right" colspan="2"><?php echo $io->total(TRUE); ?></td>
</tr>
<!-- END Invoice Total -->
<!-- Account Total Due -->
<tr>
<td class="head" colspan="2">Total Outstanding This Account:</td>
<td class="bold-right" colspan="2"><?php echo $io->account->invoices_due_total(NULL,TRUE); ?></td>
</tr>
<!-- END Account Total Due -->
</table>
</td>
</tr>
<tr>
<td><?php echo HTML::anchor(URL::link('user','invoice/download/'.$io->id),'Download detailed invoice'); ?></td>
</tr>
</table>