<html>
<head>
    <style>
        {literal}
        .edit tr td{
            vertical-align : middle;
        }

        .money ,.quantity{
            text-align : right;
        }
        table.tablesorter {
            font-family:arial;
            background-color: #CDCDCD;
            margin:10px 0pt 15px;
            font-size: 8pt;
            width: 100%;
            text-align: left;
        }
        table.tablesorter thead tr th, table.tablesorter tfoot tr th {
            background-color: #e6EEEE;
            border: 1px solid #FFF;
            font-size: 8pt;
            padding: 4px;
        }
        table.tablesorter thead tr .header {
            background-image: url(bg.gif);
            background-repeat: no-repeat;
            background-position: center right;
            cursor: pointer;
        }
        table.tablesorter tbody td {
            color: #3D3D3D;
            padding: 4px;
            background-color: #FFF;
            vertical-align: top;
        }
        table.tablesorter tbody tr.odd td {
            background-color:#F0F0F6;
        }
        table.tablesorter thead tr .headerSortUp {
            background-image: url(asc.gif);
        }
        table.tablesorter thead tr .headerSortDown {
            background-image: url(desc.gif);
        }
        table.tablesorter thead tr .headerSortDown, table.tablesorter thead tr .headerSortUp {
            background-color: #8dbdd8;
        }
        {/literal}
    </style>
</head>
<body>

<table style="width:100%;font-size:10px">
    <thead>
    <tr>
        <td colspan='4'>
            <p style="font-size:15px"><b>Raport ilościowy zakupu</b></p>
            e5 Polska Sp. z o.o.
        </td>
        <td style="text-align:right">
            Data wygenerowania raportu:<br>
            {$smarty.now|date_format:"%d.%m.%Y %H:%M:%S"}
        </td>
    </tr>
    </thead>
    <tbody>
    <tr>
        <td >
            {$MOD.LBL_DATE_FROM} {$date_from_value}<br>
            {$MOD.LBL_DATE_TO} {$date_to_value}
        </td>
        <td >
            <table>
                <tr>
                    <td>
                        Grupa:
                    </td>
                    <td>
                        {if @count($PRODUCT_GROUP_SELECTED) == 0}
                            {foreach from=$APP_LIST_STRINGS.ecmproducts_group_ks_dom key="key" item="item"}
                                {$item}<br>
                            {/foreach}
                        {else}
                            {foreach from=$APP_LIST_STRINGS.ecmproducts_group_ks_dom key="key" item="item"}
                                {if @in_array($key, $PRODUCT_GROUP_SELECTED) } {$item}<br>{/if}
                            {/foreach}
                        {/if}
                    </td>
                </tr>
            </table>
        </td>
        <td >
            <table>
                <tr>
                    <td>
                        {$MOD.LBL_STOCK}:
                    </td>
                    <td>
                        {if @count($STOCK_SELECTED) == 0}
                            {foreach from=$STOCK_LIST key="key" item="item"}
                                {$item}<br>
                            {/foreach}
                        {else}
                            {foreach from=$STOCK_LIST key="key" item="item"}
                                {if @in_array($key, $STOCK_SELECTED) } {$item}<br>{/if}
                            {/foreach}
                        {/if}
                    </td>
                </tr>
            </table>
        </td>
        <td >
            Handlowiec:
            {if $TRADER_SELECTED ==''}
                Wszyscy
            {else}
                {foreach from=$TRADERS_LIST key="key" item="item"}
                    {if @in_array($key, $TRADER_SELECTED) } {$item}<br>{/if}

                {/foreach}
            {/if}
        </td>
    </tr>
    <tr>
        {if $PRODUCT_CATEGORY_ID!=""}
        <td >
           Kategoria:
        </td>
            <td>
                {$PRODUCT_CATEGORY_NAME}
            </td>
        {/if}
    </tr>
    </tbody>
</table>

<table id="myTable" class="tablesorter">
    <thead>
    <tr>
        <th>
            Indeks
        </th>
        <th>
            {$MOD.LBL_NAME}
        </th>
        <th width="10%">
            {$MOD.LBL_QUANTITY}
        </th>
        <th width="5%">
            {$MOD.LBL_JM}
        </th>
        <th width="10%">
            Zakup Netto
        </th>
        <th width="10%">
            Waga jedn. netto
					</th>
					<th width="10%">
                        Waga ogółem netto
					</th>
    </tr>
    </thead>
    <tbody>
    {foreach from=$DATA item=item key=item_name}
        {if $item.quantity eq 0}
        {else}
            <tr>
                <td >
                    {$item.code}
                </td>
                <td>
                    {$item.name}
                </td>
                <td class="quantity" style="text-align:right;">
                    {$item.quantity|number_format:2:",":""}
                </td>
                <td>
                    {$item.jm_name}
                </td>
                <td class="money" style="text-align:right;">
                    {$item.total_netto|number_format:2:",":"."}
                    {assign var=summary_netto value=$summary_netto+$item.total_netto}
                </td>
                <td class="quantity" style="text-align:right;">
                    {$item.position_weight|number_format:6:",":""}
                </td>
                <td class="quantity" style="text-align:right;">
                    {$item.position_total_weight|number_format:6:",":""}
                </td>
            </tr>
        {/if}
    {/foreach}
    </tbody>
    <tfoot>
    <tr>
        <td colspan="2">
            {$MOD.LBL_SUMMARY}
        </td>
        <td class="money">
            {$TOTAL3|number_format:2:",":""}
        </td>
        <td class="money">

        </td>
        <td class="money">
            {$summary_netto|number_format:2:",":"."}
        </td>
        <td class="money">

        </td>
        <td class="money">
            {$TOTAL4|number_format:6:",":""}
        </td>
    </tr>
    </tfoot>
</table>
</body>
</html>