<html>
    <head>
	
        <title>Reçu de paiement</title>
		<style>

		table {
			border-collapse: collapse;
			border-radius: 1em;
			overflow: hidden;
		}
		
		th, td {
			padding : 0.3em;
			background : #ddd;
			border-bottom: 2px solid white;
		}

	.bloc2{
		display:inline-block;
		position:relative;
		text-align:center;
		margin-top:-25px;
		width:100%;
		padding-top: -10px;
		border-bottom:1px solid #000;
	}
	
		
		</style>
    </head>
      <body style="font-family:'Montserrat';">
            <div class="bloc"> 
		   @php
			$ig = DB::table('magasin')->where('id', $paie->magasin_id)->first()->logo_fichier;
			@endphp
			<div class="bloc2">
				<p style="margin-top:15px;color:#000;font-size:16px;">
				<img src="{{public_path('/storage/'.$ig)}}" style="height:75px"> <br/>
				<b><u>{{DB::table('magasin')->where('id', $paie->magasin_id)->first()->nom}}</u><br>
				{{DB::table('magasin')->where('id', $paie->magasin_id)->first()->telephone}} {{DB::table('magasin')->where('id', $paie->magasin_id)->first()->email}} <br/>
				{{DB::table('magasin')->where('id', $paie->magasin_id)->first()->adresse}}
				</b>
				</p>
		    </div>
		    </div>
		<!--BLOC DU GERANT-->
		<div class="container">
		<div class="row"> 
		
				<h3 align="center"><font color="blue">RECU DE PAIEMENT</font></h3>
                <div class="col-md-4" style="margin-left:490px;">
					<p><b><font color="brown"><u>RECU N° : {{$paie->numero}}</u></font></b></p>
					<p><b>Client : {{DB::table('fournisseur')->where('id', $paie->client_id)->first()->nom}}</b></p>
					@php
					$date= explode('-', $paie->date);
					$datec= array_reverse($date);
					$datec= implode('/', $datec);
					@endphp
					<p><b>Date paiement:</b> {{$datec}}</p>
					<p><b>Montant paiement:</b> {{$paie->montant}}</p>			        
				</div>
				<div class="col-md-4" style="margin-left:80px;margin-top:-180px">
				<p><b><font color="brown"><u>EMETTEUR</u></font></b></p>
					<p><b>{{DB::table('magasin')->orderBydesc('id')->take(1)->first()->nom}}</b></p>
					<p><b>Contacts : {{DB::table('magasin')->orderBydesc('id')->take(1)->first()->telephone}}</b></p>
					<p><b>Email : {{DB::table('magasin')->orderBydesc('id')->take(1)->first()->email}}</b></p>
					<p><b>Adresse : {{DB::table('magasin')->orderBydesc('id')->take(1)->first()->adresse}}</b></p>
		        </div>
		</div>
		</div>
     <center>
	    <br/>
        <table class="rpp" style="border-collapse: collapse;margin-left:75px;width:600px;" cellspacing="3">
        <tbody>
		@php
		$tp = DB::table('paiement_prestation')->where('prestation_id', $paie->prestation_id)->sum('montant');
		$apayer = DB::table('prestation')->where('id', $paie->prestation_id)->first()->montant;
		$reste = $apayer - $tp;
		@endphp
           <tr>
				<td style="padding: 15px;text-align:center;"> 
				Montant payé
				</td> 
				<td style="padding: 15px;text-align:center;"> 
				<b>{{number_format($paie->montant, 0, ' ', ' ')}}</b>
				</td>
			</tr>
			<tr>
				<td style="padding: 15px;text-align:center"> 
				Total paiements
				</td> 
				<td style="padding: 15px;text-align:center;"> 
				<b>{{number_format($paie->totpaie, 0, ' ', ' ')}}</b>
				</td>
			</tr>
			<tr>
				<td style="padding: 15px;text-align:center;background-color:#FAFAD2"> 
				Reste à payer
				</td> 
				<td style="padding: 15px;text-align:center;background-color:#FAFAD2"> 
				<b>{{number_format($paie->reste, 0, ' ', ' ')}}</b>
				</td>
			</tr>
		</tbody>
        </table>
      </div>
	  <p style="margin-left:355px;margin-top:50px; font-size:18px">
			<strong>Signature </i></u>
			</strong><br/>
        </p>
        <footer style="position:fixed;bottom:0;text-align:center;">
        <p align="center"><strong>&copy; {{DB::table('magasin')->orderBydesc('id')->take(1)->first()->nom}} </strong>  </p>
        </footer>
      </body>
     </html> 