Add subcontract jobs section to work order PDF
Loads subcontractJobs.subcontractor relation and renders a new table in the PDF after parts: description, subcontractor, category, client price. Adds ru/en translations for the new section labels. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -9,7 +9,7 @@ class WorkOrderPdfService
|
||||
{
|
||||
public function generate(WorkOrder $wo): \Barryvdh\DomPDF\PDF
|
||||
{
|
||||
$wo->load(['client', 'vehicle', 'master', 'works.master', 'parts', 'payments']);
|
||||
$wo->load(['client', 'vehicle', 'master', 'works.master', 'parts', 'payments', 'subcontractJobs.subcontractor']);
|
||||
$company = $wo->company ?: \App\Models\Central\Company::find($wo->company_id);
|
||||
|
||||
$themeColor = $company?->settings['theme_color'] ?? '#3B82F6';
|
||||
|
||||
+3
-1
@@ -931,7 +931,7 @@
|
||||
"GPL": "LPG",
|
||||
"GRANT — adaugă dreptul": "GRANT — add permission",
|
||||
"Galerie de până la 8 imagini. Prima e afișată în catalog. Max 2 MB / imagine.": "Gallery of up to 8 images. First is shown in the catalog. Max 2 MB / image.",
|
||||
"Gata": "Ready",
|
||||
"Gata": "Done",
|
||||
"Gata de ridicare": "Ready for pickup",
|
||||
"Gata estimat (ETA)": "Gata estimat (ETA)",
|
||||
"Gearbox": "Gearbox",
|
||||
@@ -1119,6 +1119,7 @@
|
||||
"Lucrare blocată": "Work blocked",
|
||||
"Lucrări": "Tasks",
|
||||
"Lucrări la terți": "Subcontracted work",
|
||||
"Lucrări terțe": "Subcontract jobs",
|
||||
"Lucrări terți": "Outsourced jobs",
|
||||
"Luna aceasta": "This month",
|
||||
"Luna curentă": "Current month",
|
||||
@@ -1959,6 +1960,7 @@
|
||||
"Subtotal": "Subtotal",
|
||||
"Subtotal manopere:": "Labor subtotal:",
|
||||
"Subtotal piese:": "Parts subtotal:",
|
||||
"Subtotal terțe:": "Subcontract subtotal:",
|
||||
"Subtotal:": "Subtotal:",
|
||||
"Succes": "Success",
|
||||
"Sugerează revizie / piese de uzură.": "Suggest service / wear parts.",
|
||||
|
||||
+4
-2
@@ -931,7 +931,7 @@
|
||||
"GPL": "LPG",
|
||||
"GRANT — adaugă dreptul": "GRANT — добавить право",
|
||||
"Galerie de până la 8 imagini. Prima e afișată în catalog. Max 2 MB / imagine.": "Галерея до 8 изображений. Первое отображается в каталоге. Максимум 2 МБ / изображение.",
|
||||
"Gata": "Готов",
|
||||
"Gata": "Готово",
|
||||
"Gata de ridicare": "Готово к выдаче",
|
||||
"Gata estimat (ETA)": "Gata estimat (ETA)",
|
||||
"Gearbox": "КПП",
|
||||
@@ -1119,6 +1119,7 @@
|
||||
"Lucrare blocată": "Работа заблокирована",
|
||||
"Lucrări": "Работы",
|
||||
"Lucrări la terți": "Работы у субподрядчиков",
|
||||
"Lucrări terțe": "Сторонние работы",
|
||||
"Lucrări terți": "Работы у третьих лиц",
|
||||
"Luna aceasta": "В этом месяце",
|
||||
"Luna curentă": "Текущий месяц",
|
||||
@@ -1589,7 +1590,7 @@
|
||||
"Preț": "Цена",
|
||||
"Preț achiziție": "Цена закупки",
|
||||
"Preț anual": "Годовая цена",
|
||||
"Preț client": "Цена клиенту",
|
||||
"Preț client": "Цена клиента",
|
||||
"Preț contextual": "Preț contextual",
|
||||
"Preț de bază (markup)": "Preț de bază (markup)",
|
||||
"Preț fix": "Фикс. цена",
|
||||
@@ -1959,6 +1960,7 @@
|
||||
"Subtotal": "Промежуточный итог",
|
||||
"Subtotal manopere:": "Итого работы:",
|
||||
"Subtotal piese:": "Итого запчасти:",
|
||||
"Subtotal terțe:": "Итого сторонние:",
|
||||
"Subtotal:": "Подытог:",
|
||||
"Succes": "Успех",
|
||||
"Sugerează revizie / piese de uzură.": "Предложите ТО / расходники.",
|
||||
|
||||
@@ -252,6 +252,36 @@
|
||||
</table>
|
||||
@endif
|
||||
|
||||
@if ($wo->subcontractJobs->isNotEmpty())
|
||||
<h3 style="font-size: 12px; margin: 12px 0 4px; text-transform: uppercase; color: {{ $themeColor }};">{{ __('Lucrări terțe') }}</h3>
|
||||
<table class="items">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 40%;">{{ __('Denumire') }}</th>
|
||||
<th style="width: 20%;">{{ __('Terț') }}</th>
|
||||
<th style="width: 15%;">{{ __('Categorie') }}</th>
|
||||
<th class="r" style="width: 25%;">{{ __('Preț client') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($wo->subcontractJobs as $sj)
|
||||
<tr>
|
||||
<td>{{ $sj->description ?? '—' }}</td>
|
||||
<td>{{ $sj->subcontractor?->name ?? '—' }}</td>
|
||||
<td>{{ $sj->category ? __($sj->category) : '—' }}</td>
|
||||
<td class="r"><b>{{ number_format((float) $sj->client_price, 2, '.', ' ') }}</b></td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="3" class="r">{{ __('Subtotal terțe:') }}</td>
|
||||
<td class="r">{{ number_format((float) $wo->subcontractJobs->sum('client_price'), 2, '.', ' ') }} {{ $currency }}</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
@endif
|
||||
|
||||
<div class="total-box">
|
||||
@if ($wo->discount_pct > 0)
|
||||
<div class="total-line">{{ __('Subtotal:') }} {{ number_format((float) ($worksTotal + $partsTotal), 2, '.', ' ') }} {{ $currency }}</div>
|
||||
|
||||
Reference in New Issue
Block a user