This commit is contained in:
2025-04-25 13:34:51 +03:00
parent c10d328b06
commit 0c06ac6051
3 changed files with 14 additions and 3 deletions

View File

@@ -312,7 +312,18 @@ def get_report_data():
""", (five_days_ago.strftime('%Y-%m-%d'),))
rows = cursor.fetchall()
print("Fetched rows for report 4 (non-zero quality_code, last 5 days):", rows)
data["headers"] = ["Id", "Operator Code", "CP Full Code", "OC1 Code", "OC2 Code", "Quality Code", "Date", "Time", "Approved Quantity", "Rejected Quantity"]
data["headers"] = ["Id", "Operator Code", "CP Base Code", "OC1 Code", "OC2 Code", "Quality Code", "Date", "Time", "Approved Quantity", "Rejected Quantity"]
data["rows"] = [[str(cell) if isinstance(cell, (datetime, timedelta)) else cell for cell in row] for row in rows]
elif report == "5": # Logic for the 5-ft report (all rows)
cursor.execute("""
SELECT Id, operator_code, CP_base_code, CP_full_code, OC1_code, OC2_code, quality_code, date, time, approved_quantity, rejected_quantity
FROM scan1_orders
ORDER BY date DESC, time DESC
""")
rows = cursor.fetchall()
print("Fetched rows for report 5 (all rows):", rows)
data["headers"] = ["Id", "Operator Code", "CP Base Code", "CP Full Code", "OC1 Code", "OC2 Code", "Quality Code", "Date", "Time", "Approved Quantity", "Rejected Quantity"]
data["rows"] = [[str(cell) if isinstance(cell, (datetime, timedelta)) else cell for cell in row] for row in rows]
conn.close()

View File

@@ -22,8 +22,8 @@
<button class="btn report-btn" data-report="4">Raport Articole cu defecte in ultimile 5 zile</button>
</div>
<div class="form-centered">
<label class="report-description">This report: Report 5 exports a summary of all orders from the database.</label>
<button class="btn report-btn" data-report="5">Report 5</button>
<label class="report-description">Raportarea tuturor intrarilor din baza de date</label>
<button class="btn report-btn" data-report="5">Raporteaza bazade date</button>
</div>
<div class="form-centered last-buttons">
<label class="export-description">Export current report as:</label>