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

193 lines
7.0 KiB
Smarty
Executable File

<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<table id="table" 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_SALES_ANALIS_PRODUCT}</h2>
</td>
</tr>
</table>
<br>
<form action="index.php" method="get" class="EditView" name="AnalysisProductSale">
<input type="hidden" name="module" value="EcmReports" />
<input type="hidden" name="action" value="AnalysisProductSale" />
<input type="hidden" name="parentTab" value="Raporty" />
<table style="width:100%" class="edit view">
<tbody>
<tr >
{if !empty($product_group) }
<td rowspan='2'>
{$MOD.LBL_PRODUCT_GROUP}:
</td>
<td rowspan='2'>
<select multiple name="product_group[]" title="{$MOD.TIP_MULTIPLE}">
<!--<option {if @in_array("", $smarty.request.product_group) } selected="true" {/if} value=""></option>-->
{foreach from=$product_group key="key" item="item"}
<option
value="{$key}"
{if @in_array($key, $smarty.request.product_group) } selected="true" {/if}>
{$item}
</option>
{/foreach}
</select>
</td>
{/if}
{if !empty($product_group_2) }
<td rowspan='2'>
{$MOD.LBL_PRODUCT_GROUP_2}:
</td>
<td rowspan='2'>
<select multiple name="product_group_2[]" title="{$MOD.TIP_MULTIPLE}">
<!--<option {if @in_array("", $smarty.request.product_group_2) } selected="true" {/if} value=""></option>-->
{foreach from=$product_group_2 key="key" item="item"}
<option
value="{$key}"
{if @in_array($key, $smarty.request.product_group_2) } selected="true" {/if}>
{$item}
</option>
{/foreach}
</select>
</td>
{/if}
<td class="dataField" nowrap="nowrap">
{$MOD.LBL_PRODUCT}:
<input type="text" id="productName" value="{$productName}" name="productName" style="width:50%">
<input type="hidden" id="productId" name="productId" value="{$productId}">
<button
type="button"
id="selectProduct"
value="{$APP.LBL_ADD_BUTTON}"
title="Wybierz kontrahenta">
<img src="{sugar_getimagepath file="id-ff-select.png"}">
</button>
<button
type="button"
id="clearProduct"
value="Wyczyść"
title="Wyczyść">
<img src="{sugar_getimagepath file="id-ff-clear.png"}">
</button>
</td>
{if !empty($stock_array)}
<td rowspan='2'>
{$MOD.LBL_STOCK}:
</td>
<td rowspan='2'>
<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>
{/if}
</tr>
<tr> <td class="dataField" nowrap="nowrap">
{$MOD.LBL_CONTRACTOR}:
<input type="text" id="accountName" name="accountName" value="{$accountName}" style="width:50%">
<input type="hidden" id="accountId" name="accountId" value="{$accountId}">
<button
type="button"
id="selectAccount"
value="{$APP.LBL_ADD_BUTTON}"
title="Wybierz kontrahenta">
<img src="{sugar_getimagepath file="id-ff-select.png"}">
</button>
<button
type="button"
id="clearAccount"
value="Wyczyść"
title="Wyczyść">
<img src="{sugar_getimagepath file="id-ff-clear.png"}">
</button>
</td></tr>
</tbody>
</table>
<input type="submit" value="{$MOD.LBL_EXECUTE}" name='submit'>
<input class="button" name="clear" value="Wyczyść" type="button" onclick="location.href = 'index.php?module=EcmReports&action=AnalysisProductSale';">
</form>
{if count($DATA)>0}
<table id="myTable" class="tablesorter tablesorter-blue">
<thead>
<tr>
<th>{$MOD.LBL_NAME}</th>
{foreach from=$DATA key=key item=item}
<th>{$key}</th>
{/foreach}
<th>Suma</th>
</tr>
</thead>
<tbody>
<tr>
<td>{$MOD.LBL_NETTO}</td>
{foreach from=$ROWS.netto key=key item=item}
{assign var=sumanetto value=$sumanetto+$item}
<td style="text-align: right;">{$item|number_format:2:",":"."}</td>
{/foreach}
<td style="text-align: right;">{$sumanetto|number_format:2:",":"."}</td>
</tr>
<tr>
<td>{$MOD.LBL_PURCHASE}</td>
{foreach from=$ROWS.kupno key=key item=item}
{assign var=sumakupno value=$sumakupno+$item}
<td style="text-align: right;">{$item|number_format:2:",":"."}</td>
{/foreach}
<td style="text-align: right;">{$sumakupno|number_format:2:",":"."}</td>
</tr>
<tr>
<td>{$MOD.LBL_INCOME}</td>
{foreach from=$ROWS.marza key=key item=item}
{assign var=sumamarza value=$sumamarza+$item}
<td style="text-align: right;">{$item|number_format:2:",":"."}</td>
{/foreach}
<td style="text-align: right;">{$sumamarza|number_format:2:",":"."}</td>
</tr>
<tr>
<td> Ilość razem</td>
{foreach from=$ROWS.ilosc key=key item=item}
{assign var=sumamarzaprocent value=$sumamarzaprocent+$item}
<td style="text-align: right;">{$item|number_format:2:",":"."} </td>
{/foreach}
<td style="text-align: right;">{$sumamarzaprocent|number_format:2:",":"."} </td>
</tr>
<tr>
<td> Średnia cena</td>
{foreach from=$ROWS.srednia key=key item=item}
{assign var=sumamt value=$sumamt+$item}
<td style="text-align: right;">{$item|number_format:2:",":"."} </td>
{/foreach}
<td style="text-align: right;">{$sumanetto/$sumamarzaprocent|number_format:2:",":"."} </td>
</tr>
<tr>
<td>{$MOD.LBL_OVERHEAD} %</td>
{foreach from=$ROWS.marzaprocent key=key item=item}
{assign var=sumamarzaprocent value=$sumamarzaprocent+$item}
<td style="text-align: right;">{$item|number_format:2:",":"."} %</td>
{/foreach}
<td style="text-align: right;">{$sumamarzaprocent/12|number_format:2:",":"."} %</td>
</tr>
</tbody>
</table>
{/if}
<div id="chart_div" style="width: 100%; height: 500px;"></div>
<div id="chart_div_ilosc" style="width: 100%; height: 500px;"></div>
<!-- Tablesorter script: required -->
<script src="include/jQuery/tablesorter/jquery.tablesorter.min.js"></script>
<link class="theme" rel="stylesheet" href="include/jQuery/tablesorter/themes/blue/style.css">
<script src="modules/EcmReports/javascript/AnalysisProductSale.js"></script>