Added User email viewing
Improved Table::
This commit is contained in:
@@ -11,6 +11,39 @@
|
||||
* @license http://dev.osbill.net/license.html
|
||||
*/
|
||||
class Controller_Admin_Invoice extends Controller_TemplateDefault_Admin {
|
||||
protected $secure_actions = array(
|
||||
'list'=>TRUE,
|
||||
);
|
||||
|
||||
/**
|
||||
* Show a list of invoices
|
||||
*/
|
||||
public function action_list() {
|
||||
$io = ORM::factory('invoice');
|
||||
|
||||
Block::add(array(
|
||||
'title'=>_('System Customer Invoices'),
|
||||
'body'=>Table::display(
|
||||
$io->find_all(),
|
||||
25,
|
||||
array(
|
||||
'id'=>array('label'=>'ID','url'=>'user/invoice/view/'),
|
||||
'date_orig'=>array('label'=>'Date'),
|
||||
'total_amt'=>array('label'=>'Total','class'=>'right'),
|
||||
'credit_amt'=>array('label'=>'Credits','class'=>'right'),
|
||||
'billed_amt'=>array('label'=>'Payments','class'=>'right'),
|
||||
'due(TRUE)'=>array('label'=>'Still Due','class'=>'right'),
|
||||
'account->accnum()'=>array('label'=>'Cust ID'),
|
||||
'account->name()'=>array('label'=>'Customer'),
|
||||
),
|
||||
array(
|
||||
'page'=>TRUE,
|
||||
'type'=>'select',
|
||||
'form'=>'user/invoice/view',
|
||||
)),
|
||||
));
|
||||
}
|
||||
|
||||
public function action_convert() {
|
||||
if (Config::sitemode() != KOHANA::DEVELOPMENT)
|
||||
throw new Kohana_Exception(__METHOD__.' can only be run in development');
|
||||
|
@@ -11,11 +11,5 @@
|
||||
* @license http://dev.osbill.net/license.html
|
||||
*/
|
||||
class Controller_Invoice extends Controller_TemplateDefault {
|
||||
public function action_display() {
|
||||
// @todo - this should be a global config item
|
||||
$mediapath = Route::get('default/media');
|
||||
|
||||
$this->template->content = Kohana::debug(func_get_args());
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@@ -19,7 +19,7 @@ class Controller_Task_Invoice extends Controller_Task {
|
||||
throw new Kohana_Exception('Unknown Task List command :command',array(':command'=>$mode));
|
||||
|
||||
$total = $numinv = 0;
|
||||
$duelist = View::factory('invoice/task/'.$tm.'_header');
|
||||
$duelist = View::factory('invoice/task/'.$tm.'_head');
|
||||
foreach ($io->$tm() as $t) {
|
||||
$duelist .= View::factory('invoice/task/'.$tm.'_body')
|
||||
->set('io',$t);
|
||||
@@ -27,7 +27,7 @@ class Controller_Task_Invoice extends Controller_Task {
|
||||
$numinv++;
|
||||
$total += $t->due();
|
||||
}
|
||||
$duelist .= View::factory('invoice/task/'.$tm.'_footer');
|
||||
$duelist .= View::factory('invoice/task/'.$tm.'_foot');
|
||||
|
||||
// Send our email
|
||||
$et = Email_Template::instance('task_invoice_overdue');
|
||||
|
@@ -18,20 +18,46 @@ class Controller_User_Invoice extends Controller_TemplateDefault_User {
|
||||
);
|
||||
|
||||
/**
|
||||
* Show a product
|
||||
* Show a list of invoices
|
||||
*/
|
||||
public function action_list() {
|
||||
Block::add(array(
|
||||
'title'=>sprintf('%s: %s - %s',_('Invoices For'),$this->ao->accnum(),$this->ao->name(TRUE)),
|
||||
'body'=>View::factory('invoice/user/list')
|
||||
->set('invoices',$this->ao->invoice->find_all()),
|
||||
'body'=>Table::display(
|
||||
$this->ao->invoice->find_all(),
|
||||
25,
|
||||
array(
|
||||
'id'=>array('label'=>'ID','url'=>'user/invoice/view/'),
|
||||
'date_orig'=>array('label'=>'Date'),
|
||||
'total_amt'=>array('label'=>'Total','class'=>'right'),
|
||||
'credit_amt'=>array('label'=>'Credits','class'=>'right'),
|
||||
'billed_amt'=>array('label'=>'Payments','class'=>'right'),
|
||||
'due(TRUE)'=>array('label'=>'Still Due','class'=>'right'),
|
||||
),
|
||||
array(
|
||||
'page'=>TRUE,
|
||||
'type'=>'select',
|
||||
'form'=>'user/invoice/view',
|
||||
)),
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* View an Invoice
|
||||
*/
|
||||
public function action_view($id) {
|
||||
public function action_view() {
|
||||
$output = '';
|
||||
|
||||
if (! $id = $this->request->param('id')) {
|
||||
if (isset($_POST['id']) AND is_array($_POST['id']))
|
||||
Table::post('invoice_view','id');
|
||||
|
||||
list($id,$output) = Table::page('invoice_view');
|
||||
|
||||
} else {
|
||||
$id = $this->request->param('id');
|
||||
}
|
||||
|
||||
$io = ORM::factory('invoice',$id);
|
||||
|
||||
if (! $io->loaded() OR ! Auth::instance()->authorised($io->account_id)) {
|
||||
@@ -39,10 +65,14 @@ class Controller_User_Invoice extends Controller_TemplateDefault_User {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// @todo media path probably should be a config item
|
||||
$this->template->content = View::factory('invoice/user/html')
|
||||
$output .= View::factory('invoice/user/view')
|
||||
->set('mediapath',Route::get('default/media'))
|
||||
->set('invoice',$io);
|
||||
->set('io',$io);
|
||||
|
||||
Block::add(array(
|
||||
'title'=>sprintf('%s: %s',_('Invoice'),$io->refnum()),
|
||||
'body'=>$output,
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user