Files
crm.twinpol.com/modules/EcmReports/tpls/ReportSalesByGroup.tpl
2025-05-12 15:46:37 +00:00

340 lines
9.8 KiB
Smarty

<link rel="stylesheet" type="text/css" href="modules/EcmReports/css/SearchTable.css"/>
<link class="theme" rel="stylesheet" href="include/jQuery/tablesorter/themes/blue/style.css">
<link rel="stylesheet" href="modules/EcmReports/css/ReportSalesByGroup.css">
<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;" width="16" border="0" height="16">
</td>
<td>
<h2 id="raport_name">{$MOD.LBL_REPORT_SALES_BY_GROUP}</h2>
</td>
</tr>
</table>
<form action="index.php" method="get" name="ReportSalesByGroup" id="search-form">
<input type="hidden" name="module" value="EcmReports" />
<input type="hidden" name="action" value="ReportSalesByGroup"/>
<input type="hidden" name="parentTab" value="Raporty" />
<table style="width:100%" class="edit view" id="SearchTable">
<tbody>
<tr>
{if !empty($list_years)}
<td>
<table>
<tr>
<td>
Rok:
</td>
<td>
<select name="years_group[]" title="">
{foreach from=$list_years key=key item=item}
<option
value="{$item}"
{if @in_array($item, $smarty.request.years_group) } selected="true" {/if}>
{$item}
</option>
{/foreach}
</select>
</td>
</tr>
</table>
</td>
{/if}
{if !empty($list_months)}
<td>
<table>
<tr>
<td>
Miesiąc:
</td>
<td>
<select name="months_group[]" title="">
{foreach from=$list_months key=key item=item}
<option
value="{$key}"
{if @in_array($key, $smarty.request.months_group) } selected="true" {/if}>
{$months.$item}
</option>
{/foreach}
</select>
</td>
</tr>
</table>
</td>
{/if}
{if !empty($MOD.DOCUMENT_SALES_LIST)}
<td>
<table>
<tr>
<td>
{$MOD.LBL_DOCUMENT_SALES_TYPE}:
</td>
<td>
<select multiple name="document_sales_type[]" title="{$MOD.TIP_MULTIPLE}">
{foreach from=$MOD.DOCUMENT_SALES_LIST key="key" item="item"}
<option
value="{$key}"
{if @in_array($key, $smarty.request.document_sales_type) } selected="true" {/if}>
{$item}
</option>
{/foreach}
</select>
</td>
</tr>
</table>
</td>
{/if}
{if !empty($list_types) }
<td>
<table>
<tr>
<td>
Typ:
</td>
<td>
<select multiple name="types_group[]" title="">
<option {if @in_array("", $smarty.request.types_group) } selected="true" {/if} value=""></option>
{foreach from=$list_types key=key item=item}
<option
value="{$key}"
{if @in_array($key, $smarty.request.types_group) } selected="true" {/if}>
{$item}
</option>
{/foreach}
</select>
</td>
</tr>
</table>
</td>
{/if}
{if !empty($stock_array)}
<td>
<table>
<tr>
<td>
{$MOD.LBL_STOCK}:
</td>
<td>
<select multiple name="stocks[]" title="{$MOD.TIP_MULTIPLE}">
{foreach from=$stock_array key="key" item="item"}
<option
value="{$key}"
{if @in_array($key, $smarty.request.stocks) } selected="true" {/if}>
{$item}
</option>
{/foreach}
</select>
</td>
</tr>
</table>
</td>
{/if}
{if !empty($list_group_ks_without_filter)}
<td>
<table>
<tr>
<td>
{$MOD.LBL_PRODUCT_GROUP}:
</td>
<td>
<select multiple name="product_group[]" title="{$MOD.TIP_MULTIPLE}">
<option {if @in_array("", $smarty.request.product_group) } selected="true" {/if} value=""></option>
{foreach from=$list_group_ks_without_filter key="key" item="item"}
<option
value="{$key}"
{if @in_array($key, $smarty.request.product_group) } selected="true" {/if}>
{$item}
</option>
{/foreach}
</select>
</td>
</tr>
</table>
</td>
{/if}
<!--{if !empty($list_other_group_ks)}
<td>
<table>
<tr>
<td>
Grupy do sumy:
</td>
<td>
<select multiple name="product_other_group[]" title="{$MOD.TIP_MULTIPLE}">
<option {if @in_array("", $smarty.request.product_other_group) } selected="true" {/if} value=""></option>
{foreach from=$list_other_group_ks key="key" item="item"}
<option
value="{$key}"
{if @in_array($key, $smarty.request.product_other_group) } selected="true" {/if}>
{$item}
</option>
{/foreach}
</select>
</td>
</tr>
</table>
</td>
{/if}-->
<!--
{if !empty($list_types) }
<td>
<table>
<tr>
<td>
Typ do sumy:
</td>
<td>
<select multiple name="types_group_sum[]" title="">
<option {if @in_array("", $smarty.request.types_group) } selected="true" {/if} value=""></option>
{foreach from=$list_types key=key item=item}
<option
value="{$key}"
{if @in_array($key, $smarty.request.types_group_sum) } selected="true" {/if}>
{$item}
</option>
{/foreach}
</select>
</td>
</tr>
</table>
</td>
{/if}-->
</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=ReportSalesByGroup';">
<!-- <input id="xls" class="button" name="xls" value="XLS" type="button" {if empty($table_array)}disabled{/if} onclick="generateXLS()"> -->
<input id="pdf" class="button" name="pdf" value="{$MOD.LBL_PDF}" type="button" {if empty($table_array)}disabled{/if} onclick="generatePDF()">
<input id="chart" class="button" name="chart" value="Wykres" type="button" {if empty($table_array)}disabled{/if} onclick="btnChart()">
<label for="column-chart">Wykres kolumnowy</label>
<input type="radio" name="chart-type" id="column-chart" value="columnChart" checked>
<label for="line-chart">Wykres Liniowy</label>
<input type="radio" name="chart-type" id="line-chart" value="lineChart">
</form>
{if isset($smarty.request.submit) }
{if !empty($table_array)}
<table id="myTable" class="tablesorter">
<thead>
<tr>
<td>ROK</td>
<td>MIESIĄC</td>
<td>PROFIL GŁÓWNY</td>
<td>
ILU ODBIORCÓW W LICZBACH
<!--<input type="radio" name="chart1" value="accounts_count" checked>-->
</td>
<td>
ILE DOKUMENTÓW
<!--<input type="radio" name="chart1" value="documents_count">-->
</td>
{foreach from=$list_group_ks key=groups_key item=group_ks}
<td>
{if in_array($groups_key,$types_prod_req)}
{$group_ks}
<input type="radio" name="chart1" value="{$groups_key}">
{/if}
</td>
{/foreach}
<td>
Pozostałe
<input type="radio" name="chart1" value="suma" checked>
</td>
</tr>
</thead>
<tbody>
{foreach from=$table_array key=year_key item=year name=year_name}
{assign var=count_month value=0}
{* Generate sum all types for years column *}
{assign var=sum_type value=0}
{foreach from=$year key=month_key item=month name=month_name}
{math assign=sum_type equation="x + y" x=$sum_type y=$month|@count}
{/foreach}
{foreach from=$year key=month_key item=month name=month_name}
{assign var=count_type value=0}
{foreach from=$month key=type_key item=type name=type_name}
<tr {if $smarty.foreach.type_name.first} class="tr-style-top" {/if}>
{if $count_type == 0}
{if $count_month == 0}
<td rowspan="{$sum_type}" class="pull-right">{$year_key}</td>
{/if}
<td rowspan="{$month|@count}">{$months[$month_key]}</td>
{/if}
{if in_array($type_key,$types_group_req)}
{if !empty($list_types.$type_key) }
<td>{$list_types.$type_key}</td>
{else}
<td class="pull-left">Pozostałe</td>
{/if}
<td class="pull-right">{$type.accounts_count}</td>
<td class="pull-right">{$type.documents_count}</td>
{foreach from=$list_group_ks key=groups_key item=groups}
{assign var=found value=0}
{foreach from=$type.accounts_type key=group_key item=group name=group_name}
{if in_array($group_key,$types_prod_req)}
{if $groups_key == $group_key}
{assign var=found value=1}
<td class="pull-right"> {$group|number_format:2:".":","}</td>
{/if}
{/if}
{/foreach}
{if $found==0 }
<td class="pull-right">-</td>
{/if}
{/foreach}
<td class="pull-right">{$type.accounts_type.total|number_format:2:".":","}</td>
{/if}
</tr>
{assign var=count_type value=$count_type+1}
{/foreach}
{assign var=count_month value=$count_month+1}
{/foreach}
{/foreach}
</tbody>
</table>
<div id="chart_div"></div>
{/if}
{/if}
<script type="text/javascript" src="modules/EcmReports/javascript/ReportSalesByGroup.js"></script>
<script src="include/jQuery/tablesorter/jquery.tablesorter.min.js"></script>
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
{*<script src="https://www.google.com/uds/?file=visualization&amp;v=1&amp;packages=corechart" type="text/javascript"></script>*}
<script type="text/javascript" src="modules/EcmReports/javascript/ReportSalesByGroupChart.js"></script>