0.4, // Lower stock is more urgent (40% importance) 'price_value' => 0.3, // Higher price might indicate higher priority (30% importance) 'turnover_rate' => 0.3 // Higher turnover rate means faster selling (30% importance) ]; // Check if form was submitted with custom weights $weights = $default_weights; if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['submit_weights'])) { $weights = [ 'stock_level' => floatval($_POST['weight_stock']), 'price_value' => floatval($_POST['weight_price']), 'turnover_rate' => floatval($_POST['weight_turnover']) ]; // Normalize weights to ensure they sum to 1 $total = array_sum($weights); if ($total > 0) { foreach ($weights as $key => $value) { $weights[$key] = $value / $total; } } else { $weights = $default_weights; } } // Get restocking priorities using TOPSIS $restock_priorities = restockWithTOPSIS($conn, $weights); // Check if any error occurred $error_message = ""; if (isset($restock_priorities['error'])) { $error_message = $restock_priorities['error']; $restock_priorities = []; } // Calculate total products and those needing restocking (stock < 10) $total_products = count($restock_priorities); $low_stock_count = 0; foreach ($restock_priorities as $product) { if ($product['stok'] < 10) { $low_stock_count++; } } // Get current date and time $current_date = date('Y-m-d H:i:s'); // Page title $page_title = "Analisis Restok dengan Metode TOPSIS"; ?> <?php echo $page_title; ?>

Total Produk

Produk Stok Rendah

Stok < 10
Tanggal Analisis

Kustomisasi Bobot Kriteria

Nilai lebih tinggi = stok rendah lebih penting
Nilai lebih tinggi = harga tinggi lebih penting
Nilai lebih tinggi = penjualan cepat lebih penting
Distribusi Bobot

Hasil Analisis TOPSIS

0.7) { $priority_class = 'priority-high'; } elseif ($product['topsis_score'] > 0.4) { $priority_class = 'priority-medium'; } else { $priority_class = 'priority-low'; } ?>
Prioritas ID Barang Nama Barang Stok Saat Ini Harga Skor TOPSIS Aksi
Rp
Ekspor Data