Hi Nestor,
This is a bit tricky, but possible.Ê It involves a few concepts:
1. You can insert content after the list view using the block__after_result_list() method in the delegate class.
2. You can calculate whatever totals you want in that method.
For calculating your totals, you will probably need to know what the current query is that dataface is using.Ê You can build portions of the query using the Dataface_QueryBuilder class and passing the query array to it:
e.g.
function block__after_result_list(){
ÊÊÊ $app =& Dataface_Application::getInstance();
ÊÊÊ $query =& $app->getQuery();
ÊÊÊ $queryBuilder = new Dataface_QueryBuilder($query['-table'], $query);
ÊÊÊ $where = $queryBuilder->_where();Ê // the where clause
ÊÊÊ $from = $queryBuilder->_from();Ê // the from clause
ÊÊÊÊÊÊÊ
ÊÊÊ $sql = "select sum(income) as total_income, sum(expense) as total_expense $from $where";
ÊÊÊ $res = mysql_query($sql, df_db());
ÊÊÊ list($total_income, $total_expense) = msyql_fetch_row($res);
ÊÊÊ echo "
Totals:
ÊÊÊÊÊÊÊÊÊÊÊÊ
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ - Income
- $total_income
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ - Expense
- $total_expense
ÊÊÊÊÊÊÊÊÊÊÊÊ
";
}This will make the total income and expense show up in the footer of list view. (Note I haven't tested this, so there may be bugs in this code.. but it is pretty much right.
-Steve