# Sample CSV Data for Bulk Import Testing

This folder contains ready-to-use sample CSV files for testing the bulk import feature.

## Files Included

### 1. `customers-sample.csv` (20 customers)
- **10 Commercial Customers** with pricing tiers (Standard, Silver, Gold, Platinum)
- **10 Individual Customers** (Non-Commercial, COD payment)
- Mix of credit limits, payment terms, and tax-exempt status
- Realistic company names and contact information

**Pricing Tiers Used:**
- STANDARD - No discount
- SILVER - 5% discount
- GOLD - 10% discount
- PLATINUM - 15% discount

### 2. `catalog-items-sample.csv` (25 products)
- **Automotive** (8 items): Wheels, engine parts, body components
- **Furniture** (4 items): Outdoor and indoor furniture
- **Railings** (3 items): Residential and commercial railings
- **Gates** (3 items): Driveway, garden, and security gates
- **Fitness** (3 items): Exercise equipment frames
- **Industrial** (2 items): Shelving and carts
- **Bicycle** (2 items): Road and mountain bike frames

**Features:**
- Hierarchical categories (automatically created on import)
- Realistic pricing ($35 - $450)
- Weight and surface area estimates
- Sandblasting and masking requirements

### 3. `inventory-items-sample.csv` (25 items)
- **14 Powder Coating Colors**: Black, White, Red, Blue, Silver, Gray, Green, Yellow, Orange, Bronze, Gold, Cream, Clear, Textured Black
- **11 Consumables**: Masking tape, plugs, cleaners, sandblasting media, hanging supplies, safety equipment
- **Manufacturers**: Tiger Drylac, Axalta, PPG, 3M, etc.
- Realistic stock levels, unit costs, and reorder points
- RAL color codes for powder coatings

## How to Use

### Option 1: Import All Files (Recommended)
1. Start the application
2. Navigate to **Tools** page
3. Scroll to **CSV Bulk Import** section
4. Import in this order:
   - **Customers** tab → Upload `customers-sample.csv`
   - **Catalog Items** tab → Upload `catalog-items-sample.csv`
   - **Inventory** tab → Upload `inventory-items-sample.csv`

### Option 2: Modify Before Import
1. Open any CSV file in Excel or a text editor
2. Add/remove/modify rows as needed
3. Save the file (keep CSV format)
4. Upload via the Tools page

### Option 3: Use as Templates
1. Download the official templates from the Tools page
2. Use these sample files as reference for data format
3. Create your own custom data

## Expected Import Results

### Customers Import
- ✅ 20 customers created
- ✅ 4 pricing tiers automatically linked
- ✅ 1 tax-exempt customer flagged
- ⚠️ Warnings if pricing tier codes don't exist (e.g., if you haven't seeded company data)

### Catalog Items Import
- ✅ 25 catalog items created
- ✅ 8 categories auto-created hierarchically:
  - Automotive → Wheels → Standard, Performance
  - Automotive → Engine → Valve Covers, Intake Manifolds
  - Automotive → Body → Bumpers, Grilles
  - Furniture → Outdoor, Indoor
  - Railings → Residential, Commercial
  - Gates → Residential, Commercial
  - Fitness → Equipment
  - Industrial → Shelving, Carts
  - Bicycle → Frames
- ✅ SKU format validated (CAT-*)

### Inventory Items Import
- ✅ 25 inventory items created
- ✅ 2 categories auto-created: "Powder Coating", "Consumables"
- ✅ Stock levels and reorder points set
- ✅ RAL color codes preserved

## Data Validation

The import process will:
- ✅ Validate required fields (name, email, SKU, etc.)
- ✅ Check for duplicate emails (customers) and SKUs (catalog/inventory)
- ✅ Auto-create missing categories and pricing tiers
- ✅ Skip rows with errors and report them
- ✅ Show warnings for non-critical issues

## Troubleshooting

**Issue**: "Pricing tier not found" warning
**Solution**: Run **Platform Management > Seed Data** to create pricing tiers first

**Issue**: "Duplicate email" error
**Solution**: Customer with that email already exists. Change the email or skip that row.

**Issue**: "Duplicate SKU" error (e.g., "Cannot insert duplicate key... PWD-BLK-001")
**Solution**: You have existing inventory/catalog items with those SKUs. Options:
  1. **Use the updated sample file** - All SKUs now have "IMP-" prefix to avoid conflicts
  2. **Delete existing items** - Go to Inventory page and delete conflicting items first
  3. **Edit the CSV** - Change SKUs in the file before importing (e.g., add your company code prefix)

**Issue**: CSV format error
**Solution**: Ensure file is saved as UTF-8 CSV format. Check for extra commas or quotes.

**Issue**: Database constraint violation
**Solution**: Check that all required fields are present and data types are correct (numbers for prices, valid dates, etc.)

## File Format Notes

- **Encoding**: UTF-8 (recommended)
- **Delimiter**: Comma (,)
- **Quote Character**: Double quote (") for fields containing commas
- **Line Ending**: Windows (CRLF) or Unix (LF) both supported
- **Header Row**: Required (first row must be field names)

## Tips

1. **Start Fresh**: Import these files into a new company for a complete demo dataset
2. **Test Workflows**: Use the imported data to test quote creation, job management, etc.
3. **Customize**: Modify the data to match your specific business needs
4. **Export Reference**: After import, you can use the system's export feature to see how data should be formatted

## Next Steps

After importing sample data:
1. View imported **Customers** at `/Customers`
2. Browse **Catalog Items** at `/CatalogItems`
3. Check **Inventory** at `/Inventory`
4. Create a quote using the new customers and catalog items
5. Create a job and assign inventory items

## Questions?

Refer to the main application documentation or contact support.
