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 * @license http://dev.osbill.net/license.html
*/ */
class Controller_Account extends Controller_TemplateDefault { 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 * Show a list of accounts
*/ */
public function action_list() { public function action_list() {
$this->meta->title = 'Customer List'; $this->meta->title = 'R|Customer List';
Block::factory() Block::factory()
->title(_('Customer List')) ->title(_('Customer List'))
->title_icon('fa fa-list') ->title_icon($this->icon)
->body(Table::factory() ->body(View::factory('account/list')->set('o',ORM::factory('Account')->where_authorised($this->ao,'id')->find_all()));
->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/')),
))
);
} }
/** /**
* Show a list of account logins * Show a list of account logins
*/ */
public function action_listlog() { 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() { public function action_view() {

View File

@ -19,89 +19,29 @@ class Controller_Reseller_Welcome extends Controller_Welcome {
public function action_index() { public function action_index() {
$t = time(); $t = time();
// Show outstanding invoices
$o = ORM::factory('Invoice');
Block::factory()
->title($this->ao->RTM->display('name'))
->body('');
Block::factory() Block::factory()
->title('Invoices Overdue - No Auto Billing') ->title('Invoices Overdue - No Auto Billing')
->title_icon('icon-info-sign') ->title_icon('fa fa-pencil-square-o')
->span(6) ->span(6)
->body(Table::factory() ->body(View::factory('invoice/list')->set('o',ORM::factory('Invoice')->list_overdue_billing($t)));
->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/')),
))
);
Block::factory() Block::factory()
->title('Invoices Overdue - Auto Billing') ->title('Invoices Overdue - Auto Billing')
->title_icon('icon-info-sign') ->title_icon('fa fa-pencil-square-o')
->span(6) ->span(6)
->body(Table::factory() ->body(View::factory('invoice/list')->set('o',ORM::factory('Invoice')->list_overdue_billing($t,TRUE)));
->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/')),
))
);
Block::factory() Block::factory()
->title('Upcoming Invoices') ->title('Upcoming Invoices')
->title_icon('icon-info-sign') ->title_icon('fa fa-pencil-square-o')
->span(6) ->span(6)
->body(Table::factory() ->body(View::factory('invoice/list')->set('o',ORM::factory('Invoice')->list_due($t)));
->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/')),
))
);
Block::factory() Block::factory()
->title('Un-applied payments') ->title('Un-applied payments')
->title_icon('icon-info-sign') ->title_icon('fa fa-money')
->span(6) ->span(6)
->body(Table::factory() ->body(View::factory('payment/list')->set('o',ORM::factory('Payment')->where_authorised()->list_unapplied()));
->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/')),
))
);
} }
/** /**

View File

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

View File

@ -9,7 +9,7 @@
* @copyright (c) 2009-2013 Open Source Billing * @copyright (c) 2009-2013 Open Source Billing
* @license http://dev.osbill.net/license.html * @license http://dev.osbill.net/license.html
*/ */
class Model_Account extends Model_Auth_UserDefault { class Model_Account extends lnApp_Model_Account {
// Relationships // Relationships
protected $_has_many = array( protected $_has_many = array(
'user_tokens'=>array('model'=>'user_token'), '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)'); /** OTHER METHODS **/
protected $_save_message = TRUE;
/**
* Our account number format
*/
public function accnum() {
return sprintf('%s-%04s',Company::instance()->site(TRUE),$this->id);
}
public function activated() { public function activated() {
return $this->has('group'); 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 * 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(); 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 * 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; return $format ? Currency::display($result) : $result;
} }
public function log($message) { public function isAdmin() {
// Log a message for this account return ($this->RTM->loaded() AND is_null($this->RTM->parent_id));
$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 isReseller() {
* This function will extract the available methods for this account return $this->RTM->loaded();
* 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;
} }
/** /**

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 --> <!-- o = Model_Account -->
<?php echo View::factory('service/user/list')->set('o',$o); ?> <?php echo View::factory('welcome/user/view')->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()
<?php echo View::factory('service/user/list/inactive')->set('o',$o); ?> ->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); ?> <?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 Block::factory()
<?php echo View::factory('invoice/user/list/due')->set('o',$o); ?> ->title(sprintf('Active Services Account: %s',$o->refnum()))
<?php echo View::factory('service/user/list/expiring')->set('o',$o); ?> ->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', 'plugin()->traffic_month(strtotime("first day of last month"),TRUE,TRUE)'=>'Last Month',
'recur_schedule'=>'Billing', 'recur_schedule'=>'Billing',
'price(TRUE,TRUE)'=>'Price', 'price(TRUE,TRUE)'=>'Price',
'account->accnum()'=>'Cust ID', 'account->refnum()'=>'Cust ID',
'account->name()'=>'Customer', 'account->name()'=>'Customer',
'date_next_invoice'=>'Next Invoice', 'date_next_invoice'=>'Next Invoice',
'due(TRUE)'=>'Due Invoices', 'due(TRUE)'=>'Due Invoices',

View File

@ -137,33 +137,12 @@ $(document).ready(function() {
* Show a list of invoices * Show a list of invoices
*/ */
public function action_list() { public function action_list() {
$this->meta->title = 'Customer Charges'; $this->meta->title = 'R|Customer Charges';
Block::factory() Block::factory()
->title('Customer Charges') ->title('Customer Charges')
->title_icon('fa fa-list') ->title_icon('fa fa-list')
->body(Table::factory() ->body(View::factory('charge/list')->set('o',ORM::factory('Charge')->where_authorised($this->ao)->where('void','is',NULL)->order_by('id','DESC')->find_all()));
->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/')),
))
);
} }
} }
?> ?>

View File

@ -15,9 +15,6 @@ class Model_Charge extends ORM_OSB implements Invoicable {
'product'=>array(), 'product'=>array(),
'service'=>array(), 'service'=>array(),
); );
protected $_has_one = array(
'invoice_item'=>array('far_key'=>'id'),
);
protected $_compress_column = array( protected $_compress_column = array(
'attributes', '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) { public function invoice_item($item_type) {
switch ($item_type) { switch ($item_type) {
case 5: 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', 'plugin()->display("domain_expire")'=>'Expire',
'recur_schedule'=>'Billing', 'recur_schedule'=>'Billing',
'price(TRUE,TRUE)'=>'Charge', 'price(TRUE,TRUE)'=>'Charge',
'account->accnum()'=>'Cust ID', 'account->refnum()'=>'Cust ID',
'account->name()'=>'Customer', 'account->name()'=>'Customer',
'plugin()->registrar->name'=>'Registrar', 'plugin()->registrar->name'=>'Registrar',
)) ))

View File

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

View File

@ -10,5 +10,6 @@
* @license http://dev.osbill.net/license.html * @license http://dev.osbill.net/license.html
*/ */
class Controller_Email extends Controller_TemplateDefault { 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 * Show a list of emails
*/ */
public function action_list() { public function action_list() {
$this->meta->title = 'Emails Sent'; $this->meta->title = 'R|Emails Sent';
Block::factory() Block::factory()
->title(_('Emails Sent')) ->title(_('Emails Sent'))
->title_icon('fa fa-envelope') ->title_icon($this->icon)
->body(Table::factory() ->body(View::factory('email/list')->set('o',ORM::factory('Email_Log')->where_authorised($this->ao)->find_all()));
->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),
))
);
} }
} }
?> ?>

View File

@ -21,7 +21,10 @@ class Controller_User_Email extends Controller_Email {
public function action_list() { public function action_list() {
$this->meta->title = 'Email 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() { 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,10 +1,7 @@
<?php $o = Auth::instance()->get_user(); <!-- o = Array of Model_Email -->
echo Block::factory() <?php echo Table::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) ->page_items(25)
->data($o->email_log->find_all()) ->data($o)
->columns(array( ->columns(array(
'id'=>'ID', 'id'=>'ID',
'date_orig'=>'Date', 'date_orig'=>'Date',
@ -15,5 +12,5 @@ echo Block::factory()
)) ))
->postproc(array( ->postproc(array(
'resolve("subject")'=>array('trim'=>60), 'resolve("subject")'=>array('trim'=>60),
)) ));
); ?>

View File

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

View File

@ -10,5 +10,6 @@
* @license http://dev.osbill.net/license.html * @license http://dev.osbill.net/license.html
*/ */
class Controller_Invoice extends Controller_TemplateDefault { 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() { public function action_list() {
$this->meta->title = 'Customer Invoice List'; $this->meta->title = 'R|Customer Invoice List';
Block::factory() Block::factory()
->title('Customer Invoices') ->title('Customer Invoices')
->title_icon('fa fa-edit') ->title_icon($this->icon)
->body(Table::factory() ->body(View::factory('invoice/list')->set('o',ORM::factory('Invoice')->where_authorised($this->ao)->where_active()->find_all()));
->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/')),
))
);
} }
} }
?> ?>

View File

@ -76,24 +76,9 @@ class Controller_User_Invoice extends Controller_Invoice {
$this->meta->title = 'Invoice List'; $this->meta->title = 'Invoice List';
Block::factory() Block::factory()
->title(sprintf('Invoices for Account: %s',$this->ao->accnum())) ->title(sprintf('Invoices for Account: %s',$this->ao->refnum()))
->title_icon('fa fa-list') ->title_icon($this->icon)
->body(Table::factory() ->body(View::factory('invoice/user/list')->set('o',$this->ao->invoice->find_all()));
->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/')),
))
);
} }
/** /**

View File

@ -80,7 +80,7 @@ class Invoice_TCPDF_Default extends Invoice_Tcpdf {
$this->SetFont('helvetica','',10); $this->SetFont('helvetica','',10);
$this->SetXY($x,$y); $this->Cell(0,0,_('Account Number')); $this->SetXY($x,$y); $this->Cell(0,0,_('Account Number'));
$this->SetFont('helvetica','B',11); $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 // Invoice number
$y = 210; $y = 210;

View File

@ -52,7 +52,16 @@ class Model_Invoice extends ORM_OSB implements Cartable {
private $_render = array(); 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() { public function cart_item() {
return new Cart_Item(1,sprintf('Invoice: %s',$this->refnum()),$this->due()); 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 * 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,10 +1,6 @@
<!-- o = Model Account --> <!-- o = Array of Model_Invoice -->
<?php echo Block::factory() <?php echo Table::factory()
->title(sprintf('Invoices Due Account: %s (%s)',$o->accnum(),$o->invoice->list_due_total(TRUE))) ->data($o)
->title_icon('fa fa-money')
->span(6)
->body(Table::factory()
->data($o->invoice->list_due())
->columns(array( ->columns(array(
'id'=>'ID', 'id'=>'ID',
'due_date'=>'Date Due', 'due_date'=>'Date Due',
@ -13,6 +9,5 @@
)) ))
->prepend(array( ->prepend(array(
'id'=>array('url'=>URL::link('user','invoice/view/')), 'id'=>array('url'=>URL::link('user','invoice/view/')),
)) ));
);
?> ?>

View File

@ -6,7 +6,7 @@
$i->add_service($io); $i->add_service($io);
echo Block::factory() 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') ->title_icon('fa fa-shopping-cart')
->span(6) ->span(6)
->body($i->render('html','body',array('noid'=>TRUE))); ->body($i->render('html','body',array('noid'=>TRUE)));

View File

@ -10,5 +10,6 @@
* @license http://dev.osbill.net/license.html * @license http://dev.osbill.net/license.html
*/ */
class Controller_Payment extends Controller_TemplateDefault { 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 * Show a list of payments
*/ */
public function action_list() { public function action_list() {
$this->meta->title = 'Customer Payments'; $this->meta->title = 'R|Customer Payments';
Block::factory() Block::factory()
->title('Customer Payments') ->title('Customer Payments')
->title_icon('fa fa-money') ->title_icon($this->icon)
->body(Table::factory() ->body(View::factory('payment/reseller/list')->set('o',ORM::factory('Payment')->where_authorised($this->ao)->find_all()));
->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
))
);
} }
} }
?> ?>

View File

@ -21,20 +21,9 @@ class Controller_User_Payment extends Controller_Payment {
$this->meta->title = 'Payments Received'; $this->meta->title = 'Payments Received';
Block::factory() Block::factory()
->title(sprintf('%s: %s - %s',_('Payments Received For'),$this->ao->accnum(),$this->ao->name(TRUE))) ->title(sprintf('%s: %s - %s',_('Payments Received For'),$this->ao->refnum(),$this->ao->name(TRUE)))
->title_icon('fa fa-money') ->title_icon($this->icon)
->body(Table::factory() ->body(View::factory('payment/user/list')->set('o',$this->ao->payment->find_all()));
->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',
))
);
} }
} }
?> ?>

View File

@ -100,7 +100,7 @@ class Payment_Bulk_Ezypay {
'checkout->display("name")'=>'Method', 'checkout->display("name")'=>'Method',
'total_amt'=>'Amount', 'total_amt'=>'Amount',
'fees_amt'=>'Fees', 'fees_amt'=>'Fees',
'account->accnum()'=>'Cust ID', 'account->refnum()'=>'Cust ID',
'account->name()'=>'Customer', 'account->name()'=>'Customer',
)) ))
->prepend(array( ->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() Block::factory()
->title(sprintf('%s: %s',_('Current Services Using this Product'),$po->title())) ->title(sprintf('%s: %s',_('Current Services Using this Product'),$po->title()))
->title_icon('icon-th-list') ->title_icon('icon-th-list')
->body(Table::factory() ->body(View::factory('service/reseller/list')->set('o',$po->service->where_active()->find_all()));
->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/')),
)));
} }
} }
?> ?>

View File

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

View File

@ -40,22 +40,9 @@ class Controller_User_Service extends Controller_Service {
$this->meta->title = 'Service List'; $this->meta->title = 'Service List';
Block::factory() Block::factory()
->title(sprintf('Services for Account: %s',$this->ao->accnum())) ->title(sprintf('Services for Account: %s',$this->ao->refnum()))
->title_icon('icon-th-list') ->title_icon($this->icon)
->body(Table::factory() ->body(View::factory('service/user/list')->set('o',$this->ao->service->find_all()));
->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/')),
))
);
} }
public function action_view() { public function action_view() {

View File

@ -4,7 +4,7 @@
<div class="dl-horizontal"> <div class="dl-horizontal">
<dt>Account</dt> <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) : ?> <?php if ($o->external_billing) : ?>
<dt>External Billed</dt> <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,10 +1,6 @@
<!-- o = Model Account --> <!-- o = Array of Model_Service -->
<?php echo Block::factory() <?php echo Table::factory()
->title(sprintf('Services Expiring for Account: %s',$o->accnum())) ->data($o)
->title_icon('fa fa-level-down')
->span(6)
->body(Table::factory()
->data($o->service->list_expiring())
->columns(array( ->columns(array(
'id'=>'ID', 'id'=>'ID',
'service_name(59)'=>'Service', 'service_name(59)'=>'Service',
@ -12,6 +8,5 @@
)) ))
->prepend(array( ->prepend(array(
'id'=>array('url'=>URL::link('user','service/view/')), 'id'=>array('url'=>URL::link('user','service/view/')),
)) ));
);
?> ?>

View File

@ -1,10 +1,6 @@
<!-- o = Model Account --> <!-- o = Array of MOdel_Service -->
<?php echo Block::factory() <?php echo Table::factory()
->title(sprintf('InActive Services for Account: %s',$o->accnum())) ->data($o)
->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( ->columns(array(
'id'=>'ID', 'id'=>'ID',
'service_name(60)'=>'Service', 'service_name(60)'=>'Service',
@ -12,6 +8,5 @@
)) ))
->prepend(array( ->prepend(array(
'id'=>array('url'=>URL::link('user','service/view/')), 'id'=>array('url'=>URL::link('user','service/view/')),
)) ));
);
?> ?>

View File

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

View File

@ -19,25 +19,8 @@ class Controller_Reseller_Service_Ssl extends Controller_Service {
public function action_list() { public function action_list() {
Block::factory() Block::factory()
->title('SSL Services') ->title('SSL Services')
->title_icon('icon-th-list') ->title_icon($this->icon)
->body(Table::factory() ->body(View::factory('service/list')->set('o',ORM::factory('Service')->where_authorised($this->ao)->list_byplugin('SSL')));
->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/')),
))
);
} }
} }
?> ?>

View File

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

View File

@ -70,7 +70,7 @@ class Controller_Reseller_Statement extends Controller_Statement {
krsort($result); krsort($result);
Block::factory() 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') ->title_icon('icon-tasks')
->body(View::factory('statement/user/show')->set('result',$result)->set('total',$total)); ->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); krsort($result);
Block::factory() 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') ->title_icon('icon-tasks')
->body(View::factory('statement/user/show')->set('result',$result)->set('total',$total)); ->body(View::factory('statement/user/show')->set('result',$result)->set('total',$total));
} }