<!DOCTYPE html>
<html lang="en">
@php
					$date_debut= explode('-', $date_debut);
					$date_debut= array_reverse($date_debut);
					$date_debut= implode('/', $date_debut);
					
					$date_fin= explode('-', $date_fin);
					$date_fin= array_reverse($date_fin);
					$date_fin= implode('/', $date_fin);
				  @endphp

<!-- Mirrored from www.radixtouch.in/templates/logicswave/ality/source/light/ by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 02 Sep 2020 20:02:10 GMT -->
<head>
  <meta charset="UTF-8">
  <meta content="width=device-width, initial-scale=1, maximum-scale=1, shrink-to-fit=no" name="viewport">
  <title>Ventes journalières du {{$date_debut}} au {{$date_fin}}</title>  
		</head>
			<body style="font-family:'Montserrat';font-size:12px;">
			<h3> - Ventes journalières du {{$date_debut}} au {{$date_fin}} </h3>
			  <table border="1" class="table table-striped" id="table-1" style="border-collapse: collapse;font-family:'Montserrat';font-size:12px;width:720px;">
                        <thead>
                           <tr>
                            <th>N°</th>
                            <th>Caissier</th>
                            <th>Date</th>
                            <th>Recette</th>
                            <th>Dépense</th>
                            <th>Caisseoff</th>
                            <th>Versé</th>
                            <th>Reste</th>
                          </tr>
                        </thead>
                         <tbody>
						@foreach($cloture as $clotures)
						@php
						$verse = DB::table('versement_caisier')->where('cloture_id', $clotures->id)->sum('montant');
						$rr = $clotures->caisseoff - $verse;
						@endphp
                          <tr>
						<td style="text-align:center;">{{$loop->iteration}}</td>
							<td style="text-align:center;">{{DB::table('users')->where('id',$clotures->user_id)->first()->login}}</td>
							@php
							$clotures->date= explode('-', $clotures->date);
							$clotures->date= array_reverse($clotures->date);
							$clotures->date= implode('/', $clotures->date);
							@endphp
							<td style="text-align:center;">{{$clotures->date}}</td>
							@php
							$lh = $clotures->montant;
							$lh1 =  number_format($lh, 0, ' ', ' ');
							@endphp
							<td style="text-align:center;">{{$lh1}} FCFA</td>
							<td style="text-align:center;">{{number_format($clotures->totaldep, 0, ' ', ' ')}} FCFA</td>
							<td style="text-align:center;">{{number_format($clotures->caisseoff, 0, ' ', ' ')}} FCFA</td>
							<td style="text-align:center;">{{number_format($verse, 0, ' ', ' ')}} FCFA</td>
							<td style="text-align:center;">{{number_format($rr, 0, ' ', ' ')}} FCFA</td>
                          </tr>
						  @endforeach
                        </tbody>
                        <tfoot>
                        @php
						$tverse = DB::table('versement_caisier')->whereBetween('date', [$date_debut,$date_fin])->sum('montant');
						$rrr = $caisseoff - $tvers;
						@endphp
							<tr>
								<td style="text-align:center;"><b></b></b></td>
								<td style="text-align:center;"><b></b></td>
								<td style="text-align:center;"><b></b></td>
								<td style="text-align:center;"><b>{{number_format($total, 0, ' ', ' ')}}</b></td>
								<td style="text-align:center;"><b>{{number_format($totaldep, 0, ' ', ' ')}}</b></td>
								<td style="text-align:center;"><b>{{number_format($caisseoff, 0, ' ', ' ')}}</b></td>
								<td style="text-align:center;"><b>{{number_format($tvers, 0, ' ', ' ')}}</b></td>
								<td style="text-align:center;"><b>{{number_format($rrr, 0, ' ', ' ')}}</b></td>
							</tr>
                        </tfoot>
                      </table>
                    </body>
</html>