getConnection(); // --- LISTE --- $linee = $pdo->query("SELECT id, line_number, name FROM production_lines ORDER BY line_number")->fetchAll(); $status_list = $pdo->query("SELECT id, nome, badge_color, line_color FROM production_status ORDER BY ordinamento, nome")->fetchAll(PDO::FETCH_ASSOC); // --- CARICO TUTTE LE PRODUZIONI UNA VOLTA SOLA --- $sql = "SELECT p.*, m.nome AS matrice, ms.nome AS mescola, l.name AS linea, c.nome AS cliente, s.nome AS status_nome, COALESCE(s.badge_color, '#6c757d') AS badge_color, COALESCE(s.line_color, '#ffffff') AS line_color FROM productiondata p LEFT JOIN matrice m ON p.idmatrice = m.id LEFT JOIN mescole ms ON p.idmescola = ms.id LEFT JOIN production_lines l ON p.id_linea = l.id LEFT JOIN clients c ON p.id_cliente = c.id LEFT JOIN production_status s ON p.id_status = s.id ORDER BY p.data_produzione DESC, p.Data DESC, p.id DESC"; $rows = $pdo->query($sql)->fetchAll(PDO::FETCH_ASSOC); // --- RECORD SPECIALI (IN PRODUZIONE / PAUSA / PROBLEMA) --- $rows_special = array_filter($rows, function ($r) { return in_array((int)$r['id_status'], [2, 7, 8]); }); ?> Produzione - Vista Manageriale | <?= $titlewebsite ?>
Produzione in corso / pausa / problema
Matrice Mescola Linea Cliente Data Zibo Data Cliente Metri Kg SP Ore previste Timer Status Foto
Nessuna produzione attualmente in stato In produzione / Pausa / Problema.
Tutte le produzioni (vista manageriale)
Matrice Mescola Linea Cliente Data Zibo Data Cliente Metri Kg SP Kg P Kg prod. Scarto (kg) Scarto % Ore previste Tempo lavoro Status Foto
0 ? number_format($scartoPct, 1, ',', '.') . ' %' : '-' ?>