<?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, 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, architecte.lieuCreation 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 architecte, province, commune, quartier, avenue, numdomicile, nationalite, etablissement WHERE architecte.idProvince=province.idProvince AND architecte.idCommune=commune.idCommune AND architecte.idQuartier=quartier.idQuartier AND architecte.idAvenue=avenue.idAvenue AND architecte.idArchitecte="2" 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 etablissement.validite="OUI" AND nationalite.validite="OUI" AND numdomicile.validite="OUI"';
	$req = 'SELECT architecte.nom as nomArchi, architecte.postnom as postnomArchi, 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 architecte, province, commune, quartier, avenue, numdomicile, nationalite, etablissement, ville WHERE architecte.idVille=ville.idVille 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 etablissement.validite="OUI" AND nationalite.validite="OUI" AND numdomicile.validite="OUI" AND ville.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'];
		$nationaliteArchi=$a['nationaliteArchi'];
		$abreviationEtablissement=$a['abreviationEtablissement'];
		$numDomicileArchi=$a['numDomicileArchi'];
// 		$nomArchi=$a['nomArchi'];
// 		$nomProvince=$a['nomProvince'];
// 		$nomArchi=$a['nomArchi'];
// 		$nomProvince=$a['nomProvince'];
	}
	
	$adresse = $numDomicileArchi.",".$nomAvenue.",".$nomQuartier.",".$nomCommune;
	
			
?>

<!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:160px; top:50px; padding:10px; width:450px; font-size:14px; text-align:left;">
		
		<br/><br/><br/><br/> 

		<div style="padding:10px;font-size:20px; width:400px; text-align:center">
		    <b> <u> FICHE D'ADHESION N°<?php echo strtoupper($numFicheArchi); ?>  </u> </b>
		</div>
		
		
	</div>
	
	
	<div style="position:absolute; left:0px; top:200px; border:1px solid; padding:10px; width:120px; height:100px; font-size:14px; text-align:left;">
		
		<br/><br/><br/><br/> 

		<div style="padding:10px;font-size:20px; width:120px; height:100px; text-align:center">
		    <b> PHOTO </b>
		</div>
		
		
	</div>
	
	
	<div style="position:relative; left:15px; top:2px; 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> <th>  </th> <td colspan="12"> NOM : <?php echo strtoupper($nomArchi); ?> <hr/> </td>  </tr>
		    <tr> <th>  </th> <td colspan="12"> POSTNOM : <?php echo strtoupper($postnomArchi); ?> <hr/> </td> </tr>
		    <tr> <th>  </th> <td colspan="12"> PRENOM : <?php echo strtoupper($prenomArchi); ?> <hr/> </td> </tr>
		    <tr> <th>  </th> <td colspan="12"> SEXE : <?php echo strtoupper($sexeArchi); ?> <hr/> </td> </tr>
		    <?php $dt = DateTime::createFromFormat('Y-m-d', $dateNaissanceArchi);$date1 = $dt->format('d-m-Y'); ?>
		    <tr> <th>  </th> <td colspan="12"> DATE DE NAISSANCE : <?php echo strtoupper($date1); ?> <hr/> </td> </tr>
		    <tr> <th>  </th> <td colspan="12"> NATIONALITE : <?php echo strtoupper($nationaliteArchi); ?> <hr/> </td> </tr>
		    <tr> <th>  </th> <td colspan="12"> ADRESSE E-MAIL : <?php echo $emailArchi; ?> <hr/> </td> </tr>
		    <tr> <th>  </th> <td colspan="12"> TELEPHONE : <?php echo strtoupper($telephoneArchi); ?> <hr/> </td> </tr>
		    <tr> <th>  </th> <td colspan="12"> ECOLE (UNIVERSITE, INSTITUT) : <?php echo strtoupper($abreviationEtablissement); ?> <hr/> </td> </tr>
		    <tr> <th>  </th> <td colspan="12"> ANNEE D'OBTENTION DU DIPLOME D'ARCHITECTE : <?php echo strtoupper($anneeDiplomeArchi); ?> <hr/> </td> </tr>
		    <tr> <th>  </th> <td colspan="12"> FORME D'EXERCICE : <?php echo strtoupper($formeExerciceArchi); ?> <hr/> </td> </tr>
		    <tr> <th>  </th> <td colspan="12"> NOM DE LA STRUCTURE : <?php echo strtoupper($nomStructureArchi); ?> <hr/> </td> </tr>
		    <tr> <th>  </th> <td colspan="12"> ADRESSE PROFESSIONNELLE : <?php echo strtoupper($adresse); ?> <hr/> </td> </tr>
		    <tr> <th>  </th> <td colspan="12"> NUMERO CNOA : <?php echo strtoupper($numeroCNOA_Archi); ?> <hr/> </td> </tr>
		    <tr> <th>  </th> <td colspan="12"> COPIE DU DIPLOME D'ARCHITECTE : <?php echo strtoupper($copieDiplomeArchi); ?> <hr/> </td> </tr>
		    <tr> <th>  </th> <td colspan="12"> EXTRAIT DU CASIER JUDICIAIRE OU ATTESTATION DE BVM : <?php echo strtoupper($ecj_abvmArchi); ?> <hr/> </td> </tr>
		    <tr> <th>  </th> <td colspan="12"> COPIE DU CERTIFICAT DE NATIONALITE OU PIECE D'IDENTITE : <?php echo strtoupper($pieceIdentiteArchi); ?> <hr/> <br/> </td> </tr>
		    
		    <tr> <td colspan="13" style="font-size:15px"> <b> <u> DECLARATION SUR L'HONNEUR : </u> </b>  </td> </tr>
		    <tr> <td colspan="13" style="font-size:13px; text-align:justify"> <b> J'atteste avoir lu la loi N° 18/034 du 13 Décembre 2018, le R.O.I, et le code déontologique. J'en accepte les contenus sans réserve et m'engage à respecter mes obligations envers l'Ordre et que toutes les informations me concernant sont sincères et exactes. </b>  </td> </tr>
            <?php $dt = DateTime::createFromFormat('Y-m-d', $dateCreationArchi);$date2 = $dt->format('d-m-Y'); ?>
		    <tr> <td colspan="13" style="font-size:13px; text-align:center;border-bottom:1px solid;"> <b> <br/> Fait à <?php echo strtoupper($lieuCreationArchi); ?>, le <?php echo strtoupper($date2); ?> </b> <br/><br/>  </td> </tr>
		    
		    <tr> 
		        <td colspan="7" rowspan="2" style="font-size:13px; text-align:center; border:1px solid;"> <b> <u>Signature de l'adhérant</u> </b>  </td> 
		        <td colspan="6" style="font-size:13px; text-align:center; border:1px solid;"> <b> Case réservée à l'ONA </b>  </td> 
		    </tr>
		     <tr> 
		        <td colspan="7" style="font-size:13px;height:50px;border:1px solid;">   </td> 
		        <td colspan="6" style="font-size:13px;height:50px;">   </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;
    }
	
?>

