production - restore old version

This commit is contained in:
Michał Zieliński
2025-09-08 09:04:46 +02:00
parent 7a3f58a551
commit b8b076ebe7
2 changed files with 498 additions and 477 deletions

View File

@@ -52,7 +52,8 @@ $(document).ready(function () {
try {
localStorage.setItem('productBySales_sort',
$("#allTable")[0].config.sortList[0][0] + '|' + $("#allTable")[0].config.sortList[0][1]);
} catch { }
} catch {
}
});
setTimeout(() => {
@@ -66,13 +67,14 @@ $(document).ready(function () {
var tmp = sort.split('|');
$("#allTable")[0].config.sortList = [[parseInt(tmp[0]), parseInt(tmp[1])]];
$.tablesorter.sortOn($("#allTable")[0].config, [[parseInt(tmp[0]), parseInt(tmp[1])]]);
} catch { }
} catch {
}
}
}, 500);
$("#selectAll").click(function () {
if (this.checked) {
$(".allCheck").each(function() {
$(".allCheck").each(function () {
if ($(this).closest('tr').is(':visible')) {
$(this).prop('checked', true);
}
@@ -119,6 +121,7 @@ var TabsMainBlock = false;
var Components;
var RawMaterials;
var OrderTypes
function SetTab(tab_name) {
if (TabsMainBlock) return;
var TabMenu = document.getElementById('groupTabsPanels');
@@ -157,6 +160,7 @@ function SetTab(tab_name) {
$("#hideReadyProducts").val() === "false" ? $("#toogleReadyProducts").val("Ukryj gotowe") : $("#toogleReadyProducts").val("Pokaz gotowe");
}
}
function getComnponents() {
console.log("getComnponents");
var ids = [];
@@ -180,7 +184,9 @@ function getComnponents() {
ids
},
success: function (data) {
console.log(data);
var result = JSON.parse(data);
console.log(result);
Components = result;
drawComponents(result);
updateComponentsPositions();
@@ -192,6 +198,7 @@ function getComnponents() {
}
});
}
function drawComponents(data) {
$("#componentsTableContainer").html(componentsTablePrototype());
data.forEach((el, index) => {
@@ -202,11 +209,11 @@ function drawComponents(data) {
} else {
position += '<br>';
}
position += "<img src=\"modules/EcmQuotes/images/add_position.gif\" style=\"margin-top: 3px; margin-right: 3px; cursor: pointer\" width=\"12\" alt=\"\" onclick=\"addComponentToProductionScheduler('"+el.productId+"','"+el.productQty+"')\">";
position += "<img src=\"modules/EcmQuotes/images/add_position.gif\" style=\"margin-top: 3px; margin-right: 3px; cursor: pointer\" width=\"12\" alt=\"\" onclick=\"addComponentToProductionScheduler('" + el.productId + "','" + el.productQty + "')\">";
tr.append(position);
tr.append("<td>" + (index + 1) + "</td>");
tr.append("<td><a target=\"_blank\" href=\"index.php?module=EcmProducts&action=DetailView&record=" + el.productId + "\">" + el.productCode + "</a></td>");
tr.append("<td title=\"" + el.productFullName +"\">" + el.productName + "</td>");
tr.append("<td title=\"" + el.productFullName + "\">" + el.productName + "</td>");
tr.append("<td id=\"qty-" + el.productId + "\">" + el.productQty + "</td>");
tr.append("<td id=\"state-" + el.productId + "\">" + el.productStockState + "</td>");
tr.append("<td><a target=\"_blank\" href=\"index.php?module=EcmSales&action=DetailView&record=" + el.orderId + "\">" + el.orderNo + "</a></td>");
@@ -239,7 +246,7 @@ function drawComponents(data) {
$("#selectAllComponents").attr('checked', false);
$("#selectAllComponents").click(function () {
if (this.checked) {
$(".componentCheck").each(function() {
$(".componentCheck").each(function () {
if ($(this).closest('tr').is(':visible')) {
$(this).prop('checked', true);
}
@@ -249,6 +256,7 @@ function drawComponents(data) {
}
});
}
function filterComponents() {
let filtered = Components;
if (!showReadyProducts) {
@@ -260,6 +268,7 @@ function filterComponents() {
drawComponents(filtered);
updateComponentsPositions();
}
function getRawMaterials(previousTab) {
var ids = [];
if (previousTab === '1') {
@@ -310,6 +319,7 @@ function getRawMaterials(previousTab) {
}
});
}
function drawRawMaterials(data) {
$("#rawMaterialsTableContainer").html(rawMaterialsTablePrototype());
data.forEach((el, index) => {
@@ -317,7 +327,7 @@ function drawRawMaterials(data) {
tr.append("<td><input type=\"checkbox\" value=" + el.productId + " class=\"rawMaterialCheck\" /></td>");
tr.append("<td>" + (index + 1) + "</td>");
tr.append("<td><a target=\"_blank\" href=\"index.php?module=EcmProducts&action=DetailView&record=" + el.productId + "\">" + el.productCode + "</a></td>");
tr.append("<td title=\""+ el.productFullName +"\">" + el.productName + "</td>");
tr.append("<td title=\"" + el.productFullName + "\">" + el.productName + "</td>");
tr.append("<td id=\"qty-" + el.productId + "\">" + el.productQty + "</td>");
tr.append("<td>" + el.productUnit + "</td>");
tr.append("<td id=\"state-" + el.productId + "\">" + el.productStockState + "</td>");
@@ -355,7 +365,7 @@ function drawRawMaterials(data) {
$("#selectAllRawMaterials").attr('checked', false);
$("#selectAllRawMaterials").click(function () {
if (this.checked) {
$(".rawMaterialCheck").each(function() {
$(".rawMaterialCheck").each(function () {
if ($(this).closest('tr').is(':visible')) {
$(this).prop('checked', true);
}
@@ -365,6 +375,7 @@ function drawRawMaterials(data) {
}
});
}
function filterRawMaterials() {
let filtered = RawMaterials;
if (!showReadyProducts) {
@@ -376,6 +387,7 @@ function filterRawMaterials() {
drawRawMaterials(filtered);
updateRawMaterialsPositions();
}
function orderComponents() {
var ids = [];
$('input.componentCheck:checkbox:checked').each(function () {
@@ -396,6 +408,7 @@ function orderComponents() {
$("#orderComponentsForm").submit();
}
}
function createInsideOrder() {
var ids = [];
$('input.allCheck:checkbox:checked').each(function () {
@@ -414,6 +427,7 @@ function createInsideOrder() {
$("#insideOrderProducts").val(products.join('*'));
$("#createInsideOrderForm").submit();
}
function orderRawMaterials() {
var ids = [];
$('input.rawMaterialCheck:checkbox:checked').each(function () {
@@ -434,6 +448,7 @@ function orderRawMaterials() {
$("#orderRawMaterialsForm").submit();
}
}
function showLoader(msg = "Pobieranie danych") {
$.blockUI({
@@ -451,9 +466,11 @@ function showLoader(msg = "Pobieranie danych") {
message: msg
});
}
function hideLoader() {
$.unblockUI();
}
function updateAllPositions() {
var i = 0;
var sum = 0;
@@ -466,6 +483,7 @@ function updateAllPositions() {
});
$("#allTableSum").html(sum);
}
function updateComponentsPositions() {
var i = 0;
var sum = 0;
@@ -478,6 +496,7 @@ function updateComponentsPositions() {
});
$("#componentsTableSum").html(Math.ceil(sum));
}
function updateRawMaterialsPositions() {
var i = 0;
var sum = 0;
@@ -490,32 +509,34 @@ function updateRawMaterialsPositions() {
});
$("#rawMaterialsTableSum").html(Math.ceil(sum));
}
function componentsTablePrototype() {
return '<table id="componentsTable"><thead><tr><th class="filter-false"><input type="checkbox" id="selectAllComponents" /></th><th>Pozycja</th><th>Indeks</th><th>Nazwa</th><th>Ilość</th><th>Stan</th><th>ZS E5</th><th>Typ</th><th>Status</th><th>Produkt główny</th><th>Odbiorca</th><th>Forma</th><th>Marka</th><th>Data wysyłki</th></tr></thead><tbody aria-live="polite" aria-relevant="all"></tbody><tfoot><tr><td colspan=4></td><td id="componentsTableSum">0</td><td colspan="9"></td></tr></tfoot></table>'
}
function rawMaterialsTablePrototype() {
return '<table id="rawMaterialsTable"><thead><tr><th class="filter-false"><input type="checkbox" id="selectAllRawMaterials" /></th><th>Pozycja</th><th>Indeks</th><th>Nazwa</th><th>Ilość</th><th>JM.</th><th>Stan</th><th>Zamówiono</th><th>Dostawca</th><th>Zamówienie</th><th>Adres magazynowy</th></tr></thead><tbody aria-live="polite" aria-relevant="all"></tbody><tfoot><tr><td colspan=4></td><td id="rawMaterialsTableSum">0</td><td colspan="6"></td></tr></tfoot></table>'
}
function addToProductionScheduler(orderItemId) {
showLoader("Trwa dodawanie elementu do harmonogramu produkcji...");
$.ajax({
method: "get",
url: $(location).attr("href") + "&to_pdf=1&ajaxAction=addToProductionScheduler&itemId=" + orderItemId,
success: function ()
{
success: function () {
hideLoader();
$("#productScheduled-"+orderItemId).css('visibility', 'visible');
$("#productScheduled-" + orderItemId).css('visibility', 'visible');
window.alert("Dodano do harmonogramu produkcji.");
},
});
}
function addComponentToProductionScheduler(productId, qty) {
showLoader("Trwa dodawanie elementu do harmonogramu produkcji...");
$.ajax({
method: "get",
url: $(location).attr("href") + "&to_pdf=1&ajaxAction=addComponentToProductionScheduler&productId=" + productId + "&qty=" + qty,
success: function ()
{
success: function () {
hideLoader();
window.alert("Dodano do harmonogramu produkcji.");
},

View File

@@ -1,7 +1,7 @@
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED);
ini_set('display_errors', 0);
ini_set('display_startup_errors', 0);
//error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED);
$db = $GLOBALS['db'];
global $app_list_strings;