<!DOCTYPE html>
<html>
<head>
	<title><?= $array['clientInfo']['name']; ?></title>
	<meta charset="utf-8">
</head>
<body>

	<div style="padding: 15px; border:2px solid #CCC; width: 800px; margin: 0 auto; font-family: 'Myriad Pro';">

		<ul style="list-style: none; float: left; width: 100%; margin: 0; padding: 0; border-bottom: 2px solid #CCC;">
			<li style="float: left; width: 35%;"><img src="<?= $base; ?>/assets/images/<?= $array['reports_info']['img_soon']; ?>" style="width: 250px;"></li>
			<li style="float: left; width: 65%;">
				<strong><?php echo $array['reports_info']['title']; ?></strong>

				<?php foreach ($array['reports_info']['other_information'] as $value): ?>
					<p style="font-size: 13px; margin: 0 0 3px;"><?= $value; ?></p>
				<?php endforeach; ?>
			</li>
		</ul>

		<ul style="list-style: none; width: 100%; margin: 0; padding: 0; border-bottom: 2px solid #CCC;">
			<li>
				<p style="font-size: 16px; margin: 5px 0 5px;">PEDIDO - <span style="font-size: 20px; color: #FF0000;">Nº <?= $array['request']['id']; ?></span></p>
				<p style="font-size: 13px; margin: 0 0 3px;">Data de Emissão: <?= date('d/m/Y', strtotime($array['request']['date_created'])); ?></p>
			</li>
		</ul>

		<ul style="list-style: none; width: 100%; margin: 0; padding: 0; border-bottom: 2px solid #CCC;">
			<li>
				<p style="font-size: 13px; margin: 5px 0 5px;">Razão social: <?= $array['clientInfo']['name']; ?></p>
				<p style="font-size: 13px; margin: 0 0 3px;">CPF/CNPJ: <?= ($array['clientInfo']['type'] == 2)?$array['clientInfo']['cnpj']:$array['clientInfo']['cpf']; ?></p>
				<p style="font-size: 13px; margin: 0 0 3px;">Contato: <?= $array['clientInfo']['buyer'] ?></p>
				<p style="font-size: 13px; margin: 0 0 3px;">Fone do Contato: <?= $array['clientInfo']['buyer_phone'] ?></p>
			</li>
			<br>
			<li>
				<p style="font-size: 13px; margin: 5px 0 5px;">Fazenda: <?= $array['printFarmInfo']['name']; ?></p>
				<p style="font-size: 13px; margin: 5px 0 5px;">Inscrição Estadual: <?= $array['printFarmInfo']['state_registration']; ?></p>
				<p style="font-size: 13px; margin: 5px 0 5px;">Responsável: <?= $array['printFarmInfo']['responsible']; ?></p>
				<p style="font-size: 13px; margin: 5px 0 5px;">Telefone: <?= $array['printFarmInfo']['phone']; ?></p>
			</li>
		</ul>

		<ul style="list-style: none; width: 100%; margin: 0; padding: 0; margin-top: 15px;">
			<li style="box-sizing: border-box; font-size: 11px; width: 6%; float: left; padding: 8px 2px 8px; background: #CCC;">Item</li>
			<li style="box-sizing: border-box; font-size: 11px; width: 20%; float: left; padding: 8px 2px 8px; background: #CCC;">Descrição do produto</li>
			<li style="box-sizing: border-box; font-size: 11px; width: 11.5%; float: left; padding: 8px 2px 8px; background: #CCC;">Origem</li>
			<li style="box-sizing: border-box; font-size: 11px; width: 9%; float: left; padding: 8px 2px 8px; background: #CCC;">Unid</li>
			<li style="box-sizing: border-box; font-size: 11px; width: 13%; float: left; padding: 8px 2px 8px; background: #CCC;">Apresentação</li>
			<li style="box-sizing: border-box; font-size: 11px; width: 7%; float: left; padding: 8px 2px 8px; background: #CCC;">Qtde</li>
			<li style="box-sizing: border-box; font-size: 11px; width: 16%; float: left; padding: 8px 2px 8px; background: #CCC;">Preço de venda</li>
			<li style="box-sizing: border-box; font-size: 11px; width: 12.5%; float: left; padding: 8px 2px 8px; background: #CCC;">Valor do item</li>
		</ul>

		<?php foreach($array['requestItems'] as $key => $item): ?>
			<ul style="list-style: none; width: 100%; margin: 0; padding: 0; border-bottom: 1px solid #CCC;">
				<li style="box-sizing: border-box; font-size: 11px; width: 6%; float: left; padding: 8px 2px 8px; "><?= $key + 1 ?></li>
				<li style="box-sizing: border-box; font-size: 11px; width: 20%; float: left; padding: 8px 2px 8px; "><?= $item['product_name']; ?></li>
				<li style="box-sizing: border-box; font-size: 11px; width: 11.5%; float: left; padding: 8px 2px 8px; "><?= $item['company_name']; ?></li>
				<li style="box-sizing: border-box; font-size: 11px; width: 9%; float: left; padding: 8px 2px 8px; "><?= $item['product_unity']['name']; ?></li>
				<li style="box-sizing: border-box; font-size: 11px; width: 13%; float: left; padding: 8px 2px 8px; "><?= $item['product_presentation']['name']; ?></li>
				<li style="box-sizing: border-box; font-size: 11px; width: 7%; float: left; padding: 8px 2px 8px; "><?= $item['quantity']; ?></li>
				<li style="box-sizing: border-box; font-size: 11px; width: 16%; float: left; padding: 8px 2px 8px; "><?= $item['price_sale']; ?></li>
				<li style="box-sizing: border-box; font-size: 11px; width: 12.5%; float: left; padding: 8px 2px 8px; "><?= $item['total']; ?></li>
			</ul>
		<?php endforeach; ?>
		<ul style="list-style: none; width: 100%; float: left; margin: 15px 0; padding: 0; border-bottom: 2px solid #CCC;">
			<li>Total do Pedido em R$ <strong><?= $array['request']['total']; ?></strong></li>			
		</ul>

		<!-- Adiantamento -->

		<?php if(!empty($array['requestInput'])): ?>

		<ul style="list-style: none; width: 100%; margin: 0; padding: 0;">
			<li style="width: 15%; box-sizing: border-box; font-size: 11px; float: left; padding: 8px 2px 8px; background: #CCC;">% de entrada</li>
			<li style="width: 22%; box-sizing: border-box; font-size: 11px; float: left; padding: 8px 2px 8px; background: #CCC;">Valor da Entrada</li>
			<li style="width: 30%; box-sizing: border-box; font-size: 11px; float: left; padding: 8px 2px 8px; background: #CCC;">Data de pgto da entrada</li>
			<li style="width: 30%; box-sizing: border-box; font-size: 11px; float: left; padding: 8px 2px 8px; background: #CCC;">Como diluir o % de entrada</li>
		</ul>
		<ul style="list-style: none; width: 100%; margin: 0; padding: 0; border-bottom: 2px solid #CCC;">
			<li style="box-sizing: border-box; font-size: 11px; width: 15%; float: left; padding: 8px 2px 8px; ">
				<?= $array['requestInput']['percente_input']; ?>					
			</li>
			<li style="box-sizing: border-box; font-size: 11px; width: 22%; float: left; padding: 8px 2px 8px; ">
				<?= number_format($array['requestInput']['value_input']); ?>
			</li>
			<li style="box-sizing: border-box; font-size: 11px; width: 30%; float: left; padding: 8px 2px 8px; ">
				<?= date('d/m/Y', strtotime($array['requestInput']['payment_date_input'])); ?>
			</li>
			<li style="box-sizing: border-box; font-size: 11px; width: 30%; float: left; padding: 8px 2px 8px; ">
				<?= $array['requestInput']['how_dilute_input']; ?>
			</li>
		</ul>

		<?php endif; ?>

		<!-- Fim Adiantamento -->

		<ul style="list-style: none; width: 100%; margin: 15px 0; padding: 0; border-bottom: 2px solid #CCC;">
			<li>
				<p style="font-size: 13px; margin: 0 0 3px;" >Transporte a cargo de: <strong>
					<?= (!empty($array['requestFreight']['how_pay_freight']) && $array['requestFreight']['how_pay_freight'] != 1)?$array['requestFreight']['how_pay_freight']:'Não Informado' ?>
				</strong></p>
			</li>
		</ul>

		<!-- Entregas do pedido -->

		<ul style="list-style: none; width: 100%; margin: 15px 0; padding: 0; border-bottom: 2px solid #CCC;">
			<li>
				<p style="margin: 10px 0 3px;" >Datas de Entregas deste Pedido:</p>
			</li>			
			<?php foreach($array['requestItems'] as $key => $item): ?>
				<?php if(!empty($array['delivery'])): ?>
				<li>
					<p style="font-size: 13px; margin: 10px 0 3px;" ><?= $item['product_name'].':'; ?></p>

					<?php foreach($array['delivery'][$key]['info_deliveries'] as $chave => $itemDelivery): ?>
						<strong style="font-size: 13px;"><?= $itemDelivery['date_deliverie']; ?></strong>
						<?= ($chave != count($array['delivery'][$key]['info_deliveries']) - 1)?' - ':''; ?>
					<?php endforeach; ?>

				</li>
				<?php else: ?>
				<li>
					<p style="font-size: 13px; margin: 10px 0 3px;" >Ainda não programadas!</p>
				</li>
				<?php endif; ?>
			<?php endforeach; ?>
		</ul>

		<!-- Fim Entregas do pedido -->

		<!-- Observações -->

		<?php if(!empty($array['request']['note'])): ?>

		<ul style="list-style: none; width: 100%; margin: 15px 0; padding: 0; border-bottom: 2px solid #CCC;">
			<li>
				<p style="margin: 10px 0 3px;" >Observações:</p>
			</li>			
			
			<li>
				<textarea style="width:100%; border: 0; outline: none;" rows="6"><?= $array['request']['note']; ?></textarea>
			</li>
		</ul>

		<?php endif; ?>

		<!-- Fim Observações -->
		<ul style="list-style: none; width: 100%; margin: 15px 0; padding: 0; border-bottom: 2px solid #CCC;">
			<li>
				<p>Nome do responsável pelo atendimento: <strong><?= $array['request']['user_name']; ?></strong></p>
			</li>
		</ul>
	</div>

</body>
</html>