<?php

class Endosso_View_Helper_HeaderSolicitacao extends Zend_View_Helper_Abstract {

	public function headerSolicitacao($Proposta) {
		$cobertura = $Proposta->coberturas('principal');
		$corretor = $Proposta->corretor();
		$produto = $Proposta->produto();
		$status = $Proposta->status();
		?>
		
		<link rel="stylesheet" href="/resources/css/atendimento/proposta.css" type="text/css" media="screen" />
		<table width="100%" border="0" cellpadding="1" cellspacing="1" class="">
			<tr>
				<td width="10%" align="center"><img src="/resources/imagens/essor.png" width="139" height="60"/></td>
				<td valign="top">
					<table width="100%" border="0" cellpadding="1" cellspacing="1" class="">
						<tr>
							<td colspan="0" class="produto"><?=trim($produto['ds_nome_produto']);?>&nbsp;&reg;</td>
							<td colspan="1" class="produto"><?=trim($corretor['ds_nome_corretor']);?>&nbsp;&reg;</td>
						</tr>
						<tr>
							<td width="50%" valign="top">
								<table width="100%" border="0" cellpadding="1" cellspacing="1" class="">
									<tr>
										<td class="text_bold" width="49%">Cobertura Principal: <?=($produto['id'] == 734) ? 'Multirisco II' : $cobertura['ds_nome_cobertura']?></td>
									</tr>
									<tr>
										<td class="text">Garantido por: <?=$produto['ds_nome_fantasia'];?></td>
									</tr>
									<tr>
										<td class="text_underline">Processo SUSEP: <?=$produto['nr_susep'];?></td>
									</tr>
									<tr>
										<? if (($status['ds_chave'] == 'NAO_ENVIADA') or ($status['ds_chave'] == 'DEVOLVIDA')): ?>
											<td class="text_bold">Orçamento: <?=$Proposta->doc();?></td>
										<? else: ?>
											<td class="text_bold">Proposta: <?=$Proposta->doc();?></td>										
										<? endif; ?>										
									</tr>
									<? if ($Proposta->nr_apolice): ?>
										<tr>
											<td class="text_bold">Apólice: <?=$Proposta->nr_apolice?></td>
										</tr>
									<? endif; ?>
								</table>
							</td>
							<td width="50%" valign="top">
								<? if (($status['ds_chave'] == 'NAO_ENVIADA') or ($status['ds_chave'] == 'DEVOLVIDA')): ?>
									<table width="100%" border="0" cellpadding="1" cellspacing="1" class="">
										<tr>
											<td class="text_uppercase">Orçamento sem cobertura</td>
										</tr>
										<tr>
											<td class="text_bold">Data Orçamento: <?=Agro_Util::formatDate($Proposta->dt_criacao, Zend_Date::DATES);?></td>
										</tr>
										<tr>
											<td class="text_bold">Safra: <?=$produto['ds_nome_safra']?></td>
										</tr>
										<tr>
											<td class="text"></td>
										</tr>
									</table>
								<? else: ?>
									<table width="100%" border="0" cellpadding="1" cellspacing="1" class="">
										<tr>
											<td class="text" colspan="2" colspan="2"><?=($Proposta->id_proposta_renovada ? ' <b>(Renovação)</b>' : '')?></td>
										</tr>
										<tr>
											<td class="text_bold" colspan="2">Safra: <?=$produto['ds_nome_safra'];?></td>
										</tr>
										<? if ($status['ds_chave'] == 'PROPOSTA_CANCELADA' || $status['ds_chave'] == 'APOLICE_CANCELADA'): ?>
											<tr>
												<td class="text_bold" colspan="2">Status da Proposta: <?=strtoupper(strtr($status['ds_status'],"áéíóúâêôãõàèìòùç","ÁÉÍÓÚÂÊÔÃÕÀÈÌÒÙÇ"))?></td>
											</tr>
										<? endif; ?>
									</table>
								<? endif; ?>
							</td>
						</tr>
					</table>
				</td>
			</tr>
		</table>
		<?
	}
}
