You could calculate a field like this:
Expense::Type = "Sales Income" ; Expense::Credit Amount ;
Expense::Type = "Payroll" ; Expense::Debit Amount * -1 ;
Expense::Type = "Materials" ; Expense::Debit Amount * -1;
Then you can just summarize that field to give you your revenue total.
Additionally, it would be quite easy to use ExecuteSQL() to give you totals for each type.
such as: ExecuteSQL("SELECT SUM(Credit Amount) FROM Expense WHERE Type = ?" ; "" ; "" ; "Sales Income" )