update parsedatachart
This commit is contained in:
parent
cde2134d6a
commit
3ea75fcdb7
@ -249,17 +249,19 @@ $otherConditions = implode("', '", array_map('addslashes', RATING_OTHER));
|
|||||||
// Query per il grafico a barre orizzontali con sezioni multicolore
|
// Query per il grafico a barre orizzontali con sezioni multicolore
|
||||||
$horizontalBarQuery = "
|
$horizontalBarQuery = "
|
||||||
SELECT
|
SELECT
|
||||||
p.$groupingField AS groupingValue,
|
COALESCE(p.$groupingField, 'empty') AS groupingValue,
|
||||||
SUM(CASE WHEN UPPER(r.reportsRating) IN ('$passConditions') THEN 1 ELSE 0 END) AS passCount,
|
SUM(CASE WHEN UPPER(r.reportsRating) IN ('$passConditions') THEN 1 ELSE 0 END) AS passCount,
|
||||||
SUM(CASE WHEN UPPER(r.reportsRating) IN ('$failConditions') THEN 1 ELSE 0 END) AS failCount,
|
SUM(CASE WHEN UPPER(r.reportsRating) IN ('$failConditions') THEN 1 ELSE 0 END) AS failCount,
|
||||||
SUM(CASE WHEN UPPER(r.reportsRating) NOT IN ('$passConditions', '$failConditions') THEN 1 ELSE 0 END) AS otherCount
|
SUM(CASE WHEN UPPER(r.reportsRating) NOT IN ('$passConditions', '$failConditions') THEN 1 ELSE 0 END) AS otherCount
|
||||||
FROM reports r
|
FROM reports r
|
||||||
LEFT JOIN products p ON r.idproducts = p.idproducts
|
LEFT JOIN products p ON r.idproducts = p.idproducts
|
||||||
$filters
|
$filters
|
||||||
GROUP BY p.$groupingField
|
GROUP BY COALESCE(p.$groupingField, 'empty')
|
||||||
|
LIMIT 20
|
||||||
";
|
";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$horizontalBarResult = $conn->query($horizontalBarQuery);
|
$horizontalBarResult = $conn->query($horizontalBarQuery);
|
||||||
$horizontalBarData = [];
|
$horizontalBarData = [];
|
||||||
while ($row = $horizontalBarResult->fetch_assoc()) {
|
while ($row = $horizontalBarResult->fetch_assoc()) {
|
||||||
@ -274,7 +276,7 @@ while ($row = $horizontalBarResult->fetch_assoc()) {
|
|||||||
// Query per ottenere il conteggio di Pass, Fail e altri dalle analisi
|
// Query per ottenere il conteggio di Pass, Fail e altri dalle analisi
|
||||||
$horizontalBarAnalysisQuery = "
|
$horizontalBarAnalysisQuery = "
|
||||||
SELECT
|
SELECT
|
||||||
p.$groupingField AS groupingValue,
|
COALESCE(p.$groupingField, 'empty') AS groupingValue,
|
||||||
SUM(CASE WHEN UPPER(ap.test_Rating) IN ('PASS', 'P', 'COMPLIES') THEN 1 ELSE 0 END) AS passCount,
|
SUM(CASE WHEN UPPER(ap.test_Rating) IN ('PASS', 'P', 'COMPLIES') THEN 1 ELSE 0 END) AS passCount,
|
||||||
SUM(CASE WHEN UPPER(ap.test_Rating) IN ('FAIL', 'F', 'DOESN\'T COMPLY') THEN 1 ELSE 0 END) AS failCount,
|
SUM(CASE WHEN UPPER(ap.test_Rating) IN ('FAIL', 'F', 'DOESN\'T COMPLY') THEN 1 ELSE 0 END) AS failCount,
|
||||||
SUM(CASE WHEN UPPER(ap.test_Rating) NOT IN ('PASS', 'P', 'COMPLIES', 'FAIL', 'F', 'DOESN\'T COMPLY') THEN 1 ELSE 0 END) AS otherCount
|
SUM(CASE WHEN UPPER(ap.test_Rating) NOT IN ('PASS', 'P', 'COMPLIES', 'FAIL', 'F', 'DOESN\'T COMPLY') THEN 1 ELSE 0 END) AS otherCount
|
||||||
@ -282,9 +284,11 @@ $horizontalBarAnalysisQuery = "
|
|||||||
LEFT JOIN reports r ON ap.idreports = r.idreports
|
LEFT JOIN reports r ON ap.idreports = r.idreports
|
||||||
LEFT JOIN products p ON r.idproducts = p.idproducts
|
LEFT JOIN products p ON r.idproducts = p.idproducts
|
||||||
$filters
|
$filters
|
||||||
GROUP BY p.$groupingField
|
GROUP BY COALESCE(p.$groupingField, 'empty')
|
||||||
|
LIMIT 20
|
||||||
";
|
";
|
||||||
|
|
||||||
|
|
||||||
$horizontalBarAnalysisResult = $conn->query($horizontalBarAnalysisQuery);
|
$horizontalBarAnalysisResult = $conn->query($horizontalBarAnalysisQuery);
|
||||||
$horizontalBarAnalysisData = [];
|
$horizontalBarAnalysisData = [];
|
||||||
while ($row = $horizontalBarAnalysisResult->fetch_assoc()) {
|
while ($row = $horizontalBarAnalysisResult->fetch_assoc()) {
|
||||||
@ -339,7 +343,9 @@ $productBySupplierQuery = "
|
|||||||
FROM products p
|
FROM products p
|
||||||
WHERE p.namesupplier IS NOT NULL $suPfilters
|
WHERE p.namesupplier IS NOT NULL $suPfilters
|
||||||
GROUP BY p.namesupplier
|
GROUP BY p.namesupplier
|
||||||
ORDER BY totalProducts DESC";
|
ORDER BY totalProducts DESC
|
||||||
|
LIMIT 30
|
||||||
|
";
|
||||||
|
|
||||||
$productBySupplierResult = $conn->query($productBySupplierQuery);
|
$productBySupplierResult = $conn->query($productBySupplierQuery);
|
||||||
$productBySupplier = [];
|
$productBySupplier = [];
|
||||||
@ -450,6 +456,7 @@ $analysisDistributionQuery = "
|
|||||||
$filters
|
$filters
|
||||||
GROUP BY ap.result_TestName
|
GROUP BY ap.result_TestName
|
||||||
ORDER BY totalTests DESC
|
ORDER BY totalTests DESC
|
||||||
|
LIMIT 20
|
||||||
";
|
";
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user