Improvements to taxing
This commit is contained in:
@@ -66,7 +66,7 @@ class Model_Payment extends ORM_OSB {
|
||||
public function balance($format=FALSE) {
|
||||
$result = $this->total();
|
||||
|
||||
foreach ($this->items('ALLOC') as $pio)
|
||||
foreach ($this->subitems('ALLOC') as $pio)
|
||||
$result -= $pio->alloc_amt;
|
||||
|
||||
return $format ? Currency::display($result) : Currency::round($result);
|
||||
@@ -78,7 +78,7 @@ class Model_Payment extends ORM_OSB {
|
||||
public function credit($format=FALSE) {
|
||||
$result = 0;
|
||||
|
||||
foreach ($this->items('CREDIT') as $pio)
|
||||
foreach ($this->subitems('CREDIT') as $pio)
|
||||
$result += $pio->alloc_amt*-1;
|
||||
|
||||
return $format ? Currency::display($result) : Currency::round($result);
|
||||
@@ -105,7 +105,7 @@ class Model_Payment extends ORM_OSB {
|
||||
* @param type [ALLOC|CREDIT|ALL]
|
||||
* @see payment_items
|
||||
*/
|
||||
public function items($type='ALL') {
|
||||
public function subitems($type='ALL') {
|
||||
if (! $this->_sub_items_sorted) {
|
||||
Sort::MAsort($this->_sub_items,'invoice_id');
|
||||
$this->_sub_items_sorted = TRUE;
|
||||
@@ -145,7 +145,7 @@ class Model_Payment extends ORM_OSB {
|
||||
*/
|
||||
public function save(Validation $validation = NULL) {
|
||||
// Our items will be clobbered once we save the object, so we need to save it here.
|
||||
$items = $this->items();
|
||||
$items = $this->subitems();
|
||||
|
||||
// If a user modified this payment, we'll update the source to their ID.
|
||||
if ($ao = Auth::instance()->get_user())
|
||||
|
Reference in New Issue
Block a user