<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>Título</title>
  </head>
  <body style="font-family: Arial, sans-serif; color: black;">
    <table width="100%" border="0" align="center" cellpadding="30" cellspacing="0">
      <tr>
        <td>
          <table width="600" border="0" align="center" cellpadding="0" cellspacing="0">
            <tr>
              <td width="600" align="center" bgcolor="<?php echo $header_background_color; ?>">
                <a href="<?php echo $link_website; ?>" target="_blank" style="display:block;">
                  <img src="<?php echo $logo; ?>" alt="<?php echo $store_name; ?>" border="0" style="display:block; margin:20px; padding:0;">
                </a>
              </td>
            </tr>
            <tr><td width="600" height="30"></td></tr>
            <tr>
              <td width="600">
                <p style="font-size:16px; margin:0; padding:0;"><?php echo $text_order_status; ?></p>
                <p style="font-size:30px; margin:0; padding:0;"><b><?php echo $name; ?></b></p>
                <?php if (isset($order_status_message) && $order_status_message) { ?>
                  <p style="font-size:16px; margin:10px 0; padding:0;"><?php echo $order_status_message; ?></p>
                  <p width="600" height="10" colspan="4" style="border-bottom: 1px solid #dddddd;"></p>
                <?php } ?>
                <p style="font-size:16px; margin:0; padding:0; margin-bottom: 10px;"><?php echo $text_order . ' ' . $order_id . ', ' . $text_date_added . ' ' . $date_added; ?></p>
              </td>
            </tr>
            <?php if (isset($url_store_rating)) { ?>
              <tr>
                <td width="600" align="center" bgcolor="<?php echo $btn_background_color; ?>" style="height:40px">
                  <div style="width:0; height:40px; display:inline-block; vertical-align:middle;"></div>
                  <a href="<?php echo $url_store_rating ?>" target="_blank" style="color:<?php echo $btn_text_color; ?>;font-size:14px;margin:0;padding:0;text-decoration:none;display:inline-block;vertical-align:middle;">
                    <?php echo $text_store_rating ?>
                  </a>
                </td>
              </tr>
            <?php } ?>
            <tr><td width="600" height="20"></td></tr>
            <?php if ($store_url) { ?>
              <tr>
                <td width="600" align="center" bgcolor="<?php echo $btn_background_color; ?>" style="height:40px">
                  <div style="width:0; height:40px; display:inline-block; vertical-align:middle;"></div>
                  <a href="<?php echo $store_url; ?>" target="_blank" style="color:<?php echo $btn_text_color; ?>;font-size:14px;margin:0;padding:0;text-decoration:none;display:inline-block;vertical-align:middle;">
                    <?php echo $text_link; ?>
                  </a>
                </td>
              </tr>
            <?php } ?>
            <tr><td width="600" height="30"></td></tr>
            <?php if ($comment && !$link_pagamento) { ?>
              <tr>
                <td width="600">
                  <table width="600" border="0" cellpadding="0" cellspacing="0" style="border:1px solid #dddddd; border-collapse:collapse;">
                    <tr><td width="600" height="40" colspan="3"></td></tr>
                    <tr>
                      <td width="50"></td>
                      <td width="500">
                        <p style="font-size:12px; margin:0; padding:0;"><b><?php echo $text_comment; ?></b></p>
                        <p style="font-size:16px; margin:0; padding:0;"><?php echo $comment; ?></p>
                      </td>
                      <td width="50"></td>
                    </tr>
                    <tr><td width="600" height="40" colspan="3"></td></tr>
                  </table>
                </td>
              </tr>
              <tr><td width="600" height="30"></td></tr>
            <?php } else if ($link_pagamento) { ?>
              <tr><td width="600" height="30" style="border-top: 1px solid #dddddd;"></td></tr>
              <tr>
                <td width="600">
                  <table width="600" border="0" cellpadding="0" cellspacing="0" style="border-collapse:collapse;">
                    <tr>
                      <td width="600" align="center" bgcolor="<?php echo $btn_background_color; ?>" style="height:40px">
                        <div style="width:0;height:40px;display:inline-block;vertical-align:middle;"></div>
                        <a href="<?php echo $link_pagamento; ?>" target="_blank" style="color:<?php echo $btn_text_color; ?>;font-size:14px;margin:0;padding:0;text-decoration:none;display:inline-block;vertical-align:middle;">
                          IR PARA A PÁGINA DE PAGAMENTO
                        </a>
                      </td>
                    </tr>
                  </table>
                </td>
              </tr>
              <tr><td width="600" height="30"></td></tr>
            <?php } ?>
            <tr>
              <td>
                <table width="600" border="0" cellpadding="0" cellspacing="0" style="border-collapse:collapse;">
                  <tr>
                    <td width="50"></td>
                    <td width="350">
                      <p style="font-size:12px; margin:0; padding:0;"><b><?php echo $text_product; ?></b></p>
                    </td>
                    <td width="100">
                      <p style="font-size:12px; margin:0; padding:0;"><b><?php echo $text_price; ?></b></p>
                    </td>
                    <td width="100">
                      <p style="font-size:12px; margin:0; padding:0;"><b><?php echo $text_total; ?></b></p>
                    </td>
                  </tr>
                  <tr>
                    <td width="600" height="10" colspan="4" style="border-bottom: 1px solid #dddddd;"></td>
                  </tr>
                  <?php foreach ($products as $product) { ?>
                    <tr>
                      <td width="600" height="20" colspan="4"></td>
                    </tr>
                    <tr>
                      <td width="50">
                        <p style="font-size:16px; margin:0; padding:0;"><?php echo $product['quantity'] . $text_quantity; ?></p>
                      </td>
                      <td width="350">
                        <p style="font-size:12px; color:#666666; margin:0; padding:0;"><?php echo $text_model . ' ' . $product['model']; ?></p>
                        <p style="font-size:16px; margin:0; padding:0;"><?php echo $product['name']; ?></p>
                        <?php if ($product['itens_kit']) { ?>
                          <?php foreach ($product['itens_kit'] as $itemKit) { ?>
                            <p style="font-size:12px; color:#666666; margin:0; padding:0;">
                              <?php echo $itemKit['quantidade']; ?> - <?php echo $itemKit['descricao']; ?>
                            </p>
                          <?php } ?>
                        <?php } ?>
                        <?php if (isset($product['grades'][0]) && $product['grades'][0]) { ?>
                    			<?php foreach ($product['grades'][0] as $key => $grade) { ?>
                    				<?php if ($grade != '') { ?>
                      		  	<p style="font-size:12px; color:#666666; margin:0; padding:0;"><?php echo $grade; ?></p>
                  		      <?php } ?>
                  			  <?php } ?>
                  		  <?php } ?>
                      </td>
                      <td width="100">
                        <p style="font-size:16px; margin:0; padding:0;"><?php echo $product['price']; ?></p>
                      </td>
                      <td width="100">
                        <p style="font-size:16px; margin:0; padding:0;"><?php echo $product['total']; ?></p>
                      </td>
                    </tr>
                    <tr>
                      <td width="600" height="20" colspan="4" style="border-bottom: 1px solid #dddddd;"></td>
                    </tr>
                  <?php } ?>
                  <tr><td width="600" height="30" colspan="4"></td></tr>
                  <?php foreach ($totals as $total) { ?>
                    <tr>
                      <td width="50"></td>
                      <td width="350">
                        <p style="font-size:16px; line-height:28px; margin:0; padding:0;"><?php echo $total['title']; ?></p>
                      </td>
                      <td width="200" colspan="2">
                        <p style="font-size:16px; line-height:28px; margin:0; padding:0;"><?php echo $total['text']; ?></p>
                      </td>
                    </tr>
                  <?php } ?>
                  <tr><td width="600" height="30" colspan="4"></td></tr>
                  <tr>
                    <td width="50"></td>
                    <td width="550" colspan="3">
                      <p style="font-size:16px; margin:0; padding:0;"><?php echo $text_footer; ?></p>
                    </td>
                  </tr>
                  <tr><td width="600" height="50" colspan="4"></td></tr>
                </table>
              </td>
            </tr>

            <?php if(isset($send_nfe_info)){ ?>
              <tr>
                <td width="600">
                  <table width="600" border="0" bgcolor="#eeeeee" cellpadding="0" cellspacing="0" style="border-collapse:collapse;">
                    <tr><td width="600" height="50" colspan="5"></td></tr>
                    <tr>
                      <td width="50"></td>
                      <td width="225" bgcolor="#ffffff">
                        <a href="<?php echo $link_danfe; ?>" target="_blank" style="font-size:16px;margin:20px auto 20px auto;padding:0;text-decoration:none;display:block;text-align:center;">Download DANFE</a>
                      </td>
                      <td width="50"></td>
                      <td width="225" bgcolor="#ffffff">
                        <a href="<?php echo $link_xml; ?>" target="_blank" style="font-size:16px;margin:20px auto 20px auto;padding:0;text-decoration:none;display:block;text-align:center;">Download XML</a>
                      </td>
                      <td width="50"></td>
                    </tr>
                    <tr><td width="600" height="25" colspan="5" style="border-bottom: 1px solid #dddddd"></td></tr>
                    <tr><td width="600" height="25" colspan="5"></td></tr>
                    <tr>
                      <td width="50"></td>
                      <td width="500" colspan="3">
                        <p style="font-size:16px; line-height:24px; margin:0; padding:0;"><b>Como consultar a Nota Fiscal Eletrônica deste pedido?</b></p>
                        <p style="font-size:16px; line-height:24px; margin:0; padding:0; color:#666666;">Acesse o portal da Nota Fiscal Eletrônica do ministério da Fazenda em <a href="http://www.nfe.fazenda.gov.br" target="_blank">www.nfe.fazenda.gov.br</a></p>
                        <p style="font-size:16px; line-height:24px; margin:0; padding:0; color:#666666;">Vá até Serviços > <a href="http://www.nfe.fazenda.gov.br/portal/consultaRecaptcha.aspx?tipoConsulta=resumo&tipoConteudo=d09fwabTnLk=" target="_blank">Consultar Resumo da NF-e.</a> Digite o número da chave de acesso abaixo para acessar todas as informações sobre a NF-e.</p>
                      </td>
                      <td width="50"></td>
                    </tr>
                    <tr><td width="600" height="25" colspan="5"></td></tr>
                    <tr>
                      <td width="50"></td>
                      <td width="500" colspan="3">
                        <p style="font-size:16px; line-height:24px; margin:0; padding:0;"><b>Chave de acesso</b></p>
                        <p style="font-size:16px; line-height:24px; margin:0; padding:0;"><b><?php echo $chave_acesso; ?></b></p>
                      </td>
                      <td width="50"></td>
                    </tr>
                    <tr><td width="600" height="50" colspan="5"></td></tr>
                  </table>
                </td>
              </tr>
            <?php } ?>

          </table>
        </td>
      </tr>
    </table>
  </body>
</html>
