
<body bgcolor=ffffff>

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

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

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

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

        <tr>
          <th colspan=3>
	    <hr noshade><br>
            <h4>A R - T R A N S A C T I O N</h4>
          </th>
        </tr>
      </table>
    </td>
  </tr>

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

    <td>
      <table width=100% callspacing=0 cellpadding=0>
        <tr valign=top>
          <td><%name%>
          <br><%address1%>
	  <%if address2%>
          <br><%address2%>
	  <%end address2%>
          <br><%city%> <%state%> <%zipcode%>
	  <%if country%>
	  <br><%country%>
	  <%end country%>
          <br>

          <%if contact%>
          <br><%contact%>
          <br>
          <%end contact%>

          <%if customerphone%>
          <br>Tel: <%customerphone%>
          <%end customerphone%>

          <%if customerfax%>
          <br>Fax: <%customerfax%>
          <%end customerfax%>

          <%if email%>
          <br><%email%>
          <%end email%>
          </td>
   
	  <td align=right>
	    <table>
	      <tr>
		<th align=left nowrap>Invoice #</th>
		<td><%invnumber%></td>
	      </tr>
	      <tr>
		<th align=left nowrap>Date</th>
		<td><%invdate%></td>
	      </tr>
	      <tr>
		<th align=left nowrap>Due</th>
		<td><%duedate%></td>
	      </tr>
	      <tr>
		<th align=left>Order #</th>
		<td><%ordnumber%>&nbsp;</td>
	      </tr>
	      <tr>
		<th align=left nowrap>Salesperson</th>
		<td><%employee%>&nbsp;</td>
	      </tr>
	    </table>
	  </td>
        </tr>
      </table>
    </td>
  </tr>

  <tr height=5></tr>
  
  <tr>
    <td>&nbsp;</td>
  
    <td>
      <table width=100%>
        <tr valign=top>
	  <td width=50%>
	    <table>
	      <%foreach account%>
	      <tr valign=top>
		<td><%accno%></td>
		<td><%account%></td>
		<td align=right><%amount%></td>
		<td><%projectnumber%></td>
	      </tr>
	      <%end account%>

	      <tr>
		<%if taxincluded%>
		<th colspan=2 align=right>Total</th>
		<td align=right><%invtotal%></td>
		<%end taxincluded%>

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

	      <%foreach tax%>
	      <tr>
		<th colspan=2 align=right><%taxdescription%> @ <%taxrate%> %</th>
		<td align=right><%tax%></td>
	      </tr>
	      <%end tax%>
	      
	      <%if not taxincluded%>
		<th colspan=2 align=right>Total</th>
		<td align=right><%invtotal%></td>
	      <%end taxincluded%>

	    </table>
	  </td>
	  <td width=50%>
	    <%notes%>
	  </td>
	</tr>
      </table>
    </td>
  <tr>
    <td>&nbsp;</td>
    
  </tr>

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

    <td>
      <%text_amount%> ***** <%decimal%>/100 <%currency%>
    </td>
  </tr>

  <%if paid%>
  <tr>
    <td>&nbsp;</td>

    <td>
      <table>
        <tr>
          <th>Payments</th>
        </tr>

        <tr>
          <td>
          <hr noshade>
          </td>
        </tr>

	<tr>
	  <td>
	    <table>
	      <tr>
		<th align=left>Date</th>
		<th align=left>Account</th>
		<th align=left>Source</th>
		<th align=left>Memo</th>
		<th align=left>Amount</th>
	      </tr>
  <%end paid%>

        <%foreach payment%>
	      <tr>
		<td><%paymentdate%></td>
		<td><%paymentaccount%></td>
		<td><%paymentsource%></td>
		<td><%paymentmemo%></td>
		<td><%payment%></td>
	      </tr>
        <%end payment%>

  <%if paid%>
	    </table>
	  </td>
        </tr>
      </table>
    </td>
  </tr>
  <%end paid%>

  <tr height=10></tr>

  <%foreach tax%>
  <tr>
    <td>&nbsp;</td>

    <th colspan=9 align=left><font size=-2><%taxdescription%> Registration <%taxnumber%></th>
  </tr>
  <%end tax%>

  <%if taxincluded%>
  <tr>
    <td>&nbsp;</td>
  </tr>

  <tr>
    <th colspan=3 align=left><font size=-2>Taxes shown are included in price.</th>
  </tr>
  <%end taxincluded%>

</table>

</body>
</html>

