<?php
$Validacoes = new Produto_Model_Validacoes();
$Ciclos = new Produto_Model_Ciclos();
$modelCondicoesEspeciais = new Produto_Model_CondicoesEspeciais();
$this->showPrint = true;

$producaoGarantida    = $this->proposta->atributos('PROPRIEDADE', 'PROD_PRODUCAO_GARANTIDA');
$coberturasAdicionais = $this->proposta->coberturas_contratadas('adicional');
$coberturaPrincipal   = $this->proposta->coberturas_contratadas('principal');
$questionarios        = $this->proposta->questionarios();
$beneficiarios        = $this->proposta->beneficiarios();
$propriedade          = $this->proposta->propriedade();
$proponente           = $this->proposta->proponente();
$proponente_ppe       = $this->proposta->proponente_ppe();
$respostas            = $this->proposta->respostas();
$corretor             = $this->proposta->corretor();
$carencia             = $this->proposta->carencia();
$produto              = $this->proposta->produto();
$croquis              = $this->proposta->croquis();
$pessoa_autorizada    = $this->proposta->pessoa_autorizada();
$producao_forrageira  = $this->proposta->producao_forrageira();
$safra                = $this->proposta->safra();

$beneficiarioAutorizado = [];
$circular642 = false;
$dataCriacaoProposta = Agro_Util::formatDate($this->proposta->dt_criacao);

$dtTransmissaoMae = $this->proposta['dt_transmissao'];
$date = DateTime::createFromFormat('Y-m-d H:i:s', $dtTransmissaoMae);
$dtTransmissaoMaeFormatada = $date->format('d/m/Y');
$dtTransmissaoMaeFormatoDate = DateTime::createFromFormat('Y-m-d H:i:s', $dtTransmissaoMae);

if ($this->proposta->id !== $this->proposta->id_proposta_mae) {
    $propostaMae = (new Seguro_Model_Propostas())->find($this->proposta->id_proposta_mae)->current();
    $dataCriacaoProposta = Agro_Util::formatDate($propostaMae['dt_criacao']);
	$dtTransmissaoMae = $propostaMae['dt_transmissao'];

	$dtTransmissaoMaeFormatoDate = DateTime::createFromFormat('Y-m-d H:i:s', $dtTransmissaoMae);
  	$dtTransmissaoMaeFormatada = $dtTransmissaoMaeFormatoDate->format('d/m/Y');
}

// CONFIGURAÇÕES PRODUTOS E COBERTURAS
$configuracoesProduto = (new Produto_Model_ProdutoConfig())->getConfiguracaoByData($produto['id'], $dtTransmissaoMaeFormatoDate);
$configuracoesProdutoCoberturaPrincipal = (new Produto_Model_ProdutoCoberturaConfig())
	->getConfiguracaoByData($produto['id'], $coberturaPrincipal['id_cobertura'], $dtTransmissaoMaeFormatoDate);

$configuracoesCoberturasAdicionais = [];

$possuiCondicoesParticulares = false;
if (!empty($configuracoesProdutoCoberturaPrincipal->ds_frase_condicoes_particulares)) {
	$possuiCondicoesParticulares = true;
}

foreach ($coberturasAdicionais as $coberturaAdicional) {
	$configuracoesProdutoCoberturaAdicional = (new Produto_Model_ProdutoCoberturaConfig())
		->getConfiguracaoByData($produto['id'], $coberturaAdicional['id_cobertura'], $dtTransmissaoMaeFormatoDate);
	
	if (empty($configuracoesProdutoCoberturaAdicional)) {
		continue;
	}

	$configuracoesCoberturasAdicionais[$coberturaAdicional['id_cobertura']] = $configuracoesProdutoCoberturaAdicional;

	if (!$possuiCondicoesParticulares) {
		$possuiCondicoesParticulares = !empty($configuracoesProdutoCoberturaAdicional->ds_frase_condicoes_particulares);
	}
}

if (Agro_Util::validaDataInicioFim('22/05/2022', $dataCriacaoProposta)) {
    $circular642 = true;
}

$paginalAtual = 0;
$totalPaginas = 0;
$fontSize = 'font-size: 12px;';
$statusProposta = $this->proposta->status();

$barcodeSign = '';
if ($this->apenasPrint) {
	$barcodeSign = '-SIGN';
}

$alterarNomeCoberturas = strtotime($dtTransmissaoMae) >= strtotime('2023-09-04');

//Para caso o usuário não tenha relogado após a melhoria entrar em produção
if (DATA_ALTERACAO_CONDICOES_PROPOSTA === 'DATA_ALTERACAO_CONDICOES_PROPOSTA') {
	$condicoesGeraisSUSEP = false;
  } else {
	$condicoesGeraisSUSEP = Agro_Util::validaDataInicioFim(DATA_ALTERACAO_CONDICOES_PROPOSTA, $dataCriacaoProposta);
  }

$numeroDocumento = $proponente['ds_documento_numero'];
$naturezaDocumento = $proponente['ds_documento_natureza'];
$orgaoExpedicao = $proponente['ds_nome_orgao'];
$dataExpedicaoDocumento = Agro_Util::formatDate($proponente['dt_documento_exp'], Zend_Date::DATES);

if (empty($numeroDocumento)) {
	$numeroDocumento = '-';
	$naturezaDocumento = '';
	$orgaoExpedicao = '-';
	$dataExpedicaoDocumento = '-';
}
?>


<link rel="stylesheet" href="/resources/css/seguro/propostaprint.css" type="text/css" media="print" />
<link rel="stylesheet" href="/resources/css/seguro/propostaview.css" type="text/css" media="screen" />

<div class="no-print">
  <?=$this->headerProposta($this->proposta, $paginalAtual, $totalPaginas, false, '');?>
</div>

<!-- DADOS DO PROPONENTE -->
<table width="100%" cellpadding="0" cellspacing="1" class="gadget">
	<thead>
		<tr>
			<th style="background-color: white;" colspan="6"><div><span style="font-family: verdana, sans-serif; font-size: 9px;">Dados do Proponente</span></div></th>
		</tr>
	</thead>
	<tbody>
		<? if ($proponente['tp_pessoa'] == 'F'): ?>
			<tr>
				<td colspan=3><div><span style="font-weight: bold;">Nome/Razão Social</span></div> <?=$proponente['ds_nome_proponente']?></td>
				<td nowrap="nowrap" colspan=3><div><span style="font-weight: bold;">CPF/CNPJ</span></div> <?=$proponente['cpf_cnpj']?></td>
			</tr>
			<tr>
				<td colspan=6>
					<div><span style="font-weight: bold;">Nome Social</span></div>
					<?=($proponente['fl_nome_social']) ? $proponente['ds_nome_social'] : '-'?>
				</td>
			</tr>
			<tr>
				<td nowrap="nowrap" valign="top"><div><span style="font-weight: bold;">Profissão</span></div> <?=$proponente['ds_profissao']?></td>
				<td nowrap="nowrap" valign="top" colspan="2"><div><span style="font-weight: bold;">E-mail</span></div> <?=$proponente['ds_email_proponente']?></td>
				<td nowrap="nowrap"><div><span style="font-weight: bold;">Data de Nascimento</span></div> <?=Agro_Util::formatDate($proponente['dt_nascimento'], Zend_Date::DATES)?></td>
          <?php
          /**
           * Solução aplicada de alterar a ordem da coluna de estado civil para não quebrar o PDF, quando o sexo não é
           * apresentado
           */
          if (!empty(trim($proponente['ds_sexo']))) {
              ?>
            <td nowrap="nowrap"><div><span style="font-weight: bold;">Sexo</span></div> <?=($proponente['ds_sexo'] == 'M' ? 'MASCULINO' : 'FEMININO')?></td>
            <td nowrap="nowrap"><div><span style="font-weight: bold;">Estado Civil</span></div><?=$proponente['ds_nome_estado_civil']?>&nbsp;</td>
              <?php
          } else {
              ?>
            <td nowrap="nowrap"><div><span style="font-weight: bold;">Estado Civil</span></div><?=$proponente['ds_nome_estado_civil']?>&nbsp;</td>
            <td nowrap="nowrap" style="border-left-style: hidden"><div><span style="font-weight: bold;"></span></div></td>
              <?php
          }
          ?>
			</tr>
			<tr>
				<td nowrap="nowrap"><div><span style="font-weight: bold;">Documento</span></div> <?=$naturezaDocumento?> <?=$numeroDocumento?></td>
				<td nowrap="nowrap"><div><span style="font-weight: bold;">Órgão Expedição</span></div> <?=$orgaoExpedicao?></td>
				<td nowrap="nowrap"><div><span style="font-weight: bold;">Renda Mensal</span></div> <?=$proponente['ds_faixa_remuneracao']?></td>
				<td nowrap="nowrap"><div><span style="font-weight: bold;">Data Expedição</span></div> <?=$dataExpedicaoDocumento?></td>
				<td nowrap="nowrap" colspan="2">
					<? if ($proponente['tp_segurado'] == 'P'): ?>
						<div><span style="font-weight: bold;">Segurado</span></div> PROPRIETÁRIO
					<? elseif ($proponente['tp_segurado'] == 'A'): ?>
						<div><span style="font-weight: bold;">Segurado:</span></div> ARRENDATÁRIO
					<? elseif ($proponente['tp_segurado'] == 'O'): ?>
						<div><span style="font-weight: bold;">Segurado:</span></div> OUTROS
					<? endif; ?>
				</td>					
			</tr>
			<tr>
				<td colspan=6>
					<div><span style="font-weight: bold;">O proponente é Pessoa Politicamente Exposta?</span></div> <?=($proponente['fl_politicamente_exposto'] == 2 ? 'Sim' : 'Não')?>
					<p align="justify" style="font-size: 85%; margin-top: 5px">Circular Susep nº 445/2012 - Art 4º: Consideram-se pessoas politicamente expostas os agentes públicos que desempenham ou tenham desempenhado, nos cinco anos anteriores, no Brasil ou em países, territórios e dependências estrangeiras, cargos, empregos ou funções públicas relevantes, assim como seus representantes, familiares e outras pessoas de seu relacionamento próximo.</p>
				</td>
			</tr>
		<? elseif ($proponente['tp_pessoa'] == 'J'): ?>
			<tr>
				<td nowrap="nowrap" colspan="3" width=70%><div><span style="font-weight: bold;">Nome/Razão Social</span></div> <?=$proponente['ds_nome_proponente']?></td>
				<td nowrap="nowrap" width=30%><div><span style="font-weight: bold;">CPF/CNPJ</span></div> <?=$proponente['cpf_cnpj']?></td>
				<td nowrap="nowrap">
					<? if ($proponente['tp_segurado'] == 'P'): ?>
						<div><span style="font-weight: bold;">Segurado</span></div> PROPRIETÁRIO
					<? elseif ($proponente['tp_segurado'] == 'A'): ?>
						<div><span style="font-weight: bold;">Segurado</span></div> ARRENDATÁRIO
					<? elseif ($proponente['tp_segurado'] == 'O'): ?>
						<div><span style="font-weight: bold;">Segurado</span></div> OUTROS
					<? endif; ?>
				</td>				
			</tr>
			<tr>
				<td nowrap="nowrap" colspan="3"><div><span style="font-weight: bold;">Atividade Econômica</span></div> <?=$proponente['ds_nome_atividade_economica']?>&nbsp;</td>
				<td nowrap="nowrap"><div><span style="font-weight: bold;">Receita Operacional Bruta Anual</span></div> <?=$proponente['ds_renda_bruta']?></td>
				<td nowrap="nowrap"><div><span style="font-weight: bold;">Patrimônio Líquido</span></div> <?=$proponente['ds_patrimonio']?></td>
			</tr>
			<tr>
				<td colspan=5>
					<div><span style="font-weight: bold;">Existe Sócio, Controlador, Administrador e/ou Procurador que sejam Pessoa Politicamente Exposta?</span></div> <?=($proponente['fl_parentesco_politicamente_exposto'] == 2 ? 'Sim' : 'Não')?>
                    <? if($proponente['fl_parentesco_politicamente_exposto'] == 2): ?>
                        <? foreach($proponente_ppe as $ppe):
                        	switch($ppe['tp_relacionamento']){
                        		case 'S': $tp_relacionamento = 'Sócio'; break;
                        		case 'C': $tp_relacionamento = 'Controlador'; break;
                        		case 'A': $tp_relacionamento = 'Administrador'; break;
                        		case 'P': $tp_relacionamento = 'Procurador'; break;
                        	}
                        	$arPpe[] = $ppe['ds_nome_socio']." (".$ppe['ds_nro_cpf'].") - ".$tp_relacionamento;    
                        endforeach; ?>
                        <p align="justify">
                            Relacionamento(s): <?=implode($arPpe,", ");?>
                        </p>
                    <? endif; ?>
					<p align="justify" style="font-size: 85%; margin-top: 5px">Circular Susep nº 445/2012 - Art 4º: Consideram-se pessoas politicamente expostas os agentes públicos que desempenham ou tenham desempenhado, nos cinco anos anteriores, no Brasil ou em países, territórios e dependências estrangeiras, cargos, empregos ou funções públicas relevantes, assim como seus representantes, familiares e outras pessoas de seu relacionamento próximo.</p>
				</td>
			</tr>			
		<? endif; ?>
	</tbody>
</table>
<table width="100%" cellpadding="0" cellspacing="1" class="gadget">
	<thead>
		<tr>
			<th colspan="3" style="background-color: white;">Endereço do Proponente</th>
		</tr>
	</thead>
	<tbody>
		<tr>
			<td><div><span style="font-weight: bold;">Endereço</span></div> <?=$proponente['ds_endereco_rua']?>&nbsp;</td>
			<td><div><span style="font-weight: bold;">Número</span></div> <?=$proponente['ds_endereco_nro']?>&nbsp;</td>
			<td><div><span style="font-weight: bold;">Complemento</span></div> <?=$proponente['ds_endereco_complem']?>&nbsp;</td>
		</tr>
		<tr>
			<td><div><span style="font-weight: bold;">Bairro</span></div><?=$proponente['ds_endereco_bairro']?>&nbsp;</td>
			<td><div><span style="font-weight: bold;">CEP</span></div><?=$proponente['ds_endereco_cep']?>&nbsp;</td>
			<td><div><span style="font-weight: bold;">Município/UF</span></div><?=$proponente['ds_nome_municipio']?>/<?=$proponente['ds_sigla']?>&nbsp;</td>
		</tr>
		<tr>
			<td width=33%><div><span style="font-weight: bold;">Telefone Principal</span></div> <?=$proponente['ds_tel_residencia']?>&nbsp;</td>
			<td width=33%><div><span style="font-weight: bold;">Telefone Celular</span></div> <?=$proponente['ds_tel_celular']?>&nbsp;</td>
			<td width=33%><div><span style="font-weight: bold;">Telefone Propriedade</span></div> <?=$proponente['ds_tel_propriedade']?>&nbsp;</td>
		</tr>
	</tbody>
</table>

<!-- DADOS DA PROPRIEDADE -->
<table width="100%" cellpadding="0" cellspacing="1" class="gadget">
	<thead>
		<tr>
			<th colspan="5" style="background-color: white;">Dados da Propriedade</th>
		</tr>
	</thead>
	<tbody>
		<tr>
			<td width="30%"><div><span style="font-weight: bold;">Endereço</span></div> <?=$propriedade['ds_endereco']?>&nbsp;</td>
			<td><div><span style="font-weight: bold;">Número</span></div> <?=$propriedade['ds_endereco_nro']?>&nbsp;</td>
			<td><div><span style="font-weight: bold;">Complemento</span></div> <?=$propriedade['ds_endereco_complemento']?>&nbsp;</td>
			<td width="20%"><div><span style="font-weight: bold;">Bairro</span></div> <?=$propriedade['ds_endereco_bairro']?>&nbsp;</td>
			<td><div><span style="font-weight: bold;">CEP</span></div> <?=$propriedade['ds_endereco_cep']?>&nbsp;</td>
		</tr>
		<tr>
			<td><div><span style="font-weight: bold;">Município/UF</span></div> <?=$propriedade['ds_nome_municipio']?>/<?=$propriedade['ds_sigla']?>&nbsp;</td>
			<td colspan="3"><div><span style="font-weight: bold;">Nome da Propriedade</span></div> <?=$propriedade['ds_nome_propriedade']?>&nbsp;</td>
			<td><div><span style="font-weight: bold;">Código BACEN</span></div> <?=$propriedade['cd_bacen']?>&nbsp;</td>
		</tr>
		<tr>
			<td colspan="5"><div><span style="font-weight: bold;"><?=(strtotime($this->proposta['dt_vigencia_inicio']) >= strtotime('2016-01-01') ? 'Dica de acesso à Sede' : 'Ref. para Localização') ?></span></div> <?=$propriedade['ds_referencia_localizacao']?>&nbsp;</td>
		</tr>
		<tr>
			<td colspan="5">
			<div><span style="font-weight: bold;">Coordenadas Geográficas</span></div> <?=$propriedade['ds_coordenadas']?>&nbsp;
				<? if ($propriedade['ds_coordenadas']){
					$stCoordenada = str_replace(" ,", "", $propriedade['ds_coordenadas']);
					$stCoordenada = str_replace(",", "", $stCoordenada);
					$stCoordenada = str_replace("-", "", $stCoordenada);
					$arCoordenada = explode(" ",$stCoordenada);
					?>
                    <a style="color: blue; text-decoration: underline;" href="/scripts/kml/proposta/<?=$this->proposta->id?>" target="_blank">Download para Google Earth</a>
				<? } ?>
			</td>
		</tr>
		<tr>
			<td colspan="5">
			    <? (count($pessoa_autorizada) == 0 ? $existe = false: $existe = true) ?>
			<div><span style="font-weight: bold;">Há representante(s) do proponente a acompanhar a(s) vistoria(s)? </span></div>
				<?
				if ($existe) {
					foreach($pessoa_autorizada as $pessoa){
						$cpf = ($pessoa['cpf_cnpj'] ? '/ CPF: '.$pessoa['cpf_cnpj'] : '');
						echo ($pessoa['ds_pessoa_autorizada'] ? 'Nome: '.$pessoa['ds_pessoa_autorizada'].' '.$cpf  : '&nbsp;');
						echo ($pessoa['ds_telefone'] ? ' / Telefone: '.$pessoa['ds_telefone'] : '&nbsp;');
						echo ($pessoa['ds_grau_parentesco'] ? ' / Parentesco e/ou Grau de Relacionamento: '.$pessoa['ds_grau_parentesco'] : '&nbsp;');
						echo '<br>';
					}
				} else {
				    echo "Não";
				}
				?>
			</td>
		</tr>
	</tbody>
</table>

<!-- DADOS DOS BENEFICIARIOS -->
<table width="100%" cellpadding="0" cellspacing="1" class="gadget">
	<thead>
		<tr>
			<th style="background-color: white;" colspan="<?=(count($beneficiarios) ? 5 : 0)?>">Cláusula Beneficiária</th>
		</tr>
	</thead>
	<tbody>
		<? $i = 1; ?>
		<? if (count($beneficiarios)): ?>
			<tr>
				<td><span style="font-weight: bold;">Favorecido</span></td>
				<td><span style="font-weight: bold;">Nome Social</span></td>
				<td><span style="font-weight: bold;">Qualidade</span></td>
				<td><span style="font-weight: bold;">Valor</span></td>
				<td><span style="font-weight: bold;">Documento</span></td>
			</tr>
			<? foreach ($beneficiarios as $beneficiario): ?>
				<? if ($i <= 2): ?>
					<? if (strtoupper($beneficiario['ds_tipo_conta']) == 'S' and $beneficiario['ds_nome_banco']): ?>
						<tr>
							<td><?=$beneficiario['ds_nome_banco']; ?>&nbsp;</td>
							<td>-&nbsp;</td>
							<td><?=$beneficiario['ds_qualidade_beneficiario']?>&nbsp;</td>
							<td><?=$this->currency($beneficiario['vl_limite_beneficio']);?>&nbsp;</td>
							<td><?=$beneficiario['nr_cpf_cnpj']?>&nbsp;</td>
						</tr>
					<? else: ?>
						<tr>
							<td><?=$beneficiario['ds_nome_beneficiarios']?>&nbsp;</td>
							<td><?=(!empty($beneficiario['ds_nome_social'])) ? $beneficiario['ds_nome_social'] : '-'?>&nbsp;</td>
							<td><?=$beneficiario['ds_qualidade_beneficiario']?>&nbsp;</td>
							<td><?=$this->currency($beneficiario['vl_limite_beneficio']);?>&nbsp;</td>
							<td><?=$beneficiario['nr_cpf_cnpj']?>&nbsp;</td>
						</tr>
					<? endif; ?>
				<? endif; ?>

				<?
            if ($beneficiario['fl_favorecido_autorizacao_credito']) {
              $beneficiarioAutorizado['nome'] = $beneficiario['ds_conta'] === 's' ? $beneficiario['ds_nome_banco']: $beneficiario['ds_nome_beneficiarios'];
              $beneficiarioAutorizado['cpf_cnpj'] = $beneficiario['nr_cpf_cnpj'];
            }

            $i++;
        ?>
			<? endforeach; ?>
		<? else: ?>
			<tr>
				<td align="center">Nenhum beneficiário cadastrado.</td>
			</tr>
		<? endif; ?>
	</tbody>
</table>

<!-- DADOS DA COBERTURA BASICA -->
<?
	$colspanCobertura = ($this->proposta->versao_endosso(false) == 0) ? 8 : 7;
	$condicoesEspeciais = $modelCondicoesEspeciais->getByProdutoCobertura($this->proposta->id_produto, $coberturaPrincipal['id_cobertura'], $dtTransmissaoMaeFormatoDate);
	$tituloCondicaoEspecial = !empty($condicoesEspeciais) ? $condicoesEspeciais['ds_titulo'] : '';
	$tituloCoberturaPrincipal = strtotime($this->proposta['dt_vigencia_inicio']) > strtotime('2015-02-04') ? "Demonstrativo - Cobertura Principal" : 'Demonstrativo do Prêmio - Cobertura Básica';
	$tituloCoberturaPrincipal .= $alterarNomeCoberturas ? " - {$tituloCondicaoEspecial}" : "";
?>
<table width="100%" cellpadding="0" cellspacing="1" class="gadget">
	<thead>
		<tr>
			<th style="background-color: white;" colspan="<?=$colspanCobertura?>"><?=$tituloCoberturaPrincipal?></th>
		</tr>
	</thead>
	<tbody>
		<tr>
			<td><div><span style="font-weight: bold;">Cultura</span></div><?=$produto['ds_nome_cultura']?>&nbsp;</td>
			<td><div><span style="font-weight: bold;">Código BACEN</span></div><?=$produto['cd_bacen']?></td>
			<td><div><span style="font-weight: bold;">Área Total</span></div><?=$this->proposta->area()?>ha</td>
			<td><div><span style="font-weight: bold;">Unidades Seguradas</span></div><?=$this->proposta->count_itens_segurados()?>&nbsp;</td>
			<td><div><span style="font-weight: bold;">LMGA</span></div>R$<?=Agro_Util::formatDbCurrency($this->proposta->lmga());?></td>
			<td>
				<div><span style="font-weight: bold;"><?=($producaoGarantida ? ($produto["ds_nome_cultura"] == "Pastagem" ? 'Franquia' : 'NC')  : 'Franquia')?></span></div>
				<?=$coberturaPrincipal['vl_franquia']?>% 
				<?if($produto["ds_nome_cultura"] == "Pastagem"):?>
					- R$<?=Agro_Util::formatDbCurrency(($this->proposta->lmga() * $coberturaPrincipal['vl_franquia']) / 100);?>
				<?endif;?>
			</td>
			<?if($this->proposta->versao_endosso(false) == 0):?>
				<td><div><span style="font-weight: bold;">Taxa</span></div><?=number_format($coberturaPrincipal['vl_taxa'],2,'.','')?>%</td>
			<? endif; ?>
			<td><div><span style="font-weight: bold;">Prêmio Tarifário</span></div>R$<?=Agro_Util::formatDbCurrency($coberturaPrincipal['vl_premio']);?>&nbsp;</td>
		</tr>
	</tbody>
</table>

<!-- DADOS DAS COBERTURAS ADICIONAIS -->
<?
$countAutomaticas = 0;
foreach ($coberturasAdicionais as $cobertura) {
	if ($cobertura['fl_contratacao_automatica']) $countAutomaticas++;
}

$colspanCobertura = ($this->proposta->versao_endosso(false) == 0) ? 6 : 5;

if ($coberturasAdicionais && (count($coberturasAdicionais) > $countAutomaticas)): ?>
	<table width="100%" cellpadding="0" cellspacing="1" class="gadget">
		<thead>
			<tr>
				<th style="background-color: white;" colspan="<?=$colspanCobertura?>"><?=(strtotime($this->proposta['dt_vigencia_inicio']) > strtotime('2015-02-04') ? 'Demonstrativo - Coberturas Adicionais' : 'Demonstrativo do Prêmio - Coberturas Adicionais')?></th>
			</tr>
		</thead>
		<tbody>
			<tr>
				<td colspan="<?=($alterarNomeCoberturas) ? 2 : 1?>"><span style="font-weight: bold;">Cobertura</span></td>
				<td><span style="font-weight: bold;">Franquia</span></td>
				<?if($this->proposta->versao_endosso(false) == 0):?>
					<td><span style="font-weight: bold;">Taxa</span></td>
				<? endif; ?>
				<td><span style="font-weight: bold;">LMI</span></td>
				<td align="right"><span style="font-weight: bold;">Prêmio Adicional</span></td>
			</tr>
			<? foreach ($coberturasAdicionais as $cobertura): ?>
				<?
				if (!$cobertura['fl_contratacao_automatica']){
					if ($cobertura['ds_chave_cobertura'] == 'COB_PROTECAO_FITO'){
						$vl_lmi = $this->proposta->area_liquida() * 100;
					} else {
						$vl_lmi = ($cobertura['vl_lmi'] * $this->proposta->lmga())/100;
					}
				?>
					<tr>
						<td><?=$cobertura['ds_nome_cobertura']?></td>
						<?php
							if ($alterarNomeCoberturas) {
								$condicoesEspeciais = $modelCondicoesEspeciais->getByProdutoCobertura($this->proposta->id_produto, $cobertura['id_cobertura'], $dtTransmissaoMaeFormatoDate);
								$tituloCondicaoEspecial = !empty($condicoesEspeciais) ? trim($condicoesEspeciais['ds_titulo']) : '';
								echo "<td>{$tituloCondicaoEspecial}</td>";
							}
						?>
						<td><?=($cobertura['fl_exibir_franquia']) ? $cobertura['vl_franquia']."%" : '-'; ?></td>
						<?if($this->proposta->versao_endosso(false) == 0):?>
							<td><?=number_format($cobertura['vl_taxa'],2,'.','')."%" ; ?></td>
						<? endif; ?>
						<td><?=$this->currency($vl_lmi)?></td>
						<td align="right"><?=($cobertura['vl_premio'] ? Agro_Util::formatDbCurrency($cobertura['vl_premio']) : '-');?></td>
					</tr>
				<? } ?>
			<? endforeach; ?>
		</tbody>
	</table>
<? endif; ?>

<!-- -->
<? if($produto["ds_nome_cultura"] == "Pastagem"): ?>
	<? 
	$count = 1;
	foreach($producao_forrageira as $indice) :
		$arProducaoForrageira[$count]['ano'] = $indice['ano'];
		$arProducaoForrageira[$count]['indice'] = $indice['indice'];
		$indiceEsperado = $indice['indice_esperado'];
		$count++;
	endforeach; 
	?>
	
	<table width="100%" cellpadding="0" cellspacing="1" class="gadget">
		<tr>
			<th></th>
			<th style="background-color: white;" colspan="5" align="center">Histórico do Índice de Produção Forrageira das áreas de pastagens seguradas</th>
		</tr>
		<tr>
			<td width=30% align="left"><b>Ano</b></td>
			<td align="center"><?=$arProducaoForrageira[1]['ano'];?></td>
			<td align="center"><?=$arProducaoForrageira[2]['ano'];?></td>
			<td align="center"><?=$arProducaoForrageira[3]['ano'];?></td>
			<td align="center"><?=$arProducaoForrageira[4]['ano'];?></td>
			<td align="center"><?=$arProducaoForrageira[5]['ano'];?></td>
		</tr>
		<tr>
			<td width=30% align="left"><b>Índice de Produção Forrageira</b></td>
			<td align="center"><?=number_format($arProducaoForrageira[1]['indice'],2,',','.');?></td>
			<td align="center"><?=number_format($arProducaoForrageira[2]['indice'],2,',','.');?></td>
			<td align="center"><?=number_format($arProducaoForrageira[3]['indice'],2,',','.');?></td>
			<td align="center"><?=number_format($arProducaoForrageira[4]['indice'],2,',','.');?></td>
			<td align="center"><?=number_format($arProducaoForrageira[5]['indice'],2,',','.');?></td>
		</tr>
	</table>
	<table width="37%" cellpadding="0" cellspacing="1" class="gadget" style="margin-bottom: 5px;">
		<tr>
			<td width=85%><b>Índice de Produção Forrageira Esperado (IPFE<sub style="font-size: 7pt;">M</sub>)</b></td>
			<td align="center"><?=number_format($indiceEsperado,2,',','.');?></td>
		</tr>
	</table>
	<p style="margin-bottom: 15px;">Importante: o valor do Índice de Produção Forrageira Anual e o Índice de Produção Forrageira Esperado (IPFE<sub style="font-size: 7pt;">M</sub>) já estão ponderados pelas Áreas das Pequenas Áreas Forrageiras.</p>
<? endif; ?>
<!-- -->

<!-- DADOS DE COBRANCA -->
<?
if ($this->proposta->isEndosso()) {
	switch ($this->proposta->tipo_endosso()) {
		case 'COBRANCA':
			$this->boxCobrancaAumento($this->proposta);
			break;
		case 'REDUCAO':
			$this->boxCobrancaReducao($this->proposta);
			break;
		case 'SEM_MOVIMENTO':
			$this->boxCobrancaSemMovimento($this->proposta);
			break;
		default:
			$this->boxCobrancaDefault($this->proposta, true);
			break;
	}
} else {
	$this->boxCobrancaDefault($this->proposta, true);
}
?>

<!-- NOVA PAGINA -->
<?= $this->footerProposta($this->proposta, $this->isEnviarDocusign) ?>
<div  style="page-break-before: always;"></div>

<!-- OBSERVACOES DA PROPOSTA -->
<table width="100%" cellpadding="0" cellspacing="1" class="gadget">
	<thead>
		<tr>
			<th style="background-color: white;">Observação</th>
		</tr>
	</thead>
	<tbody>
		<tr>
			<td>
			<? $observacao = $this->proposta->observacoes(); ?>
			<? foreach($observacao as $observacao_principal) {
				if($observacao_principal['fl_principal']){?>
					<?=nl2br($observacao_principal['ds_observacao']);?>
				<?}
			}?>
			&nbsp;
			</td>
		</tr>
	</tbody>
</table>

<!-- INFORMACOES DO CORRETOR -->
<table width="100%" cellpadding="0" cellspacing="1" class="gadget">
	<thead>
		<tr>
			<th style="background-color: white;" colspan="4">Corretor</th>
		</tr>
	</thead>
	<tbody>
		<tr>
			<td><div><span style="font-weight: bold;">Corretora:</span></div> <?=$corretor['ds_nome_fantasia']?>&nbsp;</td>
			<td><div><span style="font-weight: bold;">Número SUSEP:</span></div> <?=$corretor['nr_susep']?>&nbsp;</td>
			<td><div><span style="font-weight: bold;">Participação:</span></div> <?=$corretor['ds_nome_corretor']?>&nbsp;</td>
			<td><div><span style="font-weight: bold;">Telefone:</span></div> <?=$corretor['ds_telefone_contato_seguro_agricola']?>&nbsp;</td>
		</tr>
	</tbody>
</table>

<!-- DADOS DOS ANEXOS -->
<table width="100%" cellpadding="0" cellspacing="1" class="gadget">
	<thead>
		<tr>
			<th style="background-color: white;">Anexos</th>
		</tr>
	</thead>
	<tbody>
		<tr>
			<td class=carencia>
				<b>Anexo 1: RISCOS EXCLUÍDOS, PERDAS NÃO COBERTAS E/OU CONDIÇÕES PARTICULARES</b><br>
				<b>Anexo 2: DESCRIÇÃO DO RISCO</b><br />
				Unidade(s) Segurada(s) conforme Condições Especiais do contrato de seguro.<br />
				<b>Anexo 3: CROQUIS</b><br />
				Descrição da área conforme especificação anexa a esta proposta.<br />
				<b>Anexo 4: DECLARAÇÃO DE CONSENTIMENTO PARA TRATAMENTO DE DADOS PESSOAIS LEI GERAL DE PROTEÇÃO DE DADOS PESSOAIS – LGPD</b><br>
				<b>Anexo 5: DECLARAÇÃO DO PROPONENTE</b><br>

				<?php
					echo "<b>DOCUMENTOS DISPONÍVEIS PARA CONSULTA</b><br/> As Condições Gerais, Especiais e Adicionais deste Seguro estão disponíveis no site da Seguradora: ";
					
					if ($this->isEnviarDocusign) {
						echo "<span style='color: white;'>ds_url_condicoes</span>";
					} else {
						echo "<a href='{$produto['ds_url_condicoes']}' target='_blank'>{$produto['ds_url_condicoes']}</a>";
					}

					echo "<br>Verifique o texto correspondente às seguintes coberturas:";
				?>

				<br/>

				<?
				if (is_array($carencia)):
					$titulos = array();
					foreach ($carencia as $item):
						$titulos[] = $item['ds_titulo'];
						echo $item['ds_titulo'];
						echo "<br />";
					endforeach;
				endif;
				?>
			</td>
		</tr>
	</tbody>
</table>

<!-- INFORMACOES -->
<table width="100%" cellpadding="0" cellspacing="1" class="gadget">
	<thead>
		<tr>
			<th style="background-color: white;">Informações</th>
		</tr>
	</thead>
	<tbody>
		<tr>
			<td class=carencia>
				<?php 
					if (!empty($produto['ds_frase_padrao_orcamento']) && $this->proposta['id_status'] === Seguro_Model_Propostas::ID_STATUS_NAO_ENVIADA) { 
						echo "<b>{$produto['ds_frase_padrao_orcamento']}</b><br><br>";
					} 
				?>
				
				A aceitação do seguro estará sujeita a análise do risco. <br /><br />

				<?php if ($condicoesGeraisSUSEP) {?>
             		A ACEITAÇÃO DA PROPOSTA DE SEGUROS ESTÁ SUJEITA À ANÁLISE DO RISCO CONFORME METODOLOGIA E CRITÉRIOS DA SEGURADORA.
              		<br/><br/>
              		NO ENTANTO, AINDA QUE O RISCO SEJA TECNICAMENTE PASSÍVEL DE ACEITAÇÃO, A ESSOR NÃO ESTABELECE, OU MANTÉM, RELACÕES COMERCIAIS COM PESSOA, FÍSICA OU JURÍDICA, QUE TENHA VIOLADO DIREITOS HUMANOS, OU SEJA UMA POTENCIAL VIOLADORA DOS MESMOS. AFINAL, O GRUPO SCOR, AO QUAL PERTENCE, É MEMBRO DO PACTO GLOBAL DAS NAÇÕES UNIDAS, POSSUINDO O COMPROMISSO DE RESPEITAR OS DIREITOS HUMANOS NA CONDUÇÃO DE SUAS ATIVIDADES COMERCIAIS; REPUDIA A VIOLAÇÃO, OU POTENCIAL VIOLAÇÃO, DOS DIREITOS HUMANOS; E NÃO APOIA, NEM TOLERA QUALQUER FORMA DE ABUSO HUMANO, SERVIDÃO, TRABALHO FORÇADO, TRABALHO COMPULSÓRIO, TRÁFICO HUMANO OU ESCRAVIDÃO EM SUAS EMPRESAS E TAMPOUCO EM QUALQUER EMPRESA COM A QUAL ESTEJA ENVOLVIDA EM UMA TRANSAÇÃO COMERCIAL, CONFORME DISPOSTO NO CÓDIGO DE CONDUTA ACESSÍVEL NO SITE ("https://essor.com.br/").
              		<br/><br/>
          		<?php } ?>

        <?php
        if ($circular642) {
          ?>
          A Seguradora disporá do prazo de 15 (quinze) dias para análise quanto à aceitação da presente proposta, contados da data de seu recebimento, seja para seguros novos, alterações ou renovações. Para os seguros rurais com subvenção econômica dos prêmios nos termos da Lei No 10.823, de 19 de dezembro de 2003, o referido prazo de aceitação será de 45 (quarenta e cinco) dias.<br /><br />
          A Seguradora poderá solicitar documentos complementares para análise e aceitação do risco ou da alteração proposta dentro do referido prazo de aceitação. No caso de solicitação dos referidos documentos complementares por parte da Seguradora, o prazo de aceitação ficará suspenso, voltando a correr a partir das 24 horas da data em que se der a entrega da documentação.<br /><br />
          No caso de ausência por parte da Seguradora de manifestação quanto ao seguro proposto dentro do referido prazo de aceitação, estará caracterizada sua aceitação tácita.<br /><br />
          Em se tratando de proposta de seguro mediante pagamento de prêmio, total ou parcial, antecipadamente à aceitação do seguro, o proponente terá direito à cobertura provisória de seguro, desde que solicitada pelo mesmo, e conforme vigência especificada neste presente documento. No caso de aceitação da presente proposta, a seguradora considerará o período de cobertura provisória como o de efetiva vigência do seguro a ser emitido. No caso de recusa de riscos com vigência igual ou superior a 12 meses, a cobertura provisória prevalecerá por mais 2 (dois) dias úteis após a formalização da recusa da seguradora. No caso de recusa de riscos com vigência inferior a 12 meses, a cobertura provisória será imediatamente encerrada no momento da comunicação da recusa.<br /><br />
          <?php
        }
        ?>
				O registro deste plano na SUSEP não implica, por parte da Autarquia, em incentivo ou recomendação à sua comercialização.<br />
				O segurado poderá consultar a situação cadastral de seu corretor de seguros, no site www.susep.gov.br, por meio do número de seu registro na SUSEP, nome completo, CNPJ ou CPF.<br />

				<? if($safra['id'] > 15): ?>
                	A concessão de subsídio federal fica condicionada à regularidade do Proponente junto ao CADIN e ao preenchimento do Termo de Responsabilidade do Produtor Rural integrante desta proposta, bem como a existência de recursos pelo Ministério da Agricultura, na forma da Resolução 13 do Comitê Gestor Interministerial do Seguro Rural (CGSR).<br/><br/>
                <? endif; ?>
				
				<? if(strtotime($this->proposta['dt_transmissao']) >= strtotime('2020-07-01')): ?>
					<!--  <p>REMUNERAÇÃO INTERMEDIÁRIOS: <?=$corretor['vl_comissao']; ?>%</p> -->
				<? endif; ?>
				
        <p>Informamos que, nas hipóteses de <b>(I) RECUSA DA PROPOSTA DE SEGURO</b> e <b>(II) ENDOSSOS COM RESTITUIÇÃO DE PRÊMIO</b>, a <b>ESSOR</b> efetuará a devolução do prêmio mediante crédito na conta corrente de titularidade do <b>SEGURADO</b>, conforme dados bancários informados no momento da contratação do seguro. Na falta destes, as informações bancárias serão novamente solicitadas no momento do pagamento.</p><br/>
 
				<p>Informamos ainda que <b>(III) PAGAMENTOS DE INDENIZAÇÕES DE SINISTRO</b> somente serão efetuados mediante crédito na conta corrente de titularidade do <b>SEGURADO</b>, cujos dados serão solicitados no momento da regulação do respectivo sinistro.</p><br/>
				 
				<p>O <b>SEGURADO</b> deverá informar, por escrito, os dados da conta corrente, ou, se for o caso, que não é titular de conta corrente, sob pena de ficar constituído em mora se não o fizer. Na falta desta informação, o processo de regulação/liquidação de sinistro não estará concluído e não se iniciará o prazo de 30 dias para pagamento da indenização a partir a entrega da documentação solicitada, conforme previsto nas Condições Gerais do Seguro Agrícola.</p><br/>
				 
				<p>Caso o <b>SEGURADO</b> informe que não é titular de conta corrente, a <b>SEGURADORA</b> efetuará o pagamento através de ordem de pagamento. </p><br/>

				<p>A ordem de pagamento é uma transferência de valor que fica disponível para o beneficiário retirar em Banco a ser informado.</p><br/>

				<p><b>Somente as pessoas que <u>não são</u> titulares de conta corrente podem receber uma ordem de pagamento.</b></p>

				<?php if (!$condicoesGeraisSUSEP) { ?>
          			<b>Para fins da Cláusula 9.1 - alínea d das Condições Gerais do Seguro, com exceção ao período de plantio definido na proposta, soberano e independente de qualquer outra norma ou disposição, são consideradas recomendações técnicas dos órgãos oficiais aquelas definidas pelo Zoneamento Agrícola de Risco Climático (ZARC) publicado pelo Ministério da Agricultura, Pecuária e Abastecimento (MAPA) para o ano vigente. A condução da cultura segurada pelo proponente em desacordo, parcial ou total, às demais estritas condições e/ou orientações emanadas pelo MAPA, dentre outras de igual relevância, acarretará na ineficácia absoluta da cobertura e no imediato cancelamento do contrato de seguro por não aquisição do direito à garantia. </b>
        		<?php } ?>
			</td>
		</tr>
	</tbody>
</table>

<!-- DADOS DE LOCAIS DE ENTREGA DE SEMENTE (SE HOUVER) -->
<? if(count($this->locais_entrega)): ?>
	<table width="100%" cellpadding="0" cellspacing="1" class="gadget">
		<thead>
			<tr>
				<th style="background-color: white;">Local de Entrega de Sementes</th>
			</tr>
		</thead>
		<tbody>
			<table width="100%" cellpadding="5" cellspacing="1" class="gadget">
				<thead>
					<tr>
						<th style="background-color: white;">CNPJ</th>
						<th style="background-color: white;">Nome</th>
						<th style="background-color: white;">Município/UF</th>
					</tr>
				</thead>
				<tbody>
					<? foreach ($this->locais_entrega as $local): ?>
						<tr  style="background-color: white;">
						<? if ($local['id_cooperativa'] == 1): // armazenamento próprio ?>
							<td align="center">-</td>
							<td><?=$local['ds_nome_cooperativa']?></td>
							<td align="center">-</td>
						<? else: ?>
							<td align="center"><?=$local['cnpj']?></td>
							<td><?=$local['ds_nome_cooperativa']?></td>
							<td align="center"><?=$local['ds_nome_municipio'].'/'.$local['ds_sigla']?></td>
						<? endif; ?>
						</tr>
					<? endforeach; ?>
				</tbody>
			</table>
		</tbody>
	</table>
<? endif; ?>

<!-- NOVA PAGINA -->
<?= $this->footerProposta($this->proposta, $this->isEnviarDocusign) ?>
<div style="page-break-before: always;"></div>

<!-- DADOS DO QUESTIONARIO -->
<table width="100%" cellpadding="0" cellspacing="1" class="gadget">
	<thead>
		<tr>
			<th style="background-color: white;">Questionário</th>
		</tr>
	</thead>
	<tbody>
		<tr>
			<td><?=$this->questionarioView($this->proposta);?></td>
		</tr>
	</tbody>
</table>

<!-- BLOCO 3 - CARÊNCIA -->
<?php if (is_array($carencia)): ?>

	<table width="100%" cellpadding="0" cellspacing="1" class="gadget">
		<thead>
			<tr>
				<th style='font-size: 12px; background-color: white;'>Carência(s)</th>
			</tr>
		</thead>
		<tbody>
			<tr>
				<td class="carencia" style="padding: 5px;">
					<?php
						foreach ($carencia as $item):
							echo "<div style='font-size: 12px; font-weight: bold; white-space: pre-line;'>{$item['ds_condicao_especial']}</div>";
						endforeach;
					?>
				</td>
			</tr>
		</tbody>
	</table>
<?php endif; ?>

<!-- BLOCO 1 - RESTRIÇÕES PARA COBERTURA DOS RISCOS -->
<?php if (!empty($configuracoesProduto->ds_frase_restricoes)): ?>
	
	<table width="100%" cellpadding="0" cellspacing="1" class="gadget">
		<thead>
			<tr>
				<th style='font-size: 12px; background-color: white;'>Restrições para Cobertura dos Riscos</th>
			</tr>
		</thead>
		<tbody>
			<tr>
				<td class="carencia" style="padding: 5px;">

					<?php echo "<div style='font-size: 12px; font-weight: bold;'>" . nl2br($configuracoesProduto->ds_frase_restricoes) . "</div>"; ?>

					<?
					// TEXTO EXCLUSIVO PARA MILHO PIPOCA
					$ModelProduto = new Produto_Model_Produtos();
					$Produto = $ModelProduto->getRow($this->proposta->id_produto);
					if(strtoupper($Produto->ds_nome_produto) == strtoupper('AgroBrasil PG Milho Pipoca')): ?>
						<br />
						<b>
						CONDIÇÕES PARTICULARES 1:<br />
						A COBERTURA TERMINARÁ 160 DIAS APÓS A DATA DE PLANTIO.<br /><br />

						CONDIÇÕES PARTICULARES 2:<br />
						RISCO EXCLUÍDO DO SEGURO: EXCESSO DE CHUVA PRÓXIMO A COLHEITA
						</b>
						<br /><br />
					<? endif; ?>

				</td>
			</tr>
		</tbody>
	</table>
<?php endif; ?>

<? if($produto["ds_nome_cultura"] == "Pastagem"): ?>
	<table width="100%" cellpadding="0" cellspacing="1" class="gadget">
	<thead>
		<tr>
			<th style="background-color: white;">Informações Adicionais</th>
		</tr>
	</thead>
	<tbody>
		<tr>
			<td class=carencia>
				<p>O Proponente declara ter ciência e concordar que o monitoramento, medição e tratamentos dos índices apurados durante todo o período de garantia serão realizados pelas empresas especificadas neste documento: <br />
				- Airbus DS Geo SA: provedor responsável por dados, monitoramento e processamento de dados <br /> 
				- Agritask Ltd: provedor responsável pela disponibilização dos dados
				</p>	
			</td>
		</tr>
	</tbody>
	</table>
<? endif; ?>

<?= $this->footerProposta($this->proposta, $this->isEnviarDocusign) ?>


<? // BLOCO ESPECÍFICO PARA MAÇÃ TELADA
if($this->proposta->id_produto == 713): ?>
	<table width="100%" cellpadding="0" cellspacing="1" class="gadget">
		<thead>
			<tr>
				<th style="background-color: white;">Particularidade do Cultivo Protegido</th>
			</tr>
		</thead>
		<tbody>
			<tr>
				<td class=carencia>
				Inclui-se na cobertura, mediante pagamento de prêmio específico, com o que se desconsidera a exclusão prevista nas condições especiais do cultivo protegido: Frutas cobertas por telas ou plástico anti-granizo entre 5 (cinco) e 10 (dez) anos de fabricação. Telas ou plástico anti-granizo entre 5 (cinco) e 10 (dez) anos de fabricação. Telas ou plástico anti-granizo que apresentem bolsões ou vãos entre fileiras entre 20 (vinte) e 50 (cinquenta) centímetros. Telas ou plástico anti-granizo que apresentem ângulo entre 20 (vinte) e 30 (trinta) graus de inclinação. O Custo Unitário do homem/dia passa de R$ 30,00 para R$ 80,00. O Custo do Metro Quadrado da tela passa de R$ 1,10 para R$ 1,30.
				</td>
			</tr>
		</tbody>
	</table>
<? endif;
// FIM BLOCO ESPECÍFICO PARA MAÇÃ TELADA ?>

<!-- BLOCO 1 -  RISCOS EXCLUÍDOS E/OU PERDAS NÃO COBERTAS  -->
<?php if (!empty($configuracoesProduto->ds_frase_risco)): ?>
	<?//= $this->footerProposta($this->proposta) ?>
	<div  style="page-break-before: always;"></div>

	
	<table width="100%" cellpadding="0" cellspacing="1" class="gadget">
		<thead>
			<tr>
				<th style='font-size: 12px; background-color: white;'>Anexo 1 - Riscos Excluídos, Perdas Não Cobertas e/ou Condições Particulares</th>
			</tr>
		</thead>
		<tbody>
			<tr class="no-view">
				<td>
					<?php
					
						if($dtTransmissaoMaeFormatada > DATA_ALTERACAO_PDF_PROPOSTA){
							$dsFraseRisco =  explode('4.21', $configuracoesProduto->ds_frase_risco);
							echo "<div style='font-size: 12px; font-weight: bold;'>" . nl2br($dsFraseRisco[0]) ."</p></div>";
						}else{
							$dsFraseRisco =  explode('4.19', $configuracoesProduto->ds_frase_risco);
							echo "<div style='font-size: 12px; font-weight: bold;'>" . nl2br($dsFraseRisco[0]) ."</p></div>";
						}

						?>
				</td>
			</tr>
		</tbody>
	</table>
	<?php endif; ?>
	
	<!-- BLOCO 1.1 - RISCOS EXCLUÍDOS E/OU PERDAS NÃO COBERTAS  -->
	<?php if (!empty($dsFraseRisco[1])): ?>
		<?= $this->footerProposta($this->proposta, $this->isEnviarDocusign) ?>
		<div style="page-break-before: always;"></div>
	
		
	<div class="no-view">
		<table width="100%" cellpadding="0" cellspacing="1" class="gadget">
			<thead>
				<tr>
					<th style='font-size: 12px; background-color: white;'>Anexo 1 - Riscos Excluídos, Perdas Não Cobertas e/ou Condições Particulares</th>
				</tr>
			</thead>
			<tbody>
				<tr>
					<td class="carencia" style="padding: 5px;">
						<?php 
							if($dtTransmissaoMaeFormatada > DATA_ALTERACAO_PDF_PROPOSTA){
								echo "<div style='font-size: 12px; font-weight: bold;'>4.21". nl2br($dsFraseRisco[1]) ."</div>";
							}else{
								echo "<div style='font-size: 12px; font-weight: bold;'>4.19". nl2br($dsFraseRisco[1]) ."</div>";
							}


							
							if (!empty($configuracoesProdutoCoberturaPrincipal->ds_frase_outros_riscos_excluidos)) {
								echo "
								<br>
								<div style='font-size: 12px; font-weight: bold;'>OUTROS RISCOS EXCLUÍDOS E/OU PERDAS NÃO COBERTAS</div>
								<div style='font-size: 12px; font-weight: bold;'>". nl2br($configuracoesProdutoCoberturaPrincipal->ds_frase_outros_riscos_excluidos) . "</div>
								";
							}

							if (!empty($coberturasAdicionais)) {
								echo "<br>";
								foreach ($coberturasAdicionais as $coberturaAdicional) {
									$configuracoesProdutoCoberturaAdicional = $configuracoesCoberturasAdicionais[$coberturaAdicional['id_cobertura']];
									
									if (!empty($configuracoesProdutoCoberturaAdicional->ds_frase_outros_riscos_excluidos)) {
										echo "<div style='font-size: 12px; font-weight: bold;'>". nl2br($configuracoesProdutoCoberturaAdicional->ds_frase_outros_riscos_excluidos) ."</div>";
									}
								}
							}

						?>
					</td>
				</tr>
			</tbody>
		</table>
		<?= $this->footerProposta($this->proposta, $this->isEnviarDocusign) ?>
	</div>
<?php endif; ?>

<!-- BLOCO 1.2 - CONDIÇÕES PARTICULARES (PDF) -->
<?php if (!empty($possuiCondicoesParticulares)): ?>

	<?php if (empty($dsFraseRisco[1])): ?>
		<?= $this->footerProposta($this->proposta, $this->isEnviarDocusign) ?>
	<?php endif; ?>
	
	<div style="page-break-before: always;"></div>

	
	<div class="no-view">
		<table width="100%" cellpadding="0" cellspacing="1" class="gadget">
			<thead>
				<tr>
					<th style='font-size: 12px; background-color: white;'>Anexo 1 - Riscos Excluídos, Perdas Não Cobertas e/ou Condições Particulares</th>
				</tr>
			</thead>
			<tbody>
				<tr>
					<td class="carencia" style="padding: 5px;">
						<?php 
							if (!empty($configuracoesProdutoCoberturaPrincipal->ds_frase_condicoes_particulares)) {
								echo "<div style='font-size: 12px; font-weight: bold;'>". nl2br($configuracoesProdutoCoberturaPrincipal->ds_frase_condicoes_particulares) . "</div>";
							}

							if (!empty($coberturasAdicionais)) {
								echo "<br>";
								foreach ($coberturasAdicionais as $coberturaAdicional) {
									$configuracoesProdutoCoberturaAdicional = $configuracoesCoberturasAdicionais[$coberturaAdicional['id_cobertura']];

									if (!empty($configuracoesProdutoCoberturaAdicional->ds_frase_condicoes_particulares)) {
										echo "<div style='font-size: 12px; font-weight: bold;'>". nl2br($configuracoesProdutoCoberturaAdicional->ds_frase_condicoes_particulares) ."</div>";
									}
								}
							}
						?>
					</td>
				</tr>
			</tbody>
		</table>
		<?= $this->footerProposta($this->proposta, $this->isEnviarDocusign) ?>
	</div>
<?php endif; ?>

<div style="page-break-before: always;"></div>

<!-- DADOS DAS UNIDADES -->
<?= $this->unidadesView($this->proposta, true, array(), 'PRO', true, $this->isEnviarDocusign, false); ?>

<!-- DADOS DOS CROQUIS -->
<? $countCroquis = count($croquis);?>
<? foreach ($croquis as $index => $croqui): ?>
	<? if (file_exists(PATH_CROQUI."/".$croqui['ds_nome_arquivo'])): ?>
		<div  style="page-break-before: always;"></div>
	
		<? list($width, $height) = getimagesize(PATH_CROQUI."/".$croqui['ds_nome_arquivo']); ?>
		<table width="100%" cellpadding="0" cellspacing="1" class="gadget">
			<thead>
				<tr>
					<th style="background-color: white;">Anexo 3 - Croqui <?=$index+1?></th>
				</tr>
			</thead>
			<tbody>
				<tr>
					<?php if($this->apenasPrint) { ?>
						<td align="center"><img src="<?= PATH_CROQUI."/".$croqui['ds_nome_arquivo'] ?>" height="<?=($height > 700 ? 700 : $height)?>" width="<?=($width > 650 ? 650 : $width)?>" /></td>
					<?php } else { ?>
						<td align="center"><img src="/agronet/file/croqui/name/<?= $croqui['ds_nome_arquivo'] ?>" height="<?=($height > 700 ? 700 : $height)?>" width="<?=($width > 650 ? 650 : $width)?>" /></td>
					<?php } ?>
				</tr>
			</tbody>
		</table>
		<?= $this->footerProposta($this->proposta, $this->isEnviarDocusign) ?>
	<? endif;?>
<? endforeach; ?>

<!--Anexo 4: DECLARAÇÃO DE CONSENTIMENTO PARA TRATAMENTO DE DADOS PESSOAIS LEI GERAL DE PROTEÇÃO DE DADOS PESSOAIS – LGPD-->
<?php
if (!in_array($statusProposta, [Seguro_Model_Propostas::DS_CHAVE_STATUS_DEVOLVIDA, Seguro_Model_Propostas::DS_CHAVE_STATUS_NAO_ENVIADA])) {
	echo "<div  style='page-break-before: always;'></div>";


	$styleCabecalho = "{$fontSize} text-align: center; style='border-top: 1px solid;'";
    $stylePadrao = "{$fontSize} text-align: center; border: 0 !important; border-style: none;";
    $styleTexto = "{$fontSize} text-align: justify; padding-top: 10px; border: 0 !important; border-style: none;";
    $styleAssinaturas = "{$stylePadrao} padding-top: 25px; border: 0 !important; border-style: none;";
    ?>
  	<table width="100%" cellpadding="0" cellspacing="1" class="gadget">
		<thead>
			<tr>
				<th colspan="3" style="<?=$fontSize?> background-color: white;">
					Anexo 4 - Declaração de Consentimento Para Tratamento de Dados Pessoais Lei Geral de Proteção de Dados Pessoais - LGPD
				</th>
			</tr>
		</thead>
		<tbody>
			<?php
			if ($proponente['tp_pessoa'] === 'F') {
			?>
			<tr>
				<td style="border-bottom: none;">
					<table>
						<tr>
							<td style="<?=$stylePadrao?>">
								SEGURADO
							</td>
						</tr>
						<tr>
							<td id="termo_lgpd" style="<?=$styleTexto?>">
							<?php if($dtTransmissaoMaeFormatada > DATA_ALTERACAO_PDF_PROPOSTA){ ?>
              Eu autorizo a Essor a utilizar meus dados pessoais e imagem para fins comerciais, jurídicos,
              financeiros e administrativos, inclusive enviarem para empresas terceiras que fazem parte do processo.
              Esta autorização terá prazo de validade de 15 anos, para garantir que todos os serviços e benefícios ofertados possam ser usufruídos.
          <?php }else{ ?>
              Eu autorizo a AgroBrasil e a Essor a utilizarem meus dados pessoais e imagem para fins comerciais, jurídicos,
              financeiros e administrativos, inclusive enviarem para empresas terceiras que fazem parte do processo.
              Esta autorização terá prazo de validade de 15 anos, para garantir que todos os serviços e benefícios ofertados possam ser usufruídos.
          <?php }?>
							</td>
						</tr>
						<tr>
							<td style="<?=$stylePadrao?>"><div style="color: white;">assinatura_do_proponente</div></td>
						</tr>
						<tr>
							<td style="<?=$styleAssinaturas?>"><?=str_repeat('_', 70);?></td>
						</tr>
						<tr>
							<td style="<?=$stylePadrao?> padding-bottom: 25px;"><?=$proponente['ds_nome_proponente']?> / CPF: <?=$proponente['cpf_cnpj']?></td>
						</tr>
					</table>
				</td>
			</tr>
			<?php
			}
			?>
			<tr>
				<td style="border-top: 1px solid;">
					<table>
						<tr>
							<td style="<?=$stylePadrao?>">
								CORRETOR
							</td>
						</tr>
						<tr>
							<?php if($dtTransmissaoMaeFormatada > DATA_ALTERACAO_PDF_PROPOSTA){?>
								<td id="termo_titularidade_dados" style="<?=$styleTexto?>">
							Eu me responsabilizo e declaro estar formalmente autorizado e/ou ser o responsável legal pelo titular destes
							dados pessoais acima indicados para fornecê-los à Essor visando o uso destes dados para fins
							comerciais, jurídicos, financeiros e administrativos, inclusive para enviar a empresas terceiras que fazem
							parte do processo. Esta autorização tem prazo de validade de 15 anos para garantir que todos os benefícios do contrato possam ser usufruídos.
							</td>
							<?php }else{?>
								<td style="<?=$styleTexto?>">
							Eu me responsabilizo e declaro estar formalmente autorizado e/ou ser o responsável legal pelo titular destes
							dados pessoais acima indicados para fornecê-los à AgroBrasil e Essor visando o uso destes dados para fins
							comerciais, jurídicos, financeiros e administrativos, inclusive para enviar a empresas terceiras que fazem
							parte do processo. Esta autorização tem prazo de validade de 15 anos para garantir que todos os benefícios do contrato possam ser usufruídos.
							</td>
							<?php }?>

						</tr>
						<tr>
							<td style="<?=$stylePadrao?>"><div style="color: white;">assinatura_do_corretor</div></td>
						</tr>
						<tr>
							<td style="<?=$styleAssinaturas?>"><?=str_repeat('_', 70);?></td>
						</tr>
						<tr>
							<td style="<?=$stylePadrao?> padding-bottom: 25px;">
							<div style="text-align: center; margin-left: 15px; margin-right: 15px;">
              <p style="margin-bottom: 4px;">ASSINATURA DO CORRETOR</P>
                  <span>Assinatura opcional. Informações foram validadas através de autenticação em sistema.</span>
            </div>
							</td>
						</tr>
					</table>
				</td>
			</tr>
		</tbody>
	</table>
    <?php
}
?>

<!-- DECLARACAO DO PROPONENTE -->
<div  style="page-break-before: always;"></div>

<table width="100%" cellpadding="0" cellspacing="1" class="gadget">
	<thead>
		<tr>
			<th colspan="3" style="<?=$fontSize?> background-color: white;">Anexo 5 - Declaração do Proponente</th>
		</tr>
	</thead>
	<tbody>
		<? if (($this->proposta->status() == 'NAO_ENVIADA') || ($this->proposta->status() == 'NAO_ENVIADA_DEVOLVIDA')): ?>
			<tr>
				<td class="carencia">
					<p style="<?=$fontSize?>">Caso decida-se pela efetivação da proposta de seguro agrícola, entre em contato com o seu corretor e solicite o encaminhamento à seguradora.</p>
				</td>
			</tr>
		<? else: ?>
			<tr>
				<td colspan="3">
					<div style="<?=$fontSize?>">
					<?php
						if ($circular642) {
							if ($condicoesGeraisSUSEP) {
								echo nl2br(DECLARACAO_PROPONENTE_CONDICOES_SUSEP);
							  } else {
								echo nl2br(DECLARACAO_PROPONENTE_IMPRESSAO_ESSOR_2022);
							  }
						} else {
							echo nl2br(DECLARACAO_PROPONENTE_IMPRESSAO_ESSOR);
						}
					?>
					</div>
				</td>
			</tr>
			<tr>
				<td width="33%">
					<b>Local e Data</b>
					<table width="100%">
						<tbody>
							<tr>
								<td align="center" border="0" style="border: 0 !important; border-style: none;">
									<p><?=$proponente['ds_nome_municipio']?> - <?=$proponente['ds_sigla']?></p>
									<div style="color: white;">
										data_assinatura
									</div>
								</td>
							</tr>
						</tbody>
					</table>
				</td>
				<td style="width: 33%;">
					<b>Assinatura do Proponente</b>
					<div style="color: white;">assinatura_do_proponente</div>
				</td>
				<?php if (!$this->isEnviarDocusign && $condicoesGeraisSUSEP) { ?>
					<td style="width: 33%;">
						<div>
							<b>Assinatura do Corretor</b>
							<div style="color: white;">assinatura_do_corretor</div>
						</div>
						<br><br><br>
						<table width="100%">
							<tbody>
								<tr>
									<td style="border: 0 !important; border-style: none; font-style: italic; font-size: x-small;
										text-align: center; padding-right: 12px; padding-left: 12px;">
										<p>Assinatura opcional. Informações foram validadas através de autenticação em sistema.</p>
									</td>
								</tr>
							</tbody>
						</table>
					</td>
				<?php } else { ?>
					<td style="width: 33%; height: 65px;">
						<b>Assinatura do Corretor</b>
						<div style="color: white;">assinatura_do_corretor</div>
					</td>
				<?php }?>
			</tr>
		<? endif; ?>
	</tbody>
</table>
