<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<template id="report_payment_receipt2_document">
    <t t-call="report.external_layout">
    <t t-set="o" t-value="o.with_context({'lang':o.partner_id.lang})" />
        <div class="page">

            <div class="row">
                <div name="invoice_address" class="col-xs-5 col-xs-offset-7">
                    <address t-field="o.partner_id"
                        t-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": True}' />
                    <span t-if="o.partner_id.vat">TIN: <span t-field="o.partner_id.vat"/></span>
                </div>
            </div>

            <h2>
                Receipt No : <span t-field="o.name"/>
            </h2>

            <br/>

            <table style="width:100%;text-align:left !important;">
              <tr>
                <td style="width:50%">
                </td>
                <td style="border:2px solid black; padding:2px;">
                  <strong>Currency</strong>
                </td>
                <td style="border:2px solid black; padding:2px;">
                  <strong>Payment Date</strong>
                </td>
                <td style="border:2px solid black; padding:2px;">
                  <strong>V/No Contrib</strong>
                </td>
                <td style="border:2px solid black; padding:2px;">
                  <strong>Entity</strong>
                </td>
              </tr>

              <tr>
                <td style="width:50%">
                </td>
                <td style="border:2px solid black; padding:2px;">
                    <span t-field="o.currency_id.name"/>                        
                </td>
                <td style="border:2px solid black; padding:2px;">
                  <span t-field="o.payment_date"/>
                </td>
                <td style="border:2px solid black; padding:2px;">
                </td>
                <td style="border:2px solid black; padding:2px;">
                  <span t-field="o.partner_id.property_account_receivable_id.code"/>
                </td>
              </tr>

            </table>
            
            <br/> <br/>

            <div class="row">
                <span style="padding-left:15px;">
                    Receipt of payment of the following documents(s), in the total amount of <strong><span style="padding-left: 3px;" t-esc="get_amount(o.amount)"/></strong> (<span style="padding-left: 3px;" t-esc="get_amount_in_words(o.amount)"/>)
                </span>
            </div>
            
            <br/> <br/>

            <table class="table table-condensed">
                <thead>
                    <tr>
                        <th>Document No</th>
                        <th>Description</th>
                        <th class="text-right">Invoice amount</th>
                        <th class="text-right">Receipt amount</th>
                        <th class="text-right">Amount pending</th>
                    </tr>
                </thead>
                <tbody class="invoice_tbody">
                    <tr t-foreach="o.invoice_ids" t-as="l">
                        <td style="width: 15%;"><span t-field="l.number"/></td>
                        <td style="width: 35%;"><span t-field="l.name"/></td>
                        <td class="text-right" style="width: 15%;">
                            <span t-field="l.amount_total" t-options='{"widget": "monetary", "display_currency": o.currency_id}'/>
                        </td>
                        <td class="text-right" style="width: 15%;">
                            <span t-field="o.amount" t-options='{"widget": "monetary", "display_currency": o.currency_id}'/>
                        </td>
                        <td class="text-right" style="width: 20%;">
                            <span t-field="l.residual" t-options='{"widget": "monetary", "display_currency": o.currency_id}'/>
                        </td>
                    </tr>

                    <tr>
                        <td style="border-style:none"/>
                        <td style="border-style:none"/>
                        <td style="border-top:2px solid;text-align:right;width:15%">
                            <strong>Total:</strong>
                        </td>
                        <td style="border-top:2px solid;text-align:right;width:15%">
                            <strong><span t-field="o.amount"/></strong>
                        </td>
                    </tr>
                </tbody>
            </table>
            
            <br/> <br/>

            <div class="row">
                <div>
                    Payment made through <span t-field="o.journal_id.name"/> <br/>
                    <span t-if="o.communication" t-field="o.communication"/>
                </div>
            </div>

            <br/> <br/> <br/>

            <table width="100%">
                <tr>
                    <td style="text-align:center;">
                        Financeiro:<br/><br/><br/>
                        <img src="/account_payment_receipt_prime/static/src/img/prime_financiaro.png" style="max-height:3.5cm; max-width:5cm;"/>
                    </td>
                </tr>
            </table>
        </div>
    </t>
</template>

<template id="report_payment_receipt2">
    <t t-call="report.html_container">
        <t t-foreach="docs" t-as="o">
            <t t-call="account_payment_receipt_prime.report_payment_receipt2_document" t-lang="o.partner_id.lang"/>
        </t>
    </t>
</template>

</data>
</openerp>