Some cleanup, setup improvements and other misc items

This commit is contained in:
Deon George
2013-10-09 16:43:41 +11:00
parent 638d123739
commit c473bf6e7d
54 changed files with 477 additions and 3991 deletions

View File

@@ -148,15 +148,16 @@ $(document).ready(function() {
->title_icon('icon-th-list')
->body(Table::factory()
->page_items(50)
->data(ORM::factory('Charge')->where('account_id','IN',$this->ao->RTM->customers($this->ao->RTM))->order_by('id DESC')->find_all())
->data(ORM::factory('Charge')->where_authorised('account_id',$this->ao)->where('void','is',NULL)->order_by('id DESC')->find_all())
->columns(array(
'id'=>'ID',
'date_orig'=>'Processed',
'date_charge'=>'Date',
'processed(TRUE)'=>'Processed',
'invoice_item->invoice_id'=>'Invoice',
'sweep_type'=>'Sweep',
'status'=>'Status',
'quantity'=>'Quantity',
'amount'=>'Amount',
'total(TRUE)'=>'Total',
'description'=>'Description',
'service_id'=>'Service',
'account->accnum()'=>'Cust ID',
@@ -164,6 +165,7 @@ $(document).ready(function() {
))
->prepend(array(
'id'=>array('url'=>URL::link('reseller','charge/edit/')),
'invoice_item->invoice_id'=>array('url'=>URL::link('user','invoice/view/')),
))
);
}

View File

@@ -13,6 +13,9 @@ class Model_Charge extends ORM_OSB {
protected $_belongs_to = array(
'account'=>array(),
);
protected $_has_one = array(
'invoice_item'=>array('far_key'=>'id'),
);
protected $_nullifempty = array(
'attributes',
@@ -23,14 +26,23 @@ class Model_Charge extends ORM_OSB {
);
protected $_display_filters = array(
'amount'=>array(
array('Currency::display',array(':value')),
),
'date_orig'=>array(
array('Config::date',array(':value')),
),
'date_charge'=>array(
array('Config::date',array(':value')),
),
'amount'=>array(
array('Currency::display',array(':value')),
'processed'=>array(
array('StaticList_YesNo::get',array(':value')),
),
'sweep_type'=>array(
array('StaticList_SweepType::get',array(':value')),
),
'void'=>array(
array('StaticList_YesNo::get',array(':value')),
),
);
@@ -47,6 +59,10 @@ class Model_Charge extends ORM_OSB {
}
}
public function processed($render=FALSE) {
return $this->label_bool('processed',$render);
}
public function total($format=FALSE) {
$result = $this->quantity * $this->amount;