<?php $ci = get_instance();?>
<div id="div_print" style="overflow-x: auto;">
	<table class="R_table">
		<!-- Header -->
		<tr>
			<th class="R_T_th report_header" style="font-size: <?php echo (double)$font_size + 10;?>px;">
				Audit Trail - Invoice
			</th>
		</tr>
		<tr>
			<td>
				<table class="R_table">
					<tr>
						<td style="vertical-align: top;" class="pull-left">
							<table class="R_table" style="font-size: <?php echo (double)$font_size;?>px;">
								<?php if(isset($params)):?>
									<?php foreach($params as $label=>$v):?>
										<tr>
											<td class="R_P_td_label report_params_left_label"><?php echo $label;?>:</td>
											<td class="R_P_td_value report_params_left_data" style="white-space: normal;">
												<?php echo $v;?>
											</td>
										</tr>
									<?php endforeach;?>
								<?php endif;?>
							</table>
						</td>
						<td style="width: 1%; vertical-align: top;">
							<table class="R_table" style="font-size: <?php echo (double)$font_size;?>px;">
								<tr>
									<td class="R_P_td_label report_params_right_label">Printed On:</td>
									<td class="R_P_td_value report_params_right_data"><?php echo date("d M Y h:ia");?></td>
								</tr>
								<tr>
									<td class="R_P_td_label report_params_right_label">Printed By:</td>
									<td class="R_P_td_value report_params_right_data"><?php echo $user->NAME;?></td>
								</tr>
							</table>
						</td>
					</tr>
				</table>
			</td>
		</tr>
		<!--  -->
		<tr>
			<td style="padding-top: 10px;">
				<table class="R_table report_table_content" style="font-size: <?php echo (double)$font_size;?>px;">
					<thead>
						<tr>
							<th class="R_th R_border_top R_border_bottom" style="text-align: center;">DATE</th>
							<th class="R_th R_border_top R_border_bottom" style="text-align: center;">TIME</th>
							<th class="R_th R_border_top R_border_bottom" style="text-align: center;">USERNAME</th>
							<th class="R_th R_border_top R_border_bottom" style="text-align: center;">REFNO</th>
							<th class="R_th R_border_top R_border_bottom" style="text-align: center;">FIELD NAME</th>
							<th class="R_th R_border_top R_border_bottom" style="text-align: center;">NEW VALUE</th>
							<th class="R_th R_border_top R_border_bottom" style="text-align: center;">OLD VALUE</th>
						</tr>
					</thead>
					<tbody>
						<?php 
							$total_col = 8;
						?>
						<?php if(count($list) > 0):?>
							<?php foreach($list as $lv):?>
								<tr>
									<td class="R_td" style="text-align: left; padding-left: 20px;">
										<?php echo date("d M Y", strtotime($lv->DATE));?>
									</td>
									<td class="R_td" style="text-align: left;">
										<?php echo date("H:i A", strtotime($lv->DATE));?>
									</td>
									<td class="R_td" style="text-align: center;">
										<?php echo '['.$lv->WEB_USER_CODE.']&nbsp;&nbsp;'.$lv->WEB_USER_NAME;?>
									</td>
									<td class="R_td" style="text-align: center;">
										<?php echo $lv->KEY;?>
									</td>
									<td class="R_td" style="text-align: center;">
										<?php echo $lv->FIELD;?>
									</td>
									<td class="R_td" style="text-align: center;">
										<?php echo $lv->NEW_DATA;?>
									</td>
									<td class="R_td" style="text-align: center;">
										<?php echo $lv->OLD_DATA;?>
									</td>
								</tr>
							<?php endforeach;?>
						<?php else:?>
							<tr>
								<td colspan="<?php echo $total_col;?>" class="R_td" style="text-align: center;">No result.</td>
							</tr>
						<?php endif;?>
					</tbody>
				</table>
			</td>
		</tr>
	</table>
</div>

<script>
	$(document).ready(function(){
		$("#report_btn_print").show("fast");
	});
</script>