InsideOrders fix

This commit is contained in:
Michał Zieliński
2025-07-15 17:18:21 +02:00
parent 0068e3beec
commit 5173239e69
4 changed files with 126 additions and 123 deletions

View File

@@ -35,17 +35,14 @@ else if ($_REQUEST['isDuplicate']=="true") {
$duplicate=true; $duplicate=true;
//get data //get data
$focus->retrieve($_REQUEST['return_id']); $focus->retrieve($_REQUEST['return_id']);
} } else {
else {
$new_number=true; $new_number=true;
//dates
$focus->register_date = date("d.m.Y"); $focus->register_date = date("d.m.Y");
$OPT ['check_parent_id'] = false; $OPT ['check_parent_id'] = false;
// add mz@bim-it.pl 11.11.2023
$products = []; $products = [];
if ($_REQUEST['fromProductsBySalesReport']) { if ($_REQUEST['fromProductionScheduler']) {
$requestProducts = explode('*', $_POST['insideOrderProducts']); $requestProducts = explode('*', $_REQUEST['insideOrderProducts']);
if (is_array($requestProducts)) { if (is_array($requestProducts)) {
$position = 0; $position = 0;
foreach ($requestProducts as $p) { foreach ($requestProducts as $p) {
@@ -95,6 +92,7 @@ else {
$products[] = $row; $products[] = $row;
} }
} }
$focus->position_list = json_encode($products);
} }
} }
} }

View File

@@ -1,6 +1,6 @@
//START: //START:
$(document).ready( $(document).ready(
function() { function () {
// confirm exit // confirm exit
window.onbeforeunload = confirmExit; window.onbeforeunload = confirmExit;
// prevent submit by enter press // prevent submit by enter press
@@ -8,20 +8,20 @@ $(document).ready(
//// categories //// categories
getCategoriesList(); getCategoriesList();
$("#parent_name").change( $("#parent_name").change(
function() { function () {
$(".loading_panel").css("display", "block"); $(".loading_panel").css("display", "block");
setTimeout(function() { setTimeout(function () {
getParentInfo($("#parent_id").val(), 'Accounts'); getParentInfo($("#parent_id").val(), 'Accounts');
}, 1000); }, 1000);
}); });
// searchProductInput change // searchProductInput change
$('#searchProductsInput').keyup(function() { $('#searchProductsInput').keyup(function () {
searchProducts(); searchProducts();
}); });
$("#stock_pw").change(function() { $("#stock_pw").change(function () {
$("#pw_stock_id").val(($("#stock_pw :selected").val())); $("#pw_stock_id").val(($("#stock_pw :selected").val()));
}); });
$("#stock_rw").change(function() { $("#stock_rw").change(function () {
$("#rw_stock_id").val(($("#stock_rw :selected").val())); $("#rw_stock_id").val(($("#stock_rw :selected").val()));
}); });
DrawHeaders(); DrawHeaders();
@@ -49,7 +49,7 @@ $(document).ready(
$("#pw_stock_id").val(($("#stock_pw :selected").val())); $("#pw_stock_id").val(($("#stock_pw :selected").val()));
} }
// handle setItems // handle setItems
setITEMS = function() { setITEMS = function () {
SetTab('ITEMS'); SetTab('ITEMS');
//var formname = 'EditView'; //var formname = 'EditView';
//if (check_form_(formname) == true) { //if (check_form_(formname) == true) {
@@ -62,18 +62,22 @@ $(document).ready(
}; };
// add mz@bim-it.pl 11.11.2023 // add mz@bim-it.pl 11.11.2023
if ($("#position_list").val().length) { if ($("#position_list").val().length) {
const data = JSON.parse($("#position_list").val().replaceAll("'", '"')); let rawData = $("#position_list").val();
rawData = rawData.replace(/"(\d+)"/g, '\\"$1\\"');
rawData = rawData.replace(/'/g, '"');
const data = JSON.parse(rawData);
items = data; items = data;
FillTable(data, false); FillTable(data, false);
checkProducts();
} }
$("#stock_rw").change(function() { $("#stock_rw").change(function () {
for (var i = 0; i < items.length; i++) { for (var i = 0; i < items.length; i++) {
if (items[i].product_component === 1) { if (items[i].product_component === 1) {
refreshStock(i, 1); refreshStock(i, 1);
} }
} }
}); });
$("#stock_pw").change(function() { $("#stock_pw").change(function () {
for (var i = 0; i < items.length; i++) { for (var i = 0; i < items.length; i++) {
if (items[i].product_component === 0) { if (items[i].product_component === 0) {
refreshStock(i, 0); refreshStock(i, 0);
@@ -84,7 +88,7 @@ $(document).ready(
}); });
// handle save // handle save
var check_form_ = check_form; var check_form_ = check_form;
check_form = function(formname) { check_form = function (formname) {
window.onbeforeunload = null; window.onbeforeunload = null;
if (items.length == 0) { if (items.length == 0) {
alert("Brak produktów"); alert("Brak produktów");
@@ -110,13 +114,15 @@ check_form = function(formname) {
} }
}; };
function confirmExit() { function confirmExit() {
return ""; return "";
} }
function lockEnter() { function lockEnter() {
// prevent default // prevent default
$(window).keydown(function(event) { $(window).keydown(function (event) {
if (event.keyCode == 13 && $(":focus").prop('tagName')!='TEXTAREA') { if (event.keyCode == 13 && $(":focus").prop('tagName') != 'TEXTAREA') {
event.preventDefault(); event.preventDefault();
return false; return false;
} }

View File

@@ -702,8 +702,7 @@ function checkProducts() {
items[index].quantity = pqty; items[index].quantity = pqty;
} }
if (items[index].product_component == 1 if (items[index].product_component == 1) {
&& id == items[index].product_product_id) {
items[index].quantity = pqty * $("#quantity_comp_" + index).val(); items[index].quantity = pqty * $("#quantity_comp_" + index).val();
$("#quantity_" + index).val(FormatNumber(items[index].quantity, 4)); $("#quantity_" + index).val(FormatNumber(items[index].quantity, 4));
} }

View File

@@ -76,7 +76,7 @@
</table> </table>
</form> </form>
<form action="index.php?module=EcmInsideOrders&action=EditView&fromProductsBySalesReport=true" method="post" <form action="index.php?module=EcmInsideOrders&action=EditView&fromProductionScheduler=true" method="post"
target="_blank" id="createInsideOrderForm"> target="_blank" id="createInsideOrderForm">
<input id="insideOrderProducts" name="insideOrderProducts" type="hidden" value=""/> <input id="insideOrderProducts" name="insideOrderProducts" type="hidden" value=""/>
</form> </form>