$mode)); $total = $numinv = 0; $duelist = View::factory('invoice/task/'.$tm.'_header'); foreach ($io->$tm() as $t) { $duelist .= View::factory('invoice/task/'.$tm.'_body') ->set('io',$t); $numinv++; $total += $t->due(); } $duelist .= View::factory('invoice/task/'.$tm.'_footer'); // Send our email $et = Email_Template::instance('task_invoice_overdue'); // @todo Update this to be dynamic $et->to = array('account'=>array(1,68)); $et->variables = array( 'TABLE'=>$duelist, 'NUM_INV'=>$numinv, 'TOTAL'=>$total, ); $et->send(); $output = sprintf('List (%s) sent to: %s',$mode,implode(',',array_keys($et->to))); $this->response->body($output); } } ?>