public function createrhreport($facility) { $rhtable = ''; $items = Facility_Transaction_Table::get_commodities_for_ordering_report($facility, 3); if ($items) { foreach ($items as $key => $value) { $coloring = ''; $negative = ''; if ($value['adjustmentnve'] < 0) { $coloring = 'style = "color: red"'; $number = explode('-', $value['adjustmentnve']); $negative = $number[1]; } else { if ($value['adjustmentnve'] == 0) { $coloring = 'style = "color: red"'; $negative = 0; } else { $negative = $value['adjustmentnve']; } } $rhtable .= '<tr>'; $rhtable .= '<td>' . $value['commodity_name'] . '</td>'; $rhtable .= '<td>' . $value['unit_size'] . '</td>'; $rhtable .= '<td>' . $value['unit_cost'] . '</td>'; $rhtable .= '<td>' . $value['opening_balance'] . '</td>'; $rhtable .= '<td>' . $value['total_receipts'] . '</td>'; $rhtable .= '<td>' . $value['total_issues'] . '</td>'; $rhtable .= '<td ' . $coloring . '>' . $negative . '</td>'; $rhtable .= '<td>' . $value['adjustmentpve'] . '</td>'; $rhtable .= '<td>' . $value['losses'] . '</td>'; $rhtable .= '<td>' . $value['days_out_of_stock'] . '</td>'; $rhtable .= '<td>' . $value['closing_stock'] . '</td>'; $rhtable .= '</tr>'; } } return $rhtable; }