# CSV Format Guide for Bulk Deposits

## Required Format

Your CSV file should have a header row with at least one of these columns (case-insensitive, spaces are OK):

### Column Names (any of these will work):

1. **Reference Number** - Member's reference number
   - Examples: `Reference Number`, `reference_number`, `REFERENCE`, `Ref Number`
   - Format: "Loyalaid/0001" or just "0001"

2. **ID Number** - Member's national ID or passport
   - Examples: `ID Number`, `id_number`, `ID`, `National ID`, `Identity Number`

3. **Email** - Member's email address
   - Examples: `Email`, `email`, `E-Mail`, `Email Address`

4. **Account Number** - Bank account number
   - Examples: `Account Number`, `account_number`, `Account`, `Bank Account`

### Example CSV Format:

```csv
Reference Number,ID Number,Email,Account Number,Amount,Status
Loyalaid/0001,1234567890,member1@example.com,123456789,100,Paid
Loyalaid/0002,0987654321,member2@example.com,987654321,200,Paid
0003,1122334455,member3@example.com,112233445,300,Unpaid
```

### Important Notes:

1. **First row must be headers** - Column names
2. **At least one identifier column** - You need at least one of: Reference Number, ID Number, Email, or Account Number
3. **Case doesn't matter** - "Reference Number", "reference number", "REFERENCE_NUMBER" all work
4. **Spaces are OK** - "Reference Number" and "Reference_Number" both work
5. **Excel files** - If uploading .xlsx, save as CSV first for best results

### Payment Detection:

The system will automatically detect if a member paid by checking:
- A "Status" column with values like "Paid", "Yes", "1", "True", "Received"
- An "Amount" column with value > 0
- Defaults to "Paid" if payment status cannot be determined

### Points Calculation:

Points are automatically calculated based on the member's subscription plan:
- M100 plan → 100 points
- M200 plan → 200 points
- M300 plan → 300 points
- M400 plan → 400 points
- M500 plan → 500 points
- M600 plan → 600 points
- M700+ plan → 700 points

### Troubleshooting:

If you get "Found 0 member(s)":
1. Check that your CSV has a header row
2. Ensure at least one column matches: Reference Number, ID Number, Email, or Account Number
3. Verify the data in those columns matches your member database
4. Check the Laravel logs: `storage/logs/laravel.log` for detailed matching information
5. Try saving your Excel file as CSV format

