<?php
	
	ob_start();
	require 'connexionBD.php';

	$db = new Connect($_GET['mySchool']);
	$dc = $db->connect_db($_GET['mySchool']);
	
	
	$req = 'SELECT architecte.nom as nomArchi, architecte.postnom as postnomArchi, sessioninscription.dateFinIns as dateFinInsArchi, architecte.numAttestation as numAttestationArchi, architecte.dateDelivranceAttestation as dateDelivranceAttestationArchi, province.nom as nomProvince, avenue.nom as nomAvenue, quartier.nom as nomQuartier, commune.nom as nomCommune, numdomicile.nom as numDomicileArchi, nationalite.nom as nationaliteArchi, etablissement.abreviation as abreviationEtablissement, architecte.prenom as prenomArchi, architecte.sexe as sexeArchi, architecte.formeExercice as formeExerciceArchi, architecte.numFiche as numFicheArchi, architecte.photo as photoArchi, architecte.nomStructure as nomStructureArchi, architecte.anneeDiplome as anneeDiplomeArchi, architecte.noteStage as noteStageArchi, architecte.dateCreation as dateCreationArchi, ville.nom as lieuCreationArchi, architecte.copieDiplome as copieDiplomeArchi, architecte.ecj_abvm as ecj_abvmArchi, architecte.pieceIdentite as pieceIdentiteArchi, architecte.email as emailArchi, architecte.telephone as telephoneArchi, architecte.numeroCNOA as numeroCNOA_Archi, architecte.dateNaissance as dateNaissanceArchi, architecte.numUser as numUserArchi FROM ville, architecte, province, commune, quartier, avenue, numdomicile, nationalite, etablissement, sessioninscription WHERE architecte.idVille=ville.idVille AND ville.validite="OUI" AND architecte.idProvince=province.idProvince AND architecte.idCommune=commune.idCommune AND architecte.idQuartier=quartier.idQuartier AND architecte.idAvenue=avenue.idAvenue AND architecte.idArchitecte="'.$_GET['idArchitecte'].'" AND architecte.idNumDomicile=numdomicile.idNumDomicile AND architecte.idNationalite=nationalite.idNationalite AND architecte.idEtablissement=etablissement.idEtablissement AND architecte.validite="OUI" AND province.validite="OUI" AND commune.validite="OUI" AND avenue.validite="OUI" AND quartier.validite="OUI" AND sessioninscription.validite ="OUI" AND etablissement.validite="OUI" AND nationalite.validite="OUI" AND numdomicile.validite="OUI"';
// 	echo $req; die;
	$q=$dc->prepare($req);
	$q->execute();
	
	while($a=$q->fetch()){
		$nomArchi=$a['nomArchi'];
		$postnomArchi=$a['postnomArchi'];
		$prenomArchi=$a['prenomArchi'];
		$sexeArchi=$a['sexeArchi'];
		$formeExerciceArchi=$a['formeExerciceArchi'];
		$copieDiplomeArchi=$a['copieDiplomeArchi'];
		$dateCreationArchi=$a['dateCreationArchi'];
		$ecj_abvmArchi=$a['ecj_abvmArchi'];
		$emailArchi=$a['emailArchi'];
		$numFicheArchi=$a['numFicheArchi'];
		$noteStageArchi=$a['noteStageArchi'];
		$photoArchi=$a['photoArchi'];
		$numeroCNOA_Archi=$a['numeroCNOA_Archi'];
		$pieceIdentiteArchi=$a['pieceIdentiteArchi'];
		$anneeDiplomeArchi=$a['anneeDiplomeArchi'];
		$dateNaissanceArchi=$a['dateNaissanceArchi'];
		$telephoneArchi=$a['telephoneArchi'];
		$numUserArchi=$a['numUserArchi'];
		$lieuCreationArchi=$a['lieuCreationArchi'];
		$nomStructureArchi=$a['nomStructureArchi'];
		$nomProvince=$a['nomProvince'];
		$nomAvenue=$a['nomAvenue'];
		$nomQuartier=$a['nomQuartier'];
		$nomCommune=$a['nomCommune'];
		$dateFinInsArchi=$a['dateFinInsArchi'];
		$nationaliteArchi=$a['nationaliteArchi'];
		$abreviationEtablissement=$a['abreviationEtablissement'];
		$numDomicileArchi=$a['numDomicileArchi'];
		$numAttestationArchi=$a['numAttestationArchi'];
// 		$dateDelivranceAttestationArchi=$a['dateDelivranceAttestationArchi'];
// 		$nomArchi=$a['nomArchi'];
// 		$nomProvince=$a['nomProvince'];
// 		$nomArchi=$a['nomArchi'];
// 		$nomProvince=$a['nomProvince'];
	}
	
	$adresse = $numDomicileArchi.",".$nomAvenue.",".$nomQuartier.",".$nomCommune;
	$nomComplet = $nomArchi." ".$postnomArchi." ".$prenomArchi;
			
?>

<!DOCTYPE html>
<html lang="en">
<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<title></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="" />
<meta name="author" content="http://templateq.com" />
</head>
<style type="text/css">
<!--
table
{
    width:  100%;
    border:none;
    border-collapse: collapse;
}
th
{
    text-align:;
    border:none;
    padding:3px;
    font-size:12px;
}
td
{
    text-align:;
    border:none;
    padding:3px;
    font-size:12px;
}
-->
</style>

<body>
	
	<div>
		
	</div>
	
	
	<div style="position:absolute; left:10px; top:10px; padding:10px; width:170px; font-size:13px; text-align:center">
	    <img src="img/logo_ONA_Ok.jpg" style="width:150px">
	</div>
	
	<div style="position:absolute; left:210px; top:10px; border-top:1px solid; border-bottom:1px solid; padding:10px; width:310px; font-size:13px; text-align:center">
    	<span style="color:blue; font-size:12px;"> <b>REPUBLIQUE DEMOCRATIQUE DU CONGO </b> </span> <br/>
    	<span style="color:red; font-size:15px;"> <b>ORDRE NATIONAL DES ARCHITECTES </b> </span> <br/>
    	<span style="color:; font-size:25px;"> <br/> <b> « O.N.A » </b> </span>  <br/>
	</div>
	
	<div style="position:absolute; left:550px; top:10px; padding:10px; width:170px; font-size:13px; text-align:center">
	    <img src="img/drapeau-rdc.png" style="width:120px">
	</div>
	
	
	
	<div style="position:relative; left:55px; top:125px; padding:10px; width:550px; font-size:14px; text-align:left;">
		
		<br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/> 

		<div style="padding:10px;font-size:25px; width:550px; text-align:center">
		    <b> <u> ATTESTATION DE MEMBRE / N° <?php echo strtoupper($numFicheArchi); ?> </u> </b>
		</div>
		
		
	</div>
	
	
	<div style="position:absolute; left:565px; top:120px; border:1px solid; padding:10px; width:120px; height:70px; font-size:14px; text-align:left;">
		
		<br/><br/>

		<div style="padding:10px;font-size:20px; width:120px; height:70px; text-align:center">
		    <b> PHOTO </b>
		</div>
		
		
	</div>
	
	
	<div style="position:relative; left:15px; top:5px; padding:3px; font-size:12px; text-align:center">
		
		<table>
		    
			<col style="width: 20%">
			<col style="width: 6%">
			<col style="width: 6%">
			<col style="width: 6%">
			<col style="width: 5%">
			<col style="width: 6%">
			<col style="width: 6%">
			<col style="width: 6%">
			<col style="width: 6%">
			<col style="width: 6%">
			<col style="width: 6%">
			<col style="width: 6%">
			<col style="width: 6%">
			
		    
		    <tr>
		        <th colspan="">  </th>
		        <th colspan="" style="text-align:center">  </th>
		        <th colspan="" style="text-align:center">  </th>
		        <th colspan="" style="text-align:center">  </th>
		        <th colspan="" style="text-align:center">  </th>
		        <th colspan="" style="text-align:center">  </th>
		        <th colspan="" style="text-align:center">  </th>
		        <th colspan="" style="text-align:center">  </th>
		        <th colspan="" style="text-align:center">  </th>
		        <th colspan="" style="text-align:center">  </th>
		        <th colspan="" style="text-align:center">  </th>
		        <th colspan="" style="text-align:center">  </th>
		        <th colspan="" style="text-align:center">  </th>
		    </tr>
		    
		    <tr> 
		        <td colspan="13" style="font-size:20px;text-align:justify"> 
		            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
		            Nous, Ordre National des Architectes de la R.D. Congo (ONA), Section Congolaise de l'Union Internationale des Architectes (UIA), Membre de l'Union des Architectes
		            d'Afrique (UAA) et de la Fédération des Architectes Francophones d'Afrique (FAFA), attestons par la présente que <b> <?php echo strtoupper($nomComplet); ?>, Architecte CNOA <?php echo strtoupper($numeroCNOA_Archi); ?> </b> est Membre de l'Ordre National
		            des Architectes. <br/><br/>
		            
		            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
		            En foi de quoi, nous lui délivrons la présente Attestation pour faire valoir tout ce que de droit. <br/><br/><br/>
		        </td>
		    </tr>
		    
		    <tr> 
		        <td colspan="13" style="font-size:20px;text-align:center"> 
		            <b>Attestation délivrée à <?php echo strtoupper($lieuCreationArchi); ?>, le <?php echo date('d-m-Y'); ?> </b> <br/><br/><br/>
		            
		            Pour le Conseil National de l'Ordre <br/><br/>
		            
		            <b> MUYONGO KAMWANGU Jean François </b> <br/>
		            
		            <b> Architecte CNOA 0171 </b> <br/><br/><br/><br/>
		            
		            Secrétaire Général Adjoint <br/><br/>
		            
		            
		        </td>
		    </tr>
		    
		    <tr>
		        <td colspan="2"></td>
		        <td colspan="8" style="font-size:20px;text-align:center;border-bottom:1px solid"> 
		        </td>
		        <td colspan="3"></td>
		    </tr>
		    <tr>
		        <td colspan="2"></td>
		        <td colspan="8" style="font-size:20px;text-align:center;border-top:1px solid;border-bottom:1px solid"> 
		        <?php $dt = DateTime::createFromFormat('Y-m-d', $dateFinInsArchi);$date1 = $dt->format('d-m-Y'); ?>
		            <b> N.B : Valide jusqu'au <?php echo strtoupper($date1); ?> </b>
		        </td>
		        <td colspan="3"></td>
		    </tr>


		    <tr> 
		        <td colspan="13" style="font-size:10px; text-align:center;"> 
		             <br/> <hr/>
		             Siège : 05, Avenue Colonel LUKUSA, Immeuble Doublier (Rond-point Forescom), Appartement 5/A, Commune de la Gombe - Kinshasa / Contact : (+243) 818383740 - 999964240 - 821235055 <br/>
		             E-mail : <a>conseilnational.ona.rdc@gmail.com</a> <br/>
		             Site web : <a>www.onadrc.org</a>
		        </td> 
		    </tr>


		</table>
		
	</div>
	
	
</body>
</html>


<?php 
   
	$content = ob_get_clean();
    require_once 'html2pdf.class.php';
    try
    {
        $html2pdf = new HTML2PDF("P", "A4", "fr");
        $html2pdf->setDefaultFont("Arial");
        $html2pdf->writeHTML($content);
        $html2pdf->Output("votre_pdf.pdf");
    }
    catch(HTML2PDF_exception $e) {
        echo $e;
        exit;
    }
	
?>

