Work on invoices, products and other minor things

This commit is contained in:
Deon George
2011-10-11 19:52:31 +11:00
parent 50a096e22a
commit 718c42be65
12 changed files with 393 additions and 257 deletions

View File

@@ -33,7 +33,7 @@ class Controller_Admin_Welcome extends Controller_TemplateDefault {
'account->name()'=>array('label'=>'Account'),
'account->display("status")'=>array('label'=>'Active'),
'id'=>array('label'=>'ID','url'=>'user/invoice/view/'),
'total_amt'=>array('label'=>'Total','class'=>'right'),
'total(TRUE)'=>array('label'=>'Total','class'=>'right'),
'due(TRUE)'=>array('label'=>'Amount Due','class'=>'right'),
),
array('page'=>TRUE)),
@@ -51,7 +51,7 @@ class Controller_Admin_Welcome extends Controller_TemplateDefault {
'account->name()'=>array('label'=>'Account'),
'account->display("status")'=>array('label'=>'Active'),
'id'=>array('label'=>'ID','url'=>'user/invoice/view/'),
'total_amt'=>array('label'=>'Total','class'=>'right'),
'total(TRUE)'=>array('label'=>'Total','class'=>'right'),
'due(TRUE)'=>array('label'=>'Amount Due','class'=>'right'),
),
array('page'=>TRUE)),
@@ -69,7 +69,7 @@ class Controller_Admin_Welcome extends Controller_TemplateDefault {
'account->name()'=>array('label'),
'account->display("status")'=>array('label'=>'Active'),
'id'=>array('label'=>'ID','url'=>'user/invoice/view/'),
'total_amt'=>array('label'=>'Total','class'=>'right'),
'total(TRUE)'=>array('label'=>'Total','class'=>'right'),
'due(TRUE)'=>array('label'=>'Amount Due','class'=>'right'),
),
array('show_other'=>'due()')),
@@ -78,12 +78,10 @@ class Controller_Admin_Welcome extends Controller_TemplateDefault {
));
// Show un-applied payments
$o = ORM::factory('payment');
Block_Sub::add(array(
'title'=>'Unapplied Payments',
'body'=>Table::display(
$o->list_unapplied(),
ORM::factory('payment')->list_unapplied(),
25,
array(
'date_payment'=>array('label'=>'Pay Date'),

View File

@@ -12,7 +12,8 @@
class Currency {
public static function display($amount) {
// @todo $cid and therefore precision should come from a global session value.
return Num::format($amount,2,TRUE);
// @todo This rounding needs to be system configurable.
return Num::format(round($amount,2),2,TRUE);
}
}
?>

View File

@@ -110,6 +110,10 @@ class Model_Account extends Model_Auth_UserDefault {
foreach ($this->invoices_due($date) as $io)
$result += $io->due();
// @todo This shouldnt really be required
if ($result < 0)
$result = 0;
return $format ? Currency::display($result) : $result;
}

View File

@@ -105,8 +105,10 @@ class Period {
$return = array(
'start'=>$period_start,
'start_time'=>$period_start,
'date'=>$start,
'end'=>$period_end,
'end_time'=>$period_end,
'weekday'=>$weekday,
'prorata'=>round($remain_time/$total_time,$precision),
'total_time'=>sprintf('%3.1f',$total_time/86400),