Template E Column Counts

Below is the modified output.inc file, which changes the write_excel() function. With this change, the Template E xls sheet shows the totals for Published Publications, New Faculty Hires, Post Docs, and Grad & Undergrad graduations.

Link to discussion on GitHub
https://github.com/EPSCoR/ERCore/issues/62


public function write_excel(&$objPHPExcel, $sheet = 0){
$data = $this->data();
//d($data, '$data');
$worksheet = $objPHPExcel->setActiveSheetIndex($sheet);

$hastotal_row = array("Published Publications","Total New Faculty Hired","Total Post Docs Involved","Total Graduate Students Graduated", "Total Undergraduates Graduated");
$people_rel_total_rows = array("Total New Faculty Hired","Total Post Docs Involved","Total Graduate Students Graduated", "Total Undergraduates Graduated");

$base_row = 4;
$col = 3;
foreach ($data as $range_label => $categories){
$row = $base_row;
foreach ($categories as $cat_key=>$cat_data){
unset ($tot);
foreach ($cat_data as $row_key=>$row_data){

if ($cat_key == "Proposals/Grants/Contracts"){//just need to treat the second one different
$worksheet->setCellValueByColumnAndRow($col, $row, intval($row_data['count']));
$worksheet->setCellValueByColumnAndRow($col+1, $row, intval($row_data['amount']));

}elseif(in_array($cat_key, $hastotal_row) ){
$tot = $tot + intval($row_data['count']);
$worksheet->setCellValueByColumnAndRow($col, $row, intval($row_data['count']));
}else{
$worksheet->setCellValueByColumnAndRow($col, $row, intval($row_data['count']));
}
$row++;
}
if ($cat_key == "Published Publications"){
$worksheet->setCellValueByColumnAndRow($col, $row-3, "Total: ".intval($tot));
} elseif (in_array($cat_key, $people_rel_total_rows) ){
$worksheet->setCellValueByColumnAndRow($col, $row-5, "Total: ".intval($tot));
} else {
//
}

$row++;

}
$col -= 2;
}
}