<?
$this->showPrint = true;
?>

<link rel="stylesheet" href="/resources/css/sinistro/cobrancaprint.css" type="text/css" media="print" />
<link rel="stylesheet" href="/resources/css/sinistro/cobrancaview.css" type="text/css" media="screen" />

<div class="content">
	<? $this->headerCobrancaEssor($this->id,$this->tipoRelatorio);
	?>

		<table class='grid2' cellspacing='1' cellpadding='0' border='0' id='tablePagination'>
			<thead>
				<tr>
					<th colspan="<?=($this->tipoRelatorio == 'F' ? 13 : 12);?>" align="center" nowrap="nowrap">Honorários</th>
					<th colspan="3" id="separator" align="center"></th>
					<th colspan="2" align="center">Kilometragem</th>
					<th id="separator" align="center"></th>
					<th colspan="4" align="center" nowrap="nowrap">Despesas</th>
				</tr>
			</thead>
			<thead>
				<tr>
					<th align="center" nowrap="nowrap">Data</th>
					<th align="center" nowrap="nowrap">Proposta</th>
					<th align="center" nowrap="nowrap">Processo</th>
					<?=($this->tipoRelatorio == 'F' ? '<th align="center" nowrap="nowrap">Proc. Seg.</th>' : '');?>
					<th align="center" nowrap="nowrap">Segurado</th>
					<th align="center" nowrap="nowrap">Município</th>
					<th align="center" nowrap="nowrap">UF</th>
					<th align="center" nowrap="nowrap">Cultura</th>
					<th width="80px" align="center" nowrap="nowrap">Talhão</th>
					<th align="center" nowrap="nowrap">Variedade</th>
					<th align="center" nowrap="nowrap">Vistoria</th>
					<th align="center" nowrap="nowrap">Área Vistoriada</th>
					<th align="center" nowrap="nowrap">R$</th>
					<th id="separator" align="center" nowrap="nowrap">&nbsp;</th>
					<th align="center" nowrap="nowrap">Perito</th>
					<th width="20px" id="separator" align="center" nowrap="nowrap">&nbsp;</th>
					<th align="center" nowrap="nowrap">Km</th>
					<th align="center" nowrap="nowrap">R$</th>
					<th id="separator" align="center" nowrap="nowrap">&nbsp;</th>
					<th align="center" nowrap="nowrap">Pedágio</th>
					<th align="center" nowrap="nowrap">Hotel</th>
					<th align="center" nowrap="nowrap">Alimentação</th>
					<th align="center" nowrap="nowrap">Total</th>
				</tr>
			</thead>
			<tbody>

				<?

				$i = 0;
				foreach($this->dados as $registro):

					if ($i % 2 == 0) {
						$class = '';
					} else {
						$class = "highlight";
					}


					?>

					<tr class="<?= $class; ?>">
						<td align="center"><?=Agro_Util::formatDate($registro['dt_vistoria'],Zend_Date::DATES);?></td>
						<td align="center"><?=$registro['id_proposta_mae']; ?></td>
						<td align="center"><?=$registro['id_processo']; ?></td>
						<?=($this->tipoRelatorio == 'F' ? '<td align="center">'.$registro['id_processo_seguradora'].'</td>' : '');?>
						<td align="left"><?=$registro['ds_nome_proponente'];?></td>
						<td align="left"><?=$registro['ds_nome_municipio'];?></td>
						<td align="center"><?=$registro['ds_sigla'];?></td>
						<td align="left"><?=$registro['ds_nome_cultura'];?></td>
						<td align="center"><?=$registro['itens'];?></td>
						<td align="center"><?=$registro['variedade'];?></td>
						<td align="center"><?=$registro['tp_vistoria'];?></td>

						<td align="center"><?=Agro_Util::formatDbCurrency($registro['itensAreaTotal']);?></td>
						<td align="right"><?=Agro_Util::formatDbCurrency($registro['vl_honorarios']);?></td>
						<td id="separator"></td>
						<td align="right"><?=$registro['perito'];?></td>
						<td id="separator"></td>
						<td align="center"><?=Agro_Util::formatDbCurrency($registro['vl_quilometragem']);?></td>
						<td align="right"><?=Agro_Util::formatDbCurrency($registro['vl_custo_quilometragem']);?></td>
						<td id="separator"></td>
						<td align="right"><?=Agro_Util::formatDbCurrency($registro['vl_pedagio']);?></td>
						<td align="right"><?=Agro_Util::formatDbCurrency($registro['vl_hotel']);?></td>
						<td align="right"><?=Agro_Util::formatDbCurrency($registro['vl_alimentacao']);?></td>
						<td align="right"><?=Agro_Util::formatDbCurrency($registro['vl_despesas']);?></td>

					</tr>
				<?
				$i++;
				endforeach;

				?>
				<tr id="top">
					<td colspan="<?=($this->tipoRelatorio == 'F' ? 10 : 9);?>" class="highlight">
					</td>
					<td colspan="2" align="center">
					Total de Honorários
					</td>
					<td align="right"><strong><?=Agro_Util::formatDbCurrency($this->notaHonorarios);?></strong></td>
					<td>&nbsp;</td>
					<td>&nbsp;</td>
					<td>&nbsp;</td>
					<td align="center"><strong><?=Agro_Util::formatDbCurrency($this->notaKmRodada,0);?></strong></td>
					<td align="right"><strong><?=Agro_Util::formatDbCurrency($this->notaKmCusto);?></strong></td>
					<td colspan="1">&nbsp;</td>

					<td align="right"><strong><?=Agro_Util::formatDbCurrency($this->notaPedagio);?></strong></td>
					<td align="right"><strong><?=Agro_Util::formatDbCurrency($this->notaHotel);?></strong></td>
					<td align="right"><strong><?=Agro_Util::formatDbCurrency($this->notaAlimentacao);?></strong></td>
					<td align="right"><strong><?=Agro_Util::formatDbCurrency($this->notaDespesas);?></strong></td>

				</tr>
				<tr valign="middle">
					<td colspan="15" align="center">Espaço Reservado para Assinatura e Carimbo
						<div id="carimbo"></div>
					</td>
					<td colspan="7">
						<table id="totais">
							<tr>
								<td>Reembolso de Despesas</td>
								<td id="right" align="right"><strong><?=Agro_Util::formatDbCurrency($this->notaDespesas);?></strong></td>
							</tr>
							<tr>
								<td>Quilometragem</td>
								<td id="right" align="right"><strong><?=Agro_Util::formatDbCurrency($this->notaKmCusto);?></strong></td>
							</tr>
							<tr>
								<td>Total de Despesas e km</td>
								<td id="right" align="right"><strong><?=Agro_Util::formatDbCurrency($this->notaTotalDespesasEKm);?></strong></td>
							</tr>
							<!-- <tr>
								<td>Total da Nota Fiscal</td>
								<td id="right" align="right"><strong><?=Agro_Util::formatDbCurrency($valorTotalNotaFiscal);?></strong></td>
							</tr> -->
						</table>
					</td>
				</tr>
			</tbody>

		</table>
</div>
