# Weight-Based Products

Selling Products by Weight with EAN-13 Barcodes

## Overview

Complete implementation for selling products by weight (meat, fruits, vegetables, dairy, bakery) using EAN-13 barcodes that encode both product identity and weight.

##### Barcode Format

Format: [Type:2][Product:5][Weight:5][Check:1] = 13 digits Example: 2012345015007 +-- 20: Meat type +-- 12345: Product ID +-- 01500: Weight in grams (1.5kg) +-- 7: Check digit

## Key Features

#### EAN-13 Barcode Support

- Automatic barcode generation
- Weight encoding in barcode
- Modulo-10 checksum validation
- Standard EAN-13 format compatibility

#### Product Types

- Type 20: Meat & Poultry
- Type 21: Fruits & Vegetables
- Type 22: Dairy Products
- Type 23: Bakery Items

#### Price Calculation

- Automatic price per weight unit
- Tare weight deduction support
- Real-time price updates
- Multiple unit support (kg, g, lbs)

#### Scale Integration

- Label-printing scales support
- External printer integration
- Android/Tablet solutions
- PC-based POS integration

## System Setup

### Step 1: Database Migration

# Run the migration script python add_weight_based_products.py # This adds 8 new fields to products table: - is_weight_based (boolean) - weight_barcode_type (integer 20-23) - weight_price_per_unit (decimal) - weight_unit (varchar: kg, g, lbs) - weight_tare (decimal) - weight_barcode_prefix (varchar) - weight_min_weight (decimal) - weight_max_weight (decimal)

### Step 2: Create Weight-Based Products

1. Go to Products Management
2. Click "Add New Product"
3. Check "Weight-Based Product" checkbox
4. Select Barcode Type (20-23)
5. Enter Price Per Unit (e.g., P50/kg)
6. Select Weight Unit (kg, g, lbs)
7. Set Tare Weight if needed (e.g., 10g for packaging)
8. Save the product

### Step 3: Configure Scale

##### Scale Configuration Steps

1. Program product database into scale
2. Set barcode format to EAN-13
3. Configure price per unit
4. Set tare weight if applicable
5. Test barcode generation

Refer to SCALE_CONFIGURATION_TEMPLATES.md for detailed instructions per scale model

## Supported Scale Types

Label-Printing Scales

- Bizerba GLMI-800: Web interface configuration
- CAS CL-5000 Series: Keypad programming
- Toledo 8530: Touchscreen interface
- Avery Berkel HL122: Keypad config
- Digi SM-300: Network software

Alternative Solutions

- Scale + Printer: Any scale with external printer
- Android/Tablet: Mobile barcode generation apps
- PC-POS: Computer-based POS integration

## Point of Sale Usage

### Scanning Weight-Based Products

1. Weigh the product: Place item on scale
2. Generate label: Scale prints barcode label with weight
3. Scan at POS: Scan the barcode at checkout
4. Auto-calculation: System decodes weight and calculates price
5. Complete sale: Price displayed automatically

### Example Transaction

Product: Beef Steak (Type 20) Price: P250/kg Barcode Scanned: 2012345015007 System Decodes: +-- Type: 20 (Meat) +-- Product ID: 12345 +-- Weight: 01500g (1.5kg) +-- Check: 7 ? Calculation: Weight: 1.5kg Price/kg: P250 Tare: 0kg Total: P375.00

## API Endpoints

Method | Endpoint | Description
--- | --- | ---
POST | `/api/v1/weight-products/parse-barcode` | Decode barcode and return product with price
POST | `/api/v1/weight-products/generate-barcode` | Generate barcode for product and weight
GET | `/api/v1/weight-products/` | List all weight-based products

## Best Practices

Product Setup

- Use consistent barcode types per category
- Set realistic min/max weights
- Include tare weight for packaging
- Test barcodes before going live

Staff Training

- Train on proper weighing technique
- Explain barcode validation
- Practice with test products
- Keep quick reference cards handy

Maintenance

- Calibrate scales regularly
- Update product prices as needed
- Check label printer supplies
- Verify barcode readability