# Configure Saudi Tax Invoice Pro - Data Setup

## ✅ Invoice Layout is Installed!

Your invoice layout is now working and displaying correctly. To ensure all data shows properly, configure the following:

## 1. Business Information

Go to **Settings → Business Settings** and fill in:

### Basic Info
- Business Name (الاسم)
- Commercial Registration (C.R.) Number
- VAT Number (رقم ضريبة القيمة المضافة)
- Email
- Phone Number

### Address Details
- City (مدينة)
- Postal Code (رمز بريدي)
- Building Number (رقم المبنى)
- Street Name (شارع)
- District (حي)
- Additional Number (رقم إضافي)

## 2. Invoice Layout Settings

Go to **Settings → Invoice Layouts → Edit "Saudi Tax Invoice Pro"**

### Enable These Options:
- ✅ Show Logo (upload your company logo)
- ✅ Show QR Code
- ✅ Show Business Name
- ✅ Show Customer
- ✅ Show Tax 1 (VAT)
- ✅ Show City
- ✅ Show Mobile Number
- ✅ Show Email

### QR Code Fields:
Select these fields for QR code:
- Business Name
- Invoice Number
- Invoice Date
- Total Amount
- Tax 1 (VAT)

## 3. Customer Information

When creating sales, ensure customer has:
- Customer Name
- VAT Number (if B2B)
- Commercial Registration (if B2B)
- Complete Address (City, Postal Code, Building, Street, District)

For **Walking Customer** (B2C sales):
- The invoice will show "Walking Customer"
- VAT and CR fields will be empty (which is correct for B2C)

## 4. Transaction Data

The invoice automatically pulls:
- Invoice Number
- Invoice Date
- Due Date
- Payment Method (from payment records)
- Product Details
- Quantities and Prices
- Tax Calculations
- Totals

## 5. Optional Fields

These fields can be customized in the template if needed:
- Payment Terms (default: "45 days")
- Warranty Number
- Reference Number
- Supply Date

## How to Test

1. **Refresh POS page** (Ctrl+F5)
2. **Select "Saudi Tax Invoice Pro"** from Invoice Layout dropdown
3. **Create a test sale** with:
   - At least one product
   - A customer (or Walking Customer)
   - Payment method
4. **Print Invoice** - it should show all data correctly

## Troubleshooting

### QR Code Not Showing
- Enable "Show QR Code" in invoice layout settings
- Select QR code fields
- Ensure transaction is finalized (not draft)

### Business Address Not Showing
- Fill in all address fields in Business Settings
- Save and refresh

### Customer Data Missing
- Edit customer and add complete address
- For Walking Customer, some fields will be empty (normal)

### Logo Not Appearing
- Upload logo in Invoice Layout settings
- Ensure "Show Logo" is enabled
- Logo file should be in: `public/uploads/invoice_logos/`

## Current Status

✅ Invoice template created
✅ Layout added to database
✅ Available in POS dropdown
✅ Fits on one A4 page
✅ Bilingual (Arabic/English)
✅ ZATCA compliant format

## Next Steps

1. Configure business information
2. Upload company logo
3. Test with real sale
4. Adjust any custom fields if needed

---

**Note**: The invoice layout is working correctly as shown in your screenshot. Just ensure all business and customer data is properly configured in the system settings.
