ifnex/04_Laravel/resources/views/pdfs/invoice.blade.php
Kazem Alghasi 31d28fbe68 docs(pdf): add technical mapping and implementation notes to templates
Add detailed documentation within AWB, Invoice, and Label PDF templates
to map HTML elements to specific Excel cell references and VLOOKUP
sources. This includes requirements for fonts, colors, and dimensions
to ensure future alignment with official IFNEX branding and Excel
templates.

Also update project status to reflect completed middleware configuration
tasks.
2026-08-04 09:50:53 +03:30

159 lines
8.7 KiB
PHP

<!DOCTYPE html>
<!--
INVOICE PDF TEMPLATE TODO: تطبیق نهایی با قالب اکسل
Excel Reference: شیت «INVOICE + label» در فایل 01KYWGVNKS5TNMN37RV77PCYNZ.xlsx
Cell Mapping:
- B1: «INVOICE»
- E2:F2: DATE
- F3: INVOICE NO (AWB number, lookup key)
- A4:B9: SHIPPER info (Name, Company, Contact, Address, City/Zip, Email)
- A10:B16: CONSIGNEE info
- A18:F18: Content description
- A20:F20: Items table headers (NO, DESCRIPTION, H.S. Code, QUANTITY, UNIT PRICE, TOTAL IN USD)
- A21:F29: 9 item rows (VLOOKUP from List sheet)
- C30:F30: TOTAL INVOICE AMOUNT IN USD
- A31:B32: Weight & Dimension
- A34:B34: REASON FOR EXPORT
- A36:F36: Legal declaration
- F40:F45: AWB echo, Weight, Origin/Destination country
VLOOKUP Source: شیت «List» (A3:CH3938)
Required Fields:
- Shipper: Name, Company, Contact, Address, City/Zip, Email
- Consignee: Name, Company, Contact, Address, City/Zip, Email
- Content: Description, Reason for Export
- Items: up to 9 rows (Description, HS Code, Quantity, Unit Price, Total USD)
- Shipment: Weight, Volumetric Weight, Dimensions, Service, Direction
- Total Invoice Amount in USD
Font: باید فونت رسمی IFNEX استفاده شود
Colors: عنوان‌ها نارنجی #f37021، جدول‌ها با حاشیه #ddd
Page: A4 Portrait
-->
<html lang="fa" dir="rtl">
<head>
<meta charset="UTF-8">
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: DejaVu Sans, sans-serif; font-size: 11px; direction: rtl; text-align: right; }
.container { padding: 20px; }
.header { text-align: center; margin-bottom: 20px; border-bottom: 2px solid #f37021; padding-bottom: 10px; }
.header h1 { color: #f37021; font-size: 20px; margin-bottom: 5px; }
.header .meta { display: flex; justify-content: space-between; font-size: 10px; color: #666; }
.section { margin-bottom: 15px; border: 1px solid #ddd; padding: 10px; }
.section-title { font-weight: bold; color: #f37021; margin-bottom: 8px; font-size: 12px; border-bottom: 1px solid #eee; padding-bottom: 3px; }
.row { display: flex; margin-bottom: 4px; }
.label { width: 130px; font-weight: bold; color: #555; }
.value { flex: 1; }
.two-col { display: flex; gap: 20px; }
.col { flex: 1; }
table { width: 100%; border-collapse: collapse; margin-top: 10px; }
th, td { border: 1px solid #ddd; padding: 6px; text-align: right; font-size: 10px; }
th { background-color: #f5f5f5; font-weight: bold; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.total { font-weight: bold; color: #f37021; }
.footer { margin-top: 20px; border-top: 1px solid #ddd; padding-top: 10px; font-size: 9px; color: #666; }
.declaration { font-size: 9px; color: #666; margin-top: 15px; line-height: 1.5; }
.awb-box { background-color: #f9f9f9; padding: 5px 10px; display: inline-block; border: 1px dashed #f37021; }
</style>
</head>
<body>
<div class="container">
<div class="header">
<h1>INVOICE / فاکتور</h1>
<div class="meta">
<span>DATE: {{ $shipment->created_at?->format('Y-m-d') }}</span>
<span class="awb-box">INVOICE NO: {{ $shipment->awb_no }}</span>
</div>
</div>
<div class="two-col">
<div class="col section">
<div class="section-title">SHIPPER / فرستنده</div>
<div class="row"><span class="label">Name:</span><span class="value">{{ $shipper['name'] }}</span></div>
<div class="row"><span class="label">Company:</span><span class="value">{{ $shipper['company'] }}</span></div>
<div class="row"><span class="label">Contact:</span><span class="value">{{ $shipper['phone'] }}</span></div>
<div class="row"><span class="label">Address:</span><span class="value">{{ $shipper['address'] }}</span></div>
<div class="row"><span class="label">City/Zip:</span><span class="value">{{ $shipper['city'] }} {{ $shipper['zip'] }}</span></div>
<div class="row"><span class="label">Email:</span><span class="value">{{ $shipper['email'] }}</span></div>
</div>
<div class="col section">
<div class="section-title">CONSIGNEE / گیرنده</div>
<div class="row"><span class="label">Name:</span><span class="value">{{ $receiver['name'] }}</span></div>
<div class="row"><span class="label">Company:</span><span class="value">{{ $receiver['company'] }}</span></div>
<div class="row"><span class="label">Contact:</span><span class="value">{{ $receiver['phone'] }}</span></div>
<div class="row"><span class="label">Address:</span><span class="value">{{ $receiver['address'] }}</span></div>
<div class="row"><span class="label">City/Zip:</span><span class="value">{{ $receiver['city'] }} {{ $receiver['zip'] }}</span></div>
<div class="row"><span class="label">Email:</span><span class="value">{{ $receiver['email'] }}</span></div>
</div>
</div>
<div class="section">
<div class="section-title">SHIPMENT DETAILS</div>
<div class="row">
<div style="width: 50%">
<div class="row"><span class="label">Weight:</span><span class="value">{{ $shipment->weight }} kg</span></div>
<div class="row"><span class="label">Volumetric:</span><span class="value">{{ $shipment->volumetric_weight }} kg</span></div>
<div class="row"><span class="label">Dimensions:</span><span class="value">{{ $shipment->dimensions }}</span></div>
<div class="row"><span class="label">Service:</span><span class="value">{{ $shipment->type?->label() }}</span></div>
<div class="row"><span class="label">Direction:</span><span class="value">{{ $shipment->direction?->label() }}</span></div>
</div>
<div style="width: 50%">
<div class="row"><span class="label">From:</span><span class="value">{{ $shipment->fromCountry?->name }}</span></div>
<div class="row"><span class="label">To:</span><span class="value">{{ $shipment->toCountry?->name }}</span></div>
<div class="row"><span class="label">Forwarder:</span><span class="value">{{ $shipment->forwarder }}</span></div>
<div class="row"><span class="label">Reason:</span><span class="value">{{ $shipment->reason_for_export ?: 'N/A' }}</span></div>
</div>
</div>
</div>
<div class="section">
<div class="section-title">CONTENT / محموله</div>
<p style="margin-bottom: 10px;">{{ $shipment->reason_for_export ?: 'General Goods' }}</p>
<table>
<thead>
<tr>
<th style="width: 40px">No</th>
<th>Description</th>
<th style="width: 100px">H.S. Code</th>
<th style="width: 70px">Qty</th>
<th style="width: 90px">Unit Price (USD)</th>
<th style="width: 100px">Total (USD)</th>
</tr>
</thead>
<tbody>
@forelse($items as $item)
<tr>
<td class="text-center">{{ $item->row_number }}</td>
<td>{{ $item->description }}</td>
<td class="text-center">{{ $item->hs_code }}</td>
<td class="text-center">{{ $item->quantity }}</td>
<td class="text-center">{{ number_format($item->unit_price, 2) }}</td>
<td class="text-center">{{ number_format($item->total_usd, 2) }}</td>
</tr>
@empty
<tr><td colspan="6" class="text-center">No items</td></tr>
@endforelse
</tbody>
</table>
<div style="margin-top: 10px; text-align: left;">
<strong>TOTAL INVOICE AMOUNT IN USD: {{ number_format($invoice_total_usd, 2) }}</strong>
</div>
</div>
<div class="declaration">
I HEREBY STATE THAT THE ABOVE INFORMATION IS TRUE AND CORRECT TO THE BEST OF MY KNOWLEDGE.
</div>
<div class="footer">
IFNEX Logistics We Deliver Value | AWB: {{ $shipment->awb_no }} | Generated on {{ now()->format('Y-m-d H:i') }}
</div>
</div>
</body>
</html>