<link rel="stylesheet" type="text/css" href="include/jQuery/jquery-ui/themes/base/jquery-ui.css"/>
<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="include/jQuery/tablesorter-master/jquery.tablesorter.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/ReportEcmWorkCardsEcmProduct.js"></script>
{*<script type="text/javascript" src="https://www.google.com/jsapi"></script>*}

<style type="text/css">
    {literal}
        thead, tfoot {font-weight: bold;}

        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: #E8E8E8;
            color: #343432;
        }
        table.tablesorter tbody tr.alt-row:hover td {
            background: #E8E8E8;
            color: #343432;
        }
        .element{ 
            position:fixed;
            bottom: 0%;
            width: 97%;
            padding:10px;
            font-family:Arial;
            background-color: white;
            border:1px solid black; 
        }
    {/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>{$MOD.LBL_REPORT_ECMWORKCARDS_PRODUCTS}</h2>
            </td>
        </tr>
</table>

<br>

<ul class="tablist" style="width:100%;">
    <li>
        <a class="current" href="#">{$MOD.LBL_SEARCH}</a>
    </li>
</ul>

<form action="index.php" method="get" name="where" id="where">
    <input type="hidden" name="module" value="EcmReports" />
    <input type="hidden" name="action" value="ReportEcmWorkCardsEcmProduct" />
    <input type="hidden" name="parentTab" value="Produkcja"/>
    <table style="border-top: 0px none; margin-bottom: 4px;width:100%" class="tabForm" border="0" cellpadding="0" cellspacing="0">
        <tr>
            <td style="white-space: nowrap">{$MOD.LBL_DATE_FROM}
                <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">
                    Calendar.setup({ldelim}
                            inputField: "date_from",
                            daFormat: "{$dateFormat}",
                            button: "date_from_trigger",
                            singleClick: true,
                            dateStr: "",
                            step: 1
                    {rdelim}
                        );
                </script>
            </td>
            <td style="white-space: nowrap">{$MOD.LBL_DATE_TO}
                <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: "{$dateFormat}",
                            button: "date_to_trigger",
                            singleClick: true,
                            dateStr: "",
                            step: 1
                    {rdelim}
                        );
                </script>
            </td>
        </tr>
    </table>
</form>
<input class="button" value="{$MOD.LBL_EXECUTE}" type="submit" form="where">
<input class="button" value="{$MOD.LBL_CLEAR}" type="button" onclick="location.href = 'index.php?module=EcmReports&action=ReportEcmWorkCards&amp;parentTab=Raporty';">
<input id="excelEksport" class="button" name="importToExcel" value="{$MOD.BTN_EXCEL_EXPORT}" type="button" onclick="excelExport();">
<input id="pdfEksport" class="button" name="importToPDF" value="{$MOD.BTN_PDF_EXPORT}" type="button" onclick="pdfExport();">

<table id="myTable" class="tablesorter tablesorter-blue" role="grid">
    <thead>
        <tr class="tablesorter-headerRow" role="row">
            <th width="40%" style = "text-align: left">{$MOD.LBL_PRODUCTS}</th>
            <th width="15%" style = "text-align: left">{$MOD.LBL_WORKER_NAME}</th>
            <th width="7%" style = "text-align: left">{$MOD.LBL_ACTION_CODE}</th>
            <th width="30%" style = "text-align: left">{$MOD.LBL_ACTION}</th>
            <th width="5%" style = "text-align: left">{$MOD.LBL_QUANTITY}</th>
            <th width="5%" style = "text-align: left">{$MOD.LBL_PW_QUANTITY}</th>
            <th width="10%" style = "text-align: right">{$MOD.LBL_SUM_NETTO}</th>
            <th width="10%" style = "text-align: right">{$MOD.LBL_SUM_BRUTTO}</th>
        </tr>
    </thead>
    <tbody>
        {foreach from=$data item=rekord key=kl}
            <tr id="parent_{$rekord.indeks}">
                <td onclick="showHide({$rekord.indeks});"><span id="span_{$rekord.indeks}" class="plusStyle">[+]</span> {$rekord.code} {$rekord.name}</td>
                <td colspan="4" onclick="showHide({$rekord.indeks});"></td>
                <td onclick="showHide({$rekord.indeks});" style = "text-align: right">{$rekord.pw}</td>
                <td onclick="showHide({$rekord.indeks});" style = "text-align: right">{$rekord.netto|number_format:2:",":"."}</td>
                <td onclick="showHide({$rekord.indeks});" style = "text-align: right">{$rekord.brutto|number_format:2:",":"."}</td>
            </tr>
            {foreach from=$rekord.actions key=klucz item=pracownik}
				{foreach from=$pracownik item=czynnosc}
					<tr name="child_{$rekord.indeks}" style="display: none;">
						<td onclick="showHide('{$rekord.indeks}');" style = "text-align: left"></td>
						<td onclick="showHide({$rekord.indeks});" style = "text-align: left">{$klucz}</td>
						<td onclick="showHide({$rekord.indeks});" style = "text-align: left">{$czynnosc.actioncode}</td>
						<td onclick="showHide({$rekord.indeks});" style = "text-align: left">{$czynnosc.actionname}</td>
						<td onclick="showHide({$rekord.indeks});" style = "text-align: right">{$czynnosc.quantity}</td>
						<td onclick="showHide({$rekord.indeks});" style = "text-align: right">{$rekord.pw}</td>
						<td onclick="showHide({$rekord.indeks});" style = "text-align: right">{$czynnosc.netto|number_format:2:",":"."}</td>
						<td onclick="showHide({$rekord.indeks});" style = "text-align: right">{$czynnosc.brutto|number_format:2:",":"."}</td>
					</tr>
				{/foreach}
            {/foreach}
        {/foreach}
    </tbody>
    <tfoot style="background-color: #E8E8E8;">
        <tr>
            <td style="text-align: left;background-color: #E8E8E8; border: 1px solid #E8E8E8;">{$MOD.LBL_SUM}</td>
            <td style="text-align: right;background-color: #E8E8E8; border: 1px solid #E8E8E8;" colspan="5"></td>
            <td style="text-align: right;background-color: #E8E8E8; border: 1px solid #E8E8E8;">{$suma.netto|number_format:2:",":"."}</td>
            <td style="text-align: right;background-color: #E8E8E8; border: 1px solid #E8E8E8;">{$suma.brutto|number_format:2:",":"."}</td>
        </tr>
    </tfoot>
</table>