<?xml version="1.0"?>
<document filename="test.pdf">
  <template pageSize="(595.0,842.0)" title="Test" author="Martin Simon" allowSplitting="20">
    <pageTemplate id="first">
      <frame id="first" x1="42.0" y1="28.0" width="511" height="786"/>
    </pageTemplate>
  </template>
  <stylesheet>
    <blockTableStyle id="Standard_Outline">
      <blockAlignment value="LEFT"/>
      <blockValign value="TOP"/>
    </blockTableStyle>
    <blockTableStyle id="Tableau2">
      <blockAlignment value="LEFT"/>
      <blockValign value="TOP"/>
    </blockTableStyle>
    <blockTableStyle id="Tableau3">
      <blockAlignment value="LEFT"/>
      <blockValign value="TOP"/>
      <lineStyle kind="GRID" colorName="black"/>
      <blockBackground colorName="#e6e6e6" start="0,0" stop="0,0"/>
      <blockBackground colorName="#e6e6e6" start="1,0" stop="1,0"/>
      <blockBackground colorName="#e6e6e6" start="2,0" stop="2,0"/>
      <blockBackground colorName="#e6e6e6" start="3,0" stop="3,0"/>
      <blockBackground colorName="#e6e6e6" start="4,0" stop="4,0"/>
      <blockBackground colorName="#e6e6e6" start="5,0" stop="5,0"/>
      <blockBackground colorName="#e6e6e6" start="6,0" stop="6,0"/>
      <blockBackground colorName="#e6e6e6" start="7,0" stop="7,0"/>
    </blockTableStyle>
    <blockTableStyle id="Tableau6">
      <blockAlignment value="LEFT"/>
      <blockValign value="TOP"/>
      <lineStyle kind="GRID" colorName="black"/>
    </blockTableStyle>
    <initialize>
      <paraStyle name="all" alignment="justify"/>
    </initialize>
    <paraStyle name="P1" fontName="Times-Roman" fontSize="6.0" leading="8" spaceBefore="0.0" spaceAfter="6.0"/>
    <paraStyle name="P2" fontName="Times-Roman" fontSize="11.0" leading="14" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
    <paraStyle name="P3" fontName="Times-Roman" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
    <paraStyle name="P4" fontName="Times-Roman" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
    <paraStyle name="P5" fontName="Times-Roman" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
    <paraStyle name="P6" fontName="Times-Roman" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
    <paraStyle name="P7" fontName="Times-Roman" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
    <paraStyle name="P8" fontName="Times-Roman" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
    <paraStyle name="P9" fontName="Times-Roman" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
    <paraStyle name="P10" fontName="Times-Roman" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
    <paraStyle name="P11" fontName="Times-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
    <paraStyle name="P12" fontName="Times-Roman" fontSize="11.0" leading="14"/>
    <paraStyle name="P13" fontName="Times-Roman" fontSize="11.0" leading="14"/>
    <paraStyle name="P14" fontName="Times-Roman" fontSize="11.0" leading="14" alignment="LEFT"/>
    <paraStyle name="P15" fontName="Times-Roman" fontSize="11.0" leading="14"/>
    <paraStyle name="P16" fontName="Times-Roman" fontSize="11.0" leading="14" alignment="LEFT"/>
    <paraStyle name="P17" fontName="Times-Roman" fontSize="14.0" leading="17" alignment="CENTER"/>
    <paraStyle name="P18" fontName="Times-Roman" fontSize="14.0" leading="17" alignment="LEFT"/>
    <paraStyle name="P19" fontName="Times-Roman" alignment="LEFT"/>
    <paraStyle name="P20" fontName="Times-Roman" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
    <paraStyle name="Standard" fontName="Times-Roman"/>
    <paraStyle name="Text body" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
    <paraStyle name="List" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
    <paraStyle name="Table Contents" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
    <paraStyle name="Table Heading" fontName="Times-Roman" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
    <paraStyle name="Caption" fontName="Times-Roman" fontSize="10.0" leading="13" spaceBefore="6.0" spaceAfter="6.0"/>
    <paraStyle name="Index" fontName="Times-Roman"/>
  </stylesheet>
  <images/>
  <story>
    <para style="P1">[[ repeatIn(objects,'o') ]]</para>
    <para style="P1">[[ setLang(o.lang) ]]</para>
    <blockTable colWidths="286.0,224.0" style="Tableau2">
      <tr>
        <td>
          <para style="P2">
            <font color="white"> </font>
          </para>
        </td>
        <td>
          <para style="P12">[[ o.name ]]</para>
          <para style="P13">[[ adr_get(o, 'invoice')['name'] ]]</para>
          <para style="P13">[[ adr_get(o, 'invoice')['street'] ]]</para>
          <para style="P13">[[ adr_get(o, 'invoice')['zip'] ]] [[ adr_get(o, 'invoice')['city'] ]]</para>
          <para style="P13">[[ adr_get(o, 'invoice')['country_id'] and adr_get(o, 'invoice')['country_id'][1] ]]</para>
          <para style="P13">
            <font color="white"> </font>
          </para>
          <para style="P13">VAT: [[ o.vat or removeParentNode('para') ]]</para>
        </td>
      </tr>
    </blockTable>
    <para style="P17">
      <font color="white"> </font>
    </para>
    <para style="P18">
      <font color="white"> </font>
    </para>
    <para style="P13"><font face="Times-Roman">Document</font><font face="Times-Roman">:</font> Customer account statement</para>
    <para style="P13">
      <font face="Times-Roman">Date: </font>
      <font face="Times-Roman">[[ time.strftime('%d/%m/%Y') ]]</font>
    </para>
    <para style="P15"><font face="Times-Roman">Customer Ref:</font> [[ o.id ]]</para>
    <para style="P16">
      <font color="white"> </font>
    </para>
    <para style="P16">Dear Sir/Madam,</para>
    <para style="P16">
      <font color="white"> </font>
    </para>
    <para style="P16">Exception made of a mistake of our side, it seems that the following bills stay unpaid. Please, take appropriate measures in order to carry out this payment in the next 8 days.</para>
    <para style="P16">
      <font color="white"> </font>
    </para>
    <para style="P16">Would your payment have been carried out after this mail was sent, please consider the present one as void. Do not hesitate to contact our accounting departement at +32 81 81 37 00.</para>
    <para style="P16">
      <font color="white"> </font>
    </para>
    <para style="P16">Best regards.</para>
    <para style="P19">
      <font color="white"> </font>
    </para>
    <blockTable colWidths="59.0,137.0,65.0,58.0,60.0,57.0,56.0,19.0" style="Tableau3">
      <tr>
        <td>
          <para style="P3">Date</para>
        </td>
        <td>
          <para style="P3">Description</para>
        </td>
        <td>
          <para style="P3">Ref</para>
        </td>
        <td>
          <para style="P3">Maturity date</para>
        </td>
        <td>
          <para style="P4">Due</para>
        </td>
        <td>
          <para style="P4">Paid</para>
        </td>
        <td>
          <para style="P4">Maturity</para>
        </td>
        <td>
          <para style="P4">Li.</para>
        </td>
      </tr>
      <tr>
        <td>
          <para style="P5">
            <font face="Times-Roman">[[repeatIn(getLines(o), 'line') ]]</font>
            <font face="Times-Roman"> [[ line['date'] ]]</font>
          </para>
        </td>
        <td>
          <para style="P6">[[ line['name'] ]]</para>
        </td>
        <td>
          <para style="P7">[[ line['ref'] ]]</para>
        </td>
        <td>
          <para style="P7">[[ line['date_maturity'] ]]</para>
        </td>
        <td>
          <para style="P10">[[ line['debit'] and '%.2f' % (line['debit'] * (line['account_id']['type'] == 'payable' and -1 or 1)) or '' ]]</para>
        </td>
        <td>
          <para style="P8">[[ line['credit'] and '%.2f' % (line['credit'] * (line['account_id']['type'] == 'payable' and -1 or 1)) or '' ]]</para>
        </td>
        <td>
          <para style="P8">[[ (line['date_maturity'] &lt; time.strftime('%Y-%m-%d')) and '%.2f' % ((line['debit'] - line['credit']) * (line['account_id']['type'] == 'payable' and -1 or 1)) or '' ]]</para>
        </td>
        <td>
          <para style="P8">[[ line['blocked'] and 'X' or '' ]]</para>
        </td>
      </tr>
    </blockTable>
    <blockTable colWidths="318.0,61.0,56.0,56.0,19.0" style="Tableau6">
      <tr>
        <td>
          <para style="P11">Sub-Total: </para>
        </td>
        <td>
          <para style="P11">[[ '%.2f' % (reduce(lambda x, y: x + (y['debit'] * (y['account_id']['type'] == 'payable' and -1 or 1)), getLines(o), 0)) ]]</para>
        </td>
        <td>
          <para style="P8">
            <font face="Times-Bold">[[ '%.2f' % (reduce(lambda x ,y: x + (y['credit'] * (y['account_id']['type'] == 'payable' and -1 or 1)), getLines(o), 0)) ]]</font>
          </para>
        </td>
        <td>
          <para style="P10">[[ '%.2f' % (reduce(lambda x, y: x + ((y['debit'] - y['credit']) * (y['account_id']['type'] == 'payable' and -1 or 1)), filter(lambda x: x['date_maturity'] &lt; time.strftime('%Y-%m-%d'), getLines(o)), 0)) ]]</para>
        </td>
        <td>
          <para style="P20">
            <font color="white"> </font>
          </para>
        </td>
      </tr>
      <tr>
        <td>
          <para style="P11">Balance: </para>
        </td>
        <td>
          <para style="P11">[[ '%.2f' % (reduce(lambda x, y: x +((y['debit'] - y['credit']) * (y['account_id']['type'] == 'payable' and -1 or 1)), getLines(o), 0)) ]]</para>
        </td>
        <td>
          <para style="P9">
            <font color="white"> </font>
          </para>
        </td>
        <td>
          <para style="P11">
            <font color="white"> </font>
          </para>
        </td>
        <td>
          <para style="P20">
            <font color="white"> </font>
          </para>
        </td>
      </tr>
    </blockTable>
    <para style="Standard">
      <font color="white"> </font>
    </para>
    <para style="P14">
      <font face="Times-Roman">Total amount due: </font>
      <font face="Times-Roman">[[ '%.2f' % (reduce(lambda x, y: x + ((y['debit'] - y['credit']) * (y['account_id']['type'] == 'payable' and -1 or 1)), getLines(o), 0)) ]] [[ company.currency_id.name ]].</font>
    </para>
    <para style="P13">
      <font color="white"> </font>
    </para>
  </story>
</document>

