<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>Bon de livraison</title>
		<style>
		table {
			border-collapse: collapse;
			border-radius: 1em;
			overflow: hidden;
		}
		
		th, td {
			padding : 0.4em;
			background : #EEEEE4;
			border-bottom: 2px solid white;
			font-size:12px;
		}
		
		
		.bloc2{
		display:inline-block;
		position:relative;
		text-align:center;
		margin-top:-25px;
		width:100%;
		padding-top: -10px;
		}
		</style>
    </head>
      <body style="font-family:'Montserrat';font-size:13px;" onload="window.print();">
        <div class="bloc"> 
			<div class="bloc2">
			    <div style="display:inline-block;position:absolute;margin-left:-30px">
			    <!--<img src="logo/i1.jpg" style="height:40px;margin-bottom:2px;margin-left:10px">-->
			    </div>
                <span style="margin-top:15px;margin-bottom:10px;color:#000;font-size:25px;margin-left:-40px"><b>IKHLASS PAPETERIE BLESSING</b></span><br><hr style="width:60px;">
                <div style="display:inline-block;position:absolute">
			    <!--<img src="logo/i2.jpg" style="height:40px;margin-bottom:2px;margin-left:400px;margin-top:-45px">-->
			    </div>
<span style="margin-top:20px;color:#000;font-size:14px;text-align:center"><b>Vente de Fournitures scolaires et de consommables bureautiques</b></span><br>	
<span style="margin-top:15px;color:#000;font-size:13px;text-align:center">Tél: {{DB::table('magasin')->where('id', $vente->magasin_id)->first()->telephone}} </span><br>	
<span style="margin-top:15px;color:#000;font-size:13px;text-align:center">{{DB::table('magasin')->where('id', $vente->magasin_id)->first()->adresse}}</span><br>	
				</p>
				
		    </div>
		</div>
		<!--BLOC DU GERANT-->
		<br/>
		<div class="container">
		<div class="row"> 
                <div class="col-md-4" style="margin-left:-20px;margin-top:10px;width:220px;border:1px solid #000;border-radius:10px">
				<p style="border-collapse: collapse;margin-left:10px;width:220px;line-height:2;margin-top:-5px;" cellspacing="3" >	
					@if ($vente->etat == "Validée")
					<h2 style="margin-left:13px;margin-top:5px">&nbsp;<u>FACTURE</u></h2>
				    <b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;N° : <font color="red">&nbsp;{{$vente->numero}}</font></b>
					@else
					   <h2 style="margin-left:13px;margin-top:5px"> &nbsp;<u>FACTURE</u></h2>
						<b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;N° : <font color="red"></font></b>
					@endif
					<br/>
					@php
					$date= explode('-', $vente->date);
					$date= array_reverse($date);
					$date= implode('/', $date);
					@endphp
					<b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Date : {{$date}}</b><br/><br/>
			    </p>
			        </div>
				<div class="col-md-4" style="margin-left:280px;margin-top:-120px;width:220px;border:1px solid #000;border-radius:10px">
				<p style="border-collapse: collapse;margin-left:10px;width:220px;line-height:2;margin-top:-2px;" cellspacing="3" >		
					<b>Client :
					@php echo DB::table('client_externe')->where('id', $vente->client_id)->first()->noms @endphp
					</b>
					<br/>
					<b>Contacts :
					@php echo DB::table('client_externe')->where('id', $vente->client_id)->first()->tel @endphp
					</b>
					<br/>
					<b>Adresse :
					@php echo DB::table('client_externe')->where('id', $vente->client_id)->first()->adresse @endphp
					</b>
			    </p>
			    </div>
		</div>
		</div>
	    <br/>
         
        <table style="border-collapse: collapse;width:530px;margin-left:-30px">
		<thead>
		  <tr>
			<th style="width:15%;">RÉF</th>
			<th style="width:35%;">DÉSIGNATION</th>
			<th style="width:15%;">P.U</th>
			<th style="width:5%;">QTE</th>
			<th style="width:15%;">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 align="center">{{DB::table('produit_vendable')->where('id', $lignes->produit_id)->first()->barcode}}</td>
		   <td >
		   {{DB::table('produit_vendable')->where('id', $lignes->produit_id)->first()->designation}}
		   </td>
		   <td align="center"> {{number_format($lignes->pv, 0, ' ', ' ')}} </td>
		   <td align="center"> {{$lignes->qte}} </td>
		   <td align="center">{{number_format($lignes->montligne, 0, ' ', ' ')}} </td>
		    
		   </tr>
			@endforeach
			<tr>
				<td align="center" colspan="5"> &nbsp;</td>
				
			</tr>
			<tr>
				<td align="center"> </td>
				<td align="center" colspan="2"> TOTAL ARTICLE</td>
				<td align="center"> <b>{{$total_article}}</b> </td>
				<td align="center">  </td>
			</tr>
		</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="display:inline-block;position:fixed;bottom:0px;">
			<table style="text-align:right;width:530px;margin-left:-30px" cellspacing="3">
			<tr hidden><td width="200px" >Montant HT</td> =<td width="80px" style="text-align:right;padding-right:25px"> {{$ht1}} </td></tr>
			<tr><td width="200px">REMISE</td> =<td width="80px" style="text-align:right;padding-right:25px"> {{$rem}} </td></tr>
			<!--<tr><td width="200px">TVA</td> =<td width="80px" style="text-align:right;padding-right:25px"> {{$taux1}} </td></tr>-->
			<!--<tr hidden><td width="200px">Net Com </td> =<td width="80px" style="text-align:right;padding-right:25px"> {{$nc}} </td></tr>-->
			<tr>
				<td width="200px"><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}} | Nous vous remercions pour votre commande. </td></tr>
			</table>
			</div>
		
        </p>
		
     
       
      </body>
     </html> 