# FG Reports - Quick Start Guide ## 🚀 Access the Reports Page ### Step 1: Login 1. Go to `http://localhost:8080` (or your app URL) 2. Login with credentials: - **Username**: `admin` - **Password**: `admin123` ### Step 2: Navigate to Reports Option A - Using Navigation Menu: 1. Click "Quality" in the top navigation bar 2. Click "Reports" (if visible in submenu) Option B - Direct URL: - Go to: `http://localhost:8080/quality/reports` ## 📊 Generate Your First Report ### Daily Report (Easiest) 1. Click the **"Today's Report"** card 2. Click **"Generate Report"** button 3. View results in the table below 4. Statistics display at top: Total, Approved, Rejected counts ### Select Specific Date Report 1. Click the **"Select Day"** card 2. A date picker appears 3. Select a date from the calendar 4. Click **"Generate Report"** 5. View the data ### Date Range Report 1. Click the **"Date Range"** card 2. Select **Start Date** 3. Select **End Date** 4. Click **"Generate Report"** 5. View all scans within that range ## 💾 Export Data After generating a report: ### Export to Excel 1. Click the **"Export Excel"** button (green with file icon) 2. File downloads as: `fg_report_YYYY-MM-DD.xlsx` 3. Open in Microsoft Excel or Google Sheets ### Export to CSV 1. Click the **"Export CSV"** button 2. File downloads as: `fg_report_YYYY-MM-DD.csv` 3. Open in Excel, Google Sheets, or any text editor ## 📈 Available Report Types | Report | Purpose | When to Use | |--------|---------|------------| | **Today's Report** | All scans from today | Daily production overview | | **Select Day** | Choose any date | Look at past production | | **Date Range** | Pick start & end dates | Analyze a period | | **Last 5 Days** | Automatic 5-day window | Weekly summary | | **Defects Today** | Only rejected items today | Quality issues monitoring | | **Defects by Date** | Rejected items on specific date | Defect investigation | | **Defects Range** | Rejected items in date range | Period defect analysis | | **Defects 5 Days** | Last 5 days rejected items | Weekly defect trends | | **All Data** | Everything in database | Complete export | ## 📊 Reading the Report ### Statistics (Top Right) - **Total Scans**: Total records in report - **Approved**: Scans with quality code '000' (green) - **Rejected**: Scans with quality codes 001-999 (red) ### Status Badges in Table - **Green Badge**: APPROVED (quality_code = '000') - **Red Badge**: REJECTED (quality_code = '001' or higher) ### Table Columns | Column | Meaning | |--------|---------| | ID | Record number | | Operator Code | Who scanned (e.g., OP01) | | CP Code | Product code (e.g., CP00000001-0001) | | OC1 Code | Operation code 1 | | OC2 Code | Operation code 2 | | Status | APPROVED or REJECTED | | Date | Scan date | | Time | Scan time | | Created | When record was created | ## 🎨 Dark Mode The reports page fully supports dark mode: 1. Toggle theme using the moon icon (🌙) in top navigation 2. All colors automatically adjust 3. Text remains readable in both modes ## 🔧 Keyboard Shortcuts - **Tab**: Navigate between fields - **Enter**: Generate report / Confirm selection - **Esc**: Clear filters (if supported) ## ❌ Troubleshooting ### Issue: "No data to display" - **Cause**: Selected date range has no scans - **Solution**: - Try "All Data" report to verify data exists - Use "Last 5 Days" for demo data - Generate test data if needed ### Issue: Export button is greyed out - **Cause**: No report has been generated yet - **Solution**: Select a report type and click "Generate Report" first ### Issue: Page is loading forever - **Cause**: Database query is taking long time - **Solution**: - Try a more specific date range - Avoid "All Data" if database is very large - Wait a few seconds for it to complete ### Issue: Date picker won't open - **Cause**: Browser compatibility issue - **Solution**: - Use Chrome, Firefox, or Safari (latest versions) - Try a different browser - Clear browser cache and reload ## 💡 Tips & Tricks 1. **Quick Daily Check**: Click "Today's Report" → "Generate" → "Export Excel" - Takes ~10 seconds - Perfect for daily reports 2. **Weekly Summary**: Click "Last 5 Days" → "Generate" - Automatic 5-day window - No date selection needed 3. **Find Defects**: Click "Defects Today" or "Defects Range" - Only shows rejected scans - Easier to see quality issues 4. **Archive All Data**: Click "All Data" → "Export Excel" - Complete database backup - Useful for compliance/audits 5. **Batch Export**: Generate multiple reports, export each separately - Naming includes date for organization - Can easily import all into one Excel workbook ## 📱 Mobile Usage The reports page is fully responsive: - Works on phone, tablet, desktop - Report cards stack vertically on small screens - Table scrolls horizontally if needed - All buttons easily clickable on touch devices ## 🔒 Permissions You need an active login to access reports: - Anonymous users cannot view reports - Session expires after inactivity (default: 30 minutes) - Re-login required if session expires ## 📞 Support If you encounter issues: 1. **Check browser console** (F12 → Console tab) 2. **Check server logs**: `docker logs quality_app_v2` 3. **Verify login**: Make sure you're logged in as admin 4. **Clear cache**: Ctrl+Shift+Del (or Cmd+Shift+Del on Mac) 5. **Restart app**: `docker compose restart app` ## 🎯 Common Workflows ### Workflow 1: Daily Quality Report ``` 1. Login 2. Navigate to Reports 3. Click "Today's Report" 4. Click "Generate Report" 5. Click "Export Excel" 6. Email the file to supervisor ``` **Time**: ~2 minutes ### Workflow 2: Investigation Specific Defect ``` 1. Navigate to Reports 2. Click "Defects by Date" 3. Select the date you want to investigate 4. Click "Generate Report" 5. Review rejected scans 6. Click "Export Excel" for documentation ``` **Time**: ~5 minutes ### Workflow 3: Weekly Trend Analysis ``` 1. Navigate to Reports 2. Click "Last 5 Days" 3. Click "Generate Report" 4. Check approval rate in statistics 5. Export Excel to track trends over weeks ``` **Time**: ~3 minutes ### Workflow 4: Complete Database Backup ``` 1. Navigate to Reports 2. Click "All Data" 3. Click "Generate Report" 4. Click "Export Excel" 5. Archive the file ``` **Time**: ~1 minute (+ export time for large databases) ## 📚 Next Steps - Read the full documentation: `FG_REPORTS_IMPLEMENTATION.md` - See the implementation summary: `FG_REPORTS_SUMMARY.md` - Check the checklist: `FG_REPORTS_CHECKLIST.md` ## ✅ You're Ready! You now have a complete FG Scan Reports system with: - ✅ 9 different report types - ✅ Real-time filtering - ✅ Excel and CSV export - ✅ Dark mode support - ✅ Mobile responsive design - ✅ Production-ready code **Happy reporting!** 📊