db->tblLocation . '` AS `Location` ' . 'ON `Location`.`id` = `' . $this->tableName . '`.`id_location`'; return $sql; } function getTotalAmountDue() { $sql = 'SELECT SUM(`' . $this->tableName . '`.`amount`) ' . 'FROM `' . $this->tableNameDB . '` AS `' . $this->tableName . '` ' . $this->_getJoin4Grid() . ' ' . 'WHERE 1 AND `' . $this->tableName . '`.`paid` = \'n\''; $sql .= $this->_getWhereDeleted(); $filter = array_intersect_key($this->_filter, array_fill_keys(array('id_member', 'id_location'), '')); $sql .= $this->_getWhereFilter($filter); $res = $this->db->queryOne($sql); $this->isDBError($res); return $res; } function getAmountOverdue() { $sql = 'SELECT SUM(`' . $this->tableName . '`.`amount`) ' . 'FROM `' . $this->tableNameDB . '` AS `' . $this->tableName . '` ' . $this->_getJoin4Grid() . ' ' . 'WHERE 1 AND `' . $this->tableName . '`.`paid` = \'n\''; $sql .= ' AND `' . $this->tableName . '`.`date_due` < CURRENT_DATE()'; $sql .= $this->_getWhereDeleted(); $filter = array_intersect_key($this->_filter, array_fill_keys(array('id_member', 'id_location', 'id_member_or_location'), '')); $sql .= $this->_getWhereFilter($filter); $res = $this->db->queryOne($sql); $this->isDBError($res); return $res; } }