importify various fixing
This commit is contained in:
@@ -16,10 +16,11 @@ if (isset($_POST['productId'])) {
|
||||
// Query per ottenere le analisi associate a ogni report con LEFT JOIN su analysisvocabulary
|
||||
$reportId = $report['idreports'];
|
||||
$queryAnalysis = "
|
||||
SELECT rp.*, av.nameanalysisvoc
|
||||
FROM result_project rp
|
||||
LEFT JOIN analysisvocabulary av ON rp.result_TestName = av.idanalysisvocabulary
|
||||
WHERE rp.idreports = $reportId";
|
||||
SELECT av.nameanalysisvoc, ap.test_Rating AS analysis_test_Rating
|
||||
FROM result_project rp
|
||||
LEFT JOIN analysis_project ap ON rp.idanalysis_project = ap.idAnalysis_Project
|
||||
LEFT JOIN analysisvocabulary av ON ap.result_TestName = av.idanalysisvocabulary
|
||||
WHERE rp.idreports = $reportId";
|
||||
$resultAnalysis = $conn->query($queryAnalysis);
|
||||
|
||||
// Mappa per aggregare i risultati delle analisi in base a 'result_TestName' e calcolare il peggior rating
|
||||
@@ -28,7 +29,7 @@ if (isset($_POST['productId'])) {
|
||||
$testName = $analysis['nameanalysisvoc'];
|
||||
|
||||
// Normalizza il rating per confrontare varianti diverse
|
||||
$normalizedRating = strtoupper(trim($analysis['test_Rating']));
|
||||
$normalizedRating = strtoupper(trim($analysis['analysis_test_Rating']));
|
||||
|
||||
// Gestiamo anche varianti come "Complies", "Doesn't Comply", "//" e "N/A"
|
||||
if ($normalizedRating === 'P' || $normalizedRating === 'PASS' || $normalizedRating === 'COMPLIES') {
|
||||
|
||||
@@ -19,17 +19,23 @@ $reportDetails = $stmt->get_result()->fetch_assoc();
|
||||
|
||||
// Query per ottenere le parti e i risultati del report con il nome dell'analista e delle parti
|
||||
$queryPartsAndResults = "
|
||||
SELECT rp.*,
|
||||
a.nameanalysisvoc AS testName,
|
||||
cv.namecompoundsvocabulary AS analytsName,
|
||||
pr.partsDescription,
|
||||
rp.result_UnitofMeasure -- Aggiunge l'unità di misura
|
||||
SELECT
|
||||
rp.*,
|
||||
a.nameanalysisvoc AS testName,
|
||||
cv.namecompoundsvocabulary AS analytsName,
|
||||
pr.partsDescription,
|
||||
pr.partsCode,
|
||||
rp.result_UnitofMeasure,
|
||||
rp.result_AnalytsRating AS analytsRating -- Renamed the field for clarity
|
||||
FROM result_project rp
|
||||
LEFT JOIN analysisvocabulary a ON rp.result_TestName = a.idanalysisvocabulary
|
||||
LEFT JOIN analysis_project ap ON rp.idanalysis_project = ap.idAnalysis_Project
|
||||
LEFT JOIN analysisvocabulary a ON ap.result_TestName = a.idanalysisvocabulary
|
||||
LEFT JOIN compundsvocabulary cv ON rp.result_AnalytsName = cv.idcompoundsvocabulary
|
||||
LEFT JOIN parts pr ON rp.idPart = pr.idParts
|
||||
WHERE rp.idreports = ?
|
||||
ORDER BY rp.result_TestName, rp.idPart";
|
||||
ORDER BY ap.result_TestName, rp.idPart;
|
||||
";
|
||||
|
||||
|
||||
$stmtParts = $conn->prepare($queryPartsAndResults);
|
||||
$stmtParts->bind_param("i", $idreports);
|
||||
@@ -209,6 +215,7 @@ $partsAndResults = $stmtParts->get_result();
|
||||
$currentPart = ''; // Variabile per tracciare la parte corrente
|
||||
|
||||
while ($row = $partsAndResults->fetch_assoc()) {
|
||||
//print_r($row);
|
||||
// Se il nome dell'analisi cambia, crea una nuova sezione per l'analisi
|
||||
if ($currentTestName != $row['testName']) {
|
||||
if ($currentTestName != '') {
|
||||
@@ -247,9 +254,9 @@ $partsAndResults = $stmtParts->get_result();
|
||||
|
||||
// Classificazione del rating
|
||||
$ratingClass = '';
|
||||
if (strtoupper($row['test_Rating']) == 'FAIL' || strtoupper($row['test_Rating']) == "DOESN'T COMPLY") {
|
||||
if (strtoupper($row['analytsRating']) == 'FAIL' || strtoupper($row['analytsRating']) == "DOESN'T COMPLY" || strtoupper($row['analytsRating']) == "F") {
|
||||
$ratingClass = 'rating-fail';
|
||||
} elseif (strtoupper($row['test_Rating']) == 'PASS' || strtoupper($row['test_Rating']) == 'COMPLIES') {
|
||||
} elseif (strtoupper($row['analytsRating']) == 'PASS' || strtoupper($row['analytsRating']) == 'COMPLIES' || strtoupper($row['analytsRating']) == 'P') {
|
||||
$ratingClass = 'rating-pass';
|
||||
} else {
|
||||
$ratingClass = 'rating-ambiguous';
|
||||
@@ -257,7 +264,7 @@ $partsAndResults = $stmtParts->get_result();
|
||||
|
||||
// Stampa i dettagli dell'analita
|
||||
echo '<tr>';
|
||||
echo '<td>' . (!empty($row['analytsName']) ? $row['analytsName'] . ' (ID: ' . $row['result_AnalytsName'] . ')' : ' ') . '</td>';
|
||||
echo '<td>' . (!empty($row['analytsName']) ? $row['analytsName'] . ' (CAS: ' . $row['cas'] . ')' : ' ') . '</td>';
|
||||
echo '<td>' . (!empty($row['result_Value']) ? htmlspecialchars($row['result_Value'], ENT_QUOTES, 'UTF-8') : ' ');
|
||||
|
||||
// Aggiungi l'unità di misura se presente
|
||||
@@ -266,7 +273,7 @@ $partsAndResults = $stmtParts->get_result();
|
||||
}
|
||||
|
||||
echo '</td>';
|
||||
echo '<td class="' . $ratingClass . '">' . (!empty($row['test_Rating']) ? htmlspecialchars($row['test_Rating'], ENT_QUOTES, 'UTF-8') : ' ') . '</td>';
|
||||
echo '<td class="' . $ratingClass . '">' . (!empty($row['analytsRating']) ? htmlspecialchars($row['analytsRating'], ENT_QUOTES, 'UTF-8') : ' ') . '</td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
|
||||
@@ -354,7 +361,7 @@ $partsAndResults = $stmtParts->get_result();
|
||||
if (selectedRating === '' ||
|
||||
(selectedRating === 'pass' && (ratingText === 'pass' || ratingText === 'complies')) ||
|
||||
(selectedRating === 'fail' && (ratingText === 'fail' || ratingText === "doesn't comply")) ||
|
||||
(selectedRating === 'ambiguous' && (ratingText === 'n/a' || ratingText === 'ambiguous' || ratingText === '//'))) {
|
||||
(selectedRating === 'ambiguous' && (ratingText === 'n/a' || ratingText === 'data' || ratingText === '//'))) {
|
||||
$(this).show();
|
||||
visibleRows++;
|
||||
} else {
|
||||
@@ -440,7 +447,7 @@ $partsAndResults = $stmtParts->get_result();
|
||||
if (selectedRating === '' ||
|
||||
(selectedRating === 'pass' && (ratingText === 'pass' || ratingText === 'complies')) ||
|
||||
(selectedRating === 'fail' && (ratingText === 'fail' || ratingText === "doesn't comply")) ||
|
||||
(selectedRating === 'ambiguous' && (ratingText === 'n/a' || ratingText === 'ambiguous' || ratingText === '//'))) {
|
||||
(selectedRating === 'ambiguous' && (ratingText === 'n/a' || ratingText === 'data' || ratingText === '//'))) {
|
||||
$(this).show();
|
||||
} else {
|
||||
$(this).hide();
|
||||
|
||||
Reference in New Issue
Block a user