Improved User Welcome

This commit is contained in:
Deon George 2013-05-28 21:35:54 +10:00
parent d4a2ace403
commit e8ed74549a
9 changed files with 75 additions and 13 deletions

View File

@ -13,7 +13,7 @@ class Company {
// Our Company Setup object
private $so;
public function __construct(Model_Setup $so) {
protected function __construct(Model_Setup $so) {
$this->so = $so;
if (! $this->so->loaded())

View File

@ -16,10 +16,60 @@ class Controller_User_Welcome extends Controller_Welcome {
);
public function action_index() {
Block::add(array(
'title'=>sprintf('%s: %s',$this->ao->accnum(),$this->ao->name(TRUE)),
'body'=>View::factory('welcome/user'),
));
Block::factory()
->title(sprintf('Active Service for Account: %s',$this->ao->accnum()))
->title_icon('icon-info-sign')
->span(6)
->body(Table::factory()
->data($this->ao->service->list_active())
->jssort('service')
->columns(array(
'id'=>'ID',
'service_name()'=>'Service',
))
->prepend(array(
'id'=>array('url'=>URL::link('user','service/view/')),
))
);
Block::factory()
->title('Quick Shortcuts')
->title_icon('icon-bookmark')
->span(6)
->body(View::factory('welcome/user/shortcuts'));
Block::factory()
->title(sprintf('Invoices Due Account: %s (%s)',$this->ao->accnum(),$this->ao->invoice->list_due_total(TRUE)))
->title_icon('icon-info-sign')
->span(6)
->body(Table::factory()
->data($this->ao->invoice->list_due())
->columns(array(
'id'=>'ID',
'due_date'=>'Date Due',
'total(TRUE)'=>'Invoice Total',
'due(TRUE)'=>'Amount Due',
))
->prepend(array(
'id'=>array('url'=>URL::link('user','invoice/view/')),
))
);
Block::factory()
->title(sprintf('Services Expiring for Account: %s',$this->ao->accnum()))
->title_icon('icon-info-sign')
->span(6)
->body(Table::factory()
->data($this->ao->service->list_expiring())
->columns(array(
'id'=>'ID',
'service_name()'=>'Service',
'expire(TRUE)'=>'Date',
))
->prepend(array(
'id'=>array('url'=>URL::link('user','service/view/')),
))
);
}
}
?>

View File

@ -42,12 +42,11 @@ abstract class Kohana extends Kohana_Core {
'',
);
foreach ($prefixes as $p) {
foreach ($prefixes as $p)
if ($x = parent::find_file($dir,$p.$file,$ext,$array))
return $x;
}
break;
// We found a site path.
// We found a path.
return $x;
}

View File

@ -0,0 +1,4 @@
<div class="shortcuts">
<a href="<?php echo URL::link('user','invoice/list',TRUE); ?>" class="shortcut"><i class="shortcut-icon icon-list-alt"></i><span class="shortcut-label">Invoices</span></a>
<a href="<?php echo URL::link('user','service/list',TRUE); ?>" class="shortcut"><i class="shortcut-icon icon-list-alt"></i><span class="shortcut-label">Services</span></a>
</div>

View File

@ -4,7 +4,7 @@
* This class supports OSB exporting.
*
* @package Export
* @category Model
* @category Models
* @author Deon George
* @copyright (c) 2009-2013 Open Source Billing
* @license http://dev.osbill.net/license.html

View File

@ -4,7 +4,7 @@
* This class supports OSB exporting.
*
* @package Export
* @category Model
* @category Models
* @author Deon George
* @copyright (c) 2009-2013 Open Source Billing
* @license http://dev.osbill.net/license.html

View File

@ -4,7 +4,7 @@
* This class supports OSB exporting.
*
* @package Export
* @category Model
* @category Models
* @author Deon George
* @copyright (c) 2009-2013 Open Source Billing
* @license http://dev.osbill.net/license.html

View File

@ -4,7 +4,7 @@
* This class supports OSB exporting.
*
* @package Export
* @category Model
* @category Models
* @author Deon George
* @copyright (c) 2009-2013 Open Source Billing
* @license http://dev.osbill.net/license.html

View File

@ -620,6 +620,15 @@ class Model_Invoice extends ORM_OSB implements Cartable {
return $result;
}
public function list_due_total($format=FALSE,$time=NULL) {
$result = 0;
foreach ($this->list_due($time) as $io)
$result += $io->due();
return $format ? Currency::display($result) : Currency::round($result);
}
/**
* Return a list of invoices that need to be sent.
* @todo This should be optimised a little to return only invoices to send, instead of looking for them.