Improvements to invoice

This commit is contained in:
Deon George
2013-06-13 23:35:19 +10:00
parent 25a47cac3a
commit 6875dc3693
15 changed files with 321 additions and 200 deletions

View File

@@ -20,7 +20,7 @@
<div class="span5">
<div class="row">
<div class="dl-horizontal">
<div class="dl-horizontal pull-right">
<dt>Tax Invoice</dt>
<dd><?php echo $o->id(); ?></dd>
<dt>Issue Date</dt>
@@ -45,112 +45,54 @@
<div class="span11">
<h4>Charge Details</h4>
<div class="accordion" id="charges">
<div class="accordion-group">
<table class="table table-striped table-condensed table-hover" id="list-table" border="0">
<tbody>
<?php foreach ($o->items_periods() as $rs) : ?>
<tr><th colspan="5"><?php echo StaticList_RecurSchedule::get($rs); ?></th></tr>
<?php foreach ($o->items_index('period') as $rs => $items) : ?>
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#charges" data-target="#collapse_<?php echo $rs; ?>">
<?php if ($rs) :
printf('%s - %s service(s)',StaticList_RecurSchedule::get($rs),count($items));
else :
echo 'Other Items';
endif ?>
</a>
</div>
<?php foreach ($o->items_periods($rs) as $iio) : ?>
<?php if ($iio->service_id) : ?>
<tr>
<th>&nbsp;</th>
<th colspan="2"><?php echo HTML::anchor(URL::link('user','service/view/'.$iio->service_id),$iio->service->id()).' '.$iio->service->service_name(); ?></th>
<th>&nbsp;</th>
<th><div class="text-right"><?php echo $o->service_items_total($iio,TRUE); ?></div></th>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td><?php printf('%s (%s)',$iio->invoice_line(),$iio->display('id')); ?></td>
<td><div class="text-right"><?php echo $iio->subtotal(TRUE); ?></div></td>
<td>&nbsp;</td>
</tr>
<?php if ($items) : ?>
<div id="collapse_<?php echo $rs; ?>" class="accordion-body collapse in">
<table>
<?php
foreach ($items as $k=>$service_id) :
$i = 0;
$lp = NULL;
$ito_tax = NULL;
foreach ($o->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->title(),$ito->service->name()); ?> (<?php echo $ito->product_id; ?>)</td>
<td class="right"><?php echo ($i++==0 ? Currency::display($o->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($o->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($o->items_service_tax($ito->service_id));?>&nbsp;</td>
</tr>
<!-- END Product Sub Items Tax -->
<?php } ?>
<?php if ($x=$o->service_items_extra($iio)) : ?>
<?php foreach ($x as $eiio) : ?>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td><?php printf('%s (%s)',$eiio->invoice_line(),$eiio->display('id')); ?></td>
<td><div class="text-right"><?php echo $eiio->subtotal(TRUE); ?></div></td>
<td>&nbsp;</td>
</tr>
<?php endforeach ?>
<?php endif ?>
</table>
</div>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td><?php echo 'Taxes'; ?></td>
<td><div class="text-right"><?php echo $o->service_items_tax($iio,TRUE); ?></div></td>
<td>&nbsp;</td>
</tr>
<?php else : ?>
<?php endif ?>
<?php endforeach ?>
<?php endforeach ?>
<?php if ($o->items_index('account')) : ?>
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#charges" data-target="#collapse_other">Other Items</a>
</div>
<div id="collapse_<?php echo $rs; ?>" class="accordion-body collapse">
<table>
<?php foreach ($o->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($o->items_service_tax($ito->service_id));?>&nbsp;</td>
</tr>
<!-- Product End Sub Items Tax -->
<?php endforeach ?>
</table>
</div>
<?php endif ?>
</div>
</div>
</tbody>
</table>
</div> <!-- /span -->
</div>
@@ -162,7 +104,7 @@
<div class="span5">
<div class="row">
<div class="dl-horizontal">
<div class="dl-horizontal pull-right">
<!-- Sub Total -->
<dt>Sub Total</dt>
<dd><?php echo $o->subtotal(TRUE); ?></dd>
@@ -191,11 +133,12 @@
<!-- END Invoice Taxes Total -->
<!-- Invoice Total -->
<dt>Total This Invoice:</dt>
<dt>Total Invoice:</dt>
<dd><?php echo $o->total(TRUE); ?></dd>
<!-- END Invoice Total -->
<!-- Account Total Due -->
<dt>Total Outstanding This Account:</dt>
<dt>Account Due:</dt>
<dd><?php echo $o->account->invoices_due_total(NULL,TRUE); ?></dd>
<!-- END Account Total Due -->
@@ -205,4 +148,5 @@
</div> <!-- /span -->
</div>
<?php echo Form::button(URL::link('user','invoice/download/'.$o->id),'Download detailed invoice',array('class'=>'btn btn-primary pull-right')); ?></td>
<br>
<?php echo HTML::anchor(URL::link('user','invoice/download/'.$o->id),'Download Invoice',array('class'=>'btn pull-right')); ?></td>

View File

@@ -0,0 +1,36 @@
<table class="table table-striped table-condensed table-hover" id="list-table">
<tbody>
<?php foreach ($o->items_periods() as $rs) : ?>
<tr><th colspan="5"><?php echo StaticList_RecurSchedule::get($rs); ?></th></tr>
<?php foreach ($o->items_periods($rs) as $iio) : ?>
<?php if ($iio->service_id) : ?>
<tr>
<th>&nbsp;</th>
<th colspan="2"><?php echo $iio->service->service_name(); ?></th>
<th>&nbsp;</th>
<th><div class="text-right"><?php echo $o->service_items_total($iio,TRUE); ?></div></th>
</tr>
<tr>
<td colspan="2">&nbsp;</td>
<td><?php echo $iio->invoice_line(); ?></td>
<td><div class="text-right"><?php echo $iio->total(TRUE); ?></div></td>
<td>&nbsp;</td>
</tr>
<?php if ($x=$o->service_items_extra($iio)) : ?>
<?php foreach ($x as $eiio) : ?>
<tr>
<td colspan="2">&nbsp;</td>
<td><?php echo $eiio->invoice_line(); ?></td>
<td><div class="text-right"><?php echo $eiio->total(TRUE); ?></div></td>
<td>&nbsp;</td>
</tr>
<?php endforeach ?>
<?php endif ?>
<?php endif ?>
<?php endforeach ?>
<?php endforeach ?>
</tbody>
</table>

View File

@@ -1,7 +1,9 @@
<div class="pull-right">
<?php
echo Form::open('cart/add');
echo Form::hidden('module_id',$mid);
echo Form::hidden('module_item',$o->id);
echo Form::open('cart/add');
echo Form::hidden('module_id',$mid,array('nocg'=>TRUE));
echo Form::hidden('module_item',$o->id,array('nocg'=>TRUE));
echo Form::button('submit','Add to Cart',array('class'=>'btn btn-primary','nocg'=>TRUE));
echo Form::close('cart/add');
?>
Add to cart for payment: <?php echo StaticList_YesNo::form('cart_add',true); ?>
<?php echo Form::submit('submit','Add to Cart'); echo Form::close('cart/add'); ?>
</div>