# WORKFLOW IS WORKING - HOW TO USE IT

## ✅ CONFIRMED: The workflow is working correctly!

Database test results:
- **Enquiry List**: 1 customer (P Karthikeyan) - NO advance paid, NO registration
- **Booked Customers**: 1 customer (James) - HAS advance paid (500), NO registration  
- **Registered Customers**: 3 customers - HAS registration number

---

## ⚠️ IMPORTANT: You MUST Use the Correct URLs

The workflow filters ONLY work when you include the `contextpage` parameter in the URL!

### ❌ WRONG (Shows ALL customers):
```
http://localhost/admin_crm/htdocs/societe/list.php
```

### ✅ CORRECT (Shows filtered customers):

**Enquiry List:**
```
http://localhost/admin_crm/htdocs/societe/list.php?contextpage=enquiry
```

**Booked Customers:**
```
http://localhost/admin_crm/htdocs/societe/list.php?contextpage=booked_customers
```

**Registered Customers:**
```
http://localhost/admin_crm/htdocs/societe/list.php?contextpage=registered_customers
```

---

## 📋 How to Test the Workflow

### Step 1: Check Enquiry List
1. Open this URL in your browser:
   ```
   http://localhost/admin_crm/htdocs/societe/list.php?contextpage=enquiry
   ```
2. You should see: **P Karthikeyan** (and any other customers with NO advance paid)
3. You should NOT see: James, Veda v, Hari, or Workflow Test Customer

### Step 2: Check Booked Customers List
1. Open this URL in your browser:
   ```
   http://localhost/admin_crm/htdocs/societe/list.php?contextpage=booked_customers
   ```
2. You should see: **James** (advance paid = 500)
3. You should NOT see: P Karthikeyan, Veda v, Hari, or Workflow Test Customer

### Step 3: Check Registered Customers List
1. Open this URL in your browser:
   ```
   http://localhost/admin_crm/htdocs/societe/list.php?contextpage=registered_customers
   ```
2. You should see: **Veda v, Hari, Workflow Test Customer** (all have registration numbers)
3. You should NOT see: P Karthikeyan or James

---

## 🔧 If You Still See ALL Customers in Every List

### Possible Cause 1: Browser Cache
**Solution:** Clear your browser cache or use Incognito/Private mode
- Chrome: Ctrl+Shift+N
- Firefox: Ctrl+Shift+P
- Edge: Ctrl+Shift+N

### Possible Cause 2: Session Cache in Dolibarr
**Solution:** Clear Dolibarr cache
1. Go to: Setup → Setup → Other setup
2. Click "Clear cache" button
3. Or delete files in: `documents/admin/temp/`

### Possible Cause 3: Not Using the Correct URL
**Solution:** Make sure the URL includes `?contextpage=enquiry` (or booked_customers, or registered_customers)

### Possible Cause 4: Search Filters Applied
**Solution:** Clear any search filters
1. Look for search boxes at the top of the list
2. Clear all search fields
3. Click the "Reset" or "Clear" button

---

## 📊 Current Customer Distribution

| Customer Name | Advance Paid | Registration Number | Should Appear In |
|--------------|--------------|---------------------|------------------|
| P Karthikeyan | (empty) | (empty) | **Enquiry** |
| James | 500 | (empty) | **Booked Customers** |
| Veda v | 800 | 5686546 | **Registered Customers** |
| Hari | (empty) | 5686546T | **Registered Customers** |
| Workflow Test Customer | 500 | REG-2024-001 | **Registered Customers** |

---

## 🎯 Quick Test

Run this command to verify the database queries work:
```bash
cd c:\xampp\htdocs\admin_crm
php debug_booked_issue.php
```

Expected output:
```
Testing Booked Customers query:
  - ID: 2, Name: James, Advance: 500.00000000
Total in Booked Customers: 1

Testing Enquiry query:
  - ID: 3, Name: P Karthikeyan, Advance: empty
Total in Enquiry: 1
```

---

## ❓ Still Not Working?

If you're using the CORRECT URLs with `?contextpage=...` and still seeing all customers:

1. **Check the URL bar** - Make sure it shows `?contextpage=booked_customers` (or enquiry, or registered_customers)
2. **Check for typos** - It must be exactly `booked_customers` (with underscore)
3. **Try incognito mode** - This eliminates cache issues
4. **Run the debug script** - `php debug_booked_issue.php` to verify database queries work

The workflow logic IS working - the issue is likely with how you're accessing the lists!
