<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:-10px;
		height:30px;
		margin-left:-65px;
		font-size:18px;
	}
	.bloc2{
		display:inline-block;
		position:relative;
		margin-left:-60px;
		margin-top:2px;
		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:10px;" onload="window.print();">
      <div class="bloc"> 
	  <div class="bloc1">  				
				<b>ETS ISSIFOU & FRERES </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:-50px;margin-top:50px;">
				<p style="border-collapse: collapse;margin-left:20px;width:150px;line-height:2;margin-top:-2px;" cellspacing="3" >	
					@if ($vente->etat == "Validée")
				<b>FACTURE :{{$vente->numero}}</b>
					@else
						<b>FACTURE</b>
					@endif
					@php
					$date= explode('-', $vente->date);
					$date= array_reverse($date);
					$date= implode('/', $date);
					@endphp
			    </p>
			    </div>
				<div class="col-md-4" style="margin-left:140px;margin-top:-100px;">
				<p style="border-collapse: collapse;margin-left:-70px;width:200px;line-height:2;margin-top:-2px;" cellspacing="3" >	
					<b>
					    DATE : {{$date}} &nbsp; {{$vente->heure}}
					</b>
			    </p>
			    </div>
				@endif
				@if ($vente->etat == "Proforma")
					<div class="col-md-4" style="margin-left:-50px;margin-top:40px;">
				<p style="border-collapse: collapse;margin-left:20px;width:200px;line-height:2;margin-top:-2px;text-align:center;font-size:12px" cellspacing="3" >
				<strong>*** CECI EST UNE PROFORMA, VEUILLEZ RÉCLAMER VOTRE RECU D'ACHAT SVP !!! ***</strong>
				</p>
				</div>
				@endif
		</div>
		</div>
	    <br/>
        <table style="width:250px;margin-left:-40px;">
		<thead>
                      <tr>
                        <th style="width:5%;">N°</th>
                        <th style="width:45%;">Article</th>
						<th style="width:20%;">P.U</th>
                        <th style="width:10%;">Qté</th>
						<th style="width:20%;">TTC</th>
                      </tr>
                    </thead>
        <tbody style="height:500px;">
			@foreach($ligne as $lignes)
           <tr>
		   <td height="30px" align="center">{{$loop->iteration}}</td>
		   <td height="30px" align="center">{{DB::table('produit_vendable')->where('id', $lignes->produit_id)->first()->designation}}</td>
		   <td align="center">&nbsp;&nbsp; {{ number_format($lignes->pv, 0, ' ', ' ')}} </td><td align="center">&nbsp;&nbsp; {{$lignes->qte}} </td>
		   <td align="center">&nbsp;&nbsp; {{number_format($lignes->montligne, 0, ' ', ' ') }} </td></tr>
			@endforeach
		</tbody>
        
        </table>
		
		
        <p style="margin-top:10px;margin-left:-25px;">
		@php
			$lh = $vente->montant;
			$lh1 =  number_format($lh, 0, ' ', ' ');
			$lh2 = $ligneM;
			$rem =  number_format($vente->montant_remise, 0, ' ', ' ');
			$md =  number_format($vente->montant_donne, 0, ' ', ' ');
			$rl =  number_format($vente->relicat, 0, ' ', ' ');
			$nc =  number_format($vente->net_com, 0, ' ', ' ');
			$lh2 =  number_format($lh2, 0, ' ', ' ');
			$ht = DB::table('vente')->where('id', $lignes->vente_id)->first()->montant_ht;
			$ht1 =  number_format($ht, 0, ' ', ' ');
			$ttc = DB::table('vente')->where('id', $lignes->vente_id)->first()->montant;
			$ttc1 =  number_format($ttc, 0, ' ', ' ');
			$taux = DB::table('vente')->where('id', $lignes->vente_id)->first()->total_taux;
			$taux1 =  number_format($taux, 0, ' ', ' ');
			
		@endphp
			
			<table style="margin-left:-40px;width:250px;" cellspacing="3">
			<tr><td width="100px" height="10px">Montant HT</td> =<td width="40px" style="text-align:right;"> {{$ht1}} </td></tr>
			<tr><td width="100px" height="10px">Remise</td> =<td width="40px" style="text-align:right;"> {{$rem}} </td></tr>
			<tr><td width="100px" height="10px">Net Com </td> =<td width="40px" style="text-align:right;"> {{$nc}} </td></tr>
			@foreach($lignetax as $lignetax)
			@php
			$mtl =  number_format($lignetax->montligne, 0, ' ', ' ');
			@endphp
			<tr><td width="100px" height="25px">Taux ({{$lignetax->taux}})</td> <td width="80px" style="text-align:right;"> {{$mtl}} </td></tr>
			@endforeach
			<tr><td width="100px" height="25px"><b>Montant TTC</b></td> =<td width="80px" style="text-align:right;"> <b>{{$ttc1}} </b></td></tr>
			<tr><td  style="text-align:center;" colspan="2" height="25px"> <b>{{$montant1}} francs</b></td></tr>
			</table>
			<br/>
			@if ($vente->etat == "Validée")
			<table style="width:250px;margin-left:-40px;">
			<tr><td width="100px" style="text-align:center;"> <b>Montant remis</b></td><td  style="text-align:right;" width="80px">{{$md}} </td></tr>
			<tr><td  style="text-align:center;"> <b>Reliquat</b></td><td  style="text-align:right;">{{$rl}} </td></tr>
			<tr><td  style="text-align:center;"> <b>Servie par</b></td><td  style="text-align:center;">{{DB::table('users')->where('id', $vente->user_id)->first()->login}}</td></tr>
			</table>
			@endif
			<br/>
			@if( $vente->sig !=  "")
			<div style="margin-left:-40px;width:250px;">
			    <center>
    			<span><b>MECeF Compteurs :</b> {{$vente->compteur}}</span> <br>
    			<span><b>MECeF Heure :</b>  {{date("Y-m-d",strtotime($vente->date_mef))."T".date("H:i:s",strtotime($vente->date_mef))}}</span> <br>
    			<span><b>Code MECeF :</b> {{$vente->display_sig}}</span>  <br>
    			<span><b>ISF :</b> {{$vente->nim}}</span>
    			</center>
			</div>
			@endif
        </p>
		
      </div>
        <footer style="position:fixed;bottom:30px;text-align:center;font-size:14px">
        <p align="center"> </p>
	
        </footer>
      </body>
     </html> 