{*************************************************************************************/
/*      This file is part of the Thelia package.                                     */
/*                                                                                   */
/*      Copyright (c) OpenStudio                                                     */
/*      email : dev@thelia.net                                                       */
/*      web : http://www.thelia.net                                                  */
/*                                                                                   */
/*      For the full copyright and license information, please view the LICENSE.txt  */
/*      file that was distributed with this source code.                             */
/*************************************************************************************}

{* Set the default translation domain, that will be used by {intl} when the 'd' parameter is not set *}
{default_translation_domain domain='pdf.default'}
{literal}
<style>
    h1, h2, h3, h4 {
        color:#f6993c;
    }

    h1 {
        font-size: 60px;
    }

    h4 {
        color:#58585a;
        font-size: 14px;
    }


    p, td {
        color:#58585a;
    }

    .table-1 td {
        background: #f1f3f4;
        border:solid 1px #bcbdc0;
    }

    .table-2 td {
        border:solid 1px #bcbdc0;
    }


    .table-3-1 {
        border:solid 1px #bcbdc0;

    }

    span {
        font-size: 9px;
    }
</style>
{/literal}
<page backtop="10mm" backleft="10mm" backright="10mm" backbottom="10mm">
    <page_header>
    </page_header>

    <page_footer>
        <table>
            <col style="width: 80%; padding: 1mm; border: none; text-align: left;" />
            <col style="width: 20%; padding: 1mm; border: none; text-align: right;" />
            <tbody>
            <tr>
                <td><!-- Insérer ici les mentions légales --></td>
                <td>{intl l="page"} [[page_cu]]/[[page_nb]]</td>
            </tr>
            </tbody>
        </table>
    </page_footer>
{loop name="order.invoice" type="order" id=$order_id customer="*"}
    {loop name="currency.order" type="currency" id=$CURRENCY}
    {assign "orderCurrency" $SYMBOL}
    {/loop}
    <table>
        <col style="width: 100%; padding: 0mm;" />

        <tr >
            <td>
                <h1>{intl l="INVOICE"}</h1>
            </td>
        </tr>
        <tr>
            <td>
                <h3>{intl l="Invoice date"}</h3>
                <span>{format_date date=$INVOICE_DATE}</span>
            </td>
        </tr>
        <tr>
            <td>
                <h3>{intl l="Invoice REF"}</h3>
                <span>{$REF}</span>
            </td>
        </tr>
        <tr>
            <td>
                <h3>{intl l="Custmer Number"}</h3>
                <span>{loop type="customer" name="customer.invoice" id=$CUSTOMER current="0"}{$REF}{/loop}</span>
            </td>
        </tr>
    </table>
    <table>
        <col style="width: 50%; padding: 3mm;" />
        <col style="width: 50%; padding: 3mm;" />
        <tr>
            <td style="border-left:solid 1mm #f6993c;" >
                <h3>{intl l="delivery adress"}</h3>
                <p>
                    {loop type="order_address" name="delivery_address" id=$DELIVERY_ADDRESS}
                    {loop type="title" name="order-invoice-address-title" id=$TITLE}{$LONG}{/loop}{$FIRSTNAME} {$LASTNAME}<br />
                    {$ADDRESS1} {$ADDRESS2} {$ADDRESS3}<br />
                    {$ZIPCODE} {$COUNTRY}<br/>
                    {loop type="country" name="country_delivery" id=$COUNTRY}{$TITLE}{/loop}
                    {/loop}
                </p>
            </td>
            <td style="border-left:solid 1mm #f6993c;">
                <h3>{intl l="invoice address"}</h3>
                <p>
                    {loop type="order_address" name="delivery_address" id=$INVOICE_ADDRESS}
                    {loop type="title" name="order-invoice-address-title" id=$TITLE}{$LONG}{/loop}{$FIRSTNAME} {$LASTNAME}<br />
                    {$ADDRESS1} {$ADDRESS2} {$ADDRESS3}<br />
                    {$ZIPCODE} {$COUNTRY}<br/>
                    {loop type="country" name="country_delivery" id=$COUNTRY}{$TITLE}{/loop}
                    {/loop}
                </p>
            </td>
        </tr>
    </table>

<table cellspacing="0" cellpadding="0" style="padding-top: 5mm;">
    <col style="width: 40%; padding: 1mm;" />
    <col style="width: 12%; padding: 1mm;" />
    <col style="width: 12%; padding: 1mm;" />
    <col style="width: 12%; padding: 1mm;" />
    <col style="width: 12%; padding: 1mm;" />
    <col style="width: 12%; padding: 1mm;" />

    <tr class="table-1">
        <td><h4>{intl l="Product"}</h4></td>
        <td><h4>{intl l="Unit. price"}</h4></td>
        <td><h4>{intl l="Tax"}</h4></td>
        <td><h4>{intl l="Unit taxed price"}</h4></td>
        <td><h4>{intl l="Quantity"}</h4></td>
        <td style="background:#f6993c"><h3 style="color:white;">{intl l="Taxed total"}</h3></td>
    </tr>
    {loop type="order_product" name="order-products" order=$ID}
    {if $WAS_IN_PROMO == 1}
        {assign "realPrice" $PROMO_PRICE}
        {assign "realTax" $PROMO_PRICE_TAX}
        {assign "realTaxedPrice" $TAXED_PROMO_PRICE}
    {else}
        {assign "realPrice" $PRICE}
        {assign "realTax" $PRICE_TAX}
        {assign "realTaxedPrice" $TAXED_PRICE}
    {/if}
    <tr class="table-2">
        <td><p>{$TITLE}</p>
                {ifloop rel="combinations"}
                {loop type="order_product_attribute_combination" name="combinations" order_product=$ID}
                {$ATTRIBUTE_TITLE} - {$ATTRIBUTE_AVAILABILITY_TITLE}<br>
                {/loop}
                {/ifloop}
        </td>
        <td><p>{$orderCurrency} {$realPrice}</p></td>
        <td><p>{$orderCurrency} {$realTax}</p></td>
        <td><p>{$orderCurrency} {$realTaxedPrice}</p></td>
        <td><p>{$QUANTITY}</p></td>
        <td><p>{$orderCurrency} {$realTaxedPrice * $QUANTITY}</p></td>
    </tr>
    {/loop}

</table>

<table class="table-3" cellspacing="0" cellpadding="0" tyle="padding-top: 5mm;">
    <col style="width: 60%; padding: 1mm;" />
    <col style="width: 20%; padding: 1mm;" />
    <col style="width: 20%; padding: 1mm;" />

    <tr>
        <td style="border-left:solid 1mm #bcbdc0"><h3>{intl l="Payment module"}</h3>
            <span>{loop name="payment-module" type="module" id=$PAYMENT_MODULE}{$TITLE}{/loop}</span>
        </td>
        <td class="table-3-1"><p>{intl l="Total without tax"}</p></td>
        <td class="table-3-1"><p>{$orderCurrency} {$TOTAL_AMOUNT}</p></td>
    </tr>
    <tr>
        <td style="border-left:solid 1mm #bcbdc0"><h3>{intl l="delivery module"}</h3>
            <span>{loop name="delivery-module" type="module" id=$DELIVERY_MODULE}{$TITLE}{/loop}</span></td>
        <td class="table-3-1"><p>{intl l="Total with tax"}</p></td>
        <td class="table-3-1"><P>{$orderCurrency} {$TOTAL_TAXED_AMOUNT - $POSTAGE}</P></td>
    </tr>
    <tr>
        <td></td>
        <td class="table-3-1"><p>{intl l="Postage"}</p></td>
        <td class="table-3-1"><p>{$orderCurrency} {$POSTAGE}</p></td>
    </tr>
    <tr>
        <td></td>
        <td class="table-3-1" style="background:#f6993c;"><h3 style="color:white;">{intl l="Total"}</h3></td>
        <td class="table-3-1" style="background:#f6993c;"><h3 style="color:white;">{$orderCurrency} {$TOTAL_TAXED_AMOUNT}</h3></td>
    </tr>
</table>
{/loop}
</page>