Added Tasks to KH

This commit is contained in:
Deon George
2011-08-16 12:27:19 +10:00
parent f272bc254d
commit 4c9b214ff7
53 changed files with 773 additions and 170 deletions

View File

@@ -72,4 +72,21 @@ class Model_Payment extends ORMOSB {
public function invoicelist() {
return join(',',$this->invoices());
}
/** LIST FUNCTIONS **/
public function list_unapplied() {
$pi = array();
// @todo database suffix needs to be dynamically calculated
foreach (DB::Query(Database::SELECT,
sprintf('SELECT A.id AS id,A.total_amt as total_amt FROM ab_%s A,ab_%s B WHERE A.site_id=B.site_id AND A.id=B.payment_id GROUP BY B.payment_id HAVING ROUND(SUM(B.alloc_amt),2)!=A.total_amt ORDER BY account_id,payment_id','payment','payment_item'))
->execute() as $values) {
array_push($pi,$values['id']);
}
return $this->where('id','IN',$pi)->order_by('account_id')->find_all();
}
}
?>

View File

@@ -13,3 +13,4 @@
class Model_Payment_Item extends ORMOSB {
protected $_belongs_to = array('payment'=>array(),'invoice'=>array());
}
?>