<html>
    <head><meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<link id="bs-css" href="css/bootstrap-cerulean.min.css" rel="stylesheet">
	<link href="css/charisma-app.css" rel="stylesheet">
    <link href='bower_components/fullcalendar/dist/fullcalendar.css' rel='stylesheet'>
    <link href='bower_components/fullcalendar/dist/fullcalendar.print.css' rel='stylesheet' media='print'>
    <link href='bower_components/chosen/chosen.min.css' rel='stylesheet'>
    <link href='bower_components/colorbox/example3/colorbox.css' rel='stylesheet'>
    <link href='bower_components/responsive-tables/responsive-tables.css' rel='stylesheet'>
    <link href='bower_components/bootstrap-tour/build/css/bootstrap-tour.min.css' rel='stylesheet'>
    <link href='css/jquery.noty.css' rel='stylesheet'>
    <link href='css/noty_theme_default.css' rel='stylesheet'>
    <link href='css/elfinder.min.css' rel='stylesheet'>
    <link href='css/elfinder.theme.css' rel='stylesheet'>
    <link href='css/jquery.iphone.toggle.css' rel='stylesheet'>
    <link href='css/uploadify.css' rel='stylesheet'>
    <link href='css/animate.min.css' rel='stylesheet'>
        <title>Etat ventes sur une période</title>
    </head>
      <body style="font-family:'Montserrat';font-size:15px;" onload="window.print();">
            <div class="container">
		   <div class="row">
		    <div class="col-md-12">  
                <center>
				<br/>				
				<img src="{{asset('assets/img/logo.jpeg')}}"/><br/>
				<p><b>Cabinet Le soin de la perfection</b></p>
				<hr style="width:100px;" />
				<p><b></b></p>
				</center>
		    </div>
		</div></div>
		<!--BLOC DU GERANT-->
		<div class="container">
		<div class="row"> 
                <div class="col-md-4" style="margin-left:20px;">
					@php
					$date_debut1= explode('-', $date_debut);
					$date_debut1= array_reverse($date_debut1);
					$date_debut1= implode('/', $date_debut1);
					
					$date_fin1= explode('-', $date_fin);
					$date_fin1= array_reverse($date_fin1);
					$date_fin1= implode('/', $date_fin1);
					@endphp
					<p><b>Période :</b> Ventes du {{$date_debut1}} au {{$date_fin1}}</p>
			    </div>
				<div class="col-md-4">  
                    &nbsp;
		        </div>
		</div>
		</div>
     <center>
	    <br/>
        <table class="rpp" border='1' style="border-collapse: collapse;margin-left:25px;width:650px" cellspacing="3">
		<thead>
                          <tr>
                            <th height="30px">N°</th>
                            <th>Nom du Dépôt/ magasin</th>
                            <th>Montant</th>
                          </tr>
                        </thead>
        <tbody>
						@foreach($magasin as $magasins)
						@php

						$vendu = DB::table('vente')->where('magasin_id', $magasins->id)->whereBetween('date', [$date_debut,$date_fin])->get()->sum('montant');
				
						$somvendu1 = DB::table('vente')->whereBetween('date', [$date_debut,$date_fin])->get()->sum('montant');
						$vendu =  number_format($vendu, 0, ' ', ' ');
						$somvendu =  number_format($somvendu1, 0, ' ', ' ');
						$tv =  $somvendu1;
						@endphp
                          <tr>
							<td style="text-align:center;height:30px" >{{$loop->iteration}}</td>
							<td style="text-align:center;">{{$magasins->nom}}</td>
							<td style="text-align:center;">{{$vendu}} F</td>
                          </tr>
						  @endforeach
						  <tr style="background-color:brown;color:#fff;">
								<td></td>
								<td style="text-align:center;height:30px"><b> Total</b></td>
								<td style="text-align:center;"><b>{{$tv}} F</b></td>
							</tr>
                        </tbody>
        
        </table>
		<p style="margin-left:430px;margin-top:90px;"><strong>Gérant(e),</strong><br/>
        Ce <?php echo date('d-m-Y');?>
        </p>
      </div>
        <footer style="position:fixed;bottom:0;text-align:center;">
        <p align="center"><strong>&copy; EasyShop Pro 2.0 2019-2020 </strong>  </p>
        </footer>
      </body>
     </html> 