@php use Carbon\Carbon; use App\Services\CommissionService; Carbon::setLocale('fr'); @endphp
@isset ($error)
{{$error}}
@else
@if($isCommissionMode)

Commissions {{Carbon::createFromFormat('m', $moisParam)->isoFormat('MMMM') . ' ' . $anneeParam }}

@else

Tableau des Ventes et commissions

@endif
@if(!$isCommissionMode)
@if($isDirecteur || $isAdministratif) @else @endif
@endif
@if(!$this->isCommissionMode) @endif @forelse($ventesData['ventes'] as $vente) @if(!$this->isCommissionMode) @endif @empty @if($this->isCommissionMode) @else @endif @endforelse @if(count($ventesData['ventes']) > 0) @if(!$this->isCommissionMode) @endif @endif

N° VENTE

DATE

CLIENT

VRP

PRIX TARIF

TAUX REMISE

CA HT

MARGE

COMM. TAUX

COMM. MONTANT

PRODUITS

COMMISSIONNÉ

SOURCE

PAIEMENT

ATTENTE

COMMANDE

ACTION

{{ $loop->iteration }}

{{ $vente->date ? \Carbon\Carbon::parse($vente->date)->format('d/m/Y') : 'N/A' }}

{{ $vente->client->nom ?? '' }}

@if($vente->vrp1 != '' || $vente->vrp2 != '' || $vente->vrp3 != '') {!! $vente->vrp1 !!} @if($vente->vrp2)
{!! $vente->vrp2 !!} @endif @if($vente->vrp3)
{!! $vente->vrp3 !!} @endif @else

N/A

@endif

{{ number_format($vente->tarif_total_ht, 0, ',', ' ') }}€

{{ number_format($vente->remise , 0, ',', ' ') }}%

{{ number_format($vente->ca_total_ht, 0, ',', ' ') }}€

{{ number_format((int)($vente->ca_total_ht - $vente->tarif_total_ht * 0.85) , 0, ',', ' ') }}€

@php // Commission rate calculation based on legacy logic if ($vente->statut != 3 && empty($vente->attente)) { echo $vente->taux; // Handle second commercial if ($vente->id_commercial_2) { echo "
"; echo $vente->vente2_taux; } // Handle third commercial if ($vente->id_commercial_3) { echo "
"; echo $vente->vente3_taux; } } else { echo '--'; } @endphp
@php // Commission calculation based on legacy logic if ($vente->statut != 3 && empty($vente->attente)) { echo $vente->montant_commission; // Handle second commercial if ($vente->id_commercial_2) { echo "
"; echo $vente->vente2_montant_commission; } // Handle third commercial if ($vente->id_commercial_3) { echo "
"; echo $vente->vente3_montant_commission; } } else { echo '--'; } @endphp
{!!$vente->final_products!!} {{ $vente->commissionneText }}

{{$vente->source_name }}

{{ $vente->paiement ?? 'N/A' }}

@if($vente->attente) @foreach(explode(';', $vente->attente) as $attente) @if($isAdmin) {{ $attente }} @if($attente == "Autre") @endif @else
{{ $attente }}
@if($attente == "Autre") @endif @endif
@endforeach @endif
@php $commandeClass = match($vente->commande) { 1 => 'bg-green-100 text-green-800', 0 => 'bg-red-100 text-red-800', default => 'bg-gray-100 text-gray-800' }; $commandeText = match($vente->commande) { 1 => 'Oui', 0 => 'Non', default => 'N/A' }; @endphp {{ $commandeText }}
@if ($vente->statut == 1 || $isAdmin) @endif @php $statusButtonClass = ""; if ($isAdmin || $isAdministratif){ // Confirmed or other status - show cancel button $statusButtonClass = 'bg-red-500 hover:bg-red-600'; $statusIcon = 'fas fa-times'; $statusTitle = 'Annuler la vente'; } @endphp @if($statusButtonClass != '') @endif @php $statusButtonClass = ""; if ($vente->statut != 2 && ($isAdmin)) { // Cancelled sale - show confirm button $statusButtonClass = 'bg-green-500 hover:bg-green-600'; $statusIcon = 'fas fa-check'; if($vente->statut == 1) $statusTitle = 'Valider la vente'; else $statusTitle = 'Revalider la vente'; } @endphp @if($statusButtonClass != '') @endif
Aucune vente trouvée.Aucune vente trouvée.

TOTAL

-

-

-

{{ number_format($ventesData['totals']['prix_tarif'], 0, ',', ' ') }}€

{{ number_format(floor($ventesData['totals']['taux_remise']), 0, ',', ' ') }}% ({{number_format(floor($ventesData['totals']['taux_remise_total']), 0, ',', ' ')}}%)

{{ number_format($ventesData['totals']['ca_ht'], 0, ',', ' ') }}€

{{ number_format($ventesData['totals']['marge'], 0, ',', ' ') }}€

-

{{ number_format($ventesData['totals']['commission_montant'], 0, ',', ' ') }} €

-

-

-

-

-

-

-

@if($isCommissionMode)

Régul commissions {{Carbon::createFromFormat('m', $moisParam)->isoFormat('MMMM') . ' ' . $anneeParam }}

@php $sum = 0; @endphp @forelse($regulComm['ventes'] as $vente) @php $sum += $vente->commission; @endphp @empty @endforelse @if(count($regulComm['ventes']) > 0) @endif

N° VENTE

DATE

CLIENT

VRP

PRIX TARIF

TAUX REMISE

CA HT

MARGE

COMM. MONTANT

COMMENTAIRE

{{ $vente->id_rdv }}

{{ $vente->date ? \Carbon\Carbon::parse($vente->date)->format('d/m/Y') : 'N/A' }}

{{ $vente->client->nom ?? '' }}

@if($vente->vrp1 != '') {!! $vente->vrp1 !!} @else

N/A

@endif

{{ number_format($vente->tarif_total_ht, 0, ',', ' ') }}€

{{ number_format($vente->remise , 0, ',', ' ') }}%

{{ number_format($vente->ca_total_ht, 0, ',', ' ') }}€

{{ number_format((int)($vente->ca_total_ht - $vente->tarif_total_ht * 0.85) , 0, ',', ' ') }}€

Aucune ancienne vente trouvée

TOTAL

{{ number_format($sum, 0, ',', ' ') }} €

@if($ventesData['totals']['prime'] > 0)

Total prime = {{ number_format($ventesData['totals']['prime'], 0, ',', ' ') }} €

@endif

Total commissions = {{ number_format($sum + $regulComm['totals']['prime'] + $ventesData['totals']['commission_montant'], 0, ',', ' ') }} €

Vendeur : {{ $this->commName }}
Date :
Signature:
Damien Clouet
 
Signature:
Imprimer @endif @if(count($ventesData['ventes']) > 0 && !$isCommissionMode && ($isAdmin))

Légende

Validé
Attente validation
Annulé
Non traité
RPE / RAI
@if($commercial != '')
@endif @endif @if (($isAdmin || $isDirecteur) && $commercial == "" && $moisParam != "" && !empty($directorData['data']))

Commission {{$directorData['director']['prenom']. ' ' . $directorData['director']['nom']}}

TAUX

COMMISSION

@foreach($directorData['data'] as $commercial)

{{ $commercial['prenom'] . ' ' . $commercial['nom'] }}

{{ $ventesData['commerciauxData'][$commercial['id']]["prix_vente"][$moisParam] }} €

@endforeach

{{ $directorData['taux'] }} %

{{ $directorData['com'] }} €

@endif @if(count($ventesData['paymentSummary']['summary']) > 0 && !$isCommissionMode)

Paiements

PAIEMENTS

CA

RATIO

@foreach($ventesData['paymentSummary']['summary'] as $paymentType => $data)

{{ $paymentType }}

{{ number_format($data['ca'], 0, ',', ' ') }} €

{{ number_format($data['ratio'], 1, ',', ' ') }} %

@endforeach

TOTAL

{{ number_format($ventesData['paymentSummary']['total'] , 0, ' ', ' ')}} €

100 %

@endif @if(isset($ventesData['cancellationSummary']['summary']['Ventes']) && $ventesData['cancellationSummary']['summary']['Ventes']['count'] > 0 && !$isCommissionMode)

Annulations

TYPE

NOMBRE

CA HT

RATIO

@foreach($ventesData['cancellationSummary']['summary'] as $type => $data)

{{ $type }}

{{ number_format($data['count'], 1, ',', ' ') }}

{{ number_format($data['ca'], 0, ',', ' ') }} €

{{ number_format($data['ratio'], 1, ',', ' ') }} %

@endforeach

TOTAL

{{$ventesData['cancellationSummary']['totalCount']}}

{{number_format($ventesData['cancellationSummary']['total'], 0, ',', ' ')}} €

100 %

@endif
@endisset