# POS Receipt Setup Guide

## Overview
The Inventino POS system now includes professional receipt generation with company branding, sales summary modal, and print functionality.

## Features

### 1. Sales Summary Modal
- **When**: Appears when you click "Complete Sale" button
- **Shows**: 
  - Customer information (if selected)
  - Detailed list of all items with quantities and prices
  - Item-level discounts (if applied)
  - Cart-level discount (if applied)
  - Subtotal, total discount, tax (7.5% VAT), and final total
- **Actions**:
  - **Cancel**: Close modal and return to POS without processing
  - **Proceed to Payment**: Continue to payment collection modal

### 2. Payment Modal
- **When**: Appears after clicking "Proceed to Payment" on the summary modal
- **Features**:
  - Payment method selection (Cash, Card, Bank Transfer)
  - Amount received input
  - Automatic change calculation for cash payments
  - Payment notes (optional)
  - Quick amount buttons
- **Actions**:
  - **Cancel**: Return to POS without processing
  - **Complete Payment**: Process the transaction

### 3. Success Modal
- **When**: Appears after successful payment processing
- **Shows**: 
  - Total amount
  - Change given (if applicable)
- **Actions**:
  - **Print Receipt**: Opens receipt in new tab for printing
  - **New Sale**: Start a new transaction
- **Auto-Print**: Receipt automatically opens in new tab after 0.5 seconds

### 4. Professional Receipt
The receipt includes:
- **Header**:
  - Company logo (if configured)
  - Business name
  - Address, phone, email
- **Receipt Details**:
  - Receipt number
  - Date and time
  - Salesperson name
  - Customer name (if selected)
- **Items Table**:
  - Product names
  - Quantities
  - Unit prices
  - Totals
- **Financial Summary**:
  - Subtotal
  - Discount (if applied)
  - Tax (7.5% VAT)
  - Total amount
- **Payment Information**:
  - Payment method
  - Amount paid
  - Change (if applicable)
- **Footer**:
  - Custom receipt message (if configured)
  - "Thank You for Your Purchase!"
  - "Visit Again Soon"
  - **"Powered by INVENTINO"** branding
  - "Smart Inventory Management System"
- **Barcode**: Sale number as barcode

## Adding Your Company Logo

### Step 1: Prepare Your Logo
- **Format**: JPEG, PNG, JPG, GIF, or WEBP
- **Recommended Size**: 600px wide x 200px tall (maintains 60mm x 20mm on thermal paper)
- **Max File Size**: 2MB
- **Background**: Transparent background recommended

### Step 2: Upload Logo
**Option A: Via Database (Recommended)**
```sql
-- Connect to your MySQL database and run:
INSERT INTO settings (key, value, type, description, created_at, updated_at)
VALUES (
    'business_logo',
    'logos/company-logo.png',
    'string',
    'Business logo path for receipts (optional)',
    NOW(),
    NOW()
)
ON DUPLICATE KEY UPDATE 
    value = 'logos/company-logo.png',
    updated_at = NOW();
```

**Option B: Manual File Upload**
1. Create a `logos` folder in `storage/app/public/`
2. Copy your logo file to `storage/app/public/logos/company-logo.png`
3. Update the database setting (see Option A)

**Option C: Via Laravel Tinker**
```bash
php artisan tinker

# Then run:
App\Models\Setting::updateOrCreate(
    ['key' => 'business_logo'],
    ['value' => 'logos/company-logo.png', 'type' => 'string', 'description' => 'Business logo path for receipts (optional)']
);
```

### Step 3: Verify Storage Link
Ensure the storage is linked to public folder:
```bash
php artisan storage:link
```

### Step 4: Test
1. Complete a sale in POS
2. View the receipt
3. Your logo should appear at the top

## Configuring Other Receipt Settings

All receipt settings are stored in the `settings` table. You can modify them using SQL or Laravel Tinker:

### Business Name
```sql
UPDATE settings SET value = 'Your Company Name' WHERE key = 'business_name';
```

### Business Address
```sql
UPDATE settings SET value = '123 Main Street, Lagos, Nigeria' WHERE key = 'business_address';
```

### Business Phone
```sql
UPDATE settings SET value = '+234 123 456 7890' WHERE key = 'business_phone';
```

### Business Email
```sql
UPDATE settings SET value = 'info@yourcompany.com' WHERE key = 'business_email';
```

### Custom Receipt Footer Message
```sql
UPDATE settings SET value = 'Follow us on social media @yourcompany' WHERE key = 'receipt_footer';
```

### Tax Rate (Default 7.5% VAT)
```sql
UPDATE settings SET value = '0.075' WHERE key = 'tax_rate';
```

## Workflow Summary

```
Click "Complete Sale"
    ↓
Sales Summary Modal (Review all details)
    ↓ Cancel OR Proceed to Payment
Payment Modal (Enter payment details)
    ↓ Cancel OR Complete Payment
Success Modal
    ↓
Receipt Auto-Opens (Print Receipt button available)
    ↓
Click "New Sale" to start fresh
```

## Thermal Printer Setup

### Recommended Printer Settings
- **Paper Width**: 80mm (3.15 inches)
- **Paper Type**: Thermal paper
- **Print Quality**: Standard
- **Margins**: Minimal (controlled by CSS)

### Browser Print Settings
When printing from the browser:
1. **Destination**: Select your thermal printer
2. **Paper Size**: Custom (80mm x 297mm) or A4 (will auto-crop)
3. **Margins**: None
4. **Scale**: 100%
5. **Background Graphics**: Enabled (for logo)
6. **Headers/Footers**: Disabled

## Troubleshooting

### Logo Not Showing
1. Check file path in database: `SELECT value FROM settings WHERE key = 'business_logo';`
2. Verify file exists: Check `storage/app/public/logos/` folder
3. Ensure storage is linked: Run `php artisan storage:link`
4. Check file permissions: Ensure web server can read the file

### Receipt Not Auto-Opening
- Check browser popup blocker settings
- Allow popups for your Inventino domain
- Manually click "Print Receipt" button in success modal

### Styling Issues
- Clear browser cache (Ctrl + F5)
- Rebuild assets: `npm run build`
- Restart browser

### Tax Not Calculating
- Verify tax_rate setting: `SELECT value FROM settings WHERE key = 'tax_rate';`
- Should be decimal format (e.g., 0.075 for 7.5%)

## Support

For additional help or feature requests, contact your system administrator or refer to the main Inventino documentation.

---

**Powered by INVENTINO**  
_Smart Inventory Management System_
