@extends('layouts.admin') @section('title', $pageTitle) @section('page-title') Comptabilité @endsection @section('page-subtitle') Gestion financière et suivi comptable @endsection @section('styles') @endsection @section('content')
@php $currentDate = \Carbon\Carbon::parse(request('year', now()->year) . '-' . request('month', now()->month) . '-01'); $cutoffDate = \Carbon\Carbon::parse('2025-10-01'); $showDispatch = $currentDate->gte($cutoffDate); // Récupérer ou créer la config du mois $dispatchConfig = \App\Models\DispatchConfiguration::firstOrCreate( ['year' => $currentDate->year, 'month' => $currentDate->month], ['sentier_percentage' => 50, 'klam_percentage' => 50] ); @endphp @if($showDispatch)
{{ $dispatchConfig->sentier_percentage }}% @if(isset($stats['min_sentier_percentage'])) @endif {{ $dispatchConfig->klam_percentage }}%
@endif
{{ number_format($stats['total_costs'], 2, ',', ' ') }}€
Coûts Total
{{ number_format($stats['total_costs_klam'] ?? 0, 2, ',', ' ') }}€
Coûts Klam
{{ number_format($stats['total_costs_sentier'] ?? 0, 2, ',', ' ') }}€
Coûts Sentier Services
{{ number_format($stats['total_margin_ht'], 2, ',', ' ') }}€
Marge HT
{{ number_format($stats['total_amount_ht'], 2, ',', ' ') }}€
Total HT
{{ number_format($stats['total_vat'], 2, ',', ' ') }}€
Total TVA
{{ number_format($stats['total_amount_ttc'], 2, ',', ' ') }}€
Total TTC
{{ $stats['addresses_count'] }}
Adresses
@if($addresses->isEmpty()) @else @foreach($addresses as $address) @endforeach @endif
ID Client Adresse Type Description Coûts Total Coûts Klam Coûts Sentier Marge Montant HT TVA Montant TTC Payeur Facture Actions

Aucune adresse travaillée pour cette période.

{{ $address['id'] ?? '-' }} @include('admin.accounting.partials.client-display', [ 'addressId' => $address['address_id'], 'currentClientId' => $address['client_id'], 'currentClientName' => $address['client_name'] ?? null, 'clients' => $clients ])
{{ $address['address_name'] }}
@php $workType = $address['work_type'] ?? 'travaux'; $workTypeDisplay = $address['work_type_display'] ?? 'Travaux'; // Mapping des icônes et classes de badges.css $typeConfig = [ 'travaux' => ['icon' => 'fa-hammer', 'class' => 'service-badge travaux'], 'interventions' => ['icon' => 'fa-tools', 'class' => 'service-badge interventions'], 'cleaning' => ['icon' => 'fa-broom', 'class' => 'service-badge cleaning'], 'dishwashing' => ['icon' => 'fa-utensils', 'class' => 'service-badge dishwashing'], 'bin' => ['icon' => 'fa-trash', 'class' => 'service-badge bin'], 'ironing' => ['icon' => 'fa-tshirt', 'class' => 'service-badge ironing'], 'other' => ['icon' => 'fa-question', 'class' => 'service-badge other'] ]; $config = $typeConfig[$workType] ?? $typeConfig['other']; @endphp {{ $workTypeDisplay }} @if(isset($address['is_manual_entry']) && $address['is_manual_entry']) {{ $address['work_description'] ?: 'Aucune description' }} @else @endif {{ number_format($address['total_costs'], 2, ',', ' ') }}€ @if(in_array($address['service_type'] ?? 'other', ['travaux', 'interventions'])) {{ number_format($address['costs_klam'] ?? 0, 2, ',', ' ') }}€ @else - @endif @if(in_array($address['service_type'] ?? 'other', ['travaux', 'interventions'])) {{ number_format($address['costs_sentier'] ?? $address['total_costs'], 2, ',', ' ') }}€ @else - @endif
% @php // Calcul de la marge en euros : Montant HT - Coûts Sentier // Pour travaux/interventions, utiliser costs_sentier, sinon total_costs $serviceType = $address['service_type'] ?? 'other'; $baseCosts = ($serviceType === 'travaux' || $serviceType === 'interventions') ? ($address['costs_sentier'] ?? $address['total_costs']) : $address['total_costs']; $marginAmount = $address['amount_ht'] - $baseCosts; // Si le montant HT n'est pas encore calculé, la marge est 0 if ($address['amount_ht'] == 0 && $baseCosts > 0) { $marginAmount = 0; } @endphp {{ number_format($marginAmount, 2, ',', ' ') }}€
{{ number_format($address['amount_ht'], 2, ',', ' ') }}€
% {{ number_format($address['vat_amount'], 2, ',', ' ') }}€
{{ number_format($address['amount_ttc'], 2, ',', ' ') }}€ @include('admin.accounting.partials.payer-selector', [ 'addressId' => $address['address_id'], 'currentPayerId' => $address['payer_client_id'], 'clients' => $clients ]) @if(isset($address['is_manual_entry']) && $address['is_manual_entry']) @else @endif
@endsection @section('scripts') @endsection