<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>FACTURE</title>
		<style>
		table {
			border-collapse: collapse;
			border: 1px solid #000;
		}
		
		th, td {
			padding : 0.1em;
			background : #fff;
			border-bottom: 1px solid #000;
			font-size:11px;
		}
		.bloc1{
		display:inline-block;
		position:absolute;	
		margin-top:-25px;
		height:30px;
		margin-left:-72px;
		font-size:18px;
		border:1px solid #000;
		padding:5px;
		width:250px;
		text-align:center;
	}
	.bloc2{
		display:inline-block;
		position:relative;
		margin-left:-60px;
		margin-top:5px;
		width:180px;
		padding-top: 20px;
		text-align:center;
	}
	.bloc{
		display:inline-block;
		position:absolute;
		width:450px;
		border-radius:10px;
		padding-left: 25px;
		height:100px;
		margin-left:20px;
		
	}
		
		</style>
    </head>
      <body style="font-family:'Montserrat';font-size:14px;" onload="window.print();">
        <div class="bloc"> 
	  <div class="bloc1">  				
				<b>COOL DISTRIBUTION </b>
		    </div>
			<div class="bloc2">  			
				Tel : 90037960/90962999/70023734
		    </div>
		    </div>
		<!--BLOC DU GERANT-->
		<div class="container">
		<div class="row"> 
		@if ($vente->etat == "Validée")
                <div class="col-md-4" style="margin-left:-45px;margin-top:45px;">
				<p style="border-collapse: collapse;margin-left:20px;width:150px;line-height:2;margin-top:-2px;font-size:11px" cellspacing="3" >	
					@if ($vente->etat == "Validée")
				<b>FACTURE N°</b> {{$vente->numero}}
					@else
						<b>FACTURE</b>
					@endif
					@php
					$date= explode('-', $vente->date);
					$date= array_reverse($date);
					$date= implode('/', $date);
					@endphp
			    </p>
			    <p style="border-collapse: collapse;margin-left:20px;width:150px;line-height:2;margin-top:-15px;font-size:11px" cellspacing="3" >	
					<b>
					    <i>DATE :</i></b> {{$date}} &nbsp; {{$vente->heure}}
					
			    </p>
			    <p style="border-collapse: collapse;margin-left:20px;width:150px;line-height:2;margin-top:-15px;font-size:11px" cellspacing="3" >	
					<b>
					    <i>CLIENT :</i></b> &nbsp; {{DB::table('client_externe')->where('id', $vente->client_id)->first()->noms}}
					
			    </p>
			    </div>
				
				@endif
				
		</div>
		</div>
	    <br/>
         
        <table style="width:270px;margin-left:-30px;margin-top:20px">
		<thead>
		  <tr>
                        <th style="width:5%;">N°</th>
                        <th style="width:45%;">PRODUIT</th>
                        <th style="width:10%;">QTE</th>
						<th style="width:20%;">PU</th>
						<th style="width:20%;">MONTANT</th>
                      </tr>
		</thead>
        <tbody>
			@foreach($ligne as $lignes)
			@php
			$nbreencarton = DB::table('produit_vendable')->where('id', $lignes->produit_id)->first()->nbreencarton;
			$cat_id = DB::table('produit_vendable')->where('id', $lignes->produit_id)->first()->categorie_id;
			@endphp
           <tr>
                <td height="30px" align="center" style="width:5%;">{{$loop->iteration}}</td>
    		    <td style="width:45%;" align="center">
    		        {{DB::table('produit_vendable')->where('id', $lignes->produit_id)->first()->designation}}
    		    </td>
		        <td align="center" style="width:10%;"> {{$lignes->qte}} </td>
		        <td align="center" style="width:20%;"> {{number_format($lignes->pv, 0, ' ', ' ')}} </td>
		   
		   <td align="center" style="width:20%;">{{number_format($lignes->montligne, 0, ' ', ' ')}} </td>
		    
		   </tr>
			@endforeach
		</tbody>
        </table>
        
        <p style="margin-top:10px;">
		@php
			$lh = $vente->montant;
			$lh1 =  number_format($lh, 0, ' ', ' ');
			$rem =  number_format($vente->montant_remise, 0, ' ', ' ');
			$nc =  number_format($vente->net_com, 0, ' ', ' ');
			$lh2 = $ligneM;
			$lh2 =  number_format($lh2, 0, ' ', ' ');
			$ht = DB::table('vente_client')->where('id', $lignes->vente_id)->first()->montant_ht;
			$ht1 =  number_format($ht, 0, ' ', ' ');
			$ttc = DB::table('vente_client')->where('id', $lignes->vente_id)->first()->montant;
			$ttc1 =  number_format($ttc, 0, ' ', ' ');
			$taux = DB::table('vente_client')->where('id', $lignes->vente_id)->first()->total_taux;
			$taux1 =  number_format($taux, 0, ' ', ' ');
			$coli = DB::table('ligne_vente_client')->where('vente_id', $lignes->vente_id)->sum('qte');
		@endphp
			
			<div  style="">
			<table style="width:250px;margin-left:-30px;margin-top:-10px">
			<!--<tr hidden><td width="200px" >Montant HT</td> =<td width="80px" style="text-align:right;padding-right:25px"> {{$ht1}} </td></tr>-->
			@if ($vente->montant_remise>0)
			<tr><td width="160px">REMISE</td> =<td width="80px" style="text-align:right;padding-right:25px"> {{$rem}} </td></tr>@endif
			@if ($vente->total_taux>0)
			<tr><td width="160px">TVA</td> =<td width="80px" style="text-align:right;padding-right:25px"> {{$taux1}} </td></tr>
			@endif
			<!--<tr hidden><td width="200px">Net Com </td> =<td width="80px" style="text-align:right;padding-right:25px"> {{$nc}} </td></tr>-->
			<tr style="background-color:#EEEEE4;padding:0.6em"><td width="160px"><b>NET A PAYER</b></td> =<td width="80px" style="text-align:right;padding-right:25px"> <b>{{$ttc1}} </b></td></tr>
			<tr><td colspan="2">Édité par {{DB::table('users')->where('id',$vente->user_id)->first()->nom}} | Merci pour votre achat. </td></tr>
			</table>
			</div>
        </p>
		
     
       
      </body>
     </html> 