Show amounts with tax now

This commit is contained in:
Deon George
2011-10-14 08:41:01 +11:00
parent f2fed0c54f
commit 8a8fbec9de
5 changed files with 29 additions and 9 deletions

View File

@@ -15,6 +15,7 @@ class Model_Product extends ORMOSB {
protected $_has_many = array(
'product_translate'=>array('far_key'=>'id'),
'service'=>array('far_key'=>'id'),
'invoice'=>array('through'=>'invoice_item'),
);
protected $_sorting = array(
@@ -26,9 +27,16 @@ class Model_Product extends ORMOSB {
'active'=>array(
array('StaticList_YesNo::display',array(':value')),
),
'price_base'=>array(
array('Tax::add',array(':value')),
array('Currency::display',array(':value')),
),
'price_type'=>array(
array('StaticList_PriceType::display',array(':value')),
),
'taxable'=>array(
array('StaticList_YesNo::display',array(':value')),
),
);
/**
@@ -116,6 +124,20 @@ class Model_Product extends ORMOSB {
echo HTML::image($thumb,array('alt'=>_('Thumb Nail')));
}
/**
* List the number of services using this product
*/
public function services_count() {
return $this->service->find_all()->count();
}
/**
* List the number of invoices using this product
*/
public function invoices_count() {
return $this->invoice->find_all()->count();
}
/**
* Return the products for a given category
* @todo This shouldnt be here.

View File

@@ -19,7 +19,7 @@
<td>
<table width="100%" border="0" cellspacing="1" cellpadding="0">
<tr valign="top">
<td class="heading"><a href="<?php echo URL::site(sprintf('product/view/%s?cid=%s',$record->id,$cat));?>"><?php echo $translate->name; ?></a> (<?php echo Currency::display($record->price_base); ?>/mth)</td>
<td class="heading"><a href="<?php echo URL::site(sprintf('product/view/%s?cid=%s',$record->id,$cat));?>"><?php echo $translate->name; ?></a> (<?php echo $record->display('price_base'); ?>/mth)</td>
</tr>
<tr>
<td style="background-color: #FFFFFF;">