This commit is contained in:
2024-04-27 09:23:34 +02:00
commit 11e713ca6f
11884 changed files with 3263371 additions and 0 deletions

View File

@@ -0,0 +1,55 @@
$(document).ready(function () {
$("#allTable").tablesorter({
sortList: [[1, 1]],
theme: 'blue',
widthFixed: true,
widgets: ['filter', 'zebra', 'stickyHeaders'],
fixedWidth: true,
widgetOptions: {
filter_formatter: {
0: function ($cell, indx) {
return $.tablesorter.filterFormatter.select2($cell, indx, {
match: true
});
},
4: function ($cell, indx) {
return $.tablesorter.filterFormatter.select2($cell, indx, {
match: true
});
},
5: function ($cell, indx) {
return $.tablesorter.filterFormatter.select2($cell, indx, {
match: true
});
},
6: function ($cell, indx) {
return $.tablesorter.filterFormatter.select2($cell, indx, {
match: true
});
},
7: function ($cell, indx) {
return $.tablesorter.filterFormatter.select2($cell, indx, {
match: true
});
},
}
}
});
$("#allTable").bind('filterEnd', function (event, config) {
calculatreCount();
});
});
function calculatreCount() {
var count = 0;
var sum = 0;
$("#allTable").find("tr").each(function (index) {
if (index >= 2 && $(this).css('display') === 'table-row' && $(this).find("td").length > 3) {
count++;
}
});
$("#allDataCount").html(count);
}
function updateColumns() {
console.log($("#display_tabs").val());
}

View File

@@ -0,0 +1,54 @@
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED);
$db = $GLOBALS['db'];
global $app_list_strings;
//config
$allFields = array('name','code','qty','group_ks', );
$showFields = array('name', 'qty', 'code', 'group_ks', 'ean', 'brand', 'shape','group', 'status', 'category');
// get data
$allQuery = "
SELECT p.* FROM ecmproducts as p
WHERE p.deleted=0 ORDER BY code ASC";
$rows = $db->query($allQuery);
$statesRes = $db->query("
SELECT SUM(quantity) as qty, product_id FROM ecmstockstates
GROUP BY product_id");
$states = array();
while( $r = $db->fetchByAssoc ( $statesRes )) {
$states[$r['product_id']] = round($r['qty']);
}
$allData = array();
while( $r = $db->fetchByAssoc ( $rows )) {
$row = array();
$row['id'] = $r['id'];
$row['name'] = $r['name'];
$row['code'] = $r['code'];
$row['qty'] = $states[$r['id']] ? $states[$r['id']] : 0;
$row['group_ks'] = $app_list_strings['ecmproducts_group_ks_dom'][$r['group_ks']];
$row['group'] = $app_list_strings['ecmproducts_group_dom'][$r['product_group']];
$row['category'] = $app_list_strings['ecmproducts_category_dom'][$r['category']];
$row['ean'] = $r['ean'];
$row['brand'] = $app_list_strings['ecmproducts_brand_dom'][$r['brand']];
$row['status'] = $app_list_strings['ecmproducts_status_dom'][$r['status']];
$row['shape'] = $app_list_strings['ecmproducts_shape_dom'][$r['shape']];
$allData[] = $row;
}
echo "Products: ".count($allData)."<br>";
// prepare template
$smarty = new Sugar_Smarty ();
$smarty->assign("allDataCount", count($allData));
$smarty->assign("allData", $allData);
$smarty->assign("allFields", $allFields);
$smarty->assign("showFields", $showFields);
echo $smarty->display ( 'modules/EcmProducts/BimIT-ListView/productsListView.tpl' );

View File

@@ -0,0 +1,273 @@
<script type="text/javascript" src="modules/EcmReports/javascript/jquery.js"></script>
<link rel="stylesheet" href="modules/EcmReports/BimIT-Reports/lib/tablesorter-2.31.3/dist/css/theme.blue.min.css">
<script type="text/javascript"
src="modules/EcmReports/BimIT-Reports/lib/tablesorter-2.31.3/dist/js/jquery.tablesorter.js"></script>
<script type="text/javascript"
src="modules/EcmReports/BimIT-Reports/lib/tablesorter-2.31.3/dist/js/jquery.tablesorter.widgets.js">
</script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/select2/3.4.6/select2.min.css" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/3.4.6/select2.min.js"></script>
<script type="text/javascript"
src="modules/EcmReports/BimIT-Reports/lib/tablesorter-2.31.3/dist/js/widgets/widget-filter-formatter-select2.min.js">
</script>
<script type="text/javascript" src="modules/EcmReports/javascript/jquery.blockUI.js"></script>
<script type="text/javascript" src="modules/EcmProducts/BimIT-ListView/productsListView.js"></script>
<!-- HEADER -->
<table id="tableMenu" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td>
<img src="themes/Sugar5/images/CaseReports.gif" style="margin-top: 3px; margin-right: 3px;" width="16"
height="16">
</td>
<td>
<h2>Produkty</h2>
</td>
</tr>
</table>
<!-- CUSTOMIZATION-->
<!--
<input type="button" id="show_customization_panel" value="Edycja widoku">
<form>
<div style="" class="edit view search basic">
<div style="" id="inlineSavedSearch">
<table width="100%" border="0" cellspacing="0" cellpadding="0"
style="border-top: 0px none; margin-bottom: 4px">
<tbody>
<tr valign="top">
<td width="34%" align="left" rowspan="4" colspan="2">
<input id="displayColumnsDef" type="hidden" name="displayColumns">
<input id="hideTabsDef" type="hidden" name="hideTabs">
<div id="edit_tabs" style="">
<table cellpadding="0" cellspacing="0" border="0">
<tbody>
<tr>
<td>&nbsp;</td>
<td scope="row" id="chooser_display_tabs_text" align="center">
<nobr>Wyświetl kolumny</nobr>
</td>
<td>&nbsp;</td>
<td scope="row" id="chooser_hide_tabs" align="center">
<nobr>Ukryj kolumny</nobr>
</td>
<td>&nbsp;</td>
</tr>
<tr>
<td valign="top" style="padding-right: 2px; padding-left: 2px;"
align="center"><a
onclick="SUGAR.tabChooser.up('display_tabs','display_tabs','hide_tabs'); updateColumns();"><img
src="themes/Sugar5/images/uparrow_big.gif?s=bed8cd35065048ceebdc639ebe305e2c&amp;c=1"
width="13" height="13" border="0" style="margin-bottom: 1px;"
alt="Sortuj"></a><br>
<a
onclick="SUGAR.tabChooser.down('display_tabs','display_tabs','hide_tabs'); updateColumns();"><img
src="themes/Sugar5/images/downarrow_big.gif?s=bed8cd35065048ceebdc639ebe305e2c&amp;c=1"
width="16" height="16" border="0" style="margin-top: 1px;"
alt="Sortuj"></a>
</td>
<td align="center">
<table border="0" cellspacing="0" cellpadding="0" align="center">
<tbody>
<tr>
<td id="display_tabs_td" align="center"><select size="7"
name="display_tabs[]" multiple="" id="display_tabs">
<option value="NAME">
Nazwa
</option>
<option value="STOCK_QTY">Na stanie</option>
<option value="PRODUCT_CATEGORY_NAME">Kategoria
</option>
<option value="STAN">Aktualny</option>
</select></td>
</tr>
</tbody>
</table>
</td>
<td valign="top" style="padding-right: 2px; padding-left: 2px;"
align="center"><a
onclick="SUGAR.tabChooser.right_to_left('display_tabs','hide_tabs', '7', '7', ''); updateColumns();"><img
src="themes/Sugar5/images/leftarrow_big.gif?s=bed8cd35065048ceebdc639ebe305e2c&amp;c=1"
width="16" height="16" border="0" style="margin-right: 1px;"
alt="Sortuj"></a><a
onclick="SUGAR.tabChooser.left_to_right('display_tabs','hide_tabs', '7', '7'); updateColumns();"><img
src="themes/Sugar5/images/rightarrow_big.gif?s=bed8cd35065048ceebdc639ebe305e2c&amp;c=1"
width="16" height="16" border="0" style="margin-left: 1px;"
alt="Sortuj"></a></td>
<td id="hide_tabs_td" align="center"><select size="7" name="hide_tabs[]"
multiple="">
<option value="GROUP_KS">Grupa księgowa</option>
<option value="ORDERED">Ilość</option>
<option value="PIECES_PER_CARTON">Ppc</option>
<option value="SALE_QTY">Średnia cena sprzedaży</option>
<option value="SALE_AVG_PRICE">Średnia cena zakupu</option>
<option value="EDIT_BTN">&nbsp;</option>
<option value="CODE">Indeks Produktu</option>
</select></td>
<td valign="top" style="padding-right: 2px; padding-left: 2px;"
align="center">
<script>
var object_refs = new Object();
object_refs['hide_tabs'] = document.getElementById('hide_tabs');
</script>
<script>
object_refs['display_tabs'] = document.getElementById(
'display_tabs');
</script>
</td>
</tr>
</tbody>
</table>
<br>
</div>
</td>
<td scope="row" align="left" width="10%">
Porządkuj po kolumnie
</td>
<td width="23%">
<select name="orderBy" id="orderBySelectt">
</select>
</td>
<td scope="row" width="10%">
Kierunek
</td>
<td width="23%">
<input id="sort_order_desc_radio" type="radio" name="sortOrder" value="DESC"> <span
onclick="document.getElementById(&quot;sort_order_desc_radio&quot;).checked = true"
style="cursor: pointer; cursor: hand">Malejąco</span><br>
<input id="sort_order_asc_radio" type="radio" name="sortOrder" value="ASC" checked=""> <span
onclick="document.getElementById(&quot;sort_order_asc_radio&quot;).checked = true"
style="cursor: pointer; cursor: hand">Rosnąco</span>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</form>
-->
<!-- DATA -->
<table id="allTable">
<thead>
<tr>
{if in_array('status', $showFields)}
<th>Status</th>
{/if}
{if in_array('code', $showFields)}
<th>Indeks</th>
{/if}
{if in_array('name', $showFields)}
<th>Nazwa</th>
{/if}
{if in_array('qty', $showFields)}
<th>Stan</th>
{/if}
{if in_array('category', $showFields)}
<th>Kategoria</th>
{/if}
{if in_array('group', $showFields)}
<th>Grupa produktowa</th>
{/if}
{if in_array('brand', $showFields)}
<th>Marka</th>
{/if}
{if in_array('shape', $showFields)}
<th>Forma</th>
{/if}
{if in_array('group_ks', $showFields)}
<th>Grupa księgowa</th>
{/if}
{if in_array('ean', $showFields)}
<th>EAN</th>
{/if}
</tr>
</thead>
<br><br>
<b>Ilość produktów:&nbsp;<div id="allDataCount">{$allDataCount}</div></b>
<tbody aria-live="polite" aria-relevant="all">
{foreach from=$allData item=ROW name=loop}
{if $smarty.foreach.loop.index % 2 == 1}
<tr>
{else}
<tr style="background-color: #e6e6e6;" role="row">
{/if}
{if in_array('status', $showFields)}
<td>
{$ROW.status}
</td>
{/if}
{if in_array('code', $showFields)}
<td>
<a target="_blank" href="index.php?module=EcmProducts&action=DetailView&record={$ROW.id}">
{$ROW.code}
</a>
</td>
{/if}
{if in_array('name', $showFields)}
<td>
{$ROW.name}
</td>
{/if}
{if in_array('qty', $showFields)}
<td>
{$ROW.qty}
</td>
{/if}
{if in_array('category', $showFields)}
<td>
{$ROW.category}
</td>
{/if}
{if in_array('group', $showFields)}
<td style="white-space: nowrap;">
{$ROW.group}
</td>
{/if}
{if in_array('brand', $showFields)}
<td>
{$ROW.brand}
</td>
{/if}
{if in_array('shape', $showFields)}
<td>
{$ROW.shape}
</td>
{/if}
{if in_array('group_ks', $showFields)}
<td style="white-space: nowrap;">
{$ROW.group_ks}
</td>
{/if}
{if in_array('ean', $showFields)}
<td>
{$ROW.ean}
</td>
{/if}
</tr>
{/foreach}
</tbody>
</table>