<style type="text/css">
{literal}
    table.report {
        margin: 15px 0;
        width: 100%;

        border-spacing: 1px;

        font-family: 'Calibri';
        font-size: 13px;
    }

    table.report thead tr th,
    table.report tbody tr td {
        padding: 2px 5px;
        border: 1px solid #CCCCCC;

        text-align: center;
    }

    table.report thead tr th {
        background: #ebebeb;
    }

    table.report tbody tr.odd {
        background: #f6f6f6;
    }

    table.report tbody tr.even {
        background: #ffffff;
    }
    {/literal}
</style>
<script type="text/javascript">
      {literal}
      function pdfExport() {
  		var url =  $(location).attr('href');
  		url = url + "&toPDF=1&to_pdf=1";

  		window.open(url);
  	}
        function xlsExport() {
  		var url =  $(location).attr('href');
  		url = url + "&toPDF=1&to_pdf=1&to_xls=1";

  		window.open(url);
  	}
	      {/literal}
	</script>
<table cellspacing="0" cellpadding="0" border="0">
    <tr>
        <td>
            <h2>{$MOD.LBL_RAPORT_TITLE}</h2>
        </td>
    </tr>
</table>

<br />

<ul class="tablist">
    <li>
        <a class="current" href="#">Opcje</a>
    </li>
</ul>

<form action="index.php" method="get" name="search_reports">
    <input type="hidden" name="module" value="EcmReports" />
    <input type="hidden" name="action" value="kpkwReport" />

    <table style="border-top: 0px none; margin-bottom: 4px; width:100%" class="tabForm" border="0" cellpadding="0" cellspacing="0">
        <tbody>
            <tr>
                <td class="dataLabel" width="5%" nowrap="nowrap">
                   {$MOD.LBL_DATE_START}
                </td>
                <td class="dataField" width="10%" nowrap="nowrap">
                    <input autocomplete="off" name="date_from" id="date_from" value="{$currentFrom}" title="" tabindex="" size="11" maxlength="10" type="text">
                    <img src="themes/default/images/jscalendar.gif" alt="Enter Date" id="date_from_trigger" align="absmiddle" border="0">
                    <script type="text/javascript">
                  	Calendar.setup ({ldelim}
				inputField : "date_from",
				daFormat : "{$dateFormat}",
				button : "date_from_trigger",
				singleClick : true,
				dateStr : "",
				step : 1
				{rdelim}
				);
                    </script>
                </td>
                <td class="dataLabel" width="5%" nowrap="nowrap">
                   {$MOD.LBL_DATE_END}
                </td>
                <td class="dataField" width="10%" nowrap="nowrap">
                    <input autocomplete="off" name="date_to" id="date_to" value="{$currentTo}" title="" 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 type="text/javascript">
                 
              		Calendar.setup ({ldelim}
				inputField : "date_to",
				daFormat : "{$dateFormat}",
				button : "date_to_trigger",
				singleClick : true,
				dateStr : "",
				step : 1
				{rdelim}
				);
                    </script>
                </td>
				<td class="dataLabel" width="5%" nowrap="nowrap">
                     {$MOD.LBL_CASH2}
                </td>
                <td class="dataField" width="10%" nowrap="nowrap">
                    <input autocomplete="off" name="ecmcash_id" id="ecmcash_id" type="hidden" value="{$PARAMS.ecmcash_id}" title="" tabindex="" size="11" maxlength="10" type="text">
                    <input autocomplete="off" name="id_currency" id="id_currency" type="hidden" value="{$PARAMS.id_currency}" title="" tabindex="" size="11" maxlength="10" type="text">
                    <input autocomplete="off" name="cash_name" id="cash_name" value="{$PARAMS.cash_name}" title="" tabindex="" size="11" maxlength="10" type="text">
                    <input title="Wybierz [Alt+T]" accesskey="T" type="button" class="button" value="{$MOD.LBL_SELECT}" name="btn1" onclick='{literal}open_popup("EcmCashs", 600, 400, "", true, false,
                         {"call_back_function":"set_return","form_name":"search_reports","field_to_name_array":
                             {"id":"ecmcash_id","name":"cash_name","currency_id":"id_currency"}}, "single", true); {/literal}'></span>
                </td>
								<td class="dataLabel" width="5%" nowrap="nowrap">
                  {$MOD.LBL_CASH_USER2}
                </td>
                <td class="dataField" width="10%" nowrap="nowrap">
                  <select name="kasjer" id="kasjer">
                  	<option value="">Wszyscy</option>
				{foreach from=$USERS item=USER key=count name=loop}
					<option value="{$USER.id}" { if $PARAMS.kasjer==$USER.id} selected="true" {/if} >{$USER.first_name} {$USER.last_name}</option>
				{/foreach}
				  </select>
                </td>
                <td class="dataLabel" width="70%" nowrap="nowrap"></td>
            </tr>
        </tbody>
    </table> 
        <input class="button" value="{$MOD.LBL_SUBMIT}" type="submit"/>
 <input class="button" name="clear" value="{$MOD.LBL_CLEAR}" type="button" onclick="location.href='index.php?module=EcmReports&action=kpkwReport';">
<!-- <input id="excelEksport" class="button" name="importToExcel" onClick="xlsExport();" value="XLS" type="button"> -->
<input id="pdf" class="button" name="pdf" value="PDF" onClick="pdfExport();" type="button">
</form>


		<center><h1>{$MOD.LBL_RAPORT_LABEL} <br>{$MOD.LBL_TIME} {$currentFrom} - {$currentTo}<BR>
		{if $PARAMS.cash_name!=''} {$MOD.LBL_CASH}: {$PARAMS.cash_name}, {$MOD.LBL_CURRENCY_PDF}: {$PARAMS.id_currency}{/if}
			{if $PARAMS.kasjer!=''}
			<br>{$MOD.LBL_CASH_USER} {$USER_NAME}
		{/if}
	</h1></center><br>
	<table class="report" style="padding-top: 0px; margin-top:0px;">
	       <thead>
                    <tr>
						<th>{$MOD.LBL_NUMBER_LP}</th>
                        <th>{$MOD.LBL_DOCUMENT_NO}<br>{$MOD.LBL_CREATE_LAB}</th>
						<th>{$MOD.LBL_TITLE}</th>
						<th>{$MOD.LBL_PARENT_NAME}</th>
						<th>{$MOD.LBL_AMOUNT_PLUS}</th>
						<th>{$MOD.LBL_AMOUNT_MINUS}</th>
                    </tr>
                </thead>
                <tbody>
               {foreach from=$DATA item=poz key=CATNAME name=loop}
               		{if $poz.type_id!=''}
                    <tr class="{$poz.class}">
						<td width="5%">{$poz.number}</td>
						<td width="15%" style="text-align:left;">
							<table class="report" style="padding-top: 0px; margin-top:0px;">
								<tr class="{$poz.class}">
									<td style="text-align:left;">{$poz.document_no}</td>
								</tr>
								<tr>
									<td style="text-align:left;">{$poz.date_entered|date_format:"%d.%m.%Y"}</td>
								</tr>
							</table>
						</td>
						<td width="22%" style="text-align:left;">{$poz.description}</td>
						<td width="22%" style="text-align:left;">{$poz.parent_name}</td>
						<td width="17%" style="text-align:right;">{if $poz.type_id==0} {$poz.amount|number_format:2:",":"."} {else} &nbsp;{/if}</td>
						<td width="17%" style="text-align:right;">{if $poz.type_id==1} {$poz.amount|number_format:2:",":"."} {else} &nbsp;{/if} 
						</td>
                    </tr>
                    {assign var="i" value=$poz.number}
                    {/if}
                {/foreach}
                {assign var="currow" value=$poz.number+1}
                		    <tr class="{if $currow%2}even{else}odd{/if}">
						<td width="45%" style="border: 0px; background: #fff;" colspan="2">&nbsp;</td>
						<td width="15%" style="border: 0px; background: #fff;"></td>
						<td width="15%" style="text-align:left;">{$MOD.LBL_VALUE}</td>
						<td width="15%" style="text-align:right;">{$DATA.in|number_format:2:",":"."}</td>
						<td width="20%" style="text-align:right;">{$DATA.out|number_format:2:",":"."}</td>
						<td width="20%" style="border: 0px;background: #fff;">&nbsp; 
						</td>
                    </tr>
                   {assign var="currow" value=$currow+1}
				   <tr class="{if $currow%2}even{else}odd{/if}">
						<td width="45%" style="border: 0px; background: #fff;" colspan="2">&nbsp;</td>
						<td width="15%" style="border: 0px; background: #fff;"></td>
						<td width="15%" style="text-align:left;">{$MOD.LBL_VALUE_BEFORE}:</td>
						<td width="15%" style="text-align:right;">{$CASH_BEFORE|number_format:2:",":"."}</td>
						<td width="20%" style="text-align:right;"></td>
						<td width="20%" style="border: 0px;background: #fff;">&nbsp; 
						</td>
                    </tr>
                    {assign var="currow" value=$currow+1}
				  <tr class="{if $currow%2}even{else}odd{/if}">
						<td width="45%" style="border: 0px; background: #fff;" colspan="2">&nbsp;</td>
						<td width="15%" style="border: 0px; background: #fff;"></td>
						<td width="15%" style="text-align:left;">{$MOD.LBL_VALUE_TOTAL}:</td>
						<td width="15%" style="text-align:right;">{$CASH_NOW|number_format:2:",":"."}</td>
						<td width="20%" style="text-align:right;"></td>
						<td width="20%" style="border: 0px;background: #fff;">&nbsp; 
						</td>
                    </tr>
                </tbody>
	</table>