
<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=sql-ledger.png border=0 width=84 height=58></th>

          <td align=right>
            <h4>
            電話： <%tel%><br>
            傳真： <%fax%>
            </h4>
          </td>
        </tr>

        <tr>
          <th colspan=3>
	    <hr noshade><br>
            <h4>應收帳 - 交易</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%>
	  <%if state%>
	  , <%state%>
	  <%end state%>
	  <%zipcode%>
	  <%if country%>
	  <br><%country%>
	  <%end country%>
          <br>

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

          <%if customerphone%>
          <br>電話： <%customerphone%>
          <%end customerphone%>

          <%if customerfax%>
          <br>傳真： <%customerfax%>
          <%end customerfax%>

          <%if email%>
          <br><%email%>
          <%end email%>

          <%if customertaxnumber%>
          <br>稅務編號： <%customertaxnumber%>
          <%end customertaxnumber%>
          </td>
   
	  <td align=right>
	    <table>
	      <tr>
		<th align=left nowrap>發票編號</th>
		<td><%invnumber%></td>
	      </tr>
	      <tr>
		<th align=left nowrap>日期</th>
		<td><%invdate%></td>
	      </tr>
	      <tr>
		<th align=left nowrap>到期日</th>
		<td><%duedate%></td>
	      </tr>
	      <%if ponumber%>
              <tr>
                <th align=left>採購單編號</th>
		<td><%ponumber%>&nbsp;</td>
	      </tr>
	      <%end ponumber%>
	      <%if ordnumber%>
	      <tr>
		<th align=left>訂單編號</th>
		<td><%ordnumber%>&nbsp;</td>
	      </tr>
	      <%end ordnumber%>
	      <tr>
		<th align=left nowrap>銷售人員</th>
		<td><%employee%>&nbsp;</td>
	      </tr>
	    </table>
	  </td>
        </tr>
      </table>
    </td>
  </tr>

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

	<tr>
	  <%if taxincluded%>
	  <th colspan=2 align=right>合計</th>
	  <td width=10>&nbsp</td>
	  <td align=right><%invtotal%></td>
	  <%end taxincluded%>

	  <%if not taxincluded%>
	  <th colspan=2 align=right>小計</th>
	  <td width=10>&nbsp</td>
	  <td align=right><%subtotal%></td>
	  <%end taxincluded%>
	</tr>

	<%foreach tax%>
	<tr>
	  <th colspan=2 align=right><%taxdescription%> @ <%taxrate%> %</th>
	  <td width=10>&nbsp</td>
	  <td align=right><%tax%></td>
	</tr>
	<%end tax%>
	
	<%if not taxincluded%>
	<tr>
	  <th colspan=2 align=right>合計</th>
	  <td width=10>&nbsp</td>
	  <td align=right><%invtotal%></td>
	</tr>
	<%end taxincluded%>
      </table>
    </td>
  </tr>

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

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

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

    <td>
      <%notes%>
    </td>
  </tr>

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

    <td>
      <table>
        <tr>
          <th>付款</th>
        </tr>

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

	<tr>
	  <td>
	    <table>
	      <tr>
		<th>日期</th>
		<th>&nbsp;</th>
		<th>來源</th>
		<th>金額</th>
	      </tr>
  <%end paid_1%>

        <%foreach payment%>
	      <tr>
		<td><%paymentdate%></td>
		<td><%paymentaccount%></td>
		<td><%paymentsource%></td>
		<td align=right><%payment%></td>
	      </tr>
        <%end payment%>

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

  <tr height=10></tr>

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

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

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

  <tr>
    <th colspan=3 align=left><font size=-2>上述稅項已包括在價格內。</th>
  </tr>
  <%end taxincluded%>

</table>

</body>
</html>

