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

@ -44,10 +44,10 @@ class StaticList_RecurSchedule extends StaticList {
$table = static::factory()->table(); $table = static::factory()->table();
foreach ($product->get_price_array() as $term => $price) { foreach ($product->get_price_array() as $term => $price) {
$x[$term] = sprintf('%s %s',Currency::display($price['price_base']),$table[$term]); $x[$term] = sprintf('%s %s',Currency::display(Tax::add($price['price_base'])),$table[$term]);
if ($price['price_setup'] > 0) if ($price['price_setup'] > 0)
$x[$term] .= sprintf(' + %s %s',Currency::display($price['price_setup']),_('Setup')); $x[$term] .= sprintf(' + %s %s',Currency::display(Tax::add($price['price_setup'])),_('Setup'));
} }
return Form::select($name,$x,$default); return Form::select($name,$x,$default);

View File

@ -1,10 +1,10 @@
<?php defined('SYSPATH') or die('No direct access allowed.'); <?php defined('SYSPATH') or die('No direct access allowed.');
/** /**
* This class provides MODULE management * This class provides Admin Email management
* *
* @package lnApp * @package lnApp
* @subpackage Page/Module * @subpackage Page/Email
* @category Controllers * @category Controllers
* @author Deon George * @author Deon George
* @copyright (c) 2010 Deon George * @copyright (c) 2010 Deon George
@ -22,12 +22,10 @@ class Controller_Admin_Email extends Controller_TemplateDefault_Admin {
* Show a list of emails * Show a list of emails
*/ */
public function action_list() { public function action_list() {
$elo = ORM::factory('email_log');
Block::add(array( Block::add(array(
'title'=>_('System Emails Sent'), 'title'=>_('System Emails Sent'),
'body'=>Table::display( 'body'=>Table::display(
$elo->find_all(), ORM::factory('email_log')->find_all(),
25, 25,
array( array(
'id'=>array('label'=>'ID','url'=>'user/email/view/'), 'id'=>array('label'=>'ID','url'=>'user/email/view/'),

View File

@ -116,7 +116,7 @@ class Controller_Task_Invoice extends Controller_Task {
case 3: case 3:
// @todo This should go in a config somewhere // @todo This should go in a config somewhere
$days = 21; $days = 13;
break; break;
default: default:

View File

@ -15,6 +15,7 @@ class Model_Product extends ORMOSB {
protected $_has_many = array( protected $_has_many = array(
'product_translate'=>array('far_key'=>'id'), 'product_translate'=>array('far_key'=>'id'),
'service'=>array('far_key'=>'id'), 'service'=>array('far_key'=>'id'),
'invoice'=>array('through'=>'invoice_item'),
); );
protected $_sorting = array( protected $_sorting = array(
@ -26,9 +27,16 @@ class Model_Product extends ORMOSB {
'active'=>array( 'active'=>array(
array('StaticList_YesNo::display',array(':value')), array('StaticList_YesNo::display',array(':value')),
), ),
'price_base'=>array(
array('Tax::add',array(':value')),
array('Currency::display',array(':value')),
),
'price_type'=>array( 'price_type'=>array(
array('StaticList_PriceType::display',array(':value')), 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'))); 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 * Return the products for a given category
* @todo This shouldnt be here. * @todo This shouldnt be here.

View File

@ -19,7 +19,7 @@
<td> <td>
<table width="100%" border="0" cellspacing="1" cellpadding="0"> <table width="100%" border="0" cellspacing="1" cellpadding="0">
<tr valign="top"> <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>
<tr> <tr>
<td style="background-color: #FFFFFF;"> <td style="background-color: #FFFFFF;">