# Saudi Tax Invoice Pro - Installation & Usage Guide

## Overview
This is a professional Saudi Tax Invoice layout that matches the exact format shown in your reference image. It includes:
- Professional header section
- QR code for ZATCA compliance
- Detailed seller and buyer information
- Bilingual (Arabic/English) labels
- Complete tax breakdown
- Signature section

## Installation Steps

### Step 1: Add the Layout to Database
Run the SQL file to add the new invoice layout:

```bash
# Option 1: Using MySQL command line
mysql -u your_username -p your_database_name < add_saudi_tax_invoice_pro_layout.sql

# Option 2: Using phpMyAdmin
# - Open phpMyAdmin
# - Select your database
# - Go to SQL tab
# - Copy and paste the content from add_saudi_tax_invoice_pro_layout.sql
# - Click "Go"
```

### Step 2: Configure the Layout
1. Login to your admin panel
2. Go to **Settings → Invoice Layouts**
3. Find **"Saudi Tax Invoice Pro"** in the list
4. Click **Edit**
5. Configure the following:

#### Logo Settings
- **Show Logo**: Enable (check the box)
- **Upload Logo**: Upload your company logo

#### QR Code Settings
- **Show QR Code**: Enable (check the box)
- **QR Code Fields**: Select the fields you want in QR code:
  - Business Name
  - Invoice Number
  - Invoice Date
  - Total Amount
  - Tax Amount

#### Business Information
Make sure your business profile has these details filled:
- **CR Number** (Commercial Registration)
- **VAT Number** (Tax Registration Number)
- **City**
- **Postal Code**
- **Building Number**
- **Street Name**
- **District**
- **Additional Number**

### Step 3: Assign to Location
1. Go to **Business Locations**
2. Edit your location
3. In **Invoice Layout** dropdown, select **"Saudi Tax Invoice Pro"**
4. Save

### Step 4: Test the Invoice
1. Go to POS
2. Create a test sale
3. Print the invoice
4. Verify all information appears correctly

## Customization Options

### Modifying Business Details
If you need to add/edit business details that appear on the invoice:

1. **Business Profile** (Settings → Business Settings):
   - Company Name
   - Tax Numbers
   - Contact Information

2. **Custom Fields** (if needed):
   Edit the file: `resources/views/sale_pos/receipts/saudi-tax-invoice-pro.blade.php`
   
   Find the seller info section and modify:
   ```php
   <span class="party-value">{{ $receipt_details->business_cr ?? 'YOUR_CR_NUMBER' }}</span>
   ```

### Changing Colors
Edit the CSS in `saudi-tax-invoice-pro.blade.php`:

```css
/* Header border color */
.header-section {
    border-bottom: 3px solid #000; /* Change #000 to your color */
}

/* Info box red text */
.info-box-red {
    color: #d32f2f; /* Change to your preferred color */
}
```

### Adding/Removing Fields
To add more fields to the seller/buyer info sections:

```php
<div class="party-row">
    <span class="party-label">Your Label / التسمية</span>
    <span class="party-value">{{ $receipt_details->your_field ?? 'Default Value' }}</span>
</div>
```

## Features Included

### ✅ Header Section
- Large "HEADER" text (customizable)
- Professional layout

### ✅ Invoice Information Grid
- Invoice Number
- Invoice Date
- Due Date
- Payment Terms
- Warranty Number
- Reference Number
- Mode of Payment

### ✅ QR Code
- ZATCA compliant QR code
- Positioned in top-right corner
- Automatic generation from transaction data

### ✅ Seller Information
- Commercial Registration (C.R.)
- VAT Number
- Business Name
- Complete Address (City, Postal Code, Building, Street, District)
- Additional Number

### ✅ Buyer Information
- Customer C.R. (if available)
- Customer VAT Number (if available)
- Customer Name
- Complete Address

### ✅ Items Table
- Serial Number
- Product Description (Arabic/English)
- Unit Price
- Quantity
- Discount
- Taxable Amount
- Discount Percentage
- VAT Rate
- Total Including VAT

### ✅ Totals Section
- Subtotal
- Discount
- Total Excluding VAT
- VAT Amount
- Total Including VAT
- Total Paid
- Remaining Due

### ✅ Signature Section
- Seller Signature Line
- Buyer Signature Line
- Bilingual labels

### ✅ Notes Section
- Arabic and English notes
- Customizable footer text

## Troubleshooting

### QR Code Not Showing
1. Check if QR code is enabled in invoice layout settings
2. Verify QR code fields are selected
3. Ensure transaction status is "final"
4. Check if SimpleSoftwareIO/simple-qrcode package is installed

### Logo Not Appearing
1. Verify logo is uploaded in invoice layout settings
2. Check file exists in: `public/uploads/invoice_logos/`
3. Ensure "Show Logo" is enabled

### Missing Business Details
1. Go to Settings → Business Settings
2. Fill in all required fields
3. Save and try printing again

### Arabic Text Not Displaying Correctly
1. Ensure your browser supports Arabic fonts
2. Check if Arial or Tahoma fonts are available
3. The layout uses RTL (right-to-left) direction automatically

## File Locations

- **Invoice Template**: `resources/views/sale_pos/receipts/saudi-tax-invoice-pro.blade.php`
- **SQL File**: `add_saudi_tax_invoice_pro_layout.sql`
- **This Guide**: `SAUDI_TAX_INVOICE_PRO_GUIDE.md`

## Support

If you need to modify the layout further:
1. Edit the blade template file
2. Modify CSS styles in the `<style>` section
3. Add/remove fields as needed
4. Test thoroughly before using in production

## ZATCA E-Invoicing Compliance

This layout is designed to support ZATCA (Zakat, Tax and Customs Authority) requirements:
- ✅ QR Code with required fields
- ✅ Bilingual (Arabic/English)
- ✅ VAT breakdown
- ✅ Seller and buyer details
- ✅ Tax registration numbers
- ✅ Invoice date and number

Make sure to configure all required fields in your business settings for full compliance.

---

**Created**: {{ date('Y-m-d') }}
**Version**: 1.0
**Compatible with**: Fodoo POS / Laravel POS Systems
