Standardisation work, changed accnum() to refnum()

This commit is contained in:
Deon George 2016-07-29 23:04:34 +10:00
parent e0b45be758
commit 85f08bbb0a
52 changed files with 361 additions and 514 deletions

View File

@ -10,5 +10,6 @@
* @license http://dev.osbill.net/license.html
*/
class Controller_Account extends Controller_TemplateDefault {
protected $icon = 'fa fa-users';
}
?>

View File

@ -20,34 +20,24 @@ class Controller_Reseller_Account extends Controller_Account {
* Show a list of accounts
*/
public function action_list() {
$this->meta->title = 'Customer List';
$this->meta->title = 'R|Customer List';
Block::factory()
->title(_('Customer List'))
->title_icon('fa fa-list')
->body(Table::factory()
->data(ORM::factory('Account')->where_authorised($this->ao,'id')->find_all())
->jssort('customer')
->columns(array(
'id'=>'ID',
'status'=>'Active',
'accnum()'=>'Num',
'name(TRUE)'=>'Account',
'email'=>'Email',
'invoices_due_total(NULL,TRUE)'=>'Invoices',
'service->find_all()->count()'=>'Services',
))
->prepend(array(
'id'=>array('url'=>URL::link('reseller','account/view/')),
))
);
->title_icon($this->icon)
->body(View::factory('account/list')->set('o',ORM::factory('Account')->where_authorised($this->ao,'id')->find_all()));
}
/**
* Show a list of account logins
*/
public function action_listlog() {
$this->template->content = View::factory('account/reseller/listlog');
$this->meta->title = 'R|Customer Logins';
Block::factory()
->title(_('Customer List'))
->title_icon('fa fa-eye')
->body(View::factory('account/listlog')->set('o',ORM::factory('Account_Log')->where_authorised($this->ao)->find_all()));
}
public function action_view() {

View File

@ -19,89 +19,29 @@ class Controller_Reseller_Welcome extends Controller_Welcome {
public function action_index() {
$t = time();
// Show outstanding invoices
$o = ORM::factory('Invoice');
Block::factory()
->title($this->ao->RTM->display('name'))
->body('');
Block::factory()
->title('Invoices Overdue - No Auto Billing')
->title_icon('icon-info-sign')
->title_icon('fa fa-pencil-square-o')
->span(6)
->body(Table::factory()
->data($o->list_overdue_billing($t))
->columns(array(
'id'=>'ID',
'due_date'=>'Due',
'account->accnum()'=>'Num',
'account->name()'=>'Account',
'total(TRUE)'=>'Total',
'due(TRUE)'=>'Due',
))
->prepend(array(
'id'=>array('url'=>URL::link('user','invoice/view/')),
))
);
->body(View::factory('invoice/list')->set('o',ORM::factory('Invoice')->list_overdue_billing($t)));
Block::factory()
->title('Invoices Overdue - Auto Billing')
->title_icon('icon-info-sign')
->title_icon('fa fa-pencil-square-o')
->span(6)
->body(Table::factory()
->data($o->list_overdue_billing($t,TRUE))
->columns(array(
'id'=>'ID',
'due_date'=>'Due',
'account->accnum()'=>'Num',
'account->name()'=>'Account',
'total(TRUE)'=>'Total',
'due(TRUE)'=>'Due',
))
->prepend(array(
'id'=>array('url'=>URL::link('user','invoice/view/')),
))
);
->body(View::factory('invoice/list')->set('o',ORM::factory('Invoice')->list_overdue_billing($t,TRUE)));
Block::factory()
->title('Upcoming Invoices')
->title_icon('icon-info-sign')
->title_icon('fa fa-pencil-square-o')
->span(6)
->body(Table::factory()
->data($o->list_due(time()))
->columns(array(
'id'=>'ID',
'due_date'=>'Due',
'account->accnum()'=>'Num',
'account->name()'=>'Account',
'total(TRUE)'=>'Total',
'due(TRUE)'=>'Due',
))
->prepend(array(
'id'=>array('url'=>URL::link('user','invoice/view/')),
))
);
->body(View::factory('invoice/list')->set('o',ORM::factory('Invoice')->list_due($t)));
Block::factory()
->title('Un-applied payments')
->title_icon('icon-info-sign')
->title_icon('fa fa-money')
->span(6)
->body(Table::factory()
->data(ORM::factory('Payment')->where_authorised()->list_unapplied())
->columns(array(
'id'=>'ID',
'date_payment'=>'Pay Date',
'account->accnum()'=>'Num',
'account->name()'=>'Account',
'account->display("status")'=>'Active',
'total(TRUE)'=>'Total',
'balance(TRUE)'=>'Balance',
))
->prepend(array(
'id'=>array('url'=>URL::link('reseller','payment/view/')),
))
);
->body(View::factory('payment/list')->set('o',ORM::factory('Payment')->where_authorised()->list_unapplied()));
}
/**

View File

@ -23,7 +23,7 @@ class Controller_User_Account extends Controller_Account {
$this->ao->reload();
Block::factory()
->title(sprintf('Account: %s',$this->ao->accnum()))
->title(sprintf('Account: %s',$this->ao->refnum()))
->title_icon('icon-wrench')
->type('form-horizontal')
->body(View::factory('account/user/edit')->set('o',$this->ao));
@ -94,7 +94,7 @@ $("#reset").validate({
');
Block::factory()
->title(sprintf('Password Reset: %s',$this->ao->accnum()))
->title(sprintf('Password Reset: %s',$this->ao->refnum()))
->title_icon('icon-cog')
->id('reset')
->type('form-horizontal')

View File

@ -9,7 +9,7 @@
* @copyright (c) 2009-2013 Open Source Billing
* @license http://dev.osbill.net/license.html
*/
class Model_Account extends Model_Auth_UserDefault {
class Model_Account extends lnApp_Model_Account {
// Relationships
protected $_has_many = array(
'user_tokens'=>array('model'=>'user_token'),
@ -39,35 +39,12 @@ class Model_Account extends Model_Auth_UserDefault {
),
);
protected $_form = array('id'=>'id','value'=>'name(TRUE)');
protected $_save_message = TRUE;
/**
* Our account number format
*/
public function accnum() {
return sprintf('%s-%04s',Company::instance()->site(TRUE),$this->id);
}
/** OTHER METHODS **/
public function activated() {
return $this->has('group');
}
/**
* Get the groups that an account belongs to
*/
public function groups() {
$result = array();
foreach ($this->group->where_active()->find_all() as $go)
foreach ($go->list_parentgrps(TRUE) as $cgo)
if (empty($result[$cgo->id]))
$result[$cgo->id] = $cgo;
return $result;
}
/**
* Get a list of all invoices for this account
*/
@ -77,14 +54,6 @@ class Model_Account extends Model_Auth_UserDefault {
return $processed ? $o->find_all() : $o->where_unprocessed()->find_all();
}
public function isAdmin() {
return ($this->RTM->loaded() AND is_null($this->RTM->parent_id));
}
public function isReseller() {
return $this->RTM->loaded();
}
/**
* Get a list of due invoices for this account
*
@ -112,36 +81,12 @@ class Model_Account extends Model_Auth_UserDefault {
return $format ? Currency::display($result) : $result;
}
public function log($message) {
// Log a message for this account
$alo = ORM::factory('Account_Log');
$alo->account_id = $this->id;
$alo->ip = Request::$client_ip;
$alo->details = $message;
$alo->save();
return $alo->saved();
public function isAdmin() {
return ($this->RTM->loaded() AND is_null($this->RTM->parent_id));
}
/**
* This function will extract the available methods for this account
* This is used both for menu options and method security
*/
public function methods() {
static $result = array();
// @todo We may want to optimise this with some session caching.
if ($result)
return $result;
foreach ($this->groups() as $go)
foreach ($go->module_method->find_all() as $mmo)
if (empty($result[$mmo->id]))
$result[$mmo->id] = $mmo;
Sort::MAsort($result,array('module->name','menu_display'));
return $result;
public function isReseller() {
return $this->RTM->loaded();
}
/**

View File

@ -0,0 +1,17 @@
<!-- o = Array of Account -->
<?php echo Table::factory()
->data($o)
->jssort('customer')
->columns(array(
'id'=>'ID',
'status'=>'Active',
'refnum()'=>'Num',
'name(TRUE)'=>'Account',
'email'=>'Email',
'invoices_due_total(NULL,TRUE)'=>'Invoices',
'service->find_all()->count()'=>'Services',
))
->prepend(array(
'id'=>array('url'=>URL::link('reseller','account/view/')),
));
?>

View File

@ -0,0 +1,13 @@
<!-- o = Array of Model_Account_Log -->
<?php echo Table::factory()
->data($o)
->page_items(25)
->columns(array(
'id'=>'ID',
'date_orig'=>'Date',
'account->refnum()'=>'Acc ID',
'account->name()'=>'Acc Name',
'ip'=>'IP Address',
'details'=>'Details',
));
?>

View File

@ -1,15 +0,0 @@
<?php $o = Auth::instance()->get_user();
echo Block::factory()
->title(_('Customer Login Activity'))
->title_icon('fa fa-eye')
->body(Table::factory()
->data(ORM::factory('Account_Log')->where_authorised($o)->find_all())
->page_items(25)
->columns(array(
'id'=>'ID',
'date_orig'=>'Date',
'account->name()'=>'Account',
'ip'=>'IP Address',
'details'=>'Details',
))
);

View File

@ -1,6 +1,10 @@
<!-- o = Model_Account -->
<?php echo View::factory('service/user/list')->set('o',$o); ?>
<?php echo View::factory('invoice/user/list/due')->set('o',$o); ?>
<?php echo View::factory('service/user/list/expiring')->set('o',$o); ?>
<?php echo View::factory('service/user/list/inactive')->set('o',$o); ?>
<?php echo View::factory('welcome/user/view')->set('o',$o); ?>
<?php echo Block::factory()
->title(sprintf('InActive Services for Account: %s',$o->refnum()))
->title_icon('fa fa-barcode')
->span(6)
->body(View::factory('service/user/list/inactive')->set('o',$o->service->where('status','!=',1)->or_where('status','IS',null)->find_all())); ?>
<?php echo View::factory('invoice/user/next')->set('o',$o); ?>

View File

@ -1,3 +1,17 @@
<?php echo View::factory('service/user/list')->set('o',$o); ?>
<?php echo View::factory('invoice/user/list/due')->set('o',$o); ?>
<?php echo View::factory('service/user/list/expiring')->set('o',$o); ?>
<?php echo Block::factory()
->title(sprintf('Active Services Account: %s',$o->refnum()))
->title_icon('fa fa-barcode')
->span(6)
->body(View::factory('service/user/list/brief')->set('o',$o->service->list_active())); ?>
<?php echo Block::factory()
->title(sprintf('Invoices Due Account: %s (%s)',$o->refnum(),$o->invoice->list_due_total(TRUE)))
->title_icon('fa fa-money')
->span(6)
->body(View::factory('invoice/user/list/due')->set('o',$o->invoice->list_due())); ?>
<?php echo Block::factory()
->title(sprintf('Expiring Services Account: %s',$o->refnum()))
->title_icon('fa fa-barcode')
->span(6)
->body(View::factory('service/user/list/expiring')->set('o',$o->service->list_expiring())); ?>

View File

@ -75,7 +75,7 @@ class Controller_Reseller_Service_Adsl extends Controller_Service {
'plugin()->traffic_month(strtotime("first day of last month"),TRUE,TRUE)'=>'Last Month',
'recur_schedule'=>'Billing',
'price(TRUE,TRUE)'=>'Price',
'account->accnum()'=>'Cust ID',
'account->refnum()'=>'Cust ID',
'account->name()'=>'Customer',
'date_next_invoice'=>'Next Invoice',
'due(TRUE)'=>'Due Invoices',

View File

@ -137,33 +137,12 @@ $(document).ready(function() {
* Show a list of invoices
*/
public function action_list() {
$this->meta->title = 'Customer Charges';
$this->meta->title = 'R|Customer Charges';
Block::factory()
->title('Customer Charges')
->title_icon('fa fa-list')
->body(Table::factory()
->page_items(50)
->data(ORM::factory('Charge')->where_authorised($this->ao)->where('void','is',NULL)->order_by('id','DESC')->find_all())
->columns(array(
'id'=>'ID',
'date_charge'=>'Date',
'processed'=>'Processed',
'invoice_item->invoice_id'=>'Invoice',
'sweep_type'=>'Sweep',
'quantity'=>'Quantity',
'amount'=>'Amount',
'total(TRUE)'=>'Total',
'description'=>'Description',
'service_id'=>'Service',
'account->accnum()'=>'Cust ID',
'account->name()'=>'Customer',
))
->prepend(array(
'id'=>array('url'=>URL::link('reseller','charge/edit/')),
'invoice_item->invoice_id'=>array('url'=>URL::link('user','invoice/view/')),
))
);
->body(View::factory('charge/list')->set('o',ORM::factory('Charge')->where_authorised($this->ao)->where('void','is',NULL)->order_by('id','DESC')->find_all()));
}
}
?>

View File

@ -15,9 +15,6 @@ class Model_Charge extends ORM_OSB implements Invoicable {
'product'=>array(),
'service'=>array(),
);
protected $_has_one = array(
'invoice_item'=>array('far_key'=>'id'),
);
protected $_compress_column = array(
'attributes',
@ -82,6 +79,20 @@ class Model_Charge extends ORM_OSB implements Invoicable {
}
}
/**
* Return the Invoice Item object for this charge
*/
public function iio() {
$iio = ORM::factory('Invoice_Item');
if ($this->processed) {
$iio->where('module_id','=',$this->mid())
->where('module_ref','=',$this->id)
->find();
}
return $iio;
}
public function invoice_item($item_type) {
switch ($item_type) {
case 5:

View File

@ -0,0 +1,24 @@
<!-- o = Array of Model_Charge -->
<?php echo Table::factory()
->page_items(50)
->data($o)
->columns(array(
'id'=>'ID',
'date_charge'=>'Date',
'processed'=>'Processed',
'iio()->invoice_id'=>'Invoice',
'sweep_type'=>'Sweep',
'quantity'=>'Quantity',
'amount'=>'Amount',
'total(TRUE)'=>'Total',
'description'=>'Description',
'service_id'=>'Service',
'account->refnum()'=>'Cust ID',
'account->name()'=>'Customer',
))
->prepend(array(
'id'=>array('url'=>URL::link('reseller','charge/edit/')),
'service_id'=>array('url'=>URL::link('user','service/view/')),
'iio()->invoice_id'=>array('url'=>URL::link('user','invoice/view/')),
));
?>

View File

@ -30,7 +30,7 @@ class Controller_Admin_Service_Domain extends Controller_Domain {
'plugin()->display("domain_expire")'=>'Expire',
'recur_schedule'=>'Billing',
'price(TRUE,TRUE)'=>'Charge',
'account->accnum()'=>'Cust ID',
'account->refnum()'=>'Cust ID',
'account->name()'=>'Customer',
'plugin()->registrar->name'=>'Registrar',
))

View File

@ -27,7 +27,7 @@ class Controller_Reseller_Service_Domain extends Controller_Service {
'plugin()->display("domain_expire")'=>'Expire',
'recur_schedule'=>'Billing',
'price(TRUE,TRUE)'=>'Price',
'account->accnum()'=>'Cust ID',
'account->refnum()'=>'Cust ID',
'account->name()'=>'Customer',
'date_next_invoice'=>'Next Invoice',
'due(TRUE)'=>'Due Invoices',

View File

@ -10,5 +10,6 @@
* @license http://dev.osbill.net/license.html
*/
class Controller_Email extends Controller_TemplateDefault {
protected $icon = 'fa fa-envelope';
}
?>

View File

@ -18,29 +18,12 @@ class Controller_Reseller_Email extends Controller_Email {
* Show a list of emails
*/
public function action_list() {
$this->meta->title = 'Emails Sent';
$this->meta->title = 'R|Emails Sent';
Block::factory()
->title(_('Emails Sent'))
->title_icon('fa fa-envelope')
->body(Table::factory()
->page_items(25)
->data(ORM::factory('Email_Log')->where_authorised($this->ao)->find_all())
->columns(array(
'id'=>'ID',
'date_orig'=>'Date',
'email'=>'To',
'resolve("subject")'=>'Subject',
'account->accnum()'=>'Cust ID',
'account->name()'=>'Customer',
))
->prepend(array(
'id'=>array('url'=>URL::link('user','email/view/')),
))
->postproc(array(
'resolve("subject")'=>array('trim'=>60),
))
);
->title_icon($this->icon)
->body(View::factory('email/list')->set('o',ORM::factory('Email_Log')->where_authorised($this->ao)->find_all()));
}
}
?>

View File

@ -21,7 +21,10 @@ class Controller_User_Email extends Controller_Email {
public function action_list() {
$this->meta->title = 'Email List';
$this->template->content = View::factory('email/user/list');
Block::factory()
->title(sprintf(_('System Emails Sent for %s: %s'),$this->ao->refnum(),$this->ao->name(TRUE)))
->title_icon($this->icon)
->body(View::factory('email/user/list')->set('o',$this->ao->email_log->find_all()));
}
public function action_view() {

View File

@ -0,0 +1,19 @@
<!-- o = Array of Model_Email -->
<?php echo Table::factory()
->page_items(25)
->data($o)
->columns(array(
'id'=>'ID',
'date_orig'=>'Date',
'email'=>'To',
'resolve("subject")'=>'Subject',
'account->refnum()'=>'Cust ID',
'account->name()'=>'Customer',
))
->prepend(array(
'id'=>array('url'=>URL::link('user','email/view/')),
))
->postproc(array(
'resolve("subject")'=>array('trim'=>60),
));
?>

View File

@ -1,19 +1,16 @@
<?php $o = Auth::instance()->get_user();
echo Block::factory()
->title(sprintf(_('System Emails Sent for %s: %s'),$o->accnum(),$o->name(TRUE)))
->title_icon('fa fa-list')
->body(Table::factory()
->page_items(25)
->data($o->email_log->find_all())
->columns(array(
'id'=>'ID',
'date_orig'=>'Date',
'resolve("subject")'=>'Subject',
))
->prepend(array(
'id'=>array('url'=>URL::link('user','email/view/')),
))
->postproc(array(
'resolve("subject")'=>array('trim'=>60),
))
);
<!-- o = Array of Model_Email -->
<?php echo Table::factory()
->page_items(25)
->data($o)
->columns(array(
'id'=>'ID',
'date_orig'=>'Date',
'resolve("subject")'=>'Subject',
))
->prepend(array(
'id'=>array('url'=>URL::link('user','email/view/')),
))
->postproc(array(
'resolve("subject")'=>array('trim'=>60),
));
?>

View File

@ -27,7 +27,7 @@ class Controller_Reseller_Service_Host extends Controller_Service {
'plugin()->display("host_expire")'=>'Expire',
'recur_schedule'=>'Billing',
'price(TRUE,TRUE)'=>'Price',
'account->accnum()'=>'Cust ID',
'account->refnum()'=>'Cust ID',
'account->name()'=>'Customer',
'date_next_invoice'=>'Next Invoice',
'due(TRUE)'=>'Due Invoices',

View File

@ -10,5 +10,6 @@
* @license http://dev.osbill.net/license.html
*/
class Controller_Invoice extends Controller_TemplateDefault {
protected $icon = 'fa fa-pencil-square-o';
}
?>

View File

@ -15,28 +15,12 @@ class Controller_Reseller_Invoice extends Controller_Invoice {
);
public function action_list() {
$this->meta->title = 'Customer Invoice List';
$this->meta->title = 'R|Customer Invoice List';
Block::factory()
->title('Customer Invoices')
->title_icon('fa fa-edit')
->body(Table::factory()
->jssort('invoices')
->data(ORM::factory('Invoice')->where_authorised($this->ao)->where_active()->find_all())
->page_items(25)
->columns(array(
'id'=>'ID',
'date_orig'=>'Date Created',
'due_date'=>'Date Due',
'total(TRUE)'=>'Total',
'due(TRUE)'=>'Due',
'account->accnum()'=>'Cust ID',
'account->name()'=>'Customer',
))
->prepend(array(
'id'=>array('url'=>URL::link('user','invoice/view/')),
))
);
->title_icon($this->icon)
->body(View::factory('invoice/list')->set('o',ORM::factory('Invoice')->where_authorised($this->ao)->where_active()->find_all()));
}
}
?>

View File

@ -76,24 +76,9 @@ class Controller_User_Invoice extends Controller_Invoice {
$this->meta->title = 'Invoice List';
Block::factory()
->title(sprintf('Invoices for Account: %s',$this->ao->accnum()))
->title_icon('fa fa-list')
->body(Table::factory()
->jssort('invoices')
->data($this->ao->invoice->find_all())
->columns(array(
'id'=>'ID',
'date_orig'=>'Date Issued',
'due_date'=>'Date Due',
'total(TRUE)'=>'Total',
'total_credits(TRUE)'=>'Credits',
'payments_total(TRUE)'=>'Payments',
'due(TRUE)'=>'Still Due',
))
->prepend(array(
'id'=>array('url'=>URL::link('user','invoice/view/')),
))
);
->title(sprintf('Invoices for Account: %s',$this->ao->refnum()))
->title_icon($this->icon)
->body(View::factory('invoice/user/list')->set('o',$this->ao->invoice->find_all()));
}
/**

View File

@ -80,7 +80,7 @@ class Invoice_TCPDF_Default extends Invoice_Tcpdf {
$this->SetFont('helvetica','',10);
$this->SetXY($x,$y); $this->Cell(0,0,_('Account Number'));
$this->SetFont('helvetica','B',11);
$this->SetXY($x,$y); $this->Cell(0,0,$this->io->account->accnum(),0,0,'R');
$this->SetXY($x,$y); $this->Cell(0,0,$this->io->account->refnum(),0,0,'R');
// Invoice number
$y = 210;

View File

@ -52,7 +52,16 @@ class Model_Invoice extends ORM_OSB implements Cartable {
private $_render = array();
// Our required Interface Methods
/** REQUIRED ABSTRACT METHODS **/
/**
* Display the Invoice Reference Number
*/
public function refnum($short=FALSE) {
return ($short ? '' : $this->account->refnum(FALSE).'-').sprintf('%06s',$this->id);
}
/** REQUIRED INTERFACE METHODS **/
public function cart_item() {
return new Cart_Item(1,sprintf('Invoice: %s',$this->refnum()),$this->due());
@ -221,13 +230,6 @@ class Model_Invoice extends ORM_OSB implements Cartable {
}
}
/**
* Display the Invoice Reference Number
*/
public function refnum() {
return sprintf('%s-%06s',$this->account->accnum(),$this->id);
}
/**
* Check the reminder value
*/

View File

@ -0,0 +1,16 @@
<!-- o = Array of Model_Invoice -->
<?php echo Table::factory()
->data($o)
->page_items(25)
->columns(array(
'id'=>'ID',
'due_date'=>'Due',
'account->refnum()'=>'Num',
'account->name()'=>'Account',
'total(TRUE)'=>'Total',
'due(TRUE)'=>'Due',
))
->prepend(array(
'id'=>array('url'=>URL::link('user','invoice/view/')),
));
?>

View File

@ -0,0 +1,17 @@
<!-- o = Array of Model_Invoice -->
<?php echo Table::factory()
->page_items(25)
->data($o)
->columns(array(
'id'=>'ID',
'date_orig'=>'Date Issued',
'due_date'=>'Date Due',
'total(TRUE)'=>'Total',
'total_credits(TRUE)'=>'Credits',
'payments_total(TRUE)'=>'Payments',
'due(TRUE)'=>'Still Due',
))
->prepend(array(
'id'=>array('url'=>URL::link('user','invoice/view/')),
));
?>

View File

@ -1,18 +1,13 @@
<!-- o = Model Account -->
<?php echo Block::factory()
->title(sprintf('Invoices Due Account: %s (%s)',$o->accnum(),$o->invoice->list_due_total(TRUE)))
->title_icon('fa fa-money')
->span(6)
->body(Table::factory()
->data($o->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/')),
))
);
<!-- o = Array of Model_Invoice -->
<?php echo Table::factory()
->data($o)
->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/')),
));
?>

View File

@ -6,7 +6,7 @@
$i->add_service($io);
echo Block::factory()
->title(sprintf('Next Invoice Items for Account: %s',$o->accnum()))
->title(sprintf('Next Invoice Items for Account: %s',$o->refnum()))
->title_icon('fa fa-shopping-cart')
->span(6)
->body($i->render('html','body',array('noid'=>TRUE)));

View File

@ -10,5 +10,6 @@
* @license http://dev.osbill.net/license.html
*/
class Controller_Payment extends Controller_TemplateDefault {
protected $icon = 'fa fa-money';
}
?>

View File

@ -18,28 +18,12 @@ class Controller_Reseller_Payment extends Controller_Payment {
* Show a list of payments
*/
public function action_list() {
$this->meta->title = 'Customer Payments';
$this->meta->title = 'R|Customer Payments';
Block::factory()
->title('Customer Payments')
->title_icon('fa fa-money')
->body(Table::factory()
->page_items(50)
->data(ORM::factory('Payment')->where_authorised($this->ao)->find_all())
->columns(array(
'id'=>'ID',
'date_payment'=>'Date',
'checkout->display("name")'=>'Method',
'total(TRUE)'=>'Total',
'balance(TRUE)'=>'Balance',
'invoicelist()'=>'Invoices',
'account->accnum()'=>'Cust ID',
'account->name()'=>'Customer',
))
->prepend(array(
//'id'=>array('url'=>URL::link('reseller','payment/edit/')), //@todo To Implement
))
);
->title_icon($this->icon)
->body(View::factory('payment/reseller/list')->set('o',ORM::factory('Payment')->where_authorised($this->ao)->find_all()));
}
}
?>

View File

@ -21,20 +21,9 @@ class Controller_User_Payment extends Controller_Payment {
$this->meta->title = 'Payments Received';
Block::factory()
->title(sprintf('%s: %s - %s',_('Payments Received For'),$this->ao->accnum(),$this->ao->name(TRUE)))
->title_icon('fa fa-money')
->body(Table::factory()
->page_items(50)
->data($this->ao->payment->find_all())
->columns(array(
'id'=>'ID',
'date_payment'=>'Date',
'checkout->display("name")'=>'Method',
'total(TRUE)'=>'Total',
'balance(TRUE)'=>'Balance',
'invoicelist()'=>'Invoices',
))
);
->title(sprintf('%s: %s - %s',_('Payments Received For'),$this->ao->refnum(),$this->ao->name(TRUE)))
->title_icon($this->icon)
->body(View::factory('payment/user/list')->set('o',$this->ao->payment->find_all()));
}
}
?>

View File

@ -100,7 +100,7 @@ class Payment_Bulk_Ezypay {
'checkout->display("name")'=>'Method',
'total_amt'=>'Amount',
'fees_amt'=>'Fees',
'account->accnum()'=>'Cust ID',
'account->refnum()'=>'Cust ID',
'account->name()'=>'Customer',
))
->prepend(array(

View File

@ -0,0 +1,16 @@
<!-- o = Array of Model_Payment -->
<?php echo Table::factory()
->data($o)
->columns(array(
'id'=>'ID',
'date_payment'=>'Pay Date',
'account->refnum()'=>'Num',
'account->name()'=>'Account',
'account->display("status")'=>'Active',
'total(TRUE)'=>'Total',
'balance(TRUE)'=>'Balance',
))
->prepend(
Auth::instance()->get_user()->isAdmin() ? array('id'=>array('url'=>URL::link('admin','payment/edit/'))) : array()
)
?>

View File

@ -0,0 +1,18 @@
<!-- o = Array of Model_Payment -->
<?php echo Table::factory()
->page_items(50)
->data($o)
->columns(array(
'id'=>'ID',
'date_payment'=>'Date',
'checkout->display("name")'=>'Method',
'total(TRUE)'=>'Total',
'balance(TRUE)'=>'Balance',
'invoicelist()'=>'Invoices',
'account->refnum()'=>'Cust ID',
'account->name()'=>'Customer',
))
->prepend(
Auth::instance()->get_user()->isAdmin() ? array('id'=>array('url'=>URL::link('admin','payment/edit/'))) : array()
);
?>

View File

@ -0,0 +1,13 @@
<!-- o = Array of Model_Payment -->
<?php echo Table::factory()
->page_items(50)
->data($o)
->columns(array(
'id'=>'ID',
'date_payment'=>'Date',
'checkout->display("name")'=>'Method',
'total(TRUE)'=>'Total',
'balance(TRUE)'=>'Balance',
'invoicelist()'=>'Invoices',
));
?>

View File

@ -248,20 +248,7 @@ $.ajax({
Block::factory()
->title(sprintf('%s: %s',_('Current Services Using this Product'),$po->title()))
->title_icon('icon-th-list')
->body(Table::factory()
->data($po->service->where_active()->find_all())
->page_items(25)
->columns(array(
'id'=>'ID',
'account->accnum()'=>'Acc Num',
'account->name()'=>'Account',
'name()'=>'Details',
'status'=>'Active',
'price(TRUE,TRUE)'=>'Price',
))
->prepend(array(
'id'=>array('url'=>URL::link('user','service/view/')),
)));
->body(View::factory('service/reseller/list')->set('o',$po->service->where_active()->find_all()));
}
}
?>

View File

@ -25,23 +25,8 @@ class Controller_Reseller_Service extends Controller_Service {
Block::factory()
->title('Customer Services')
->title_icon('fa fa-list')
->body(Table::factory()
->jssort('services')
->data(ORM::factory('Service')->where_authorised($this->ao)->find_all())
->columns(array(
'id'=>'ID',
'service_name()'=>'Service',
'recur_schedule'=>'Billing',
'price(TRUE,TRUE)'=>'Price',
'status'=>'Active',
'account->accnum()'=>'Cust ID',
'account->name()'=>'Customer',
))
->prepend(array(
'id'=>array('url'=>URL::link('user','service/view/')),
))
);
->title_icon($this->icon)
->body(View::factory('service/reseller/list')->set('o',ORM::factory('Service')->where_authorised($this->ao)->find_all()));
}
/**
@ -61,24 +46,8 @@ class Controller_Reseller_Service extends Controller_Service {
if ($svs)
Block::factory()
->title('Services that should be auto-billed')
->title_icon('icon-pencil')
->body(Table::factory()
->jssort('services')
->data($svs)
->columns(array(
'id'=>'ID',
'service_name()'=>'Service',
'recur_schedule'=>'Billing',
'price(TRUE,TRUE)'=>'Price',
'account->accnum()'=>'Cust ID',
'account->name()'=>'Customer',
'date_next_invoice'=>'Next Invoice',
'due(TRUE)'=>'Due Invoices',
))
->prepend(array(
'id'=>array('url'=>URL::link('user','service/view/')),
))
);
->title_icon($this->icon)
->body(View::factory('service/reseller/list')->set('o',$svs));
foreach (ORM::factory('Checkout')->find_all() as $co) {
$svs = array();
@ -89,7 +58,7 @@ class Controller_Reseller_Service extends Controller_Service {
if ($svs)
Block::factory()
->title($co->name)
->title_icon('icon-repeat')
->title_icon('fa fa-bank')
->body(Table::factory()
->jssort($co->id)
->data($svs)
@ -98,7 +67,7 @@ class Controller_Reseller_Service extends Controller_Service {
'service_name()'=>'Service',
'recur_schedule'=>'Billing',
'price(TRUE,TRUE)'=>'Price',
'account->accnum()'=>'Cust ID',
'account->refnum()'=>'Cust ID',
'account->name()'=>'Customer',
'date_next_invoice'=>'Next Invoice',
'due(TRUE)'=>'Due Invoices',
@ -117,23 +86,8 @@ class Controller_Reseller_Service extends Controller_Service {
public function action_listexpiring() {
Block::factory()
->title('Customer Services Expiring')
->title_icon('icon-th-list')
->body(Table::factory()
->jssort('services')
->data(ORM::factory('Service')->where_authorised($this->ao)->list_expiring())
->columns(array(
'id'=>'ID',
'expire(TRUE)'=>'Expiry',
'service_name()'=>'Service',
'recur_schedule'=>'Billing',
'price(TRUE,TRUE)'=>'Price',
'account->accnum()'=>'Cust ID',
'account->name()'=>'Customer',
))
->prepend(array(
'id'=>array('url'=>URL::link('user','service/view/')),
))
);
->title_icon($this->icon)
->body(View::factory('service/reseller/list')->set('o',ORM::factory('Service')->where_authorised($this->ao)->list_expiring()));
}
/**
@ -142,25 +96,8 @@ class Controller_Reseller_Service extends Controller_Service {
public function action_listinvoicesoon() {
Block::factory()
->title('Customer Services soon to be Invoiced')
->title_icon('icon-th-list')
->body(Table::factory()
->jssort('services')
->data(ORM::factory('Service')->where_authorised($this->ao)->list_invoicesoon(ORM::factory('Invoice')->config('GEN_SOON_DAYS')+30))
->columns(array(
'id'=>'ID',
'expire(TRUE)'=>'Expiry',
'service_name()'=>'Service',
'recur_schedule'=>'Billing',
'price(TRUE,TRUE)'=>'Price',
'charges(TRUE,TRUE)'=>'Charges',
'account->accnum()'=>'Cust ID',
'account->name()'=>'Customer',
'date_next_invoice'=>'Next Invoice',
))
->prepend(array(
'id'=>array('url'=>URL::link('user','service/view/')),
))
);
->title_icon($this->icon)
->body(View::factory('service/reseller/list')->set('o',ORM::factory('Service')->where_authorised($this->ao)->list_invoicesoon(ORM::factory('Invoice')->config('GEN_SOON_DAYS')+30)));
}
}
?>

View File

@ -40,22 +40,9 @@ class Controller_User_Service extends Controller_Service {
$this->meta->title = 'Service List';
Block::factory()
->title(sprintf('Services for Account: %s',$this->ao->accnum()))
->title_icon('icon-th-list')
->body(Table::factory()
->jssort('services')
->data($this->ao->service->find_all())
->columns(array(
'id'=>'ID',
'service_name()'=>'Service',
'recur_schedule'=>'Billing',
'price(TRUE,TRUE)'=>'Price',
'status'=>'Active',
))
->prepend(array(
'id'=>array('url'=>URL::link('user','service/view/')),
))
);
->title(sprintf('Services for Account: %s',$this->ao->refnum()))
->title_icon($this->icon)
->body(View::factory('service/user/list')->set('o',$this->ao->service->find_all()));
}
public function action_view() {

View File

@ -4,7 +4,7 @@
<div class="dl-horizontal">
<dt>Account</dt>
<dd><?php printf('%s (%s)',$o->account->name(),$o->account->accnum()); ?></dd>
<dd><?php printf('%s (%s)',$o->account->name(),$o->account->refnum(TRUE)); ?></dd>
<?php if ($o->external_billing) : ?>
<dt>External Billed</dt>

View File

@ -0,0 +1,20 @@
<!-- o = Array of Model_Service -->
<?php echo Table::factory()
->jssort('services')
->data($o)
->columns(array(
'id'=>'ID',
'service_name()'=>'Service',
'recur_schedule'=>'Billing',
'price(TRUE,TRUE)'=>'Price',
'charges(TRUE,TRUE)'=>'Charges',
'status'=>'Active',
'account->refnum()'=>'Cust ID',
'account->name()'=>'Customer',
'date_next_invoice'=>'Next Invoice',
'due(TRUE)'=>'Due Invoices',
))
->prepend(array(
'id'=>array('url'=>URL::link('user','service/view/')),
));
?>

View File

@ -1,16 +0,0 @@
<!-- o = Model_Account -->
<?php echo Block::factory()
->title(sprintf('Active Service for Account: %s',$o->accnum()))
->title_icon('fa-server')
->span(6)
->body(Table::factory()
->data($o->service->list_active())
->columns(array(
'id'=>'ID',
'service_name()'=>'Service',
))
->prepend(array(
'id'=>array('url'=>URL::link('user','service/view/')),
))
);
?>

View File

@ -0,0 +1,11 @@
<!-- o = Array of Model_Service -->
<?php echo Table::factory()
->data($o)
->columns(array(
'id'=>'ID',
'service_name()'=>'Service',
))
->prepend(array(
'id'=>array('url'=>URL::link('user','service/view/')),
));
?>

View File

@ -1,17 +1,12 @@
<!-- o = Model Account -->
<?php echo Block::factory()
->title(sprintf('Services Expiring for Account: %s',$o->accnum()))
->title_icon('fa fa-level-down')
->span(6)
->body(Table::factory()
->data($o->service->list_expiring())
->columns(array(
'id'=>'ID',
'service_name(59)'=>'Service',
'expire(TRUE)'=>'Date',
))
->prepend(array(
'id'=>array('url'=>URL::link('user','service/view/')),
))
);
<!-- o = Array of Model_Service -->
<?php echo Table::factory()
->data($o)
->columns(array(
'id'=>'ID',
'service_name(59)'=>'Service',
'expire(TRUE)'=>'Date',
))
->prepend(array(
'id'=>array('url'=>URL::link('user','service/view/')),
));
?>

View File

@ -1,17 +1,12 @@
<!-- o = Model Account -->
<?php echo Block::factory()
->title(sprintf('InActive Services for Account: %s',$o->accnum()))
->title_icon('fa fa-stop')
->span(6)
->body(Table::factory()
->data($o->service->where('status','!=',1)->or_where('status','IS',null)->find_all())
->columns(array(
'id'=>'ID',
'service_name(60)'=>'Service',
'date_end'=>'Date',
))
->prepend(array(
'id'=>array('url'=>URL::link('user','service/view/')),
))
);
<!-- o = Array of MOdel_Service -->
<?php echo Table::factory()
->data($o)
->columns(array(
'id'=>'ID',
'service_name(60)'=>'Service',
'date_end'=>'Date',
))
->prepend(array(
'id'=>array('url'=>URL::link('user','service/view/')),
));
?>

View File

@ -12,7 +12,7 @@
?>
</div>
<div class="col-md-6">
<div class="col-md-7">
<?php echo $o->service_view(); ?>
</div>

View File

@ -19,25 +19,8 @@ class Controller_Reseller_Service_Ssl extends Controller_Service {
public function action_list() {
Block::factory()
->title('SSL Services')
->title_icon('icon-th-list')
->body(Table::factory()
->jssort('host')
->data(ORM::factory('Service')->where_authorised($this->ao)->list_byplugin('SSL'))
->columns(array(
'id'=>'ID',
'name()'=>'Service',
'plugin()->expire(TRUE)'=>'Expire',
'recur_schedule'=>'Billing',
'price(TRUE,TRUE)'=>'Price',
'account->accnum()'=>'Cust ID',
'account->name()'=>'Customer',
'date_next_invoice'=>'Next Invoice',
'due(TRUE)'=>'Due Invoices',
))
->prepend(array(
'id'=>array('url'=>URL::link('user','service/view/')),
))
);
->title_icon($this->icon)
->body(View::factory('service/list')->set('o',ORM::factory('Service')->where_authorised($this->ao)->list_byplugin('SSL')));
}
}
?>

View File

@ -11,6 +11,7 @@
*/
class Controller_SSL extends Controller_TemplateDefault {
protected $auth_required = false;
protected $icon = 'fa fa-certificate';
/**
* Render out an SSL CA certificate

View File

@ -70,7 +70,7 @@ class Controller_Reseller_Statement extends Controller_Statement {
krsort($result);
Block::factory()
->title(sprintf('%s: %s - %s',_('Transactions For'),$ao->accnum(),$ao->name(TRUE)))
->title(sprintf('%s: %s - %s',_('Transactions For'),$ao->refnum(),$ao->name(TRUE)))
->title_icon('icon-tasks')
->body(View::factory('statement/user/show')->set('result',$result)->set('total',$total));
}

View File

@ -48,7 +48,7 @@ class Controller_User_Statement extends Controller_Statement {
krsort($result);
Block::factory()
->title(sprintf('%s: %s - %s',_('Transactions For'),$this->ao->accnum(),$this->ao->name(TRUE)))
->title(sprintf('%s: %s - %s',_('Transactions For'),$this->ao->refnum(),$this->ao->name(TRUE)))
->title_icon('icon-tasks')
->body(View::factory('statement/user/show')->set('result',$result)->set('total',$total));
}