<? if(is_array($this->historicos)): ?>
	<table class="grid_gray" border="0" cellpadding="1" cellspacing="1" width='100%'>
		<thead>
			<tr>
				<th id="ds_doc" align="center" nowrap="nowrap">Data</th>
				<th id="ds_nome_produto" align="center" nowrap="nowrap">Status Prévia</th>
				<th id="ds_nome_produto" align="center" nowrap="nowrap">Status Análise</th>
				<th id="ds_nome_produto" align="center" nowrap="nowrap">Usuário</th>
				<th id="ds_nome_produto" align="center" nowrap="nowrap">Observação</th>
				<th id="ds_nome_produto" align="center" nowrap="nowrap">Justificativa Dispensa</th>
				<th id="ds_nome_produto" align="center" nowrap="nowrap">Empresa</th>
			</tr>
		</thead>
	<?
	
	$i=0;

	foreach ($this->historicos as $historico): ?>
		<? $class = (($i % 2 == 0) ? "none repeat scroll 0 0 #F2F2F2" : ""); ?>

		<tr style="background:<?=$class;?>">
			<td align="center"><?=Agro_Util::formatDate($historico['dt_criacao'], Zend_Date::DATETIME);?></td>
			<td><?=$historico['ds_status']?></td>			
			<td><?=$historico['ds_status_analise']?></td>						
			<td align="center"><?=$historico['ds_nome_usuario']?></td>			
			<td>
          <?
          $motivo = $historico['ds_motivo'];

          if ($historico['id_status'] === Sistema_Model_Status::AGENDAMENTO_AGENDADO) {
              $motivo .= " - Perito: {$historico['usuario_perito']}";
          }

          echo $motivo;
          ?>
      </td>
			<td><?=$historico['ds_justificativa_dispensa']?></td>
			<? if ($historico['ds_chave_status'] == 'DISPENSADA') {?>
				<td align="center">-</td>
			<? } else { ?>
				<td><?=$historico['ds_nome_fantasia'];?></td>
			<? } ?>
		</tr>
	<? $i++;
	endforeach; 
	?>
	</table>
<? endif; ?>	