Updates to invoice display

This commit is contained in:
Deon George
2011-08-02 16:20:11 +10:00
parent c8c4c5176d
commit 41eec89afa
11 changed files with 137 additions and 11 deletions

View File

@@ -12,8 +12,9 @@
*/
class Controller_User_Invoice extends Controller_TemplateDefault {
public $secure_actions = array(
'download'=>TRUE,
'list'=>TRUE,
'view'=>FALSE,
'view'=>TRUE,
);
/**
@@ -28,7 +29,7 @@ class Controller_User_Invoice extends Controller_TemplateDefault {
Block::add(array(
'title'=>sprintf('%s: %s - %s',_('Invoices For'),$ao->accnum(),$ao->name(TRUE)),
'body'=>View::factory('invoice/list')
'body'=>View::factory('invoice/user/list')
->set('invoices',$ao->invoice->find_all()),
));
}
@@ -45,7 +46,7 @@ class Controller_User_Invoice extends Controller_TemplateDefault {
}
// @todo media path probably should be a config item
$this->template->content = View::factory('invoice/html')
$this->template->content = View::factory('invoice/user/html')
->set('mediapath',Route::get('default/media'))
->set('invoice',$io);
}

View File

@@ -23,6 +23,10 @@ class Model_Invoice extends ORMOSB {
'payment'=>array('through'=>'payment_item'),
);
protected $_sorting = array(
'id'=>'DESC',
);
/**
* @var array Filters to render values properly
*/

View File

@@ -112,7 +112,7 @@
<?php } ?>
<tr>
<td class="head" colspan="2">Sub Total:</td>
<td class="bold-right"><?echo $invoice->subtotal(TRUE); ?></td>
<td class="bold-right"><?php echo $invoice->subtotal(TRUE); ?></td>
</tr>
<tr>
<td class="head" colspan="4">Taxes Included:</td>
@@ -130,9 +130,12 @@
<!-- @todo Add discounts -->
<tr>
<td class="head" colspan="3">Total:</td>
<td class="bold-right"><?echo $invoice->total(TRUE); ?></td>
<td class="bold-right"><?php echo $invoice->total(TRUE); ?></td>
</tr>
</table>
</td>
</tr>
<tr>
<td><?php echo HTML::anchor('user/invoice/download/'.$invoice->id,'Download detailed invoice'); ?></td>
</tr>
</table>

View File

@@ -2,6 +2,7 @@
<table class="box-left">
<tr>
<td class="head">ID</td>
<td class="head">Date</td>
<td class="head">Total</td>
<td class="head">Credits</td>
<td class="head">Payments</td>
@@ -11,8 +12,9 @@
<?php $i = 0; foreach ($invoices as $invoice) { ?>
<tr class="<?php echo ++$i%2 ? 'odd' : 'even'; ?>">
<td><?php echo HTML::anchor('/user/invoice/view/'.$invoice->id,$invoice->id()); ?></td>
<td><?php echo $invoice->display('total_amt'); ?></td>
<td><?php echo $invoice->display('credit_amt'); ?></td>
<td><?php echo $invoice->display('date_orig'); ?></td>
<td class="number"><?php echo $invoice->display('total_amt'); ?></td>
<td class="number"><?php echo $invoice->display('credit_amt'); ?></td>
<td class="number"><?php echo $invoice->display('billed_amt'); ?></td>
<td style="font-weight: <?php echo $invoice->due() ? 'bold' : 'normal'; ?>"><?php echo Currency::display($invoice->due()); ?></td>
<td><?php echo $invoice->display('status'); ?></td>