Added Tasks to KH
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@@ -13,3 +13,4 @@
|
||||
class Model_Payment_Item extends ORMOSB {
|
||||
protected $_belongs_to = array('payment'=>array(),'invoice'=>array());
|
||||
}
|
||||
?>
|
||||
|
Reference in New Issue
Block a user