<?php
	$dataTable = '<table border=1>
		<tr>
			<th>Parent ID</th>
			<th>Parent Type</th>
			<th>Date Added</th>
			<th>Created By</th>
			<th>Amount</th>
			<th>Currency</th>
			<th>Adjust For Period</th>
			<th>Apply To Period</th>
			<th>Category</th>
			<th>Comment</th>
		</tr>
	';

	foreach ($this->manual_adjustment_info as $manual_adjustment) {

		$created_by = $manual_adjustment->OrchadminUser ? $manual_adjustment->OrchadminUser->f_name.' '.$manual_adjustment->OrchadminUser->l_name : '';
		$adjust_for_period = $manual_adjustment->AdjustForPeriod ? $manual_adjustment->AdjustForPeriod->year.' M '.$manual_adjustment->AdjustForPeriod->month : '';
		$apply_to_period = $manual_adjustment->ApplyToPeriod ? $manual_adjustment->ApplyToPeriod->year.' M '.$manual_adjustment->ApplyToPeriod->month : '';
		$category = $manual_adjustment->ManualAdjustmentCategory ? $manual_adjustment->ManualAdjustmentCategory->category : '';
		$currency = $manual_adjustment->currencies_id ? $manual_adjustment->Currencies->currency_name.' ('.$manual_adjustment->Currencies->ISO_4217_code.')' : '';
		
		$dataTable .= '<tr>
					<td>'.$manual_adjustment->parent_id.'</td>
					<td>'.$manual_adjustment->parent_type.'</td>
					<td>'.$manual_adjustment->date_added.'</td>
					<td>'.$created_by.'</td>
					<td>'.$manual_adjustment->amount.'</td>
					<td>'.$currency.'</td>
					<td>'.$adjust_for_period.'</td>
					<td>'.$apply_to_period.'</td>
					<td>'.$category.'</td>
					<td>'.$manual_adjustment->comment.'</td>
			</tr>';
	}

	$dataTable .= '</table>';

	echo $dataTable;
?>