{{ trans('progressStatement.pdf.statement_number') }}{{ $progressStatement->getNumber('created_at') }} du {{ \Carbon\Carbon::parse($progressStatement->start_date)->format('d/m/Y') }} au {{ \Carbon\Carbon::parse($progressStatement->end_date)->format('d/m/Y') }}

{{ trans('progressStatement.pdf.market_object') }} - {{ $progressStatement->object_market }}

{{ trans('progressStatement.pdf.partner') }} - {{ $partner }}

{{ trans('progressStatement.pdf.client') }} - {{ $progressStatement->client->fullname }}

{{ trans('progressStatement.pdf.market_number') }} - {{ $progressStatement->market_number }} Arrêté au: {{ \Carbon\Carbon::parse($progressStatement->end_date)->format('d/m/Y') }}
@php $subtotalPlannedMPRHT = 0; $subtotalPreviousMPRHT = 0; $subtotalMonthMPRHT = 0; $subtotalCumulateMPRHT = 0; $totalItemDiscounts = 0; $totalAttendanceRate = 0; $itemCount = 0; @endphp @foreach ($itemsByCategory as $categoryName => $categoryItems) @php $subtotalPlanned = 0; $subtotalPrevious = 0; $subtotalMonth = 0; $subtotalCumulate = 0; $categoryDiscounts = 0; $categoryAttendanceRate = 0; $categoryItemCount = 0; @endphp @foreach ($categoryItems as $index => $item) @php $plannedQty = $item['planned_quantity'] ?? 0; $previousQty = $item['previous_quantity'] ?? 0; $currentQty = $item['quantity'] ?? 0; $cumulateQty = $item['cumulate_quantity'] ?? ($previousQty + $currentQty); $unitPrice = $item['unit_price'] ?? 0; $attendanceRate = $item['attendance_rate'] ?? 0; $itemDiscounts = $item['discounts'] ?? []; $totalItemDiscountAmount = 0; foreach ($itemDiscounts as $discount) { if ($discount['type'] === 'percent') { $totalItemDiscountAmount += $unitPrice * ($discount['amount'] / 100); } else { $totalItemDiscountAmount += $discount['amount']; } } $finalUnitPrice = max($unitPrice - $totalItemDiscountAmount, 0); $plannedAmount = $plannedQty * $finalUnitPrice; $previousAmount = $previousQty * $finalUnitPrice; $monthAmount = $currentQty * $finalUnitPrice; $cumulateAmount = $cumulateQty * $finalUnitPrice; $itemDiscountTotal = $currentQty * $totalItemDiscountAmount; $subtotalPlanned += $plannedAmount; $subtotalPrevious += $previousAmount; $subtotalMonth += $monthAmount; $subtotalCumulate += $cumulateAmount; $categoryDiscounts += $itemDiscountTotal; $categoryAttendanceRate += $attendanceRate; $categoryItemCount++; $totalAttendanceRate += $attendanceRate; $itemCount++; @endphp @endforeach @php $categoryAverageAttendance = $categoryItemCount > 0 ? $categoryAttendanceRate / $categoryItemCount : 0; @endphp @php $subtotalPlannedMPRHT += $subtotalPlanned; $subtotalPreviousMPRHT += $subtotalPrevious; $subtotalMonthMPRHT += $subtotalMonth; $subtotalCumulateMPRHT += $subtotalCumulate; $totalItemDiscounts += $categoryDiscounts; @endphp @endforeach @php $statementDiscounts = $progressStatement->discounts ?? collect(); $statementDiscountAmount = 0; $statementDiscountDetails = []; foreach ($statementDiscounts as $discount) { $discountAmount = 0; if ($discount->type === 'percent') { $discountAmount = $subtotalMonthMPRHT * ($discount->amount / 100); } else { $discountAmount = $discount->amount; } $statementDiscountAmount += $discountAmount; $statementDiscountDetails[] = [ 'title' => $discount->title, 'type' => $discount->type, 'amount' => $discount->amount, 'calculated_amount' => $discountAmount ]; } $taxes = $progressStatement->taxes ?? collect(); $cumulateAdvance = $progressStatement->cumulate_advance ?? 0; $subtotalpreviousADF = $cumulateAdvance ?: $subtotalPlannedMPRHT * 0.2; $subtotalMonthADF = -$subtotalMonthMPRHT * 0.25; $subtotalCumulateADF = $subtotalpreviousADF + $subtotalMonthADF; $subtotalMonthAfterGlobalDiscount = max($subtotalMonthMPRHT - $statementDiscountAmount, 0); $subtotalMonthADFAfterDiscount = -$subtotalMonthAfterGlobalDiscount * 0.25; $subtotalpreviousMPRA = $subtotalPreviousMPRHT + $subtotalpreviousADF; $subtotalMonthMPRA = $subtotalMonthAfterGlobalDiscount + $subtotalMonthADFAfterDiscount; $subtotalCumulateMPRA = $subtotalpreviousMPRA + $subtotalMonthMPRA; $globalSubtotalPlannedTVA = 0; $globalSubtotalPreviousTVA = 0; $globalSubtotalMonthTVA = 0; $globalSubtotalCumulateTVA = 0; foreach ($taxes as $tax) { $taxRate = $tax->type == 'percent' ? ($tax->amount / 100) : $tax->amount; $globalSubtotalPlannedTVA += $subtotalPlannedMPRHT * $taxRate; $globalSubtotalPreviousTVA += $subtotalpreviousMPRA * $taxRate; $globalSubtotalMonthTVA += $subtotalMonthMPRA * $taxRate; $globalSubtotalCumulateTVA += $subtotalCumulateMPRA * $taxRate; } // Calcul du taux de présence moyen global $averageAttendanceRate = $itemCount > 0 ? $totalAttendanceRate / $itemCount : 0; @endphp @if($statementDiscountAmount > 0) @foreach($statementDiscountDetails as $detail) @endforeach @endif @foreach ($taxes as $tax) @php $taxRate = $tax->type == 'percent' ? ($tax->amount / 100) : $tax->amount; $taxDisplay = $tax->type == 'percent' ? $tax->amount . '%' : number_format($tax->amount, 2); $taxPlanned = $subtotalPlannedMPRHT * $taxRate; $taxPrevious = $subtotalpreviousMPRA * $taxRate; $taxMonth = $subtotalMonthMPRA * $taxRate; $taxCumulate = $subtotalCumulateMPRA * $taxRate; @endphp @endforeach @php $totalPlanned = $subtotalPlannedMPRHT + $globalSubtotalPlannedTVA; $totalPrevious = $subtotalpreviousMPRA + $globalSubtotalPreviousTVA; $totalMonth = $subtotalMonthMPRA + $globalSubtotalMonthTVA; $totalCumulate = $totalPrevious + $totalMonth; @endphp
№. {{ trans('progressStatement.pdf.title.designation') }} {{ trans('progressStatement.pdf.title.unity') }} {{ trans('progressStatement.pdf.title.quantity') }} {{ trans('progressStatement.pdf.title.price_unity') }} {{ trans('progressStatement.pdf.title.discount_price') }} {{ trans('progressStatement.pdf.title.finaly_price') }} {{ trans('progressStatement.pdf.title.attendance_rate') }} {{ trans('progressStatement.pdf.title.amount') }}
{{ trans('progressStatement.pdf.title.planned') }} {{ trans('progressStatement.pdf.title.previous') }} {{ trans('progressStatement.pdf.title.of_month') }} {{ trans('progressStatement.pdf.title.cumulative') }} {{ trans('progressStatement.pdf.title.planned') }} {{ trans('progressStatement.pdf.title.previous') }} {{ trans('progressStatement.pdf.title.of_month') }} {{ trans('progressStatement.pdf.title.cumulative') }}
{{ $categoryName }}
{{ $index + 1 }} {{ $item['designation'] }} @if(count($itemDiscounts) > 0)
@foreach($itemDiscounts as $discount) • {{ $discount['title'] }}: @if($discount['type'] === 'percent') {{ $discount['amount'] }}% @else {{ number_format($discount['amount'], 0, '.', ' ') }} @endif
@endforeach
@endif
{{ $item['statementUnity']?->name ?? '' }} {{ number_format($plannedQty, 2, '.', ' ') }} {{ number_format($previousQty, 2, '.', ' ') }} {{ number_format($currentQty, 2, '.', ' ') }} {{ number_format($cumulateQty, 2, '.', ' ') }} {{ number_format($unitPrice, 2, '.', ' ') }} {{ number_format($totalItemDiscountAmount, 2, '.', ' ') }} {{ number_format($finalUnitPrice, 2, '.', ' ') }} {{ number_format($attendanceRate, 1, '.', ' ') }}% {{ number_format($plannedAmount, 2, '.', ' ') }} {{ number_format($previousAmount, 2, '.', ' ') }} {{ number_format($monthAmount, 2, '.', ' ') }} {{ number_format($cumulateAmount, 2, '.', ' ') }}
Sous-total {{ $categoryName }}: {{ number_format($subtotalPlanned, 2, '.', ' ') }} {{ number_format($subtotalPrevious, 2, '.', ' ') }} {{ number_format($subtotalMonth, 2, '.', ' ') }} {{ number_format($subtotalCumulate, 2, '.', ' ') }}
{{ trans('progressStatement.pdf.amount_ht') }} {{ number_format($subtotalPlannedMPRHT, 2, '.', ' ') }} {{ number_format($subtotalPreviousMPRHT, 2, '.', ' ') }} {{ number_format($subtotalMonthMPRHT, 2, '.', ' ') }} {{ number_format($subtotalCumulateMPRHT, 2, '.', ' ') }}
{{ trans('progressStatement.item.discount') }}: {{ $detail['title'] }} ({{ $detail['type'] === 'percent' ? $detail['amount'].'%' : number_format($detail['amount'], 0, '.', ' ') }}) -{{ number_format($detail['calculated_amount'], 2, '.', ' ') }} -{{ number_format($detail['calculated_amount'], 2, '.', ' ') }}
{{ trans('progressStatement.pdf.advance') }} {{ number_format($subtotalpreviousADF, 2, '.', ' ') }} {{ number_format($subtotalMonthADFAfterDiscount ?? $subtotalMonthADF, 2, '.', ' ') }} {{ number_format($subtotalCumulateADF, 2, '.', ' ') }}
{{ trans('progressStatement.pdf.after_advance_payment') }} {{ number_format($subtotalpreviousMPRA, 2, '.', ' ') }} {{ number_format($subtotalMonthMPRA, 2, '.', ' ') }} {{ number_format($subtotalCumulateMPRA, 2, '.', ' ') }}
T.V.A. {{ $taxDisplay }} {{ number_format($taxPlanned, 2, '.', ' ') }} {{ number_format($taxPrevious, 2, '.', ' ') }} {{ number_format($taxMonth, 2, '.', ' ') }} {{ number_format($taxCumulate, 2, '.', ' ') }}
{{ trans('progressStatement.pdf.amount_ttc') }} {{ number_format($totalPlanned, 2, '.', ' ') }} {{ number_format($totalPrevious, 2, '.', ' ') }} {{ number_format($totalMonth, 2, '.', ' ') }} {{ number_format($totalCumulate, 2, '.', ' ') }}
@php use NumberToWords\NumberToWords; $numberToWords = new NumberToWords(); $local = appLocale(); $numberTransformer = $numberToWords->getNumberTransformer($local); $totalMonthInWords = $numberTransformer->toWords(floor($totalMonth)); @endphp