<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<template id="report_analyticjournal">
    <t t-call="report.html_container">
        <t t-foreach="docs" t-as="o">
            <t t-call="report.internal_layout">
                <div class="page">
                    <h2>Analytic Journal</h2>

                    <div class="row mt32 mb32">
                        <div class="col-xs-3">
                            <strong>Period From:</strong>
                            <p t-esc="formatLang(data['form']['date1'], date=True)"/>
                        </div>
                        <div class="col-xs-3">
                            <strong>Period To:</strong>
                            <p t-esc="formatLang(data['form']['date2'], date=True)"/>
                        </div>
                        <div class="col-xs-3">
                            <strong>Currency:</strong>
                            <p t-field="res_company.currency_id" />
                        </div>
                    </div>

                    <table class="table table-condensed">
                        <thead>
                            <tr>
                                <th>Date</th>
                                <th>Code</th>
                                <th>Move Name</th>
                                <th>Account n°</th>
                                <th>General</th>
                                <th>Analytic</th>
                            </tr>
                            <tr>
                                <th colspan="4"><t t-if="o.code"><span t-esc="o.code"/></t> - <span t-esc="o.name"/></th>
                                <th><span t-esc="formatLang(sum_general(o.id, data['form']['date1'], data['form']['date2']))"/></th>
                                <th><span t-esc="formatLang(sum_analytic(o.id, data['form']['date1'], data['form']['date2']))"/></th>
                            </tr>
                        </thead>
                        <tbody>
                            <t t-foreach="lines(o.id, data['form']['date1'], data['form']['date2'])" t-as="move">
                                <tr>
                                    <td></td>
                                    <td></td>
                                    <td>
                                        <span t-esc="move.name"/>
                                    </td>
                                    <td>
                                        <span t-esc="move.account_id.code"/>
                                        <span t-esc="move.account_id.name"/>
                                    </td>
                                    <td>
                                        <span t-esc="formatLang(move.debit-move.credit)"/>
                                    </td>
                                    <td></td>
                                </tr>
                                <tr t-foreach="lines_a(move.id, o.id, data['form']['date1'], data['form']['date2'])" t-as="move_a">
                                    <td>
                                        <span t-esc="formatLang(move_a.date,date = True)"/>
                                    </td>
                                    <td>
                                        <p t-if="move_a.code"><span t-esc="move_a.code"/></p>
                                    </td>
                                    <td>
                                        <span t-esc="move_a.name"/>
                                    </td>
                                    <td><span t-esc="move_a.account_id.code"/> - <span t-esc="move_a.account_id.name"/></td>
                                    <td></td>
                                    <td><span t-esc="formatLang(move_a.amount)"/></td>
                                </tr>
                            </t>
                            <tr t-foreach="lines_a(False, o.id, data['form']['date1'], data['form']['date2'])" t-as="move_a">
                                <td><span t-esc="formatLang(move_a.date,date = True)"/></td>
                                <td><p t-if="move_a.code"><span t-esc="move_a.code"/></p></td>
                                <td><span t-esc="move_a.name"/></td>
                                <td><span t-esc="move_a.account_id.code"/> - <span t-esc="move_a.account_id.name"/></td>
                                <td></td>
                                <td><span t-esc="formatLang(move_a.amount)"/></td>
                            </tr>
                        </tbody>
                    </table>
                </div>
            </t>
        </t>
    </t>
</template>
</data>
</openerp>
