<body bgcolor=ffffff>

<table width="100%">
<tr valign=bottom>
    <td width=10>&nbsp;</td>

    <td>
      <table width="100%">
        <tr>
          <td>
            <h4>
            <?lsmb company ?>
        <br><?lsmb address ?>
            </h4>
          </td>

          <th><img src=http://www.ledger-smb.org/images/ledger-smb.png border=0 width=80 height=58></th>

          <td align=right>
            <h4>
            Tel: <?lsmb tel ?>
        <br>Fax: <?lsmb fax ?>
            </h4>
          </td>
        </tr>

        <tr>
          <th colspan=3>
            <h4>F A T U R A</h4>
          </th>
        </tr>
      </table>
    </td>
  </tr>

  <tr>
    <td>&nbsp;</td>

    <td>
      <table width=100% callspacing=0 cellpadding=0>
        <tr bgcolor=000000>
          <th align=left width="50%"><font color=ffffff>Para</th>
          <th align=left width="50%"><font color=ffffff>Enviar para</th>
        </tr>

        <tr valign=top>
          <td><?lsmb name ?>
          <br><?lsmb address1 ?>
	  <?lsmb if address2 ?>
          <br><?lsmb address2 ?>
	  <?lsmb end address2 ?>
          <br><?lsmb city ?> <?lsmb state ?> <?lsmb zipcode ?>
	  <?lsmb if country ?>
	  <br><?lsmb country ?>
	  <?lsmb end country ?>
          <br>

          <?lsmb if contact ?>
          <br><?lsmb contact ?>
          <br>
          <?lsmb end contact ?>

          <?lsmb if customerphone ?>
          <br>Tel: <?lsmb customerphone ?>
          <?lsmb end customerphone ?>

          <?lsmb if customerfax ?>
          <br>Fax: <?lsmb customerfax ?>
          <?lsmb end customerfax ?>

          <?lsmb if email ?>
          <br><?lsmb email ?>
          <?lsmb end email ?>
          </td>

          <td><?lsmb shiptoname ?>
          <br><?lsmb shiptoaddress1 ?>
	  <?lsmb if shiptoaddress2 ?>
          <br><?lsmb shiptoaddress2 ?>
	  <?lsmb end shiptoaddress2 ?>
          <br><?lsmb shiptocity ?> <?lsmb shiptostate ?> <?lsmb shiptozipcode ?>
	  <?lsmb if shiptocountry ?>
	  <br><?lsmb shiptocountry ?>
	  <?lsmb end shiptocountry ?>
          <br>

          <?lsmb if shiptocontact ?>
          <br><?lsmb shiptocontact ?>
          <br>
          <?lsmb end shiptocontact ?>

          <?lsmb if shiptophone ?>
          <br>Tel: <?lsmb shiptophone ?>
          <?lsmb end shiptophone ?>

          <?lsmb if shiptofax ?>
          <br>Fax: <?lsmb shiptofax ?>
          <?lsmb end shiptofax ?>

          <?lsmb if shiptoemail ?>
          <br><?lsmb shiptoemail ?>
          <?lsmb end shiptoemail ?>
          </td>
        </tr>
      </table>
    </td>
  </tr>

  <tr height=5></tr>
  
  <tr>
    <td>&nbsp;</td>
  
    <td>
      <table width=100% border=1>
        <tr>
	  <th width=14% align=left nowrap>Fatura #</th>
	  <th width=14% align=left nowrap>Data</th>
	  <th width=14% align=left nowrap>Vencimento</th>
	  <th width=14% align=left>Pedido #</th>
	  <th width=14% align=left nowrap>Vendedor</th>
	  <th width=14% align=left nowrap>Local do despacho</th>
	  <th width=14% align=left nowrap>Enviar por</th>
	</tr>

	<tr>
	  <td><?lsmb invnumber ?></td>
	  <td><?lsmb invdate ?></td>
	  <td><?lsmb duedate ?></td>
	  <td><?lsmb ordnumber ?>&nbsp;</td>
	  <td><?lsmb employee ?>&nbsp;</td>
	  <td><?lsmb shippingpoint ?>&nbsp;</td>
	  <td><?lsmb shipvia ?>&nbsp;</td>
	</tr>
      </table>
    </td>
  </tr>

  <tr>
    <td>&nbsp;</td>
  
    <td>
      <table width="100%">
        <tr bgcolor=000000>
          <th align=right><font color=ffffff>No.</th>
          <th align=left><font color=ffffff>N�mero</th>
          <th align=left><font color=ffffff>Descri��o</th>
          <th>&nbsp;</th>
          <th align=right><font color=ffffff>Qtd</th>
          <th>&nbsp;</th>
          <th align=right><font color=ffffff>Pre�o unit.</th>
          <th align=right><font color=ffffff>Desc %</th>
          <th align=right><font color=ffffff>Extendido</th>
        </tr>

        <?lsmb foreach number ?>
        <tr valign=top>
          <td align=right><?lsmb runningnumber ?>.</td>
          <td><?lsmb number ?></td>
          <td><?lsmb description ?></td>
          <td><?lsmb deliverydate ?></td>
          <td align=right><?lsmb qty ?></td>
          <td><?lsmb unit ?></td>
          <td align=right><?lsmb sellprice ?></td>
          <td align=right><?lsmb discountrate ?></td>
          <td align=right><?lsmb linetotal ?></td>
        </tr>
        <?lsmb end number ?>

<!--
you can also use netprice instead of sellprice if you
don't want to show the discount
netprice = sellprice - discount
-->

        <tr>
          <td colspan=9><hr noshade></td>
        </tr>
    
        <tr>
          <?lsmb if taxincluded ?>
          <th colspan=7 align=right>Total</th>
          <td colspan=2 align=right><?lsmb invtotal ?></td>
          <?lsmb end taxincluded ?>

          <?lsmb if not taxincluded ?>
          <th colspan=7 align=right>Subtotal</th>
          <td colspan=2 align=right><?lsmb subtotal ?></td>
          <?lsmb end taxincluded ?>
        </tr>

        <?lsmb foreach tax ?>
        <tr>
          <th colspan=7 align=right><?lsmb taxdescription ?> em <?lsmb taxbase ?> @ <?lsmb taxrate ?> %</th>
          <td colspan=2 align=right><?lsmb tax ?></td>
        </tr>
        <?lsmb end tax ?>

        <?lsmb if paid ?>
        <tr>
          <th colspan=7 align=right>Pago</th>
          <td colspan=2 align=right>- <?lsmb paid ?></td>
        </tr>
        <?lsmb end paid ?>

        <tr>
          <td colspan=5>&nbsp;</td>
          <td colspan=4><hr noshade></td>
        </tr>

        <?lsmb if total ?>
        <tr>
          <td colspan=5>&nbsp;</td>
          <th colspan=2 align=right nowrap>Pendente</th>
          <th colspan=2 align=right><?lsmb total ?></th>
        </tr>
        <?lsmb end total ?>

        <tr>
      </table>
    </td>
  </tr>

  <tr>
    <td>&nbsp;</td>

    <td>
      <table width="100%">
        <tr valign=top>
          <?lsmb if notes ?>
          <td><?lsmb notes ?></td>
          <?lsmb end notes ?>

	  <td><?lsmb text_amount ?> ***** <?lsmb decimal ?>/100</td>
	  
          <td align=right nowrap>
          Todos os valores em <b><?lsmb currency ?></b>
          </td>
        </tr>
      </table>
    </td>
  </tr>

  <?lsmb if paid ?>
  <tr>
    <td>&nbsp;</td>

    <td colspan=9>
      <table width="60%">

        <tr>
          <th align=left>Pagamentos</th>
        </tr>

        <tr>
          <td colspan=4>
          <hr noshade>
          </td>
        </tr>

        <tr>
          <th align=left>Data</th>
          <th align=left>Conta</th>
          <th align=left>Fonte</th>
          <th align=left>Valor</th>
        </tr>
  <?lsmb end paid ?>

        <?lsmb foreach payment ?>
        <tr>
          <td><?lsmb paymentdate ?></td>
          <td><?lsmb paymentaccount ?></td>
          <td><?lsmb paymentsource ?></td>
          <td><?lsmb payment ?></td>
        </tr>
        <?lsmb end payment ?>

  <?lsmb if paid ?>
      </table>
    </td>
  </tr>
  <?lsmb end paid ?>

  <tr height=10></tr>

  <tr>
    <td>&nbsp;</td>

    <th>
    Obrigado pela prefer�ncia!
    </th>
  </tr>

  <tr>
    <td>&nbsp;</td>

    <td>
      <table width="100%">
        <tr valign=top>
          <td width="60%"><font size=-3>
          Pagamentos pendentes at� <?lsmb duedate ?>.
          Itens devolvidos est�o sujeitos a cobran�a de 10% como taxa de reestocagem. Uma autoriza��o de devolu��o deve ser obtida de <?lsmb company ?> antes da devolu��o das mercadorias. Devolu��es devem ser  enviadas com frete pago e com o seguro apropriado. <?lsmb company ?> n�o se responsabilizar� por danos durante o transporte.
          </font>
          </td>

          <td width="40%">
          X <hr noshade>
          </td>
        </tr>
      </table>
    </td>
  </tr>

  <?lsmb foreach tax ?>
  <tr>
    <td>&nbsp;</td>

    <th colspan=9 align=left><font size=-2><?lsmb taxdescription ?> Registro <?lsmb taxnumber ?></th>
  </tr>
  <?lsmb end tax ?>

  <?lsmb if taxincluded ?>
  <tr>
    <td>&nbsp;</td>
  </tr>

  <tr>
    <th colspan=8 align=left><font size=-2>Os impostos est�o incu�dos nos pre�os.</th>
  </tr>
  <?lsmb end taxincluded ?>

</table>

</body>
</html>