Files
GSB-Construction/Modules/FinancialManagement/resources/views/pdf/retention_statement.blade.php

158 lines
8.4 KiB
PHP

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Retention Statement - {{ $invoice->invoice_number }}</title>
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'DejaVu Sans', sans-serif; font-size: 11px; color: #1a1a1a; padding: 30px; }
.header { border-bottom: 2px solid #2d3748; padding-bottom: 12px; margin-bottom: 16px; }
.header h1 { font-size: 18px; font-weight: bold; color: #2d3748; }
.header .doc-number { font-size: 13px; color: #4a5568; margin-top: 2px; }
.meta-grid { display: table; width: 100%; margin-bottom: 16px; }
.meta-row { display: table-row; }
.meta-label { display: table-cell; width: 140px; font-weight: bold; padding: 4px 0; color: #4a5568; }
.meta-value { display: table-cell; padding: 4px 0; color: #1a202c; }
table.items { width: 100%; border-collapse: collapse; margin-top: 12px; }
table.items th { background: #edf2f7; padding: 8px 6px; text-align: left; font-size: 10px; text-transform: uppercase; color: #4a5568; border-bottom: 1px solid #cbd5e0; }
table.items td { padding: 7px 6px; border-bottom: 1px solid #e2e8f0; }
table.items .num { text-align: right; font-family: 'DejaVu Sans', monospace; }
.summary-table { width: 100%; border-collapse: collapse; margin-top: 16px; }
.summary-table td { padding: 6px 8px; font-size: 11px; }
.summary-table .label { text-align: right; font-weight: bold; color: #4a5568; width: 70%; }
.summary-table .value { text-align: right; font-family: 'DejaVu Sans', monospace; font-weight: bold; color: #1a202c; width: 30%; }
.summary-table .total-row td { font-size: 12px; border-top: 2px solid #2d3748; background: #f7fafc; color: #9b2c2c; }
.penalty-callout { background: #fff5f5; border: 1px solid #feb2b2; padding: 12px; border-radius: 4px; margin-top: 16px; }
.penalty-title { font-size: 11px; font-weight: bold; color: #9b2c2c; text-transform: uppercase; margin-bottom: 4px; }
.penalty-desc { font-size: 10px; color: #742a2a; line-height: 1.4; }
.footer { margin-top: 30px; page-break-inside: avoid; }
.sig-grid { width: 100%; border-collapse: collapse; }
.sig-grid td { width: 50%; padding: 10px; vertical-align: top; }
.sig-box { border: 1px solid #e2e8f0; padding: 12px; border-radius: 4px; min-height: 70px; }
.sig-box .label { font-size: 9px; text-transform: uppercase; color: #a0aec0; margin-bottom: 6px; }
.sig-box .name { font-weight: bold; font-size: 12px; color: #2d3748; }
.sig-box .role { font-size: 10px; color: #4a5568; }
.sig-box .date { font-size: 9px; color: #a0aec0; margin-top: 4px; }
.status-badge { display: inline-block; padding: 2px 8px; border-radius: 3px; font-size: 10px; font-weight: bold; text-transform: uppercase; }
.status-approved { background: #c6f6d5; color: #276749; }
.status-paid { background: #c6f6d5; color: #276749; }
.status-draft { background: #e2e8f0; color: #4a5568; }
.status-submitted { background: #bee3f8; color: #2a4365; }
.status-sent { background: #feebc8; color: #744210; }
.status-rejected { background: #fed7d7; color: #9b2c2c; }
</style>
</head>
<body>
<div class="header">
<h1>RETENTION STATEMENT &amp; BILLING</h1>
<div class="doc-number">{{ $invoice->invoice_number }}
@php $statusStr = is_object($invoice->status) ? $invoice->status->value : $invoice->status; @endphp
<span class="status-badge status-{{ strtolower($statusStr) }}">{{ strtoupper($statusStr) }}</span>
</div>
</div>
<div class="meta-grid">
<div class="meta-row">
<span class="meta-label">Project Name:</span>
<span class="meta-value"><strong>{{ $invoice->project->name ?? 'N/A' }}</strong> ({{ $invoice->project->code ?? 'PRJ' }})</span>
</div>
<div class="meta-row">
<span class="meta-label">Invoice Date:</span>
<span class="meta-value">{{ $invoice->invoice_date ? $invoice->invoice_date->format('F d, Y') : 'N/A' }}</span>
</div>
@if($invoice->due_date)
<div class="meta-row">
<span class="meta-label">Due Date:</span>
<span class="meta-value">{{ $invoice->due_date->format('F d, Y') }}</span>
</div>
@endif
<div class="meta-row">
<span class="meta-label">Billed Progress:</span>
<span class="meta-value">{{ number_format($invoice->billed_percentage, 1) }}%</span>
</div>
</div>
<table class="items">
<thead>
<tr>
<th style="width: 30px;">#</th>
<th>Description</th>
<th class="num">Quantity</th>
<th class="num">Unit Price</th>
<th class="num">Total</th>
</tr>
</thead>
<tbody>
@forelse($invoice->lineItems as $index => $item)
<tr>
<td>{{ $index + 1 }}</td>
<td>{{ $item->description }}</td>
<td class="num">{{ number_format($item->quantity, 2) }}</td>
<td class="num">{{ number_format($item->unit_price, 2) }}</td>
<td class="num">{{ number_format($item->total, 2) }}</td>
</tr>
@empty
<tr>
<td colspan="5" style="text-align: center; color: #a0aec0; padding: 12px;">No progress billing line items.</td>
</tr>
@endforelse
</tbody>
</table>
<table class="summary-table">
<tr>
<td class="label">Progress Billing Subtotal:</td>
<td class="value">{{ number_format($invoice->subtotal, 2) }}</td>
</tr>
<tr>
<td class="label">10% Retention Holdback:</td>
<td class="value">{{ number_format($invoice->retention_amount, 2) }}</td>
</tr>
@if((float) ($invoice->penalty_amount ?? 0) > 0)
<tr>
<td class="label" style="color: #9b2c2c;">+ Late Remittance Penalty ({{ number_format($invoice->penalty_rate, 2) }}%):</td>
<td class="value" style="color: #9b2c2c;">+{{ number_format($invoice->penalty_amount, 2) }}</td>
</tr>
@endif
<tr class="total-row">
<td class="label">TOTAL RETENTION &amp; PENALTY DUE:</td>
<td class="value">{{ number_format((float) $invoice->retention_amount + (float) ($invoice->penalty_amount ?? 0), 2) }}</td>
</tr>
</table>
@if((float) ($invoice->penalty_amount ?? 0) > 0)
<div class="penalty-callout">
<div class="penalty-title"> Overdue Late Penalty Assessment Notice</div>
<div class="penalty-desc">
A <strong>{{ number_format($invoice->penalty_rate, 2) }}% late penalty surcharge ({{ number_format($invoice->penalty_amount, 2) }})</strong> was officially assessed on
{{ $invoice->penalty_applied_at ? $invoice->penalty_applied_at->format('F d, Y') : 'this invoice' }}.<br>
<strong>Justification / Reason:</strong> "{{ $invoice->penalty_reason }}"
</div>
</div>
@endif
<div class="footer">
<table class="sig-grid">
<tr>
<td>
<div class="sig-box">
<div class="label">Approved By (Project Manager / Executive)</div>
<div class="name">{{ $invoice->penaltyAppliedBy?->name ?? 'Project Manager' }}</div>
<div class="role">Executive Approver</div>
<div class="date">{{ $invoice->approved_at ? $invoice->approved_at->format('M d, Y') : ($invoice->invoice_date ? $invoice->invoice_date->format('M d, Y') : '') }}</div>
</div>
</td>
<td>
<div class="sig-box">
<div class="label">Contractor Payment Proof &amp; Remittance</div>
<div class="name">{{ $invoice->paymentProofSubmittedBy?->name ?? 'Contractor Admin' }}</div>
<div class="role">Contractor Representative</div>
<div class="date">{{ $invoice->payment_proof_submitted_at ? $invoice->payment_proof_submitted_at->format('M d, Y') : 'Pending Remittance' }}</div>
</div>
</td>
</tr>
</table>
</div>
</body>
</html>