Dobozolás tervező arányosítva tervez
This commit is contained in:
parent
5cd4e34016
commit
7ce5a96fe6
@ -310,6 +310,9 @@ if (isset($_POST["func"])) {
|
|||||||
$sql = mysqli_query($conn,"SELECT warehouse_total, warehouse_box FROM statistics_daily WHERE item_id = '$item_id'");
|
$sql = mysqli_query($conn,"SELECT warehouse_total, warehouse_box FROM statistics_daily WHERE item_id = '$item_id'");
|
||||||
$statistics_daily = mysqli_fetch_array($sql);
|
$statistics_daily = mysqli_fetch_array($sql);
|
||||||
|
|
||||||
|
$sql = mysqli_query($conn,"SELECT front_and_rear FROM pr_parameters WHERE item_id = '$item_id'");
|
||||||
|
$pr_parameters = mysqli_fetch_array($sql);
|
||||||
|
|
||||||
$sql = mysqli_query($conn,"SELECT * FROM system_params");
|
$sql = mysqli_query($conn,"SELECT * FROM system_params");
|
||||||
$system_params = [];
|
$system_params = [];
|
||||||
while ($row = mysqli_fetch_assoc($sql)) {
|
while ($row = mysqli_fetch_assoc($sql)) {
|
||||||
@ -318,7 +321,35 @@ if (isset($_POST["func"])) {
|
|||||||
|
|
||||||
$in_foil_warehouse = intval($statistics_daily['warehouse_total']) - intval($statistics_daily['warehouse_box']);
|
$in_foil_warehouse = intval($statistics_daily['warehouse_total']) - intval($statistics_daily['warehouse_box']);
|
||||||
$daily_consumption = ($statistics_annual["total_consumption"] ?? $system_params["default_total_consumption"]) / 365;
|
$daily_consumption = ($statistics_annual["total_consumption"] ?? $system_params["default_total_consumption"]) / 365;
|
||||||
|
|
||||||
$need_to_box = intval($system_params['box_holding']) * $daily_consumption - intval($statistics_daily['warehouse_box']);
|
$need_to_box = intval($system_params['box_holding']) * $daily_consumption - intval($statistics_daily['warehouse_box']);
|
||||||
|
if ($pr_parameters['front_and_rear'] == 'első') {
|
||||||
|
$len = strlen($item_id);
|
||||||
|
if ($len < 4) {
|
||||||
|
$padded = str_pad($item_id, 4, '0', STR_PAD_LEFT);
|
||||||
|
} else {
|
||||||
|
$padded = $item_id;
|
||||||
|
}
|
||||||
|
$searchItem_ID = $padded.'+____';
|
||||||
|
|
||||||
|
$need_to_box_set = 0;
|
||||||
|
|
||||||
|
$sql = mysqli_query($conn,"SELECT item_id, warehouse_box FROM statistics_daily WHERE item_id LIKE '$searchItem_ID'");
|
||||||
|
while ($row = mysqli_fetch_assoc($sql)) {
|
||||||
|
$c_item_id = $row['item_id'];
|
||||||
|
$annual_result_set = mysqli_query($conn, "SELECT * FROM statistics_annual WHERE item_id = '$c_item_id' AND year = (SELECT MAX(year) FROM statistics_annual WHERE item_id = '$c_item_id') LIMIT 1");
|
||||||
|
$statistics_annual_set = mysqli_fetch_assoc($annual_result_set);
|
||||||
|
$daily_consumption_set = ($statistics_annual_set["total_consumption"] ?? $system_params["default_total_consumption"]) / 365;
|
||||||
|
|
||||||
|
$need_to_box_set += max(0, intval($system_params['box_holding']) * $daily_consumption_set - intval($row['warehouse_box']));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($need_to_box + $need_to_box_set > 0) {
|
||||||
|
$ratio = $need_to_box_set / ($need_to_box + $need_to_box_set);
|
||||||
|
$rationed = $ratio * $in_foil_warehouse;
|
||||||
|
$need_to_box = min($need_to_box, max(0, $rationed));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$min_db = min(max(5, ceil($need_to_box)), $in_foil_warehouse);
|
$min_db = min(max(5, ceil($need_to_box)), $in_foil_warehouse);
|
||||||
|
|
||||||
|
|||||||
@ -209,7 +209,13 @@ if (isset($_GET['type'])) {
|
|||||||
|
|
||||||
if ($pr_param['front_and_rear'] == "első") {
|
if ($pr_param['front_and_rear'] == "első") {
|
||||||
|
|
||||||
$searchItem_ID = $item_id.'+____';
|
$len = strlen($item_id);
|
||||||
|
if ($len < 4) {
|
||||||
|
$padded = str_pad($item_id, 4, '0', STR_PAD_LEFT);
|
||||||
|
} else {
|
||||||
|
$padded = $item_id;
|
||||||
|
}
|
||||||
|
$searchItem_ID = $padded.'+____';
|
||||||
|
|
||||||
$sql_wh = mysqli_query($conn,"SELECT SUM(under_sales) as under_sales FROM statistics_daily WHERE item_id LIKE '$searchItem_ID'");
|
$sql_wh = mysqli_query($conn,"SELECT SUM(under_sales) as under_sales FROM statistics_daily WHERE item_id LIKE '$searchItem_ID'");
|
||||||
$set_box_count = mysqli_fetch_array($sql_wh);
|
$set_box_count = mysqli_fetch_array($sql_wh);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user