From aa2a24067c0688023f12caa460e2966799c87ef2 Mon Sep 17 00:00:00 2001 From: kjokmjnoi Date: Thu, 26 Feb 2026 23:30:52 +0100 Subject: [PATCH] =?UTF-8?q?Gy=C3=A1rt=C3=A1si=20selejt=20r=C3=B6gz=C3=ADt?= =?UTF-8?q?=C5=91=20menu?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dashboard/production_scrap.php | 756 +++++++++++++++++++++++++++++++++ managers/menu.php | 11 + 2 files changed, 767 insertions(+) create mode 100644 dashboard/production_scrap.php diff --git a/dashboard/production_scrap.php b/dashboard/production_scrap.php new file mode 100644 index 0000000..c4ba8c5 --- /dev/null +++ b/dashboard/production_scrap.php @@ -0,0 +1,756 @@ +25 db / oldal + + + + + "; + $perpageselect = str_replace("value='".$maxperpage."'", "value='".$maxperpage."' selected", $perpageselect); + + $json = json_encode(array( + 'perpage' => $perpageselect, + 'result' => 'ok' + )); + + echo $json; + } else if (htmlspecialchars($_POST["func"]) == "LoadTable") { + $maxperpage = intval(htmlspecialchars($_POST["perpage"])); + $cpage = intval(htmlspecialchars($_POST["cpage"])); + + $item_id = htmlspecialchars(str_replace(' ', '+', $_POST['item_id'])); + $date = htmlspecialchars($_POST["date"]); + $is_saved = htmlspecialchars($_POST["is_saved"]); + + $addquery = ""; + $isfirst = true; + + if ($cpage == 0) { + $cpage = 1; + } + setcookie("maxperpage", $maxperpage, time() + (86400 * 90), "/"); + + + if ($item_id != "") { + if ($isfirst) { + $addquery = $addquery." WHERE item_id LIKE '%".$item_id."%'"; + $isfirst = false; + } else { + $addquery = $addquery." and item_id LIKE '%".$item_id."%'"; + } + } + + if ($date != "") { + if ($isfirst) { + $addquery = $addquery." WHERE DATE(FROM_UNIXTIME(scrap_date)) = '".$date."'"; + $isfirst = false; + } else { + $addquery = $addquery." and DATE(FROM_UNIXTIME(scrap_date)) = '".$date."'"; + } + } + + if ($is_saved != "") { + if ($is_saved == "1") { + if ($isfirst) { + $addquery = $addquery." WHERE is_saved = '1'"; + $isfirst = false; + } else { + $addquery = $addquery." and is_saved = '1'"; + } + } else { + if ($isfirst) { + $addquery = $addquery." WHERE COALESCE(is_saved, 0) != 1"; + $isfirst = false; + } else { + $addquery = $addquery." and COALESCE(is_saved, 0) != 1"; + } + } + } + + $sql = mysqli_query($conn,"SELECT COUNT(*) FROM scrap_production".$addquery); + $count = mysqli_fetch_array($sql)[0]; + + $addquery = $addquery." ORDER BY scrap_date DESC"; + + $maxpage = ceil($count / $maxperpage); + if (!($cpage >= 1 && $cpage <= $maxpage)) { + $cpage = 1; + } + + $limit = ($cpage - 1) * $maxperpage; + + $responseStr = ''; + + $query = "SELECT scrap_id, place, reason, item_id, scrap_date, is_saved FROM scrap_production".$addquery." LIMIT $limit, $maxperpage"; + if ($result = $conn->query($query)) { + while ($c_prod = $result->fetch_assoc()) { + + if ($responseStr != "") { + $responseStr .= "|%|"; + } + $responseStr .= $c_prod['scrap_id'].'/!/'.$c_prod['item_id'].'/!/'.$c_prod['place'].'/!/'.$c_prod['reason'].'/!/'.date("Y. m. d.", $c_prod['scrap_date']).'/!/'.$c_prod['is_saved']; + } + } + + echo '{"result": "ok", "data": "'.$responseStr.'", "maxpage": "'.$maxpage.'", "cpage": "'.$cpage.'"}'; + + } else if (htmlspecialchars($_POST["func"]) == "CreateScrap") { + $item_id = htmlspecialchars(str_replace(' ', '+', $_POST['item_id'])); + $sql = mysqli_query($conn,"INSERT INTO scrap_production(item_id) VALUES ('$item_id')"); + $sid = mysqli_insert_id($conn); + + $json = json_encode(array( + 'scrap_id' => $sid, + 'result' => 'ok' + )); + + echo $json; + } else if (htmlspecialchars($_POST["func"]) == "OpenScrap") { + $sid = htmlspecialchars($_POST["scrap_id"]); + + $sql = mysqli_query($conn,"SELECT * FROM scrap_production WHERE scrap_id = '$sid'"); + $data = mysqli_fetch_array($sql); + + $json = json_encode(array( + 'data' => $data, + 'result' => 'ok' + )); + + echo $json; + } else if (htmlspecialchars($_POST["func"]) == "AutoSaveScrap") { + $scrap_id = htmlspecialchars($_POST["scrap_id"]); + $param = htmlspecialchars($_POST["param"]); + $value = htmlspecialchars($_POST["value"]); + + $params = ['item_id', 'right_db', 'left_db', 'place', 'reason', 'source', 'note', 'scrap_date', 'is_saved']; + if (!(!empty($param) && in_array($param,$params))) { + echo json_encode(array('result' => 'Hibás paraméter lett megadva!')); + exit(); + } + + if ($param == "scrap_date" && $value != "") { + $value = strtotime($value); + } + + if ($param == "item_id" && $value != "") { + $sql = mysqli_query($conn,"SELECT item_id FROM pr_parameters WHERE item_id = '$value'"); + $data = mysqli_fetch_array($sql); + if ($data != null) { + $value = $data['item_id']; + } else { + echo json_encode(array('result' => 'Nem létező cikkszámot adott meg!')); + exit(); + } + } + + if ($scrap_id != "") { + $sql = mysqli_query($conn,"UPDATE scrap_production SET $param='$value' WHERE scrap_id = '$scrap_id'"); + } else { + $sql = mysqli_query($conn, "INSERT INTO scrap_production($param) VALUES ('$value')"); + $scrap_id = mysqli_insert_id($conn); + } + + echo json_encode(array('result' => 'ok', 'scrap_id' => $scrap_id)); + + } else if (htmlspecialchars($_POST["func"]) == "SaveScrap") { + $scrap_id = htmlspecialchars($_POST["scrap_id"]); + + $item_id = htmlspecialchars($_POST["item_id"]); + $right_db = htmlspecialchars($_POST["right_db"]); + $left_db = htmlspecialchars($_POST["left_db"]); + $place = htmlspecialchars($_POST["place"]); + $reason = htmlspecialchars($_POST["reason"]); + $source = htmlspecialchars($_POST["source"]); + $note = htmlspecialchars($_POST["note"]); + $scrap_date = htmlspecialchars($_POST["scrap_date"]); + + if ($scrap_date != "") { + $scrap_date = strtotime($scrap_date); + } + + if ($item_id != "") { + $sql = mysqli_query($conn,"SELECT item_id FROM scrap_production WHERE item_id = '$item_id'"); + $data = mysqli_fetch_array($sql); + if ($data != null) { + $item_id = $data['item_id']; + } else { + echo json_encode(array('result' => 'Nem létező cikkszámot adott meg!')); + exit(); + } + } + + if ($scrap_id == "") { + $sql = mysqli_query($conn, "INSERT INTO scrap_production(item_id) VALUES ('$item_id')"); + $scrap_id = mysqli_insert_id($conn); + } + + $sql = mysqli_query($conn,"UPDATE scrap_production SET + item_id = '$item_id', + place = '$place', + reason = '$reason', + source = '$source', + note = '$note' + WHERE scrap_id = '$scrap_id'"); + + if ($scrap_date != "") { + $sql = mysqli_query($conn,"UPDATE scrap_production SET scrap_date = $scrap_date WHERE scrap_id = '$scrap_id'"); + } else { + $sql = mysqli_query($conn,"UPDATE scrap_production SET scrap_date = NULL WHERE scrap_id = '$scrap_id'"); + } + + if ($right_db != "") { + $sql = mysqli_query($conn,"UPDATE scrap_production SET right_db = $right_db WHERE scrap_id = '$scrap_id'"); + } else { + $sql = mysqli_query($conn,"UPDATE scrap_production SET right_db = 0 WHERE scrap_id = '$scrap_id'"); + } + + if ($left_db != "") { + $sql = mysqli_query($conn,"UPDATE scrap_production SET left_db = $left_db WHERE scrap_id = '$scrap_id'"); + } else { + $sql = mysqli_query($conn,"UPDATE scrap_production SET left_db = 0 WHERE scrap_id = '$scrap_id'"); + } + + echo json_encode(array('result' => 'ok', 'scrap_id' => $scrap_id)); + + } + + exit(); +} + + +?> + + + + + + + Kezelőfelület + + + + +
+
+

Title

+
+
+
+
+
+
+
+
+ + + +

Gyártási selejt

+ +
+
+

Cikkszám

+ +
+

Dátum kiválasztása:

+ +
+

Lezárt elemek:

+ +
+

Oldalanként:

+ +
+

:

+ +
+ +
+

:

+ +
+
+ +
+
+
+ +
+
+ + + + + + + + + + + + +
CikkszámKeletkezésének helyeSelejt okaDátumMegnyitás
+
+
+ +
+
+

<    0 / 0    >

+
+ +


+ + +
+ + + + diff --git a/managers/menu.php b/managers/menu.php index ca3bf35..7bd6d74 100644 --- a/managers/menu.php +++ b/managers/menu.php @@ -13,6 +13,7 @@ $linkProduction = "'production'"; $linkBoxing = "'boxing'"; $linkProductionStat = "'productionstat'"; + $linkProductionScrap = "'production_scrap'"; /* Rendeléskezelés */ $linkWarehouseOrders = "'wh_orders'"; @@ -152,6 +153,16 @@ '; } + if (UserHasPerm('production_classic') || UserHasPerm('production_injmold') || UserHasPerm("production_sporty")) { + if (!$isProduction) { $isProduction = true; $menuhtml .= '

Gyártás

'; } + $menuhtml .= ' + '; + } + /* Rendeléskezelés */ $isOrders = false; if (UserHasPerm('removal_from_warehouse') || UserHasPerm('warehouse_reservation') || UserHasPerm('warehouse_reservation_order')) {