@extends('layouts.app') @section('title', 'Balance clients') @section('breadcrumb', 'États / Balance clients') @section('content')
@php $totFact=0; $totAvoir=0; @endphp @forelse($clients as $c) @php $factures = $c->venteDocuments->where('type','facture_vente')->sum('total_ttc'); $avoirs = $c->venteDocuments->where('type','avoir_vente')->sum('total_ttc'); $solde = $factures - $avoirs; $totFact += $factures; $totAvoir += $avoirs; @endphp @empty @endforelse @if(count($clients)) @endif
ClientCodeFactures TTCAvoirs TTCSolde
{{ $c->nom }} {{ $c->code }} {{ number_format($factures,3,',',' ') }} {{ number_format($avoirs,3,',',' ') }} {{ number_format($solde,3,',',' ') }}
Aucun client
TOTAL {{ number_format($totFact,3,',',' ') }} {{ number_format($totAvoir,3,',',' ') }} {{ number_format($totFact-$totAvoir,3,',',' ') }}
@endsection