$q->clear(); $q->addQuery('a.*, b.resource_name'); $q->addTable('resource_tasks', 'a'); $q->addJoin('resources', 'b', 'a.resource_id = b.resource_id', 'inner'); $q->addWhere('a.task_id IN (' . implode(',', $task_list) . ')'); $rows = $q->loadHashList('resource_id'); foreach ($rows as $row) { $resources[$row['task_id']][$row['resource_id']] = $row['resource_name'] . ' [' . $row['percent_allocated'] . '%]'; } $q->clear(); } // Build the data columns foreach ($tasks as $task_id => $detail) { $row =& $pdfdata[]; $row[] = $detail['task_name']; $row[] = $detail['user_username']; $row[] = implode("\n", $assigned_users[$task_id]); if ($hasResources) { $row[] = implode("\n", $resources[$task_id]); } $end_date = new w2p_Utilities_Date($detail['task_end_date']); $row[] = $end_date->format($df); } $output = new w2p_Output_PDFRenderer('A4', 'landscape'); $output->addTitle($AppUI->_('Project Completed Task Report')); $output->addDate($df); $output->addSubtitle(w2PgetConfig('company_name')); $output->addSubtitle($pname); $output->addTable($title, $columns, $pdfdata, $options); $output->getStream();