# 📄 Print Documents Guide - CargoFlow

## Available Documents (دستاویزات)

### 1. 📄 Invoice (انوائس)
**Purpose:** Professional invoice for billing
**Features:**
- Complete billing details
- Customer information
- Cargo details with weight/volume
- Payment breakdown
- Company branding
- Print-ready format

**When to use:** For billing customers and accounting

---

### 2. 🧾 Cargo Slip / Bilti (بلٹی)
**Purpose:** Cargo receipt and transportation document
**Features:**
- Bilingual (English/Urdu)
- Consignor details (بھیجنے والے کی تفصیلات)
- Shipment details (سامان کی تفصیلات)
- Payment information (ادائیگی کی تفصیلات)
- Signature sections (دستخط)
- Terms & conditions (شرائط و ضوابط)
- Barcode/CNTR number display

**When to use:** During cargo pickup and transportation

---

### 3. ✅ Delivery Receipt (ڈیلیوری رسید)
**Purpose:** Proof of delivery document
**Features:**
- Delivery confirmation section
- Receiver signature space
- Company representative signature
- Delivery date and time
- Cargo condition verification
- Bilingual format

**When to use:** At the time of delivery to customer

---

### 4. 💾 PDF Download
**Purpose:** Downloadable invoice for records
**Features:**
- PDF format
- Saves to computer
- Email-ready
- Archive-friendly

**When to use:** For digital records and email

---

## How to Access Print Documents

### Method 1: From Bookings List

1. Go to **Bookings** page: http://localhost:8080/bookings
2. Find your booking in the list
3. Click the **Print icon** (🖨️) in Actions column
4. Select document type:
   - Invoice
   - Cargo Slip (Bilti)
   - Delivery Receipt
   - Download PDF

### Method 2: From Booking Details

1. Go to **Bookings** page
2. Click **View** (eye icon) on any booking
3. Click **"Print Documents"** button (top right)
4. Select document type from dropdown

### Method 3: Direct URLs

```
Invoice:
http://localhost:8080/bookings/{id}/invoice

Cargo Slip:
http://localhost:8080/bookings/{id}/cargo-slip

Delivery Receipt:
http://localhost:8080/bookings/{id}/delivery-receipt

PDF Download:
http://localhost:8080/bookings/{id}/pdf
```

---

## Printing Instructions

### For Invoice:
1. Click "Invoice" from print menu
2. New tab opens with invoice
3. Click "🖨️ Print Invoice" button
4. Select printer
5. Print or Save as PDF

### For Cargo Slip (Bilti):
1. Click "Cargo Slip (Bilti)" from print menu
2. New tab opens with bilti
3. Click "🖨️ Print Cargo Slip" button
4. Print on A4 paper
5. Get signatures before dispatch

### For Delivery Receipt:
1. Click "Delivery Receipt" from print menu
2. New tab opens with receipt
3. Click "🖨️ Print Receipt" button
4. Print 2 copies (one for customer, one for company)
5. Get receiver signature on delivery

### For PDF Download:
1. Click "Download PDF" from print menu
2. PDF file downloads automatically
3. Save to your computer
4. Can email or archive

---

## Document Features

### Invoice Features:
✅ Professional header with gradient
✅ Company branding
✅ Customer billing address
✅ Itemized cargo details
✅ Payment breakdown
✅ Total amount calculation
✅ Advance payment tracking
✅ Balance due display
✅ Terms and conditions
✅ Signature section

### Cargo Slip (Bilti) Features:
✅ Bilingual (English/Urdu)
✅ Large CNTR number display
✅ Consignor details section
✅ Shipment route (From/To)
✅ Weight, volume, carton count
✅ Payment details
✅ Signature boxes for both parties
✅ Terms & conditions in both languages
✅ Company stamp area

### Delivery Receipt Features:
✅ Professional receipt format
✅ Customer information
✅ Delivery address
✅ Cargo details summary
✅ Delivery confirmation statement
✅ Receiver signature section
✅ Company representative signature
✅ Date and time fields
✅ Bilingual labels

---

## Workflow Examples

### Complete Booking Workflow:

**Step 1: Booking Created**
- Create booking in system
- Status: Pending

**Step 2: Cargo Pickup**
- Print **Cargo Slip (Bilti)**
- Get customer signature
- Attach to cargo
- Update status: Loaded

**Step 3: In Transit**
- Update status: In Transit
- Track location

**Step 4: Delivery**
- Print **Delivery Receipt** (2 copies)
- Deliver cargo
- Get receiver signature
- Keep one copy, give one to customer
- Update status: Delivered

**Step 5: Billing**
- Print **Invoice**
- Send to customer
- Collect payment
- Update payment status

**Step 6: Record Keeping**
- Download **PDF**
- Save in records
- Archive for future reference

---

## Customization

### Company Information:
Edit these files to add your company details:
- `resources/views/bookings/invoice.blade.php`
- `resources/views/bookings/cargo_slip.blade.php`
- `resources/views/bookings/delivery_receipt.blade.php`

### Add Company Logo:
1. Place logo image in `public/images/logo.png`
2. Add to header section in each template:
```html
<img src="{{ asset('images/logo.png') }}" alt="Logo" style="height: 50px;">
```

### Change Colors:
Update the gradient colors in style sections:
```css
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
```

---

## Print Settings

### Recommended Settings:
- **Paper Size:** A4
- **Orientation:** Portrait
- **Margins:** Default (1 inch)
- **Scale:** 100%
- **Background Graphics:** On (for colors)

### For Best Results:
- Use good quality paper
- Print in color for professional look
- Use laser printer for crisp text
- Keep margins enabled

---

## Troubleshooting

### Issue: Print button not working
**Solution:** 
- Check if popup blocker is enabled
- Allow popups for localhost
- Try different browser

### Issue: Document not displaying properly
**Solution:**
- Clear browser cache
- Refresh page
- Check internet connection (for fonts/icons)

### Issue: PDF download not working
**Solution:**
- Check if DomPDF is installed
- Run: `composer require barryvdh/laravel-dompdf`
- Clear config: `php artisan config:clear`

### Issue: Urdu text not showing
**Solution:**
- Font issue - Urdu text is in HTML
- Should display in all modern browsers
- If not, check browser encoding (UTF-8)

---

## Quick Reference

| Document | Purpose | When to Print |
|----------|---------|---------------|
| Invoice | Billing | After delivery |
| Cargo Slip | Transportation | At pickup |
| Delivery Receipt | Proof of delivery | At delivery |
| PDF | Digital record | Anytime |

---

## Tips & Best Practices

### For Cargo Slip (Bilti):
✅ Print before pickup
✅ Get customer signature
✅ Attach to cargo
✅ Keep copy in office
✅ Update status after pickup

### For Delivery Receipt:
✅ Print 2 copies
✅ Get receiver signature
✅ Note delivery date/time
✅ Keep one copy
✅ Give one to customer

### For Invoice:
✅ Print after delivery
✅ Include payment terms
✅ Send within 24 hours
✅ Follow up on payment
✅ Keep copy for records

### For PDF:
✅ Download regularly
✅ Backup to cloud
✅ Organize by month
✅ Use for email
✅ Archive for audit

---

## Support

For issues or questions:
- Check this guide first
- Review the troubleshooting section
- Contact system administrator

---

**All documents are print-ready and professionally designed!**

**Status: READY TO USE ✅**
