=== Lead Owner Summary Report API Test === 1. Lead Owner Summary Report: GET /api/reports/get_report_section Parameters: { "type": "lead_owner_summary", "startDate": "2024-01-01", "endDate": "2024-12-31" } Expected Response: { "success": true, "data": [ { "owner_id": 1, "owner_name": "Dr. Smith", "new_call_count": 15, "converted_count": 8, "touched_count": 25, "follow_up_count": 12, "junk_lead_count": 5, "lost_count": 3, "appointment_count": 10, "total_leads": 30 } ], "date_range": { "start_date": "2024-01-01", "end_date": "2024-12-31" } } === Lead Owner Detail Report API Test === 2. Lead Owner Detail Report (New Calls): GET /api/reports/get_report_section Parameters: { "type": "lead_owner_detail", "owner_id": 1, "status_type": "new_call", "startDate": "2024-01-01", "endDate": "2024-12-31", "page": 1, "pageSize": 10 } 3. Available Status Types for Detail Report: - new_call: Shows leads where lead_owner_id is NULL or empty - converted: Shows leads with status 'converted' - touched: Shows leads where lead_owner_id is not null/empty - follow_up: Shows leads with status in ('Not Contacted', 'Contact In Future', 'Attempted to Contact', 'Pre-Qualified') - junk_lead: Shows leads with status 'Junk Lead' - lost: Shows leads with status in ('Not-Qualified', 'Lost Lead') - appointment: Shows leads where book_an_appoitment_id is not null/empty === SQL Query Examples === 4. New Calls Query: SELECT * FROM lead_enquiry WHERE (lead_owner_id IS NULL OR lead_owner_id = '') AND created_at BETWEEN '2024-01-01 00:00:00' AND '2024-12-31 23:59:59'; 5. Follow Up Calls Query: SELECT * FROM lead_enquiry WHERE lead_status IN ('Not Contacted', 'Contact In Future', 'Attempted to Contact', 'Pre-Qualified') AND created_at BETWEEN '2024-01-01 00:00:00' AND '2024-12-31 23:59:59'; 6. Appointment Query: SELECT * FROM lead_enquiry WHERE (book_an_appoitment_id IS NOT NULL AND book_an_appoitment_id != '') AND created_at BETWEEN '2024-01-01 00:00:00' AND '2024-12-31 23:59:59'; === Frontend Integration Example === 7. Dashboard Cards HTML:

New Calls

{{new_call_count}}

Converted

{{converted_count}}

Touched

{{touched_count}}

Follow Up

{{follow_up_count}}

Junk Leads

{{junk_lead_count}}

Lost

{{lost_count}}

Appointments

{{appointment_count}}
8. JavaScript Function: function showDetails(statusType) { const ownerId = getCurrentOwnerId(); const startDate = getStartDate(); const endDate = getEndDate(); fetch('/api/reports/get_report_section', { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': 'Bearer ' + getAuthToken() }, body: JSON.stringify({ type: 'lead_owner_detail', owner_id: ownerId, status_type: statusType, startDate: startDate, endDate: endDate, page: 1, pageSize: 20 }) }) .then(response => response.json()) .then(data => { if (data.success) { displayDetailModal(data.data, statusType); } }); } === Testing Checklist === □ Test new_call condition (lead_owner_id NULL/empty) □ Test converted condition (status = 'converted') □ Test touched condition (lead_owner_id not null/empty) □ Test follow_up condition (status in follow-up list) □ Test junk_lead condition (status = 'Junk Lead') □ Test lost condition (status in lost list) □ Test appointment condition (book_an_appoitment_id not null/empty) □ Test pagination in detail report □ Test date range filtering □ Test owner filtering