@extends('layouts.app') @section('title', 'Rapports') @section('page-title', 'Rapports') @section('content')

Rapport des ventes

Ventes par période, magasin et client

Rapport des transferts

Mouvements entre magasins

État des stocks

Vue consolidée par magasin

Rapport financier

Ventes, achats, dépenses et cautions

Rapport des achats

Achats par fournisseur et produit

Rapport personnel

Effectifs par magasin et poste

Générer un rapport

@if(!in_array($type ?? '', ['stocks', 'personnel']))
@php $valFrom = isset($dateFrom) && is_object($dateFrom) ? $dateFrom->format('Y-m-d') : (isset($dateFrom) ? $dateFrom : ''); $valTo = isset($dateTo) && is_object($dateTo) ? $dateTo->format('Y-m-d') : (isset($dateTo) ? $dateTo : ''); @endphp
@endif
@php $needDates = in_array($type ?? '', ['ventes', 'transferts', 'financier', 'achats']); $datesMissing = $needDates && (empty($dateFrom) || empty($dateTo)); @endphp @if($type && $datesMissing)

Pour ce rapport, sélectionnez une période (date de début et date de fin) puis cliquez sur Générer.

@endif
@if(isset($resultat) && $resultat !== null)

{{ $titreResultat }}

@if(isset($dateFrom) && isset($dateTo) && $type !== 'stocks' && $type !== 'personnel')

Du {{ $dateFrom->format('d/m/Y') }} au {{ $dateTo->format('d/m/Y') }}

@endif
@if($type === 'financier' && is_array($resultat))

Total ventes

{{ number_format($resultat['total_ventes'], 0, ',', ' ') }}

Total achats

{{ number_format($resultat['total_achats'], 0, ',', ' ') }}

Total dépenses

{{ number_format($resultat['total_depenses'], 0, ',', ' ') }}

Cautions déposées

{{ number_format($resultat['total_cautions_depot'], 0, ',', ' ') }}

Dernières ventes, achats et dépenses (jusqu'à 50 lignes).

@elseif($type === 'ventes' || $type === 'achats' || $type === 'transferts') @if($type === 'ventes') @elseif($type === 'achats') @else @endif @if($type === 'ventes') @foreach($resultat as $row) @endforeach @elseif($type === 'achats') @foreach($resultat as $row) @endforeach @else @foreach($resultat as $row) @endforeach @endif
Date Réf. Client Magasin Montant
Date Fournisseur Produit Magasin Montant
Date Produit Origine → Destination Quantité
{{ $row->date_vente->format('d/m/Y') }} {{ $row->reference ?? '—' }} {{ $row->client?->nom ?? '—' }} {{ $row->magasin?->nom ?? '—' }} {{ number_format($row->montant ?? 0, 0, ',', ' ') }}
{{ $row->date_achat->format('d/m/Y') }} {{ $row->fournisseur?->nom ?? '—' }} {{ $row->produit?->designation ?? '—' }} {{ $row->magasin?->nom ?? '—' }} {{ number_format($row->montant ?? 0, 0, ',', ' ') }}
{{ $row->date_transfert->format('d/m/Y') }} {{ $row->produit?->designation ?? '—' }} {{ $row->magasinOrigine?->nom ?? '—' }} → {{ $row->magasinDestination?->nom ?? '—' }} {{ $row->quantite ?? 0 }}
@if(method_exists($resultat, 'hasPages') && $resultat->hasPages())
{{ $resultat->links() }}
@endif @elseif($type === 'stocks') @foreach($resultat as $row) @endforeach
Magasin Produit Quantité Seuil alerte
{{ $row->magasin?->nom ?? '—' }} {{ $row->produit?->designation ?? '—' }} {{ $row->quantite ?? 0 }} {{ $row->seuil_alerte ?? '—' }}
@if(method_exists($resultat, 'hasPages') && $resultat->hasPages())
{{ $resultat->links() }}
@endif @elseif($type === 'personnel') @foreach($resultat as $row) @endforeach
Nom Matricule Magasin Rôle
{{ $row->name ?? '—' }} {{ $row->matricule ?? '—' }} {{ $row->magasin?->nom ?? '—' }} {{ $row->roles->first()?->name ?? '—' }}
@if(method_exists($resultat, 'hasPages') && $resultat->hasPages())
{{ $resultat->links() }}
@endif @endif
@endif
@endsection