<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>Faktura</title>
    <style>
        @page {
            footer: page-footer;
            margin: 25pt;
        }/*
        @page :first {
            margin-top: 0;
        }*/
        body {
            font-family: Arial, Helvetica, sans-serif;
            font-size: 10pt;
            font-weight: 300;
        }
        wrapper {
            width: 595pt;
            margin: 15pt auto;
        }
        table, tr, td {
            padding: 0;
            border-collapse: collapse;
        }
        table {
            width: 100%;
        }
        td {
            vertical-align: top;
        }
        .page-break-before {
            page-break-before: always;
        }
        .icontainer {
            padding: 0;
            padding-top: 10pt;
        }
        .details-column-table {
            margin: 0 5pt 0 0;
            table-layout: fixed;
            font-size: 9pt;
        }
        .details-column-table tr {
            border: none;
            /*border-bottom: .5pt solid #ddd;*/
        }
        .details-column-table tr:last-child {
            border: none;
        }
        .details-column-table td {
            line-height: 15pt;
        }
        .details-column-table .ilabel {
            font-weight: bold;
        }
        .details-column-table .value {
            text-align: right;
            white-space: nowrap;
            font-weight: normal;
        }
        .col1 {
            width: 8.33333%;
        }
        .col2 {
            width: 16.66667%;
        }
        .col3 {
            width: 25%;
        }
        .col4 {
            width: 33.33333%;
        }
        .col5 {
            width: 41.66667%;
        }
        .col6 {
            width: 50%;
        }
        .col7 {
            width: 58.33333%;
        }
        .col8 {
            width: 66.66667%;
        }
        .col9 {
            width: 75%;
        }
        .col10 {
            width: 83.33333%;
        }
        .col11 {
            width: 91.66667%;
        }
        .col12 {
            width: 100%;
        }
        .intro {
            background-color: #003366;
            color: #ffffff;
            padding: 1pt 5pt;
            font-size: 10pt;
        }
        .adr {
            font-size: 10pt;
            line-height: 13pt;
            padding: 5pt;
        }
        td.bordered {
            border: 1px solid #b2b2b2;
            padding-left: 1pt;
        }
        td.lpad5 {
            padding-left: 5pt;
        }
        td.col30 {
            width: 28%;
        }
        td.col20 {
            width: 22%;
        }
        td.col80 {
            width: 80%;
        }
        tr.spacer td{
            line-height: 3pt;
        }
        #items th {
            background-color: #003366;
            color: #ffffff;
            font-size: 10pt;
            font-weight: normal;
            border-top: 1px solid #ccc;
            border-bottom: none;
            border-left: 1px solid #ccc;
            border-right: 1px solid #ccc;
            padding: 5pt;
        }
        #items td {
            font-size: 9pt;
            font-weight: normal;
            padding: 4pt 3pt;
        }
        #items tr:nth-child(odd) {
            background-color: #e6e6e6
        }
        td.box {
            padding: 5pt;
        }
        td.pad5 {
            padding: 5pt;
        }
        td.borderedbox {
            padding: 8pt;
            border: 1px solid #b2b2b2;
        }
        td.ra {
            text-align: right;
            padding-right: 2pt;
        }
        td.ca {
            text-align: center;
        }
        td.ci {
            font-size: 8pt;
            color: #555;
            text-align: right;
        }
    </style>
</head>
<body>
<div id="wrapper">
<div class="icontainer">
    <table>
        <tr>
            <td class="col4" align="center">
                <img src="{{$logosrc}}" style="width: 135pt; height: auto;" alt="">
            </td>
            <td class="col8">
                <table>
                    <tr>
                        <td class="col6 ci" style="padding-right: 10pt;">
                            {{$gdata->company_name}}<br />
                            {{$gdata->address}}<br />
                            VATIN: {{$gdata->vat_number}}<br />
                        </td>
                        <td class="col6 ci">
                            Reg number: {{$gdata->reg_number}}<br />
                            IBAN: {{$gdata->bank_account}}<br />
                            Phone.: {{$gdata->tel1}} Fax: {{$gdata->fax}}<br />
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            <hr>
                        </td>
                    </tr>

                    <tr>
                        <td colspan="2" style="text-align: right; font-size: 15pt; text-transform: uppercase;">
                            {{($invoice->inv_type == 'i') ? 'Invoice' : 'pro forma invoice'}} # {{$invoice->inv_id}}
                        </td>
                    </tr>

                    <tr>
                        <td colspan="2">&nbsp;</td>
                    </tr>
                    <tr>
                        <td colspan="2" align="right" class="ci">
                            Date:
                            {{sr_date($invoice->created_at)}}
                            Date of Expiry:
                            {{sr_date($invoice->created_at)}}
                        </td>

                    </tr>
                </table>
                &nbsp;
            </td>
        </tr>
    </table>
</div>
<div class="icontainer">
    <table>
        <tr>
            <td class="col4">
                <table>
                    <tr>
                        <td class="intro">Bill To:</td>
                    </tr>
                    <tr>
                        <td class="adr">
                            {{$invoice->addresses->bt_name}}<br>
                            @if(!is_null($invoice->addresses->bt_company))
                                {{$invoice->addresses->bt_company}}<br>
                                {{$invoice->addresses->bt_vat}}<br>
                            @endif
                            {{$invoice->addresses->bt_address}}, {{$invoice->addresses->bt_zip_city}}<br>
                            {{$invoice->addresses->bt_phone}}<br>
                            {{$invoice->addresses->bt_email}}<br>

                        </td>
                    </tr>
                </table>
            </td>
            <td class="col4" >&nbsp;</td>
            <td class="col4">
                <table>
                    <tr>
                        <td class="intro">Ship To:</td>
                    </tr>
                    <tr>
                        <td class="adr">
                            {{$invoice->addresses->st_name}}<br>
                            {{$invoice->addresses->st_address}}, {{$invoice->addresses->st_zip_city}}<br>
                            {{$invoice->addresses->st_phone}}<br>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
</div>
<div class="icontainer">
    <table>
        <tr>
            <td class="intro">Shipment Information:</td>
        </tr>
        <tr>
            <td>
                <table>
                    <tr>
                        <td colspan="4">&nbsp;</td>
                    </tr>
                    <tr>
                        <td class="lpad5 col20">P.O. #:</td>
                        <td class="col30 bordered">{{$invoice->inv_po_num}}</td>
                        <td class="lpad5 col20">Mode of Transportation:</td>
                        <td class="col30 bordered">{{$invoice->inv_mod_of_trans}}</td>
                    </tr>
                    <tr>
                        <td class="lpad5">P.O. Date:</td>
                        <td class=" bordered">{{($invoice->inv_po_date) ? sr_date($invoice->inv_po_date) : ''}}</td>
                        <td class="lpad5">Transportation Terms:</td>
                        <td class=" bordered">{{$invoice->inv_transp_terms}}</td>
                    </tr>
                    <tr>
                        <td class="lpad5">Letter of Credit #:</td>
                        <td class=" bordered">{{$invoice->inv_loc_num}}</td>
                        <td class="lpad5">Number of Packages:</td>
                        <td class=" bordered">{{$invoice->inv_pac_num}}</td>
                    </tr>
                    <tr>
                        <td class="lpad5">Currency:</td>
                        <td class=" bordered">{{$invoice->inv_currency}}</td>
                        <td class="lpad5">Est. Gross Weight:</td>
                        <td class=" bordered">{{$invoice->inv_est_gw}}</td>
                    </tr>
                    <tr>
                        <td class="lpad5">Payment Terms:</td>
                        <td class=" bordered">{{$invoice->inv_pay_terms}}</td>
                        <td class="lpad5">Est. Net Weight:</td>
                        <td class=" bordered">{{$invoice->inv_est_nw}}</td>
                    </tr>
                    <tr>
                        <td class="lpad5">Est. Ship Date:</td>
                        <td class=" bordered">{{($invoice->inv_est_shipp_date) ? sr_date($invoice->inv_est_shipp_date) : ''}}</td>
                        <td class="lpad5">Carrier:</td>
                        <td class=" bordered">{{$invoice->inv_carrier}}</td>
                    </tr>

                </table>
            </td>
        </tr>
    </table>
</div>
<div class="icontainer">
    <table id="items">
        <tr>
            <th style="width: 12%">Item/Part #</th>
            <th style="width: 5%">UOM</th>
            <th style="width: 44%">Description</th>
            <th style="width: 8%" class="ca">Qty</th>
            <th style="width: 10%" class="ra">Unit Price</th>
            <th style="width: 10%" class="ra">VAT %</th>
            <th style="width: 10%" class="ra">Sales Tax</th>
            <th style="width: 11%" class="ra">Line Total</th>
        </tr>
        @if(count($invoiceItems))

            @foreach($invoiceItems as $i => $item)
                <tr>
                    <td>{{$item->invi_sku}}</td>
                    <td>{{$item->invi_uom}}</td>
                    <td>{{$item->invi_desc}}</td>
                    <td class="ca">{{$item->invi_qnt}}</td>
                    <td class="ra">{{number_format($item->invi_price, 2, ',', '.')}}</td>
                    <td>{{$item->invi_vrate}}</td>
                    <td class="ra">{{number_format($item->invi_vat, 2, ',', '.')}}</td>
                    <td class="ra">{{number_format($item->invi_total, 2, ',', '.')}}</td>
                </tr>
            @endforeach
        @endif
    </table>
</div>
<div class="icontainer">
    <table>
        <tr>
            <td class="col6 bordered">
                <table>
                    <tr>
                        <td class="intro">Special Notes, Terms of Sale:</td>
                    </tr>
                    <tr>
                        <td class="pad5">{{$invoice->inv_note}}</td>
                    </tr>
                </table>
            </td>
            <td class="col1">&nbsp;</td>
            <td class="col5">
                <table>
                    <tr>
                        <td class="col4 lpad5">Subtotal</td>
                        <td class="col8 bordered ra">{{($invoice->inv_subtotal) ? number_format($invoice->inv_subtotal, 2, ',', '.') : ''}}</td>
                    </tr>
                    {{--<tr>
                        <td class="lpad5">Subject to</td>
                        <td class=" bordered ra">{{($invoice->inv_subject_to) ? number_format($invoice->inv_subject_to, 2, ',', '.') : ''}}</td>
                    </tr>
                    <tr>
                        <td class="lpad5">Rate</td>
                        <td class=" bordered ra">{{($invoice->inv_rate) ? number_format($invoice->inv_rate, 2, ',', '.') : ''}}</td>
                    </tr>--}}
                    <tr>
                        <td class="lpad5">Sales Tax</td>
                        <td class=" bordered ra">{{($invoice->inv_sales_tax) ? number_format($invoice->inv_sales_tax, 2, ',', '.') : ''}}</td>
                    </tr>
                    <tr>
                        <td class="lpad5">S & H</td>
                        <td class=" bordered ra">{{($invoice->inv_sh) ? number_format($invoice->inv_sh, 2, ',', '.') : ''}}</td>
                    </tr>
                    <tr>
                        <td class="lpad5">Insurance</td>
                        <td class=" bordered ra">{{($invoice->inv_insurance) ? number_format($invoice->inv_insurance, 2, ',', '.') : ''}}</td>
                    </tr>
                    {{--<tr>
                        <td class="lpad5">[Other] specify</td>
                        <td class=" bordered">&nbsp;</td>
                    </tr>
                    <tr>
                        <td class="lpad5">[Other] specify</td>
                        <td class=" bordered">&nbsp;</td>
                    </tr>
                    <tr>
                        <td class="lpad5">[Other] specify</td>
                        <td class=" bordered">&nbsp;</td>
                    </tr>--}}
                    <tr>
                        <td class="lpad5" style="border-top: 2pt solid #000;">Total</td>
                        <td class=" bordered ra" style="border-top: 2pt solid #000;">{{($invoice->inv_total) ? number_format($invoice->inv_total, 2, ',', '.') : ''}}</td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
</div>
<div class="icontainer">
    <table>
        <tr>
            <td colspan="4"  class="ilabel" style="padding-top: 25pt; padding-bottom: 15pt;"><strong>I declare that the information mentioned above is true and correct to the best of my knowledge.</strong></td>
        </tr>
        <tr>
            <td class="col5 borderedbox">Signature</td>
            <td class="col1">&nbsp;</td>
            <td class="col4 borderedbox">Date</td>
            <td class="col2">&nbsp;</td>
        </tr>
    </table>
</div>
</div>
</body>
</html>