================================================================================
INSTALL VERSION 2.1 UPDATE - INTRODUCERS & CLIENT OWNERSHIP
================================================================================

QUICK INSTALLATION GUIDE

================================================================================
STEP 1: BACKUP YOUR DATABASE
================================================================================

CRITICAL: Always backup before updating!

Using command line:
  mysqldump -u username -p investor_db > backup_v2.0_before_update.sql

Using phpMyAdmin:
  1. Select investor_db database
  2. Click "Export" tab
  3. Choose "Quick" export method
  4. Click "Go" to download backup


================================================================================
STEP 2: RUN DATABASE UPDATE
================================================================================

Using command line:
  mysql -u username -p investor_db < database/add_introducers.sql

Using phpMyAdmin:
  1. Select investor_db database
  2. Click "Import" tab
  3. Choose file: database/add_introducers.sql
  4. Click "Go"

Expected result:
  ✓ New table 'introducers' created
  ✓ Column 'introducer_id' added to clients
  ✓ Column 'owner_staff_id' added to clients
  ✓ 3 sample introducers inserted


================================================================================
STEP 3: VERIFY DATABASE UPDATE
================================================================================

Run these SQL queries to verify:

1. Check introducers table exists:
   SHOW TABLES LIKE 'introducers';

2. Check new columns in clients:
   DESCRIBE clients;
   (Should show introducer_id and owner_staff_id)

3. Check sample data:
   SELECT COUNT(*) FROM introducers;
   (Should show 3)


================================================================================
STEP 4: UPLOAD NEW FILES
================================================================================

Upload these 2 NEW files to your server:

  forms/introducer_form.php          → /forms/
  forms/introducers_list.php         → /forms/


================================================================================
STEP 5: REPLACE UPDATED FILES
================================================================================

Replace these 5 EXISTING files on your server:

  forms/client_form.php              → /forms/
  forms/search_clients.php           → /forms/
  index.php                          → /
  includes/header.php                → /includes/
  css/style.css                      → /css/

IMPORTANT: Make backups of your current files before replacing!


================================================================================
STEP 6: CLEAR BROWSER CACHE
================================================================================

Hard refresh your browser:

  Windows/Linux: Ctrl + Shift + F5
  Mac: Cmd + Shift + R

Or clear browser cache completely.


================================================================================
STEP 7: TEST THE UPDATE
================================================================================

1. Visit your investor database homepage
2. Check navigation shows "Management" dropdown
3. Click Management > Introducers
4. Should see list of 3 sample introducers
5. Click "Add New Introducer"
6. Form should load with all fields
7. Go to any client and click "View/Edit"
8. Check for new dropdowns:
   - Client Owner (Staff)
   - External Introducer
9. Search for clients
10. Results should show Owner and Introducer columns
11. Check dashboard shows Owner and Introducer


================================================================================
WHAT'S NEW IN v2.1
================================================================================

NEW FEATURES:
✓ External introducer/referral partner tracking
✓ Client ownership assignment (primary relationship manager)
✓ Introducer KYC management
✓ Commission rate tracking per introducer
✓ Client count per introducer
✓ New "Management" navigation dropdown
✓ Introducer list view with statistics
✓ Full introducer add/edit form

UPDATED FEATURES:
✓ Client form now includes introducer and owner
✓ Search results show introducer and owner
✓ Dashboard shows introducer and owner
✓ New status badges for KYC and introducer status


================================================================================
SAMPLE DATA INCLUDED
================================================================================

3 Sample Introducers:

1. Premier Wealth Advisors (New York)
   - Contact: John Sterling
   - Commission: 1.50%
   - Status: Active
   - KYC: Completed

2. Global Investment Partners (London)
   - Contact: Sarah Chen
   - Commission: 2.00%
   - Status: Active
   - KYC: Completed

3. Elite Financial Services (Miami)
   - Contact: Michael Rodriguez
   - Commission: 1.75%
   - Status: Active
   - KYC: In Progress


================================================================================
TROUBLESHOOTING
================================================================================

Problem: Database update fails with error
Solution:
  - Check you're running on investor_db database
  - Ensure you have ALTER TABLE permissions
  - Try running each statement individually

Problem: Can't see new introducers in dropdown
Solution:
  - Check introducers table has data
  - Verify introducer_status = 'Active'
  - Clear browser cache

Problem: Navigation dropdown doesn't work
Solution:
  - Clear browser cache completely
  - Check JavaScript is enabled
  - Ensure header.php was replaced

Problem: Search results show errors
Solution:
  - Verify database update completed
  - Check all table joins are correct
  - Ensure search_clients.php was replaced

Problem: Client form missing new fields
Solution:
  - Clear browser cache
  - Verify client_form.php was replaced
  - Check for PHP errors in logs


================================================================================
ROLLBACK INSTRUCTIONS
================================================================================

If you need to undo this update:

1. Restore database from backup:
   mysql -u username -p investor_db < backup_v2.0_before_update.sql

2. Restore old files from backups

3. Clear browser cache


================================================================================
FILES CHECKLIST
================================================================================

Before updating, verify you have all files:

NEW FILES (2):
□ database/add_introducers.sql
□ forms/introducer_form.php
□ forms/introducers_list.php

MODIFIED FILES (5):
□ forms/client_form.php
□ forms/search_clients.php
□ index.php
□ includes/header.php
□ css/style.css

DOCUMENTATION (2):
□ database/UPDATE_v2.1_INTRODUCERS.md
□ CHANGES_v2.1_SUMMARY.md


================================================================================
POST-INSTALLATION
================================================================================

After successful installation:

1. Delete or secure installation files:
   - INSTALL_v2.1_UPDATE.txt (this file)

2. Add your own introducers:
   - Navigate to Management > Add Introducer
   - Fill in company details
   - Complete KYC information
   - Set commission structure

3. Update existing clients:
   - Edit client records
   - Assign introducer if applicable
   - Assign owner (primary relationship manager)

4. Review sample introducers:
   - Edit or delete as needed
   - Use as templates for your own


================================================================================
SUPPORT
================================================================================

For detailed documentation:
  See: database/UPDATE_v2.1_INTRODUCERS.md

For quick summary:
  See: CHANGES_v2.1_SUMMARY.md

For technical support:
  Contact your database administrator


================================================================================
VERSION INFORMATION
================================================================================

Update Version: 2.1
Previous Version: 2.0 (Oasis Edition)
Release Date: December 2024
Database Changes: Yes (new table + 2 columns)
Breaking Changes: No
Backward Compatible: Yes (existing data preserved)


================================================================================
INSTALLATION COMPLETE
================================================================================

You now have:
✓ Full introducer management
✓ Client ownership tracking
✓ Commission structure management
✓ Introducer KYC compliance
✓ Enhanced client relationships

Update installed successfully!

================================================================================
