<?xml version="1.0" ?>
<odoo>

    <template id="report_contract_document">
        <t t-call="web.html_container">
            <t t-foreach="docs" t-as="o">
                <t t-call="web.external_layout">
                    <div class="page">
                        <div class="oe_structure"/>
                        <div class="row" id="partner_info">
                            <div class="col-xs-5 col-xs-offset-7">
                                <p id="partner_info"><strong>Partner:</strong></p>
                                <div t-field="o.partner_id" t-field-options='{"widget": "contact", "fields": ["address", "name", "phone", "mobile", "fax", "email"], "no_marker": true, "phone_icons": true}'/>
                                <p t-if="o.partner_id.vat">VAT: <span t-field="o.partner_id.vat"/></p>
                            </div>
                        </div>
                        <div class="row" id="header_info">
                            <div class="col-xs-3">
                                <strong>Responsible: </strong><p t-field="o.user_id"/>
                                <strong>Contract: </strong><p t-field="o.code"/>
                            </div>
                        </div>
                        <div class="row" id="invoice_info">
                            <t t-set="total" t-value="0"/>
                            <div class="col-xs-12">
                                <t t-set="total" t-value="0"/>
                                <p id="services_info"><strong>Recurring Items</strong></p>
                                <table class="table table-condensed">
                                    <thead>
                                        <tr>
                                            <th><strong>Description</strong></th>
                                            <th class="text-right"><strong>Quantity</strong></th>
                                            <th class="text-right"><strong>Unit Price</strong></th>
                                            <th class="text-right"><strong>Price</strong></th>
                                            <th class="text-right"><strong>Date Start</strong></th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <tr t-foreach="o.contract_line_ids" t-as="l">
                                            <td>
                                                <span t-field="l.name"/>
                                            </td>
                                            <td class="text-right">
                                                <span t-field="l.quantity"/>
                                            </td>
                                            <td class="text-right">
                                                <span t-field="l.price_unit" t-options='{"widget": "monetary", "display_currency": o.currency_id}'/>
                                            </td>
                                            <td class="text-right">
                                                <span t-field="l.price_subtotal" t-options='{"widget": "monetary", "display_currency": o.currency_id}'/>
                                            </td>
                                            <td>
                                                <span t-field="l.date_start"/>
                                            </td>
                                            <t t-set="total" t-value="total + l.price_subtotal"/>
                                        </tr>
                                    </tbody>
                                </table>
                            </div>
                            <div class="col-xs-4 pull-right">
                                <table class="table table-condensed">
                                    <tr class="border-black">
                                        <td><strong>Total</strong></td>
                                        <td class="text-right">
                                            <span t-esc="total" t-options='{"widget": "monetary", "display_currency": o.currency_id}'/>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        </div>
                    </div>
                </t>
            </t>
        </t>
    </template>

</odoo>
