Some invoice cleanup, and Task updating conversion
This commit is contained in:
@@ -8,14 +8,9 @@
|
||||
* @author Deon George
|
||||
* @copyright (c) 2009-2013 Open Source Billing
|
||||
* @license http://dev.osbill.net/license.html
|
||||
*
|
||||
* Column Definitions:
|
||||
* + price_type: 0=One Time, 1=Recurring, 2=Trial, 3=Extra Item
|
||||
* + item_type: 0=MAIN Service Item,2=?,3=?,4=Connection/Setup,5=Excess Service Item,6=Change Service,126=Payment Fee,127=Late Fee
|
||||
*/
|
||||
class Controller_Admin_Invoice extends Controller_TemplateDefault_Admin {
|
||||
class Controller_Admin_Invoice extends Controller_Invoice {
|
||||
protected $secure_actions = array(
|
||||
'list'=>TRUE,
|
||||
'setup'=>TRUE,
|
||||
);
|
||||
|
||||
@@ -34,39 +29,5 @@ class Controller_Admin_Invoice extends Controller_TemplateDefault_Admin {
|
||||
'TAX_ID_NAME'=>_('TAX ID name shown on invoices'),
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show a list of invoices
|
||||
*/
|
||||
public function action_list() {
|
||||
$id = $this->request->param('id');
|
||||
|
||||
$invs = ORM::factory('Invoice');
|
||||
|
||||
if ($id)
|
||||
$invs->where('account_id','=',$id);
|
||||
|
||||
Block::add(array(
|
||||
'title'=>_('System Customer Invoices'),
|
||||
'body'=>Table::display(
|
||||
$invs->find_all(),
|
||||
25,
|
||||
array(
|
||||
'id'=>array('label'=>'ID','url'=>URL::link('user','invoice/view/')),
|
||||
'date_orig'=>array('label'=>'Date'),
|
||||
'total(TRUE)'=>array('label'=>'Total','class'=>'right'),
|
||||
'total_credits(TRUE)'=>array('label'=>'Credits','class'=>'right'),
|
||||
'payments_total(TRUE)'=>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'=>URL::link('user','invoice/view'),
|
||||
)),
|
||||
));
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@@ -12,48 +12,6 @@
|
||||
class Controller_Task_Invoice extends Controller_Task {
|
||||
public $auto_render = FALSE;
|
||||
|
||||
/**
|
||||
* Email a list of invoice balances
|
||||
*
|
||||
* This function is typically used to list the overdue invoices to the admins
|
||||
* @param string mode The callback method to use as the data list eg: overdue
|
||||
*/
|
||||
public function action_list() {
|
||||
$mode = $this->request->param('id');
|
||||
|
||||
$i = ORM::factory('Invoice');
|
||||
$tm = 'list_'.$mode;
|
||||
|
||||
if (! method_exists($i,$tm))
|
||||
throw new Kohana_Exception('Unknown Task List command :command',array(':command'=>$mode));
|
||||
|
||||
$total = $numinv = 0;
|
||||
$duelist = View::factory('invoice/task/'.$tm.'_head');
|
||||
foreach ($i->$tm() as $t) {
|
||||
$duelist .= View::factory('invoice/task/'.$tm.'_body')
|
||||
->set('io',$t);
|
||||
|
||||
$numinv++;
|
||||
$total += $t->due();
|
||||
}
|
||||
$duelist .= View::factory('invoice/task/'.$tm.'_foot');
|
||||
|
||||
// Send our email
|
||||
$et = Email_Template::instance('task_invoice_list_overdue');
|
||||
|
||||
// @todo Update this to be dynamic
|
||||
$et->to = array('account'=>array(1,68));
|
||||
$et->variables = array(
|
||||
'TABLE'=>$duelist,
|
||||
'NUM_INV'=>$numinv,
|
||||
'TOTAL'=>$total,
|
||||
);
|
||||
$et->send();
|
||||
|
||||
$output = sprintf('List (%s) sent to: %s',$mode,implode(',',array_keys($et->to)));
|
||||
$this->response->body($output);
|
||||
}
|
||||
|
||||
/**
|
||||
* Email a customers a reminder of their upcoming invoices that are due.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user