<?php $totalProdutos = 0; ?>
<!DOCTYPE html>
<html lang="pt-br">

<head> 
<title>iTecPro Apple - Venda Nº <?php echo $result->idVendas ?> | <?php echo $result->nomeCliente ?> </title> 
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <link rel="stylesheet" href="<?php echo base_url(); ?>assets/css/bootstrap.min.css" />
    <link rel="stylesheet" href="<?php echo base_url(); ?>assets/css/bootstrap-responsive.min.css" />
    <link rel="stylesheet" href="<?php echo base_url(); ?>assets/css/matrix-style.css" />
    <link href="<?php echo base_url(); ?>assets/font-awesome/css/font-awesome.css" rel="stylesheet" />
    <link href='http://fonts.googleapis.com/css?family=Open+Sans:400,700,800' rel='stylesheet' type='text/css'>
    <style type="text/css">
    .table {            margin-bottom: 5px;
}
    </style>
    <script type="text/javascript" src="<?php echo base_url(); ?>assets/js/jquery-1.10.2.min.js"></script>
</head>

<body>
<div class="container-fluid">
        <div class="row-fluid">
            <div class="span12">
                <div class="invoice-content">
                    <div class="invoice-head">
                      <table class="table table-condensed">
                        <tbody>
                          <?php if ($emitente == null) { ?>
                          <tr>
                            <td colspan="3" class="alert">Você precisa configurar os dados do emitente. >>><a href="<?php echo base_url(); ?>index.php/mapos/emitente">Configurar</a> <<<</td>
                          </tr>
                          <?php } else { ?>
                        <td style="width: 25%"><img src=" <?php echo $emitente[0]->url_logo; ?> "></td>
                          <td><span style="font-size: 17px;"> &nbsp;&#63743; <?php echo $emitente[0]->nome; ?></span> </br>
                          <span style="font-size: 12px; ">
                          <span class="icon">
                          <i class="fas fa-fingerprint" style="margin:5px 1px"></i> CNPJ: <?php echo $emitente[0]->cnpj; ?> | IE: 0031459540018
                          </br>
                          <span class="icon"> <i class="fas fa-map-marker-alt" style="margin:4px 3px"></i> <?php echo $emitente[0]->rua . ', nº:' . $emitente[0]->numero . ', ' . $emitente[0]->bairro . ' - ' . $emitente[0]->cidade . ' - ' . $emitente[0]->uf; ?> </span>
                          </br>
                          <span>
                          <span class="icon">
                          <i class="fas fa-comments" style="margin:5px 1px"></i> <?php echo $emitente[0]->email . ' - Fone: ' . $emitente[0]->telefone; ?>
                          </br>
                          <span class="icon"> <i class="fas fa-user-check"></i> Responsável: <?php echo $result->nome ?>
                            <td style="width: 18%; text-align: center"><p><span><img src="http://os.itecpro.com.br/application/views/os/qrpix.png" width="104" height="97" alt=""/></span>Venda Nº<?php echo $result->idVendas ?> <?php echo date('d/m/Y'); ?></p></td>
                          </span>
                          </td>
                          </tr>
                          <?php } ?>
                          </tbody>
                      </table>
                      <table width="505" height="5" class="table table-condensend">
                        <tbody>
                          <tr>
                            <td height="15" style="width: 85%; padding-left: 0"><ul>
                              <li><i class="fas fa-users"></i><?php echo $result->nomeCliente ?> - <i class="fas fa-address-card" style="margin:5px 1px"></i></b><?php echo $result-> documento ?> -  <i class="fas fa-phone-square"></i> <?php echo $result-> celular ?><span> <?php echo $result->rua ?> <?php echo $result->numero ?> </span><span><?php echo $result->bairro ?> <?php echo $result->cidade ?> <?php echo $result->estado ?></span><br>
                              </li>
                            </ul>
                            </td>
                          </tr>
                        </tbody>
                      </table>
                      <center><h4>GARANTIA</h4></center>
                  
                  <div style="margin-top: 0; padding-top: 0">
                    <?php if ($produtos != null) { ?>
                     <table width="374" class="table table-bordered table-condensed" id="tblProdutos">
                                <thead>
                                    <tr>
                                        <th width="238" style="font-size: 15px">Produto</th>
                                        <th width="9" style="font-size: 15px">&nbsp;</th>
                                        <th width="45" style="font-size: 15px">Preço </th>
                                        <th width="62" style="font-size: 15px">Sub.Total</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <?php
                                        foreach ($produtos as $p) {
                                            $totalProdutos = $totalProdutos + $p->subTotal;
                                            echo '<tr>';
                                            echo '<td>' . $p->descricao . '</td>';
                                            echo '<td>' . $p->quantidade . '</td>';
                                            echo '<td>' . ($p->preco ?: $p->precoVenda) . '</td>';
                                            echo '<td>R$ ' . number_format($p->subTotal, 2, ',', '.') . '</td>';
                                            echo '</tr>';
                                        } ?>
                                    <tr>
                                        <td colspan="3" style="text-align: right"><strong>Total:</strong></td>
                                        <td><strong>R$
                                                <?php echo number_format($totalProdutos, 2, ',', '.'); ?></strong></td>
                                    </tr>
                                </tbody>
                    </table>
                        <p><b>Tempo de garantia:</b>
                          1 ano
                       <?php
                        } ?>                        
                        N/S: <?php echo htmlspecialchars_decode($result->observacoes_cliente) ?>                        
                  </div>
                </div>
            </div>
        </div>
</div>
<table width="822" border="1" class="table table-bordered table-condensed">
  <tbody>
    <tr>
      <td width="125"><center>
        <p><img src="http://os.itecpro.com.br/application/views/os/qrgarantia.jpeg" width="683" height="135" alt=""/></p>
      </center>
        </td>
    </tr>
  </tbody>
</table>
<script>
        window.print();
      </script>
 <footer class="footer"><div align=center><a href='Autenticador'><img src='https://contador.s12.com.br/img-7156dZZyzdYZA9AD-57.gif' border='0' alt='contador grátis'></a><script type='text/javascript' src=''></script></div></p></footer>
</body>

</html>
