<?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="57.0" y1="57.0" width="481" height="728"/>
    </pageTemplate>
  </template>
  <stylesheet>
    <blockTableStyle id="Standard_Outline">
      <blockAlignment value="LEFT"/>
      <blockValign value="TOP"/>
    </blockTableStyle>
    <blockTableStyle id="Tableau1">
      <blockAlignment value="LEFT"/>
      <blockValign value="TOP"/>
    </blockTableStyle>
    <blockTableStyle id="Tableau8">
      <blockAlignment value="LEFT"/>
      <blockValign value="TOP"/>
      <lineStyle kind="GRID" colorName="black"/>
    </blockTableStyle>
    <blockTableStyle id="Tableau3">
      <blockAlignment value="LEFT"/>
      <blockValign value="TOP"/>
      <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"/>
    </blockTableStyle>
    <blockTableStyle id="Tableau2">
      <blockAlignment value="LEFT"/>
      <blockValign value="TOP"/>
    </blockTableStyle>
    <blockTableStyle id="Tableau4">
      <blockAlignment value="LEFT"/>
      <blockValign value="TOP"/>
      <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"/>
    </blockTableStyle>
    <blockTableStyle id="Tableau10">
      <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" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
    <paraStyle name="P2" fontName="Times-Bold" fontSize="20.0" leading="25" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
    <paraStyle name="P3" fontName="Times-Bold" fontSize="10.0" leading="13" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
    <paraStyle name="P4" fontName="Times-Roman" fontSize="10.0" leading="13" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
    <paraStyle name="P5" fontName="Times-Roman"/>
    <paraStyle name="P6" fontName="Times-Roman" fontSize="9.0" leading="11" alignment="CENTER"/>
    <paraStyle name="P7" fontName="Times-Bold" fontSize="11.0" leading="14" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
    <paraStyle name="P8" fontName="Times-Roman" fontSize="6.0" leading="8"/>
    <paraStyle name="P9" fontName="Times-Bold" fontSize="9.0" leading="11" spaceBefore="0.0" spaceAfter="0.0"/>
    <paraStyle name="P10" fontName="Times-Roman" fontSize="9.0" leading="11" spaceBefore="0.0" spaceAfter="0.0"/>
    <paraStyle name="P11" fontName="Times-Roman" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
    <paraStyle name="P12" fontName="Times-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
    <paraStyle name="P13" fontName="Times-Roman" fontSize="6.0" leading="8"/>
    <paraStyle name="P14" fontName="Times-Roman" fontSize="10.0" leading="13" alignment="LEFT"/>
    <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="0.0"/>
    <paraStyle name="Table Heading" fontName="Times-Roman" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.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>
  <story>
    <blockTable colWidths="161.0,161.0,161.0" repeatRows="1" style="Tableau1">
      <tr>
        <td>
          <para style="P1">[[ company.name ]]</para>
        </td>
        <td>
          <para style="P2">Inverted Analytic Balance</para>
        </td>
        <td>
          <para style="P3">Period from [[ data['form']['date1'] ]]</para>
          <para style="P3">to [[ data['form']['date2'] ]]</para>
          <para style="P4">Currency: [[ company.currency_id.name ]]</para>
        </td>
      </tr>
    </blockTable>
    <para style="P5">
      <font color="white"> </font>
    </para>
    <para style="P6">Printing date: [[ time.strftime('%Y-%m-%d') ]] at [[ time.strftime('%H:%M:%S') ]]</para>
    <para style="P6">
      <font color="white"> </font>
    </para>
    <blockTable colWidths="85.0,199.0,99.0,50.0,49.0" style="Tableau8">
      <tr>
        <td>
          <para style="P7">Code</para>
        </td>
        <td>
          <para style="P7">Account Name</para>
        </td>
        <td>
          <para style="P7">Moves</para>
          <para style="P7">Débit Crédit</para>
        </td>
        <td>
          <para style="P7">Balance</para>
        </td>
        <td>
          <para style="P7">Quantity</para>
        </td>
      </tr>
    </blockTable>
    <para style="P8">
      <font color="white"> </font>
    </para>
    <section>
      <para style="P8">[[ repeatIn(lines_g(objects,data['form']['date1'],data['form']['date2']),'move_g') ]]</para>
      <blockTable colWidths="71.0,213.0,99.0,50.0,50.0" style="Tableau3">
        <tr>
          <td>
            <para style="P9">[[ move_g['code'] ]]</para>
          </td>
          <td>
            <para style="P9">[[ move_g['name'] ]]</para>
          </td>
          <td>
            <para style="P9">
              <font color="white"> </font>
            </para>
          </td>
          <td>
            <para style="P9">
              <font color="white"> </font>
            </para>
          </td>
          <td>
            <para style="P9">
              <font color="white"> </font>
            </para>
          </td>
        </tr>
      </blockTable>
      <para style="P8">[[ repeatIn(lines_a(objects,move_g['id'],data['form']['date1'],data['form']['date2']),'move_a') ]]</para>
      <section>
        <blockTable colWidths="28.0,71.0,184.0,50.0,50.0,50.0,49.0" style="Tableau2">
          <tr>
            <td>
              <para style="P10">
                <font color="white"> </font>
              </para>
            </td>
            <td>
              <para style="P10">[[ move_a['code'] ]]</para>
            </td>
            <td>
              <para style="P10">[[ move_a['complete_name'] ]]</para>
            </td>
            <td>
              <para style="P11">[[ move_a['debit'] ]]</para>
            </td>
            <td>
              <para style="P11">[[ move_a['credit'] ]]</para>
            </td>
            <td>
              <para style="P11">[[ '%.2f' % move_a['balance'] ]]</para>
            </td>
            <td>
              <para style="P11">[[ '%.2f' % (move_a['quantity'] or 0.0) ]]</para>
            </td>
          </tr>
        </blockTable>
      </section>
      <blockTable colWidths="71.0,213.0,50.0,50.0,50.0,49.0" style="Tableau4">
        <tr>
          <td>
            <para style="P9">total [[ move_g['code'] ]]</para>
          </td>
          <td>
            <para style="P9">[[ move_g['name'] ]]</para>
          </td>
          <td>
            <para style="P12">[[ move_g['debit'] ]]</para>
          </td>
          <td>
            <para style="P12">[[ move_g['credit'] ]]</para>
          </td>
          <td>
            <para style="P12">[[ '%.2f' % move_g['balance'] ]]</para>
          </td>
          <td>
            <para style="P12">[[ '%.2f' % (move_g['quantity'] or 0.0) ]]</para>
          </td>
        </tr>
      </blockTable>
      <para style="P8">
        <font color="white"> </font>
      </para>
    </section>
    <para style="P13">
      <font color="white"> </font>
    </para>
    <blockTable colWidths="284.0,50.0,50.0,50.0,49.0" style="Tableau10">
      <tr>
        <td>
          <para style="P3">Sum</para>
        </td>
        <td>
          <para style="P3">[[ '%.2f' % (sum_debit(objects,data['form']['date1'],data['form']['date2']) or 0) ]]</para>
        </td>
        <td>
          <para style="P3">[[ '%.2f' % (sum_credit(objects,data['form']['date1'],data['form']['date2']) or 0)]]</para>
        </td>
        <td>
          <para style="P3">[[ '%.2f' % sum_balance(objects,data['form']['date1'],data['form']['date2']) ]]</para>
        </td>
        <td>
          <para style="P3">[[ '%.2f' % (sum_quantity(objects,data['form']['date1'],data['form']['date2']) or 0.0) ]]</para>
        </td>
      </tr>
    </blockTable>
    <para style="P14">
      <font color="white"> </font>
    </para>
  </story>
</document>

