
<link rel="stylesheet" type="text/css" href="modules/EcmReports/TableSorter/css/theme.blue.css"/>
<link rel="stylesheet" type="text/css" href="modules/EcmReports/TableSorter/css/theme.blue2.css"/>
<!--  Tablesorter -->
<script type="text/javascript" src="modules/EcmReports/TableSorter/js/jquery.min.js"></script>
<script type="text/javascript" src="modules/EcmReports/TableSorter/js/jquery.tablesorter.min.js"></script>
<script type="text/javascript" src="modules/EcmReports/TableSorter/js/jquery.tablesorter.staticrow.min.js"></script>
<script type="text/javascript" src="modules/EcmReports/TableSorter/js/jquery.tablesorter.widgets.js"></script>
<script type="text/javascript" src="modules/EcmReports/javascript/jquery.blockUI.js"></script>


<script type="text/javascript" src="modules/EcmReports/javascript/ReportStocks.js"></script>

<script type="text/javascript">
    {literal}

        function pdfExport() {
            var url = $(location).attr('href');
            url = url + "&toPDF=1&to_pdf=1";

            window.location.href = url;
        }
    {/literal}
</script>
<style type="text/css">
    {literal}

        thead, tfoot {font-weight: bold;}

        .additionalColumn {
            background-color: #87CCED;
            border-top: 1px solid black;
        }
        .line {
            border-top: 1px solid black !important;;
        }
        .groupActive {
            border-top: 1px solid black;
            border-bottom: 1px solid black;
            border-left: 1px solid black;
            background-color: #87CCED;
        }

        .sumRow {
            background-color: #BDC7B5;
        }

        .sumAll td{
            background-color: #BDC7B5;
        }

        table.tablesorter tbody tr:hover td {
            background: #E8E8E8;
            color: #343432;
        }

        /* Extra selectors needed to override the default styling */
        table.tablesorter tbody tr.normal-row td {
            background: #EFEFF1;
            color: #343432;

        }
        table.tablesorter tbody tr.alt-row td {
            background: #FFF;
            color: #343432;

        }

        /* Extra selectors needed to override the default styling */
        table.tablesorter tbody tr.normal-row:hover td {
            background: #B8E8E8;
            color: #343432;
            font-weight: bold;
        }
        table.tablesorter tbody tr.alt-row:hover td {
            background: #B8E8E8;
            color: #343432;
            font-weight: bold;
        }
        table.tablesorter tbody tr.sumAll td {
            background: #EBEBED;
            color: black;
        }
        table.tablesorter tbody tr.sumAll:hover td {
            background: #E0E0E2;
            color: black;
            font-weight: bold;
        }

        table.tablesorter .sumRow, .oddListRowS1 {
            text-align: right;
        }

        table.tablesorter .alignLeft {
            text-align: left;
        }

        table.tablesorter .subcategory .alignLeft {
            padding-left: 20px;
        }

        table.tablesorter .contractor .alignLeft {
            padding-left: 40px;
        }

        .plusStyle {
            color: #abc3d7; 
            text-decoration: none; 
            cursor: pointer;
        }

    {/literal}
</style>


<table id="tableMenu" cellspacing="0" cellpadding="0" border="0">
    <tbody>
        <tr>
            <td>
                <img src="themes/Sugar/images/EcmProducts.gif" style="margin-top: 3px; margin-right: 3px;" alt="EcmProducts" width="16" border="0" height="16">
            </td>
            <td>
                <h2>Kartoteka ruchu towarów - Podsumowanie</h2>
            </td>
        </tr>
</table>

<br />
<ul class="tablist" style="width:100%;">
    <li>
        <a class="current" href="#">Wyszukiwanie</a>
    </li>		
</ul>
<form action="index.php" method="get" name="searchReportStocks">
    <input type="hidden" name="module" value="EcmReports" />
    <input type="hidden" name="action" value="Kartoteka" />
    <table style="border-top: 0px none; margin-bottom: 4px;width:100%" class="tabForm" border="0" cellpadding="0" cellspacing="0">

        <tr>		
            <td class="dataLabel" width="5%" nowrap="nowrap">{$MOD.LBL_STOCK}</td>
            <td class="dataField" width="10%" nowrap="nowrap">
                <select id="stock" name="selectStock">
                    <option value="" {if $selectStock==""} selected="true" {/if} >{$MOD.LBL_ALL_STOCKS}</option>
                    {foreach from=$STOCKS item=STOCK key=count name=loop}
                        <option value="{$STOCK.id}" {if $selectStock==$STOCK.id} selected="true" {/if} >{$STOCK.name}</option>
                    {/foreach}
                </select>
            </td>		
            <td class="dataLabel" width="10%" nowrap="nowrap"></td>

            <td class="dataLabel" width="5%" nowrap="nowrap">{$MOD.LBL_PRODUCT_ACTIVE}</td>
            <td class="dataField" width="10%" nowrap="nowrap">
                <select id="productActive" name="selectProductActive">
                    <option value="" {if $selectProductActive==""} selected="true" {/if} >{$MOD.LBL_YES}/{$MOD.LBL_NO}</option>
                    <option value="1" {if $selectProductActive=="1"} selected="true" {/if} >{$MOD.LBL_YES}</option>
                    <option value="0" {if $selectProductActive=="0"} selected="true" {/if} >{$MOD.LBL_NO}</option>
                </select>
            </td>		
            <td class="dataLabel" width="10%" nowrap="nowrap"></td>

        </tr>
        <tr>
            <td class="dataLabel" width="10%" nowrap="nowrap">Data od</td>
            <td class="dataLabel" width="10%" nowrap="nowrap">
                <input id="date_from" name="date_from" type="text" maxlength="10" size="11" tabindex="" title="Data od" value="{$date_from}" autocomplete="off">
                <img id="date_from_trigger" border="0" align="absmiddle" alt="Enter Date" src="themes/default/images/jscalendar.gif">
                <script language="JavaScript" type="text/javascript">
                    {* console.log('dupa');*}
                    Calendar.setup({ldelim}
                            inputField: "date_from",
                            daFormat: "%d.%m.%Y",
                            button: "date_from_trigger",
                            singleClick: true,
                            dateStr: "",
                            step: 1
                    {rdelim}
                        );
                </script>
            </td>
            <td class="dataLabel" width="10%" nowrap="nowrap">Data do</td>
            <td class="dataLabel" width="10%" nowrap="nowrap"> 
                <input autocomplete="off" name="date_to" id="date_to" value="{$date_to}" title="Data do" tabindex="" size="11" maxlength="10" type="text">
                <img src="themes/default/images/jscalendar.gif" alt="Enter Date" id="date_to_trigger" align="absmiddle" border="0">
                <script language="JavaScript" type="text/javascript">
                    Calendar.setup({ldelim}
                            inputField: "date_to",
                            daFormat: "%d.%m.%Y",
                            button: "date_to_trigger",
                            singleClick: true,
                            dateStr: "",
                            step: 1
                    {rdelim}
                        );
                </script>
            </td>
            <td class="dataLabel" width="60%" nowrap="nowrap"></td>
        </tr>
        </tbody>
    </table>

    <input class="button" name="submit" value="{$MOD.LBL_EXECUTE}" type="submit">
    <input class="button" name="clear" value="{$MOD.LBL_CLEAR}" type="button" onclick="location.href = 'index.php?module=EcmReports&action=Kartoteka';">
    <input id="pdf" class="button" name="pdf" value="PDF" onClick="pdfExport();" type="button">
    
    <br>
    <br>
    
    <table id="myTable" class="tablesorter " role="grid" width="50%"> 
        <thead>
            <tr class="tablesorter-headerRow" role="row">
                <th width="50%" class="sorter-text tablesorter-header tablesorter-headerUnSorted" data-column="0" tabindex="0" scope="col" role="columnheader" aria-disabled="false" unselectable="on" style="-moz-user-select: none;text-align:left;" aria-sort="none" aria-label="Name: No sort applied, activate to apply an ascending sort">Stan początkowy:</th>
                <th width="50%" class="sorter-text tablesorter-header tablesorter-headerUnSorted" data-column="1" tabindex="0" scope="col" role="columnheader" aria-disabled="false" unselectable="on" style="-moz-user-select: none;text-align:right;" aria-sort="none" aria-label="Name: No sort applied, activate to apply an ascending sort">{$TOTAL_VALUE_OLD|number_format:2:",":"." } zł</th>
            </tr>
        </thead>
        <tbody aria-live="polite" aria-relevant="all">
            {assign var="number" value=1}
            {foreach from=$DATA key="key" item="item" name=loop}
                {foreach from=$item key="key2" item="item2" name=loop}
                    <tr> 
                        <td class="oddListRowS1 alignLeft"><b>{$doc_name.$key2} {if $key==0}(+){else}(-){/if}</b></td>
                        <td class="oddListRowS1" style="text-align:right;" rowspan="{$currow}"><b>{$item2|number_format:2:",":"."} zł</b></td>
                    </tr>
					{if $key==0}
						{assign var=nowa_suma value=$nowa_suma+$item2}
					{else}
						{assign var=nowa_suma value=$nowa_suma-$item2}
					{/if}
                {/foreach}
            {/foreach}
        </tbody>
        <tr class="tablesorter-headerRow" role="row">
            <th width="10%" class="sorter-text tablesorter-header tablesorter-headerUnSorted" data-column="0" tabindex="0" scope="col" role="columnheader" aria-disabled="false" unselectable="on" style="-moz-user-select: none;text-align:left;" aria-sort="none" aria-label="Name: No sort applied, activate to apply an ascending sort">Stan końcowy:</th>
            <th width="15%" class="sorter-text tablesorter-header tablesorter-headerUnSorted" data-column="1" tabindex="0" scope="col" role="columnheader" aria-disabled="false" unselectable="on" style="-moz-user-select: none;text-align:right;" aria-sort="none" aria-label="Name: No sort applied, activate to apply an ascending sort">{$nowa_suma+$TOTAL_VALUE_OLD|number_format:2:",":"." } zł</th>
        </tr>
    </table>