InsideOrders fix
This commit is contained in:
@@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -152,7 +150,7 @@ $edit->ss->assign("STOCK_PW", $stock_pw);
|
|||||||
$edit->ss->assign("STOCK_RW", $stock_rw);
|
$edit->ss->assign("STOCK_RW", $stock_rw);
|
||||||
$edit->ss->assign("EMPLOYERS", $eas);
|
$edit->ss->assign("EMPLOYERS", $eas);
|
||||||
if (isset($products)) {
|
if (isset($products)) {
|
||||||
$edit->ss->assign("POSITION_LIST", str_replace('"', "'", json_encode($products)));
|
$edit->ss->assign("POSITION_LIST", str_replace('"', "'", json_encode($products)));
|
||||||
}
|
}
|
||||||
echo $edit->display ();
|
echo $edit->display ();
|
||||||
//loading view
|
//loading view
|
||||||
|
|||||||
@@ -1,124 +1,130 @@
|
|||||||
//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
|
||||||
lockEnter();
|
lockEnter();
|
||||||
//// 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();
|
||||||
|
|
||||||
$("#register_date").prop("disabled", true);
|
$("#register_date").prop("disabled", true);
|
||||||
$("#assigned_user_name").prop("disabled", true);
|
$("#assigned_user_name").prop("disabled", true);
|
||||||
//$("#register_date_trigger").hide();
|
//$("#register_date_trigger").hide();
|
||||||
$("#btn_assigned_user_name").hide();
|
$("#btn_assigned_user_name").hide();
|
||||||
$("#btn_clr_assigned_user_name").hide();
|
$("#btn_clr_assigned_user_name").hide();
|
||||||
|
|
||||||
if (($("#new_number").val() == true)
|
if (($("#new_number").val() == true)
|
||||||
&& ($("#duplicate").val() != true)) {
|
&& ($("#duplicate").val() != true)) {
|
||||||
generateNumber();
|
generateNumber();
|
||||||
} else if (($("#new_number").val() == true)
|
} else if (($("#new_number").val() == true)
|
||||||
&& ($("#duplicate").val() == true)) {
|
&& ($("#duplicate").val() == true)) {
|
||||||
generateNumber();
|
generateNumber();
|
||||||
getParentInfo($("#parent_id").val(),
|
getParentInfo($("#parent_id").val(),
|
||||||
$("#parent_type :selected").val());
|
$("#parent_type :selected").val());
|
||||||
getItems();
|
getItems();
|
||||||
} else {
|
} else {
|
||||||
getParentInfo($("#parent_id").val(),
|
getParentInfo($("#parent_id").val(),
|
||||||
'Accounts');
|
'Accounts');
|
||||||
getItems();
|
getItems();
|
||||||
$("#rw_stock_id").val(($("#stock_rw :selected").val()));
|
$("#rw_stock_id").val(($("#stock_rw :selected").val()));
|
||||||
$("#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) {
|
||||||
// SetTab('ITEMS');
|
// SetTab('ITEMS');
|
||||||
// //checkProducts();
|
// //checkProducts();
|
||||||
// //disable stock change
|
// //disable stock change
|
||||||
// //$("#stock_pw").prop("disabled", true);
|
// //$("#stock_pw").prop("disabled", true);
|
||||||
// $("#stock_rw").prop("disabled", true);
|
// $("#stock_rw").prop("disabled", true);
|
||||||
//}
|
//}
|
||||||
};
|
};
|
||||||
// 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();
|
||||||
items = data;
|
rawData = rawData.replace(/"(\d+)"/g, '\\"$1\\"');
|
||||||
FillTable(data, false);
|
rawData = rawData.replace(/'/g, '"');
|
||||||
}
|
const data = JSON.parse(rawData);
|
||||||
$("#stock_rw").change(function() {
|
items = data;
|
||||||
for (var i = 0; i < items.length; i++) {
|
FillTable(data, false);
|
||||||
if (items[i].product_component === 1) {
|
checkProducts();
|
||||||
refreshStock(i, 1);
|
}
|
||||||
}
|
$("#stock_rw").change(function () {
|
||||||
}
|
for (var i = 0; i < items.length; i++) {
|
||||||
});
|
if (items[i].product_component === 1) {
|
||||||
$("#stock_pw").change(function() {
|
refreshStock(i, 1);
|
||||||
for (var i = 0; i < items.length; i++) {
|
}
|
||||||
if (items[i].product_component === 0) {
|
}
|
||||||
refreshStock(i, 0);
|
});
|
||||||
}
|
$("#stock_pw").change(function () {
|
||||||
}
|
for (var i = 0; i < items.length; i++) {
|
||||||
});
|
if (items[i].product_component === 0) {
|
||||||
// enc mz
|
refreshStock(i, 0);
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// enc mz
|
||||||
|
});
|
||||||
// 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");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$(".loading_panel").css("display", "block");
|
$(".loading_panel").css("display", "block");
|
||||||
$("#register_date").prop("disabled", false);
|
$("#register_date").prop("disabled", false);
|
||||||
$("#assigned_user_name").prop("disabled", false);
|
$("#assigned_user_name").prop("disabled", false);
|
||||||
|
|
||||||
$("#position_list").val(JSON.stringifyNoSecurity(items));
|
|
||||||
|
|
||||||
var check = checkProducts();
|
|
||||||
|
|
||||||
$(".loading_panel").css("display", "none");
|
$("#position_list").val(JSON.stringifyNoSecurity(items));
|
||||||
if (check_form_(formname) == false || check == false) {
|
|
||||||
$("#register_date").prop("disabled", true);
|
var check = checkProducts();
|
||||||
$("#assigned_user_name").prop("disabled", true);
|
|
||||||
window.onbeforeunload = confirmExit;
|
$(".loading_panel").css("display", "none");
|
||||||
$(".loading_panel").css("display", "none");
|
if (check_form_(formname) == false || check == false) {
|
||||||
return false;
|
$("#register_date").prop("disabled", true);
|
||||||
} else {
|
$("#assigned_user_name").prop("disabled", true);
|
||||||
return true;
|
window.onbeforeunload = confirmExit;
|
||||||
}
|
$(".loading_panel").css("display", "none");
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
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;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|||||||
Reference in New Issue
Block a user