<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<template id="report_financial">
    <t t-call="report.html_container">
        <t t-foreach="docs" t-as="o">
            <t t-call="report.internal_layout">
                <div class="page">
                    <h2 t-esc="data['form']['account_report_id'][1]"/>

                    <div class="row mt32 mb32">
                        <div class="col-xs-3">
                            <strong>Chart of Accounts:</strong>
                            <p t-esc="get_account(data)"/>
                        </div>
                        <div class="col-xs-3">
                            <strong>Fiscal Year:</strong>
                            <p t-esc="get_fiscalyear(data)"/>
                        </div>
                        <div class="col-xs-3">
                            <strong>Filter By:</strong>
                            <p>
                                <span t-if="data['form']['filter'] == 'filter_no'">Not filtered</span>
                                <span t-if="data['form']['filter'] == 'filter_period'">Filtered by period</span>
                                <span t-if="data['form']['filter'] == 'filter_date'">Filtered by date</span>
                                <p t-if="data['form']['filter'] == 'filter_period'">
                                    Start Period: <span t-esc="get_start_period(data)"/>
                                    End Period: <span t-esc="get_end_period(data)"/>
                                </p>
                                <p t-if="data['form']['filter'] == 'filter_date'">
                                    Date from : <span t-esc="formatLang(get_start_date(data), date=True)"/><br />
                                    Date to : <span t-esc="formatLang(get_end_date(data), date=True)"/>
                                </p>
                            </p>
                        </div>
                        <div class="col-xs-3">
                            <strong>Target Moves:</strong>
                            <p t-esc="get_target_move(data)"/>
                        </div>
                    </div>

                    <table class="table table-condensed" t-if="data['form']['debit_credit'] == 1">
                        <thead>
                            <tr>
                                <th>Name</th>
                                <th class="text-right">Debit</th>
                                <th class="text-right">Credit</th>
                                <th class="text-right">Balance</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr t-foreach="get_lines(data)" t-as="a">
                                <t t-if="a['level'] != 0">
                                    <t t-if="a.get('level') &gt; 3"><t t-set="style" t-value="'font-weight: normal;'"/></t>
                                    <t t-if="not a.get('level') &gt; 3"><t t-set="style" t-value="'font-weight: bold;'"/></t>

                                    <td>
                                        <span style="color: white;" t-esc="'..' * a.get('level', 0)"/>
                                        <span t-att-style="style" t-esc="a.get('name')"/>
                                    </td>
                                    <td class="text-right" style="white-space: nowrap;">
                                        <span t-att-style="style" t-esc="formatLang(a.get('debit'), currency_obj=res_company.currency_id)"/>
                                    </td>
                                    <td class="text-right" style="white-space: nowrap;">
                                        <span t-att-style="style" t-esc="formatLang(a.get('credit'), currency_obj=res_company.currency_id)"/>
                                    </td>
                                    <td class="text-right" style="white-space: nowrap;">
                                        <span t-att-style="style" t-esc="formatLang(a.get('balance'), currency_obj=res_company.currency_id)"/>
                                    </td>
                                </t>
                            </tr>
                        </tbody>
                    </table>

                    <table class="table table-condensed" t-if="not data['form']['enable_filter'] and not data['form']['debit_credit']">
                        <thead>
                            <tr>
                                <th>Name</th>
                                <th class="text-right">Balance</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr t-foreach="get_lines(data)" t-as="a">
                                <t t-if="a['level'] != 0">
                                    <t t-if="a.get('level') &gt; 3"><t t-set="style" t-value="'font-weight: normal;'"/></t>
                                    <t t-if="not a.get('level') &gt; 3"><t t-set="style" t-value="'font-weight: bold;'"/></t>

                                    <td>
                                        <span style="color: white;" t-esc="'..' * a.get('level', 0)"/>
                                        <span t-att-style="style" t-esc="a.get('name')"/>
                                    </td>
                                    <td class="text-right"><span t-att-style="style" t-esc="formatLang(a.get('balance'), currency_obj=res_company.currency_id)"/></td>
                                </t>
                            </tr>
                        </tbody>
                    </table>

                    <table class="table table-condensed" t-if="data['form']['enable_filter'] == 1 and not data['form']['debit_credit']">
                        <thead>
                            <tr>
                                <th>Name</th>
                                <th class="text-right">Balance</th>
                                <th class="text-right"><span t-esc="data['form']['label_filter']"/></th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr t-foreach="get_lines(data)" t-as="a">
                                <t t-if="a['level'] != 0">
                                    <t t-if="a.get('level') &gt; 3"><t t-set="style" t-value="'font-weight: normal;'"/></t>
                                    <t t-if="not a.get('level') &gt; 3"><t t-set="style" t-value="'font-weight: bold;'"/></t>

                                    <td>
                                        <span style="color: white;" t-esc="'..' * a.get('level', 0)"/>
                                        <span t-att-style="style" t-esc="a.get('name')"/>
                                    </td>
                                    <td class="text-right"><span t-att-style="style" t-esc="formatLang(a.get('balance'), currency_obj=res_company.currency_id)"/></td>
                                    <td class="text-right"><span t-att-style="style" t-esc="formatLang(a.get('balance_cmp'), currency_obj=res_company.currency_id)"/></td>
                                </t>
                            </tr>
                        </tbody>
                    </table>
                </div>
            </t>
        </t>
    </t>
</template>
</data>
</openerp>
